Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions tests/bsim/bluetooth/audio/src/cap_acceptor_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,11 @@ static void broadcast_code_cb(struct bt_conn *conn,
{
printk("Broadcast code received for %p\n", recv_state);

if (memcmp(broadcast_code, BROADCAST_CODE, sizeof(BROADCAST_CODE)) != 0) {
FAIL("Failed to receive correct broadcast code\n");
return;
}

SET_FLAG(flag_broadcast_code);
}

Expand Down Expand Up @@ -984,6 +989,12 @@ static void base_wait_for_metadata_update(void)
backchannel_sync_send_all(); /* let others know we have received a metadata update */
}

static void wait_for_broadcast_code(void)
{
printk("Waiting for broadcast code\n");
WAIT_FOR_FLAG(flag_broadcast_code);
}

static void wait_for_streams_stop(int stream_count)
{
/* The order of PA sync lost and BIG Sync lost is irrelevant
Expand Down Expand Up @@ -1032,6 +1043,7 @@ static void test_cap_acceptor_broadcast_reception(void)

create_and_sync_sink(bap_streams, &stream_count);

wait_for_broadcast_code();
sink_wait_for_data();

/* Since we are re-using the BAP broadcast source test
Expand Down
24 changes: 24 additions & 0 deletions tests/bsim/bluetooth/audio/src/cap_commander_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

#include "bstests.h"
#include "common.h"
#include "bap_common.h"

#if defined(CONFIG_BT_CAP_COMMANDER)

Expand Down Expand Up @@ -1026,6 +1027,27 @@ static void test_broadcast_reception_stop(size_t acceptor_count)
WAIT_FOR_FLAG(flag_broadcast_reception_stop);
}

static void test_distribute_broadcast_code(size_t acceptor_count)
{
struct bt_cap_commander_distribute_broadcast_code_param distribute_broadcast_code_param = {
0};
struct bt_cap_commander_distribute_broadcast_code_member_param param[CONFIG_BT_MAX_CONN] = {
0};

distribute_broadcast_code_param.type = BT_CAP_SET_TYPE_AD_HOC;
distribute_broadcast_code_param.param = param;
distribute_broadcast_code_param.count = acceptor_count;
memcpy(distribute_broadcast_code_param.broadcast_code, BROADCAST_CODE,
sizeof(BROADCAST_CODE));
for (size_t i = 0; i < acceptor_count; i++) {

distribute_broadcast_code_param.param[i].member.member = connected_conns[i];
distribute_broadcast_code_param.param[i].src_id = src_id[i];
}

bt_cap_commander_distribute_broadcast_code(&distribute_broadcast_code_param);
}

static void test_main_cap_commander_capture_and_render(void)
{
const size_t acceptor_cnt = get_dev_cnt() - 1; /* Assume all other devices are acceptors
Expand Down Expand Up @@ -1103,6 +1125,8 @@ static void test_main_cap_commander_broadcast_reception(void)

test_broadcast_reception_start(acceptor_count);

test_distribute_broadcast_code(acceptor_count);

backchannel_sync_wait_any(); /* wait for the acceptor to receive data */

backchannel_sync_wait_any(); /* wait for the acceptor to receive a metadata update */
Expand Down
Loading