Bluetooth: Audio: add babblesim tests for CAP distribute broadcastcode
Adding a babblesim test for the distribute broadcastcode CAP procedure Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
This commit is contained in:
parent
86ab272286
commit
f9cea63608
2 changed files with 36 additions and 0 deletions
|
@ -400,6 +400,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);
|
||||
}
|
||||
|
||||
|
@ -996,6 +1001,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
|
||||
|
@ -1046,6 +1057,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
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include "bstests.h"
|
||||
#include "common.h"
|
||||
#include "bap_common.h"
|
||||
|
||||
#if defined(CONFIG_BT_CAP_COMMANDER)
|
||||
|
||||
|
@ -1056,6 +1057,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
|
||||
|
@ -1133,6 +1155,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 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue