Skip to content

Commit 29f5628

Browse files
Thalleyjhedberg
authored andcommitted
Bluetooth: CAP: Add bt_cap_unicast_group_get_info
Add bt_cap_unicast_group_get_info to get information about a CAP unicast group. For now this just contain the pointer to the BAP unicast group, which then can be used with bt_bap_unicast_group_get_info to get information specific to BAP. The bt_cap_unicast_group_info struct can later be expanded with any additional information CAP may add. Signed-off-by: Emil Gydesen <[email protected]>
1 parent f27f8ed commit 29f5628

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

include/zephyr/bluetooth/audio/cap.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,24 @@ int bt_cap_unicast_group_foreach_stream(struct bt_cap_unicast_group *unicast_gro
424424
bt_cap_unicast_group_foreach_stream_func_t func,
425425
void *user_data);
426426

427+
/** Structure holding information of audio stream endpoint */
428+
struct bt_cap_unicast_group_info {
429+
/** Pointer to the underlying Basic Audio Profile unicast group */
430+
const struct bt_bap_unicast_group *unicast_group;
431+
};
432+
433+
/**
434+
* @brief Return structure holding information of unicast group
435+
*
436+
* @param unicast_group The unicast group object.
437+
* @param info The structure object to be filled with the info.
438+
*
439+
* @retval 0 Success
440+
* @retval -EINVAL @p unicast_group or @p info are NULL
441+
*/
442+
int bt_cap_unicast_group_get_info(const struct bt_cap_unicast_group *unicast_group,
443+
struct bt_cap_unicast_group_info *info);
444+
427445
/** Stream specific parameters for the bt_cap_initiator_unicast_audio_start() function */
428446
struct bt_cap_unicast_audio_start_stream_param {
429447
/** Coordinated or ad-hoc set member. */

subsys/bluetooth/audio/cap_initiator.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,6 +1111,24 @@ int bt_cap_unicast_group_foreach_stream(struct bt_cap_unicast_group *unicast_gro
11111111
bap_unicast_group_foreach_stream_cb, &data);
11121112
}
11131113

1114+
int bt_cap_unicast_group_get_info(const struct bt_cap_unicast_group *unicast_group,
1115+
struct bt_cap_unicast_group_info *info)
1116+
{
1117+
if (unicast_group == NULL) {
1118+
LOG_DBG("unicast_group is NULL");
1119+
return -EINVAL;
1120+
}
1121+
1122+
if (info == NULL) {
1123+
LOG_DBG("info is NULL");
1124+
return -EINVAL;
1125+
}
1126+
1127+
info->unicast_group = unicast_group->bap_unicast_group;
1128+
1129+
return 0;
1130+
}
1131+
11141132
static bool valid_unicast_audio_start_param(const struct bt_cap_unicast_audio_start_param *param)
11151133
{
11161134
struct bt_bap_unicast_group *unicast_group = NULL;

0 commit comments

Comments
 (0)