[PATCH BlueZ 2/4] advertising: Add implementation of SupportedSecondaryChannels

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>

This implements SupportedSecondaryChannels property which expose what
the supported secondary channels.
---
 src/advertising.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/src/advertising.c b/src/advertising.c
index a843dbba3..df7ebbf81 100644
--- a/src/advertising.c
+++ b/src/advertising.c
@@ -1234,10 +1234,50 @@ static gboolean get_supported_includes(const GDBusPropertyTable *property,
 	return TRUE;
 }
 
+static struct adv_secondary {
+	int flag;
+	const char *name;
+} secondary[] = {
+	{ MGMT_ADV_FLAG_SEC_1M, "1M" },
+	{ MGMT_ADV_FLAG_SEC_2M, "2M" },
+	{ MGMT_ADV_FLAG_SEC_CODED, "Codec" },
+	{ },
+};
+
+static void append_secondary(struct btd_adv_manager *manager,
+						DBusMessageIter *iter)
+{
+	struct adv_secondary *sec;
+
+	for (sec = secondary; sec && sec->name; sec++) {
+		if (manager->supported_flags & sec->flag)
+			dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING,
+								&sec->name);
+	}
+}
+
+static gboolean get_supported_secondary(const GDBusPropertyTable *property,
+					DBusMessageIter *iter, void *data)
+{
+	struct btd_adv_manager *manager = data;
+	DBusMessageIter entry;
+
+	dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY,
+					DBUS_TYPE_STRING_AS_STRING, &entry);
+
+	append_secondary(manager, &entry);
+
+	dbus_message_iter_close_container(iter, &entry);
+
+	return TRUE;
+}
+
 static const GDBusPropertyTable properties[] = {
 	{ "ActiveInstances", "y", get_active_instances, NULL, NULL },
 	{ "SupportedInstances", "y", get_instances, NULL, NULL },
 	{ "SupportedIncludes", "as", get_supported_includes, NULL, NULL },
+	{ "SupportedSecondaryChannels", "as", get_supported_secondary, NULL,
+									NULL },
 	{ }
 };
 
-- 
2.17.2




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux