Bluetooth: BAP: Add support for reconfiguring unicast group
This allows applications to modify the values set by an existing unicast group, assuming that none of the streams in the CIG has been connected. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
175855e0d8
commit
8b8f727761
6 changed files with 308 additions and 50 deletions
|
@ -1233,6 +1233,53 @@ static void test_main_async_group(void)
|
|||
PASS("Unicast client async group parameters passed\n");
|
||||
}
|
||||
|
||||
static void test_main_reconf_group(void)
|
||||
{
|
||||
static struct bt_bap_lc3_preset preset_16_2_2 = BT_BAP_LC3_UNICAST_PRESET_16_2_2(
|
||||
BT_AUDIO_LOCATION_FRONT_LEFT, BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED);
|
||||
struct bt_bap_stream rx_stream = {0};
|
||||
struct bt_bap_stream tx_stream = {0};
|
||||
struct bt_bap_unicast_group_stream_param rx_param = {
|
||||
.qos = &preset_16_2_1.qos,
|
||||
.stream = &rx_stream,
|
||||
};
|
||||
struct bt_bap_unicast_group_stream_param tx_param = {
|
||||
.qos = &preset_16_2_1.qos,
|
||||
.stream = &tx_stream,
|
||||
};
|
||||
struct bt_bap_unicast_group_stream_pair_param pair_param = {
|
||||
.rx_param = &rx_param,
|
||||
.tx_param = &tx_param,
|
||||
};
|
||||
struct bt_bap_unicast_group_param param = {
|
||||
.params = &pair_param,
|
||||
.params_count = 1U,
|
||||
.packing = BT_ISO_PACKING_SEQUENTIAL,
|
||||
};
|
||||
struct bt_bap_unicast_group *unicast_group;
|
||||
int err;
|
||||
|
||||
init();
|
||||
|
||||
err = bt_bap_unicast_group_create(¶m, &unicast_group);
|
||||
if (err != 0) {
|
||||
FAIL("Unable to create unicast group: %d", err);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
rx_param.qos = &preset_16_2_2.qos;
|
||||
tx_param.qos = &preset_16_2_2.qos;
|
||||
err = bt_bap_unicast_group_reconfig(unicast_group, ¶m);
|
||||
if (err != 0) {
|
||||
FAIL("Unable to reconfigure unicast group: %d", err);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
PASS("Unicast client async group parameters passed\n");
|
||||
}
|
||||
|
||||
static const struct bst_test_instance test_unicast_client[] = {
|
||||
{
|
||||
.test_id = "unicast_client",
|
||||
|
@ -1255,6 +1302,13 @@ static const struct bst_test_instance test_unicast_client[] = {
|
|||
"values in each direction, such as 10000us SDU interval in C to P "
|
||||
"and 7500us for P to C",
|
||||
},
|
||||
{
|
||||
.test_id = "unicast_client_reconf_group",
|
||||
.test_pre_init_f = test_init,
|
||||
.test_tick_f = test_tick,
|
||||
.test_main_f = test_main_reconf_group,
|
||||
.test_descr = "Tests that a unicast group (CIG) can be reconfigred with new values",
|
||||
},
|
||||
BSTEST_END_MARKER,
|
||||
};
|
||||
|
||||
|
|
23
tests/bsim/bluetooth/audio/test_scripts/bap_unicast_client_reconf_group.sh
Executable file
23
tests/bsim/bluetooth/audio/test_scripts/bap_unicast_client_reconf_group.sh
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) 2021-2024 Nordic Semiconductor ASA
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
SIMULATION_ID="bap_unicast_client_reconf_group"
|
||||
VERBOSITY_LEVEL=2
|
||||
|
||||
source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
|
||||
|
||||
cd ${BSIM_OUT_PATH}/bin
|
||||
|
||||
printf "\n\n======== BAP Unicast Client Reconfigure Group parameters test =========\n\n"
|
||||
|
||||
Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_audio_prj_conf \
|
||||
-v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=0 -testid=unicast_client_reconf_group -rs=23 -D=1
|
||||
|
||||
# Simulation time should be larger than the WAIT_TIME in common.h
|
||||
Execute ./bs_2G4_phy_v1 -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} \
|
||||
-D=1 -sim_length=60e6 $@
|
||||
|
||||
wait_for_background_jobs
|
Loading…
Add table
Add a link
Reference in a new issue