From fa55ed9812d652a64f1354a247c73fbbf456a72d Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Wed, 8 Jul 2015 15:56:07 -0400 Subject: [PATCH] Implementation of bt_component_sink_handle_notification MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- plugins/sink.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/plugins/sink.c b/plugins/sink.c index 911b5e84..ea7d7993 100644 --- a/plugins/sink.c +++ b/plugins/sink.c @@ -72,3 +72,27 @@ struct bt_component *bt_component_sink_create(const char *name, end: return sink ? &sink->parent : NULL; } + +enum bt_component_status bt_component_sink_handle_notification( + struct bt_component *component, + struct bt_notification *notification) +{ + enum bt_component_status ret = BT_COMPONENT_STATUS_OK; + struct bt_component_sink *sink = NULL; + + if (!component || !notification) { + ret = BT_COMPONENT_STATUS_INVAL; + 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); + assert(sink->handle_notification); + ret = sink->handle_notification(component, notification); +end: + return ret; +} -- 2.34.1