From: Manish Mandlik <mmandlik@google.com>
To: marcel@holtmann.org, luiz.dentz@gmail.com
Cc: linux-bluetooth@vger.kernel.org,
chromeos-bluetooth-upstreaming@chromium.org,
Manish Mandlik <mmandlik@google.com>
Subject: [BlueZ PATCH v1 3/3] adv_monitor: Receive Device Tracking event
Date: Mon, 27 Sep 2021 13:16:57 -0700 [thread overview]
Message-ID: <20210927131456.BlueZ.v1.3.I68039747acc3c63f758278452889d6ed2bfff065@changeid> (raw)
In-Reply-To: <20210927201657.593569-1-mmandlik@google.com>
This patch registers a callback function to receive Advertisement
Monitor Device Tracking event.
Test performed:
- verified by logs that Monitor Device is received from the controller
and sent to the bluetoothd when the controller starts/stops monitoring
a bluetooth device.
---
src/adv_monitor.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/src/adv_monitor.c b/src/adv_monitor.c
index 715ac5904..05bd49134 100644
--- a/src/adv_monitor.c
+++ b/src/adv_monitor.c
@@ -1531,6 +1531,27 @@ static void adv_monitor_removed_callback(uint16_t index, uint16_t length,
ev->monitor_handle);
}
+/* Processes Adv Monitor tracking event from kernel */
+static void adv_monitor_tracking_callback(uint16_t index, uint16_t length,
+ const void *param, void *user_data)
+{
+ struct btd_adv_monitor_manager *manager = user_data;
+ const struct mgmt_ev_adv_monitor_tracking *ev = param;
+ uint16_t handle = le16_to_cpu(ev->monitor_handle);
+ const uint16_t adapter_id = manager->adapter_id;
+ char addr[18];
+
+ if (length < sizeof(*ev)) {
+ btd_error(adapter_id,
+ "Wrong size of Adv Monitor Tracking event");
+ return;
+ }
+
+ ba2str(&ev->addr.bdaddr, addr);
+ DBG("Adv monitor with handle 0x%04x %s tracking device %s", handle,
+ ev->monitor_state ? "started" : "stopped", addr);
+}
+
/* Allocates a manager object */
static struct btd_adv_monitor_manager *manager_new(
struct btd_adapter *adapter,
@@ -1555,6 +1576,10 @@ static struct btd_adv_monitor_manager *manager_new(
manager->adapter_id, adv_monitor_removed_callback,
manager, NULL);
+ mgmt_register(manager->mgmt, MGMT_EV_ADV_MONITOR_TRACKING,
+ manager->adapter_id, adv_monitor_tracking_callback,
+ manager, NULL);
+
return manager;
}
--
2.33.0.685.g46640cef36-goog
prev parent reply other threads:[~2021-09-27 20:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-27 20:16 [BlueZ PATCH v1 0/3] Introduce Advertisement Monitor Device Tracking event Manish Mandlik
2021-09-27 20:16 ` [BlueZ PATCH v1 1/3] doc: Add " Manish Mandlik
2021-09-27 20:23 ` Luiz Augusto von Dentz
2021-09-27 20:38 ` Introduce " bluez.test.bot
2021-09-28 8:09 ` [BlueZ PATCH v1 1/3] doc: Add " Marcel Holtmann
[not found] ` <CAGPPCLB9j4Bgb=rraxdOBK+iACVO7+jJAHsPRn7B4JpTr3v-cQ@mail.gmail.com>
2021-09-29 13:26 ` Marcel Holtmann
2021-09-27 20:16 ` [BlueZ PATCH v1 2/3] lib: Add definition of AdvMonitor " Manish Mandlik
2021-09-27 20:16 ` Manish Mandlik [this message]
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=20210927131456.BlueZ.v1.3.I68039747acc3c63f758278452889d6ed2bfff065@changeid \
--to=mmandlik@google.com \
--cc=chromeos-bluetooth-upstreaming@chromium.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.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).