a2dp: Add implementation of MediaEndpoint.Device
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 15 Jan 2019 14:07:13 +0000 (11:07 -0300)
committerhimanshu <h.himanshu@samsung.com>
Wed, 22 Jan 2020 11:15:13 +0000 (16:45 +0530)
This adds the implementation of MediaEndpoint.Device property so the
clints don't need to guess what device the endpoint belongs.

Change-Id: I29a24302fced1922df417735b8b07d3fd92bc590
Signed-off-by: himanshu <h.himanshu@samsung.com>
profiles/audio/a2dp.c

index 5a071a0..acd0e7a 100644 (file)
@@ -1810,6 +1810,19 @@ static gboolean get_capabilities(const GDBusPropertyTable *property,
        return TRUE;
 }
 
+static gboolean get_device(const GDBusPropertyTable *property,
+                                       DBusMessageIter *iter, void *data)
+{
+       struct a2dp_remote_sep *sep = data;
+       const char *path;
+
+       path = device_get_path(sep->chan->device);
+
+       dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH, &path);
+
+       return TRUE;
+}
+
 static const GDBusPropertyTable sep_properties[] = {
        { "UUID", "s", get_uuid, NULL, NULL,
                                        G_DBUS_PROPERTY_FLAG_EXPERIMENTAL },
@@ -1817,6 +1830,8 @@ static const GDBusPropertyTable sep_properties[] = {
                                        G_DBUS_PROPERTY_FLAG_EXPERIMENTAL },
        { "Capabilities", "ay", get_capabilities, NULL, NULL,
                                        G_DBUS_PROPERTY_FLAG_EXPERIMENTAL },
+       { "Device", "o", get_device, NULL, NULL,
+                                       G_DBUS_PROPERTY_FLAG_EXPERIMENTAL },
        { }
 };