Wiki » History » Version 2
« Previous -
Version 2/8
(diff) -
Next » -
Current version
N. Köster, 10/08/2015 12:44 PM
RSB Lazy Converter¶
Warning: Currently, there is only an implementation for Python! If any other developer feels that this is also a useful extension for other languages, please feel free to contribute!¶
1. Description¶
This lib allows you to lazily convert any rsb event payload without creating any converter beforehand. This is realised by creating Participants with a modified RSB configuration which only uses SchemaAndByteArrayConverters for all incoming data. Given the schema of the payload converters are then created at runtime and to allow conversion of the current payload. This allow lazy and flexible receiving of data of any kind (as long as the data types are present/installed). Data can be converted to the actual protobuf object or a programming language pendant object.
2. Dependencies¶
Python¶
This lib requires rsb-python>=0.12, rstconverters>=0.12, protobuf_to_dict in order to work.
3. Examples¶
Python¶
Please have a look at the examples folder or follow this minimal example:
$ ipython In [1]: import rsb_lazy_converter, pprint In [2]: a_listener, incomming_data_queue = rsb_lazy_converter.createLazyListener_queued("/") In [3]: while True: ...: pprint.pprint(incomming_data_queue.get(True)) {'causes': [], 'data': {'data': {'id': u'/home/control/motionsensor/testunit_1/', 'label': u'TestUnit_1', 'motion_state': {'value': 200}}, 'wireschema': '.rst.homeautomation.unit.MotionSensor'}, 'id': '23c62149-41aa-5c03-a603-5ee8e6eb76ec', 'metaData': {'createTime': 1430391438.65, 'deliverTime': 1444300372.915713, 'receiveTime': 1444300372.915685, 'sendTime': 1444300372.914962, 'userInfos': {}, 'userTimes': {}}, 'method': None, 'scope': '/home/control/motionsensor/testunit_1/status/', 'type': 'tuple'} ...
4. Versioning¶
Versioning is kept similar to the RSB versioning to make the dependency clear.
5. Toolkit Project¶
There is a project file in the Toolkit available here. Alternatively you can just add this entry to your distribution file:
[ "rsb-lazy-converter-python", "0.12" ]