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 --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@xxxxxxxxxxxx> - * + * 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@xxxxxxxxxxxx> - * + * 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); -- 2.39.2