struct bt_component_class *component_class);
const char *bt_component_class_get_description(
struct bt_component_class *component_class);
+const char *bt_component_class_get_help(
+ struct bt_component_class *component_class);
+struct bt_value *bt_component_class_query_info(
+ struct bt_component_class *component_class,
+ const char *action, struct bt_value *params);
enum bt_component_class_type bt_component_class_get_type(
struct bt_component_class *component_class);
}
}
+static struct bt_value *bt_py3_cc_query_info(
+ struct bt_component_class *component_class,
+ const char *action, struct bt_value *params)
+{
+ PyObject *py_cls = NULL;
+ PyObject *py_params = NULL;
+ PyObject *py_query_info_func = NULL;
+ PyObject *py_action = NULL;
+ PyObject *py_results_addr = NULL;
+ struct bt_value *results = NULL;
+
+ py_cls = lookup_cc_ptr_to_py_cls(component_class);
+ if (!py_cls) {
+ goto error;
+ }
+
+ py_params = bt_py3_bt_value_from_ptr(params);
+ if (!py_params) {
+ goto error;
+ }
+
+ py_action = SWIG_FromCharPtr(action);
+ if (!py_action) {
+ goto error;
+ }
+
+ py_results_addr = PyObject_CallMethod(py_cls,
+ "_query_info_from_bt", "(OO)", py_action, py_params);
+ if (!py_results_addr) {
+ goto error;
+ }
+
+ /*
+ * The returned object, on success, is an integer object
+ * (PyLong) containing the address of a BT value object
+ * (which is now ours).
+ */
+ results = (struct bt_value *) PyLong_AsUnsignedLongLong(
+ py_results_addr);
+
+ /* Clear potential overflow error; should never happen */
+ if (PyErr_Occurred()) {
+ results = NULL;
+ goto error;
+ }
+
+ if (!results) {
+ goto error;
+ }
+
+ goto end;
+
+error:
+ BT_PUT(results);
+ PyErr_Clear();
+
+end:
+ Py_XDECREF(py_params);
+ Py_XDECREF(py_query_info_func);
+ Py_XDECREF(py_action);
+ Py_XDECREF(py_results_addr);
+ return results;
+}
+
static enum bt_notification_iterator_status bt_py3_exc_to_notif_iter_status(void)
{
enum bt_notification_iterator_status status =
/*
* The returned object, on success, is an integer object
* (PyLong) containing the address of a BT notification
- * object (which is not ours).
+ * object (which is now ours).
*/
notif = (struct bt_notification *) PyLong_AsUnsignedLongLong(
py_get_method_result);
/* Clear potential overflow error; should never happen */
if (PyErr_Occurred()) {
+ notif = NULL;
goto error;
}
/* Component class creation functions (called from Python module) */
static int bt_py3_cc_set_optional_attrs_methods(struct bt_component_class *cc,
- const char *description)
+ const char *description, const char *help)
{
int ret = 0;
}
}
+ if (help) {
+ ret = bt_component_class_set_help(cc, help);
+ if (ret) {
+ goto end;
+ }
+ }
+
ret = bt_component_class_set_init_method(cc, bt_py3_cc_init);
if (ret) {
goto end;
goto end;
}
+ ret = bt_component_class_set_query_info_method(cc,
+ bt_py3_cc_query_info);
+ if (ret) {
+ goto end;
+ }
+
end:
return ret;
}
static struct bt_component_class *bt_py3_component_class_source_create(
PyObject *py_cls, const char *name, const char *description,
- bool has_seek_time)
+ const char *help, bool has_seek_time)
{
struct bt_component_class *cc;
int ret;
goto end;
}
- ret = bt_py3_cc_set_optional_attrs_methods(cc, description);
+ ret = bt_py3_cc_set_optional_attrs_methods(cc, description, help);
if (ret) {
BT_PUT(cc);
goto end;
static struct bt_component_class *bt_py3_component_class_filter_create(
PyObject *py_cls, const char *name, const char *description,
- bool has_seek_time)
+ const char *help, bool has_seek_time)
{
struct bt_component_class *cc;
int ret;
goto end;
}
- ret = bt_py3_cc_set_optional_attrs_methods(cc, description);
+ ret = bt_py3_cc_set_optional_attrs_methods(cc, description, help);
if (ret) {
BT_PUT(cc);
goto end;
}
static struct bt_component_class *bt_py3_component_class_sink_create(
- PyObject *py_cls, const char *name, const char *description)
+ PyObject *py_cls, const char *name, const char *description,
+ const char *help)
{
struct bt_component_class *cc;
int ret;
goto end;
}
- ret = bt_py3_cc_set_optional_attrs_methods(cc, description);
+ ret = bt_py3_cc_set_optional_attrs_methods(cc, description, help);
if (ret) {
BT_PUT(cc);
goto end;
struct bt_component_class *bt_py3_component_class_source_create(
PyObject *py_cls, const char *name, const char *description,
- bool has_seek_time);
+ const char *help, bool has_seek_time);
struct bt_component_class *bt_py3_component_class_filter_create(
PyObject *py_cls, const char *name, const char *description,
- bool has_seek_time);
+ const char *help, bool has_seek_time);
struct bt_component_class *bt_py3_component_class_sink_create(
- PyObject *py_cls, const char *name, const char *description);
+ PyObject *py_cls, const char *name, const char *description,
+ const char *help);
void bt_py3_component_create(
struct bt_component_class *comp_class, PyObject *py_self,
const char *name);