summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2019-02-15 13:53:08 +0200
committerhimanshu <h.himanshu@samsung.com>2020-02-11 14:27:47 +0530
commit5dec7c4f9f15cc86914cfa787d95037ad89c41bf (patch)
treecc2058c1e521508ecab92d620786032459191ca3 /src
parent56ee3df77bfbfd7fd1f9e03f95152c8651444961 (diff)
downloadbluez-5dec7c4f9f15cc86914cfa787d95037ad89c41bf.tar.gz
bluez-5dec7c4f9f15cc86914cfa787d95037ad89c41bf.tar.bz2
bluez-5dec7c4f9f15cc86914cfa787d95037ad89c41bf.zip
advertising: Add implementation of SupportedSecondaryChannels
This implements SupportedSecondaryChannels property which expose what the supported secondary channels. Change-Id: I95c8ba8ecb2d8379d334bbe5532fc53b90ebdeae Signed-off-by: himanshu <h.himanshu@samsung.com>
Diffstat (limited to 'src')
-rw-r--r--src/advertising.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/advertising.c b/src/advertising.c
index 625750c4..d20c2528 100644
--- a/src/advertising.c
+++ b/src/advertising.c
@@ -1229,10 +1229,58 @@ 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 secondary_exits(const GDBusPropertyTable *property, void *data)
+{
+ struct btd_adv_manager *manager = data;
+
+ /* 1M PHY shall always be supported if ext_adv is supported */
+ return manager->supported_flags & MGMT_ADV_FLAG_SEC_1M;
+}
+
+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,
+ secondary_exits },
{ }
};