tests: Bluetooth: tester: Improve BAP adv intervals

Modify the extended and periodic interval to be values that
are more suited for audio as they are multiple
of the expected resulting ISO interval.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2024-12-09 09:33:55 +01:00 committed by Benjamin Cabé
commit 2b93e6b40e

View file

@ -2,6 +2,7 @@
/*
* Copyright (c) 2023 Codecoup
* Copyright (c) 2024 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -9,6 +10,7 @@
#include <stddef.h>
#include <errno.h>
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/types.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/ring_buffer.h>
@ -294,11 +296,21 @@ static int setup_broadcast_source(uint8_t streams_per_subgroup, uint8_t subgroup
uint8_t btp_bap_broadcast_source_setup(const void *cmd, uint16_t cmd_len,
void *rsp, uint16_t *rsp_len)
{
struct bt_le_per_adv_param per_adv_param =
*BT_LE_PER_ADV_PARAM(BT_GAP_MS_TO_PER_ADV_INTERVAL(150),
BT_GAP_MS_TO_PER_ADV_INTERVAL(150), BT_LE_PER_ADV_OPT_NONE);
/* Zephyr Controller works best while Extended Advertising interval is a multiple
* of the ISO Interval minus 10 ms (max. advertising random delay). This is
* required to place the AUX_ADV_IND PDUs in a non-overlapping interval with the
* Broadcast ISO radio events.
*/
struct bt_le_adv_param ext_adv_param =
*BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV, BT_GAP_MS_TO_ADV_INTERVAL(140),
BT_GAP_MS_TO_ADV_INTERVAL(140), NULL);
int err;
struct bt_audio_codec_cfg codec_cfg;
const struct btp_bap_broadcast_source_setup_cmd *cp = cmd;
struct btp_bap_broadcast_source_setup_rp *rp = rsp;
struct bt_le_adv_param param = *BT_LE_EXT_ADV_NCONN;
uint32_t broadcast_id;
/* Only one local source/BIG supported for now */
@ -356,17 +368,15 @@ uint8_t btp_bap_broadcast_source_setup(const void *cmd, uint16_t cmd_len,
base_ad[1].type = BT_DATA_NAME_COMPLETE;
base_ad[1].data_len = sizeof(CONFIG_BT_DEVICE_NAME) - 1;
base_ad[1].data = CONFIG_BT_DEVICE_NAME;
err = tester_gap_create_adv_instance(&param, BTP_GAP_ADDR_TYPE_IDENTITY, base_ad, 2, NULL,
0, &gap_settings);
err = tester_gap_create_adv_instance(&ext_adv_param, BTP_GAP_ADDR_TYPE_IDENTITY, base_ad, 2,
NULL, 0, &gap_settings);
if (err != 0) {
LOG_DBG("Failed to create extended advertising instance: %d", err);
return BTP_STATUS_FAILED;
}
err = tester_gap_padv_configure(BT_LE_PER_ADV_PARAM(BT_GAP_PER_ADV_FAST_INT_MIN_2,
BT_GAP_PER_ADV_FAST_INT_MAX_2,
BT_LE_PER_ADV_OPT_NONE));
err = tester_gap_padv_configure(&per_adv_param);
if (err != 0) {
LOG_DBG("Failed to configure periodic advertising: %d", err);