From 952ebadee3ef6bb5a23d74e31e5a7aca40619515 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Thu, 25 Feb 2016 12:30:57 -0500 Subject: [PATCH] Implement bt_component_sink_set_handle_notification_cb MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- lib/plugin-system/sink.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib/plugin-system/sink.c b/lib/plugin-system/sink.c index c1d1df066..7067e06ed 100644 --- a/lib/plugin-system/sink.c +++ b/lib/plugin-system/sink.c @@ -142,3 +142,26 @@ enum bt_component_status bt_component_sink_register_notification_type( end: return ret; } + +enum bt_component_status bt_component_sink_set_handle_notification_cb( + struct bt_component *component, + bt_component_sink_handle_notification_cb handle_notification) +{ + enum bt_component_status ret = BT_COMPONENT_STATUS_OK; + struct bt_component_sink *sink = NULL; + + if (!component) { + ret = BT_COMPONENT_STATUS_INVALID; + goto end; + } + + if (bt_component_get_type(component) != BT_COMPONENT_TYPE_SINK) { + ret = BT_COMPONENT_STATUS_UNSUPPORTED; + goto end; + } + + sink = container_of(component, struct bt_component_sink, parent); + sink->handle_notification = handle_notification; +end: + return ret; +} -- 2.34.1