bt2: add support for the "query info" API
Any user-defined component class can now define a _query_info() static
method which accepts an action name and parameters (value object, or
None) and returns a bt2.create_value()-compatible object:
class MySink(bt2.UserSinkComponent):
def _consume(self):
pass
@staticmethod
def _query_info(action, params):
if action == 'get-stuff':
return {
'stuff': get_stuff(),
'id': get_id()
}
elif action == 'get-thing':
return the_thing()
This static method can raise any exception: the caller of
bt_component_class_query_info() gets NULL.
On the Python side, either with a user-defined component class or with
a component class wrapper:
results = comp_class.query_info('get-stuff', {'name': 'wrerzvr'})
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.040119 seconds and 4 git commands to generate.