diff --git a/tests/bsim/bluetooth/audio/prj.conf b/tests/bsim/bluetooth/audio/prj.conf index 9414077e03..a00f49142a 100644 --- a/tests/bsim/bluetooth/audio/prj.conf +++ b/tests/bsim/bluetooth/audio/prj.conf @@ -113,6 +113,7 @@ CONFIG_BT_OTS_CLIENT=y # Broadcast Audio Scan Service and client CONFIG_BT_BAP_SCAN_DELEGATOR=y +CONFIG_BT_BAP_SCAN_DELEGATOR_MAX_METADATA_LEN=255 CONFIG_BT_BAP_BROADCAST_ASSISTANT=y # Hearing Access diff --git a/tests/bsim/bluetooth/audio/src/bap_broadcast_assistant_test.c b/tests/bsim/bluetooth/audio/src/bap_broadcast_assistant_test.c index 94b67b1349..3980fe963a 100644 --- a/tests/bsim/bluetooth/audio/src/bap_broadcast_assistant_test.c +++ b/tests/bsim/bluetooth/audio/src/bap_broadcast_assistant_test.c @@ -11,6 +11,7 @@ #include #include "../../../../../subsys/bluetooth/host/hci_core.h" #include "common.h" +#include "bap_common.h" extern enum bst_result_t bst_result; @@ -36,6 +37,8 @@ static bt_addr_le_t g_broadcaster_addr; static struct bt_le_scan_recv_info g_broadcaster_info; static struct bt_le_per_adv_sync *g_pa_sync; +static uint8_t metadata[] = {BT_AUDIO_CODEC_DATA(BT_AUDIO_METADATA_TYPE_VENDOR, LONG_META)}; + static const char *phy2str(uint8_t phy) { switch (phy) { @@ -424,6 +427,38 @@ static void test_bass_mod_source(void) mod_src_param.pa_interval = g_broadcaster_info.interval; subgroup.bis_sync = BIT(1) | BIT(2); /* Indexes 1 and 2 */ subgroup.metadata_len = 0; + + err = bt_bap_broadcast_assistant_mod_src(default_conn, &mod_src_param); + if (err != 0) { + FAIL("Could not modify source (err %d)\n", err); + return; + } + + WAIT_FOR_FLAG(flag_cb_called); + WAIT_FOR_FLAG(flag_write_complete); + printk("Source added, waiting for server to PA sync\n"); + WAIT_FOR_FLAG(flag_state_synced) + printk("Server PA synced\n"); +} + +static void test_bass_mod_source_long_meta(void) +{ + int err; + struct bt_bap_broadcast_assistant_mod_src_param mod_src_param = { 0 }; + struct bt_bap_scan_delegator_subgroup subgroup = { 0 }; + + printk("Long write\n"); + UNSET_FLAG(flag_cb_called); + UNSET_FLAG(flag_write_complete); + mod_src_param.src_id = g_src_id; + mod_src_param.num_subgroups = 1; + mod_src_param.pa_sync = true; + mod_src_param.subgroups = &subgroup; + mod_src_param.pa_interval = g_broadcaster_info.interval; + subgroup.bis_sync = BIT(1) | BIT(2); + + subgroup.metadata_len = sizeof(metadata); + memcpy(subgroup.metadata, metadata, sizeof(metadata)); err = bt_bap_broadcast_assistant_mod_src(default_conn, &mod_src_param); if (err != 0) { FAIL("Could not modify source (err %d)\n", err); @@ -525,6 +560,7 @@ static void test_main_client_sync(void) test_bass_create_pa_sync(); test_bass_add_source(); test_bass_mod_source(); + test_bass_mod_source_long_meta(); test_bass_broadcast_code(); printk("Waiting for receive state with BIS sync\n"); diff --git a/tests/bsim/bluetooth/audio/src/bap_common.h b/tests/bsim/bluetooth/audio/src/bap_common.h index 4bf98bf46d..7b75f465eb 100644 --- a/tests/bsim/bluetooth/audio/src/bap_common.h +++ b/tests/bsim/bluetooth/audio/src/bap_common.h @@ -29,7 +29,8 @@ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, \ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, \ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, \ - 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f + 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, \ + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87 #define LONG_META_LEN (sizeof((uint8_t []){LONG_META}) + 1U) /* Size of data + type */