Skip to content

Commit dae29d3

Browse files
Thalleyjhedberg
authored andcommitted
Bluetooth: BAP: Add bt_bap_unicast_group_get_info
Add bt_bap_unicast_group_get_info to get information about a unicast group. In this first iteration the info struct only contains the sink and source presentation delay, but the info struct can easily be expanded on later to contain more. Signed-off-by: Emil Gydesen <[email protected]>
1 parent e42e875 commit dae29d3

File tree

3 files changed

+49
-2
lines changed

3 files changed

+49
-2
lines changed

include/zephyr/bluetooth/audio/bap.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ extern "C" {
5454
/** An invalid Broadcast ID */
5555
#define BT_BAP_INVALID_BROADCAST_ID 0xFFFFFFFFU
5656

57+
/** Value that represents an unset presentation delay value */
58+
#define BT_BAP_PD_UNSET 0xFFFFFFFFU
59+
5760
/**
5861
* @brief Recommended connectable advertising parameters
5962
*
@@ -1744,6 +1747,33 @@ int bt_bap_unicast_group_foreach_stream(struct bt_bap_unicast_group *unicast_gro
17441747
bt_bap_unicast_group_foreach_stream_func_t func,
17451748
void *user_data);
17461749

1750+
/** Structure holding information of audio stream endpoint */
1751+
struct bt_bap_unicast_group_info {
1752+
/** Presentation delay for sink ASEs
1753+
*
1754+
* Will be @ref BT_BAP_PD_UNSET if no sink ASEs have been QoS configured
1755+
*/
1756+
uint32_t sink_pd;
1757+
1758+
/** Presentation delay for source ASEs
1759+
*
1760+
* Will be @ref BT_BAP_PD_UNSET if no source ASEs have been QoS configured
1761+
*/
1762+
uint32_t source_pd;
1763+
};
1764+
1765+
/**
1766+
* @brief Return structure holding information of unicast group
1767+
*
1768+
* @param unicast_group The unicast group object.
1769+
* @param info The structure object to be filled with the info.
1770+
*
1771+
* @retval 0 Success
1772+
* @retval -EINVAL @p unicast_group or @p info are NULL
1773+
*/
1774+
int bt_bap_unicast_group_get_info(const struct bt_bap_unicast_group *unicast_group,
1775+
struct bt_bap_unicast_group_info *info);
1776+
17471777
/** Unicast Client callback structure */
17481778
struct bt_bap_unicast_client_cb {
17491779
/**

subsys/bluetooth/audio/bap_endpoint.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@
3737
#define BROADCAST_STREAM_CNT 0
3838
#endif /* CONFIG_BT_BAP_BROADCAST_SOURCE */
3939

40-
#define BT_BAP_PD_UNSET 0xFFFFFFFFU /* Valid value range uses 24 bits, but is stored in 32 */
41-
4240
/* Temp struct declarations to handle circular dependencies */
4341
struct bt_bap_unicast_group;
4442
struct bt_bap_broadcast_source;

subsys/bluetooth/audio/bap_unicast_client.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3252,6 +3252,25 @@ int bt_bap_unicast_group_foreach_stream(struct bt_bap_unicast_group *unicast_gro
32523252
return 0;
32533253
}
32543254

3255+
int bt_bap_unicast_group_get_info(const struct bt_bap_unicast_group *unicast_group,
3256+
struct bt_bap_unicast_group_info *info)
3257+
{
3258+
if (unicast_group == NULL) {
3259+
LOG_DBG("unicast_group is NULL");
3260+
return -EINVAL;
3261+
}
3262+
3263+
if (info == NULL) {
3264+
LOG_DBG("info is NULL");
3265+
return -EINVAL;
3266+
}
3267+
3268+
info->sink_pd = unicast_group->sink_pd;
3269+
info->source_pd = unicast_group->source_pd;
3270+
3271+
return 0;
3272+
}
3273+
32553274
int bt_bap_unicast_client_config(struct bt_bap_stream *stream,
32563275
const struct bt_audio_codec_cfg *codec_cfg)
32573276
{

0 commit comments

Comments
 (0)