diff --git a/src/advertising.c b/src/advertising.c
index 3d4b15f..6f87dfc 100644
--- a/src/advertising.c
+++ b/src/advertising.c
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 bool parse_secondary(DBusMessageIter *iter,
+ struct btd_adv_client *client)
+{
+ const char *str;
+ struct adv_secondary *sec;
+
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING)
+ return false;
+
+ /* Reset secondary channels before parsing */
+ client->flags &= 0xfe00;
+
+ dbus_message_iter_get_basic(iter, &str);
+
+ for (sec = secondary; sec && sec->name; sec++) {
+ if (strcmp(str, sec->name))
+ continue;
+
+ if (!(client->manager->supported_flags & sec->flag))
+ return false;
+
+ DBG("Secondary Channel: %s", str);
+
+ client->flags |= sec->flag;
+
+ return true;
+ }
+
+ return false;
+}
+
static struct adv_parser {
const char *name;
bool (*func)(DBusMessageIter *iter, struct btd_adv_client *client);
{ "Data", parse_data },
{ "Discoverable", parse_discoverable },
{ "DiscoverableTimeout", parse_discoverable_timeout },
+ { "SecondaryChannel", parse_secondary },
{ },
};
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)
{