diff mbox series

[BlueZ,2/7] device: Add support to iterate through service data

Message ID 20240805120429.67606-3-iulia.tanasescu@nxp.com (mailing list archive)
State Accepted
Commit 11fce8b098979b3ce12c52da5a018fe01c24ce27
Headers show
Series Implement the MediaAssistant "Push" command | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Iulia Tanasescu Aug. 5, 2024, 12:04 p.m. UTC
Some usecases require iterating through the service data structures
advertised by a scanned device - for example, a Broadcast Source
advertises the Broadcast Audio Announcement Service UUID, with the
Broadcast ID as service data. The Broadcast ID is used by audio
profiles to uniquely identify the Broadcast Source.

This adds an API to iterate through the service data advertised by
a device.
---
 src/device.c | 8 +++++++-
 src/device.h | 5 ++++-
 2 files changed, 11 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/src/device.c b/src/device.c
index a1dc0750c..cf7264051 100644
--- a/src/device.c
+++ b/src/device.c
@@ -5,7 +5,7 @@ 
  *
  *  Copyright (C) 2006-2010  Nokia Corporation
  *  Copyright (C) 2004-2010  Marcel Holtmann <marcel@holtmann.org>
- *
+ *  Copyright 2024 NXP
  *
  */
 
@@ -7374,3 +7374,9 @@  void btd_device_set_conn_param(struct btd_device *device, uint16_t min_interval,
 					max_interval, latency,
 					timeout);
 }
+
+void btd_device_foreach_service_data(struct btd_device *dev, bt_ad_func_t func,
+							void *data)
+{
+	bt_ad_foreach_service_data(dev->ad, func, data);
+}
diff --git a/src/device.h b/src/device.h
index 3742f6028..97536774e 100644
--- a/src/device.h
+++ b/src/device.h
@@ -5,7 +5,7 @@ 
  *
  *  Copyright (C) 2006-2010  Nokia Corporation
  *  Copyright (C) 2004-2010  Marcel Holtmann <marcel@holtmann.org>
- *
+ *  Copyright 2024 NXP
  *
  */
 
@@ -211,3 +211,6 @@  void btd_device_foreach_ad(struct btd_device *dev, bt_device_ad_func_t func,
 void btd_device_set_conn_param(struct btd_device *device, uint16_t min_interval,
 					uint16_t max_interval, uint16_t latency,
 					uint16_t timeout);
+void btd_device_foreach_service_data(struct btd_device *dev,
+					bt_device_ad_func_t func,
+					void *data);