From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 3/4] advertising: Add implementation of SecondaryChannel
Date: Fri, 15 Feb 2019 16:23:00 +0200 [thread overview]
Message-ID: <20190215142301.30909-3-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20190215142301.30909-1-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This add the parsing for SecondaryChannel which indicates what secondary
PHY shall be used.
---
src/advertising.c | 52 ++++++++++++++++++++++++++++++++++++++---------
1 file changed, 42 insertions(+), 10 deletions(-)
diff --git a/src/advertising.c b/src/advertising.c
index df7ebbf81..8cda6a372 100644
--- a/src/advertising.c
+++ b/src/advertising.c
@@ -874,6 +874,47 @@ static bool parse_discoverable_timeout(DBusMessageIter *iter,
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);
@@ -891,6 +932,7 @@ static struct adv_parser {
{ "Data", parse_data },
{ "Discoverable", parse_discoverable },
{ "DiscoverableTimeout", parse_discoverable_timeout },
+ { "SecondaryChannel", parse_secondary },
{ },
};
@@ -1234,16 +1276,6 @@ 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)
{
--
2.17.2
next prev parent reply other threads:[~2019-02-15 14:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-15 14:22 [PATCH BlueZ 1/4] doc/advertising-api: Add support for setting Secondary Channel Luiz Augusto von Dentz
2019-02-15 14:22 ` [PATCH BlueZ 2/4] advertising: Add implementation of SupportedSecondaryChannels Luiz Augusto von Dentz
2019-02-15 14:23 ` Luiz Augusto von Dentz [this message]
2019-02-15 14:23 ` [PATCH BlueZ 4/4] client: Add advertise.secondary command Luiz Augusto von Dentz
2019-02-21 12:09 ` [PATCH BlueZ 1/4] doc/advertising-api: Add support for setting Secondary Channel Luiz Augusto von Dentz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190215142301.30909-3-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).