Browse Source

Bluetooth: BAP: Add a set of suggested intervals to use with BAP

Add a selection of interval values that are suitable for BAP,
which will allow better coexistence between ISO and ACL,
for both broadcast and unicast. Some of these are defined
by the BAP spec, and some are defined by Zephyr, since they
do have a suggested value from BAP.

Samples and tests have been updated to use these new values.
Peripheral samples have also been updated with
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS so that the connection
parameters from the centrals aren't updated to something else
shortly after.

The shell has also been updated to use the LE Audio (BAP) values
if audio is enabled, and the audio.conf file has disabled automatic
updating of the connection parameters as the peripheral, as we rarely
(if ever) want to do that.

Due to the connection interval change, CI hit an issue
with test_bass_broadcast_code in test_main_client_sync, where
the reading of the long receive state did not finish before we
attempted to do another procedure, so the function was updated to have
a retry.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
pull/86911/head
Emil Gydesen 8 months ago committed by Benjamin Cabé
parent
commit
9d4cc4b49b
  1. 12
      doc/releases/release-notes-4.2.rst
  2. 95
      include/zephyr/bluetooth/audio/bap.h
  3. 3
      samples/bluetooth/bap_broadcast_assistant/src/main.c
  4. 6
      samples/bluetooth/bap_broadcast_sink/prj.conf
  5. 2
      samples/bluetooth/bap_broadcast_sink/src/main.c
  6. 18
      samples/bluetooth/bap_broadcast_source/src/main.c
  7. 3
      samples/bluetooth/bap_unicast_client/src/main.c
  8. 6
      samples/bluetooth/bap_unicast_server/prj.conf
  9. 2
      samples/bluetooth/bap_unicast_server/src/main.c
  10. 6
      samples/bluetooth/cap_acceptor/prj.conf
  11. 3
      samples/bluetooth/cap_acceptor/src/main.c
  12. 6
      samples/bluetooth/cap_initiator/src/cap_initiator_broadcast.c
  13. 3
      samples/bluetooth/cap_initiator/src/cap_initiator_unicast.c
  14. 6
      samples/bluetooth/hap_ha/prj.conf
  15. 2
      samples/bluetooth/hap_ha/src/main.c
  16. 4
      samples/bluetooth/pbp_public_broadcast_source/src/main.c
  17. 4
      samples/bluetooth/tmap_bms/src/cap_initiator.c
  18. 3
      samples/bluetooth/tmap_central/src/main.c
  19. 6
      samples/bluetooth/tmap_peripheral/prj.conf
  20. 2
      samples/bluetooth/tmap_peripheral/src/main.c
  21. 12
      subsys/bluetooth/host/shell/bt.c
  22. 8
      tests/bluetooth/shell/audio.conf
  23. 6
      tests/bluetooth/tester/overlay-le-audio.conf
  24. 22
      tests/bluetooth/tester/src/audio/btp_bap_broadcast.c
  25. 21
      tests/bluetooth/tester/src/btp_gap.c
  26. 5
      tests/bsim/bluetooth/audio/prj.conf
  27. 18
      tests/bsim/bluetooth/audio/src/bap_bass_broadcaster_test.c
  28. 37
      tests/bsim/bluetooth/audio/src/bap_broadcast_assistant_test.c
  29. 20
      tests/bsim/bluetooth/audio/src/bap_broadcast_source_test.c
  30. 4
      tests/bsim/bluetooth/audio/src/bap_common.h
  31. 20
      tests/bsim/bluetooth/audio/src/bap_unicast_client_test.c
  32. 11
      tests/bsim/bluetooth/audio/src/cap_acceptor_test.c
  33. 4
      tests/bsim/bluetooth/audio/src/cap_commander_test.c
  34. 36
      tests/bsim/bluetooth/audio/src/cap_initiator_broadcast_test.c
  35. 4
      tests/bsim/bluetooth/audio/src/cap_initiator_unicast_test.c
  36. 33
      tests/bsim/bluetooth/audio/src/common.c
  37. 1
      tests/bsim/bluetooth/audio/src/common.h
  38. 5
      tests/bsim/bluetooth/audio/src/csip_set_coordinator_test.c
  39. 33
      tests/bsim/bluetooth/audio/src/gmap_ugg_test.c
  40. 29
      tests/bsim/bluetooth/audio/src/pbp_public_broadcast_source_test.c
  41. 4
      tests/bsim/bluetooth/audio/src/tmap_client_test.c
  42. 1
      tests/bsim/bluetooth/audio/src/tmap_server_test.c
  43. 2
      tests/bsim/bluetooth/audio/test_scripts/bap_broadcast_audio_assistant.sh
  44. 2
      tests/bsim/bluetooth/audio_samples/bap_unicast_client/src/unicast_client_sample_test.c

12
doc/releases/release-notes-4.2.rst

@ -65,6 +65,18 @@ New APIs and options
* Bluetooth * Bluetooth
* Audio
* :c:macro:`BT_BAP_ADV_PARAM_CONN_QUICK`
* :c:macro:`BT_BAP_ADV_PARAM_CONN_REDUCED`
* :c:macro:`BT_BAP_CONN_PARAM_SHORT_7_5`
* :c:macro:`BT_BAP_CONN_PARAM_SHORT_10`
* :c:macro:`BT_BAP_CONN_PARAM_RELAXED`
* :c:macro:`BT_BAP_ADV_PARAM_BROADCAST_FAST`
* :c:macro:`BT_BAP_ADV_PARAM_BROADCAST_SLOW`
* :c:macro:`BT_BAP_PER_ADV_PARAM_BROADCAST_FAST`
* :c:macro:`BT_BAP_PER_ADV_PARAM_BROADCAST_SLOW`
* Host * Host
* :c:func:`bt_le_get_local_features` * :c:func:`bt_le_get_local_features`

95
include/zephyr/bluetooth/audio/bap.h

@ -32,6 +32,7 @@
#include <zephyr/bluetooth/addr.h> #include <zephyr/bluetooth/addr.h>
#include <zephyr/bluetooth/bluetooth.h> #include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/conn.h> #include <zephyr/bluetooth/conn.h>
#include <zephyr/bluetooth/gap.h>
#include <zephyr/bluetooth/iso.h> #include <zephyr/bluetooth/iso.h>
#include <zephyr/net_buf.h> #include <zephyr/net_buf.h>
#include <zephyr/sys/slist.h> #include <zephyr/sys/slist.h>
@ -51,6 +52,100 @@ extern "C" {
/** An invalid Broadcast ID */ /** An invalid Broadcast ID */
#define BT_BAP_INVALID_BROADCAST_ID 0xFFFFFFFFU #define BT_BAP_INVALID_BROADCAST_ID 0xFFFFFFFFU
/**
* @brief Recommended connectable advertising parameters
*
* If connection has not been established after 30 seconds, the device should switch to
* @ref BT_BAP_ADV_PARAM_CONN_REDUCED
*
* Defined by Table 8.1 in BAP 1.0.2
*/
#define BT_BAP_ADV_PARAM_CONN_QUICK \
BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_EXT_ADV, BT_GAP_MS_TO_ADV_INTERVAL(20), \
BT_GAP_MS_TO_ADV_INTERVAL(30), NULL)
/**
* @brief Reduced connectable advertising parameters
*
* Defined by Table 8.1 in BAP 1.0.2
*/
#define BT_BAP_ADV_PARAM_CONN_REDUCED \
BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_EXT_ADV, \
BT_GAP_MS_TO_ADV_INTERVAL(150), BT_GAP_MS_TO_ADV_INTERVAL(150), NULL)
/**
* @brief Recommended connection parameters for initial connection request for 7.5 ms SDU interval
*
* Once service discovery has completed and a stream is setup, it is recommended to switch to
* @ref BT_BAP_CONN_PARAM_RELAXED
*
* Defined by Table 8.3 in BAP 1.0.2
*/
#define BT_BAP_CONN_PARAM_SHORT_7_5 \
BT_LE_CONN_PARAM(BT_GAP_US_TO_CONN_INTERVAL(7500), BT_GAP_MS_TO_CONN_INTERVAL(30), 0, \
BT_GAP_MS_TO_CONN_TIMEOUT(4000))
/**
* @brief Recommended connection parameters for initial connection request for 10 ms SDU interval
*
* Once service discovery has completed and a stream is setup, it is recommended to switch to
* @ref BT_BAP_CONN_PARAM_RELAXED
*
* Defined by Table 8.3 in BAP 1.0.2
*/
#define BT_BAP_CONN_PARAM_SHORT_10 \
BT_LE_CONN_PARAM(BT_GAP_MS_TO_CONN_INTERVAL(10), BT_GAP_MS_TO_CONN_INTERVAL(30), 0, \
BT_GAP_MS_TO_CONN_TIMEOUT(4000))
/**
* @brief Recommended connection parameters for coexistence of ACL and ISO
*
* Defined by Table 8.3 in BAP 1.0.2
*/
#define BT_BAP_CONN_PARAM_RELAXED \
BT_LE_CONN_PARAM(BT_GAP_MS_TO_CONN_INTERVAL(50), BT_GAP_MS_TO_CONN_INTERVAL(70), 0, \
BT_GAP_MS_TO_CONN_TIMEOUT(4000))
/**
* @brief Fast advertising parameters for broadcast audio
*
* This is suitable for both 7.5 ms and 10 ms SDU intervals, but prioritizes lower time to
* synchronize over coexistence with ISO and power consumption.
*/
#define BT_BAP_ADV_PARAM_BROADCAST_FAST \
BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV, BT_GAP_MS_TO_ADV_INTERVAL(60), \
BT_GAP_MS_TO_ADV_INTERVAL(60), NULL)
/**
* @brief Slow advertising parameters for broadcast audio
*
* This is suitable for both 7.5 ms and 10 ms SDU intervals, but prioritizes coexistence with ISO
* and power consumption over lower time to synchronize.
*/
#define BT_BAP_ADV_PARAM_BROADCAST_SLOW \
BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV, BT_GAP_MS_TO_ADV_INTERVAL(150), \
BT_GAP_MS_TO_ADV_INTERVAL(150), NULL)
/**
* @brief Fast advertising parameters for broadcast audio
*
* This is suitable for both 7.5 ms and 10 ms SDU intervals, but prioritizes lower time to
* synchronize over coexistence with ISO and power consumption.
*/
#define BT_BAP_PER_ADV_PARAM_BROADCAST_FAST \
BT_LE_PER_ADV_PARAM(BT_GAP_MS_TO_PER_ADV_INTERVAL(60), BT_GAP_MS_TO_PER_ADV_INTERVAL(60), \
BT_LE_PER_ADV_OPT_NONE)
/**
* @brief Slow advertising parameters for broadcast audio
*
* This is suitable for both 7.5 ms and 10 ms SDU intervals, but prioritizes coexistence with ISO
* and power consumption over lower time to synchronize.
*/
#define BT_BAP_PER_ADV_PARAM_BROADCAST_SLOW \
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)
/** /**
* @brief Check if a BAP BASS BIS_Sync bitfield is valid * @brief Check if a BAP BASS BIS_Sync bitfield is valid
* *

3
samples/bluetooth/bap_broadcast_assistant/src/main.c

@ -383,8 +383,7 @@ static void scan_recv_cb(const struct bt_le_scan_recv_info *info,
printk("Connecting to Broadcast Sink: %s\n", sr_info.bt_name); printk("Connecting to Broadcast Sink: %s\n", sr_info.bt_name);
err = bt_conn_le_create(info->addr, BT_CONN_LE_CREATE_CONN, err = bt_conn_le_create(info->addr, BT_CONN_LE_CREATE_CONN,
BT_LE_CONN_PARAM_DEFAULT, BT_BAP_CONN_PARAM_RELAXED, &broadcast_sink_conn);
&broadcast_sink_conn);
if (err != 0) { if (err != 0) {
printk("Failed creating connection (err=%u)\n", err); printk("Failed creating connection (err=%u)\n", err);
scan_for_broadcast_sink(); scan_for_broadcast_sink();

6
samples/bluetooth/bap_broadcast_sink/prj.conf

@ -4,6 +4,12 @@ CONFIG_BT_AUDIO=y
CONFIG_BT_SMP=y CONFIG_BT_SMP=y
CONFIG_BT_PAC_SNK=y CONFIG_BT_PAC_SNK=y
CONFIG_BT_PERIPHERAL=y CONFIG_BT_PERIPHERAL=y
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n
# Set preferred values based on BT_BAP_CONN_PARAM_RELAXED
CONFIG_BT_PERIPHERAL_PREF_MIN_INT=50
CONFIG_BT_PERIPHERAL_PREF_MAX_INT=70
CONFIG_BT_PERIPHERAL_PREF_LATENCY=0
CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=400
CONFIG_BT_OBSERVER=y CONFIG_BT_OBSERVER=y
CONFIG_BT_GATT_DYNAMIC_DB=y CONFIG_BT_GATT_DYNAMIC_DB=y
CONFIG_BT_EXT_ADV=y CONFIG_BT_EXT_ADV=y

2
samples/bluetooth/bap_broadcast_sink/src/main.c

@ -964,7 +964,7 @@ static int start_adv(void)
int err; int err;
/* Create a connectable advertising set */ /* Create a connectable advertising set */
err = bt_le_ext_adv_create(BT_LE_EXT_ADV_CONN, NULL, &ext_adv); err = bt_le_ext_adv_create(BT_BAP_ADV_PARAM_CONN_REDUCED, NULL, &ext_adv);
if (err != 0) { if (err != 0) {
printk("Failed to create advertising set (err %d)\n", err); printk("Failed to create advertising set (err %d)\n", err);

18
samples/bluetooth/bap_broadcast_source/src/main.c

@ -34,20 +34,6 @@
BUILD_ASSERT(strlen(CONFIG_BROADCAST_CODE) <= BT_ISO_BROADCAST_CODE_SIZE, "Invalid broadcast code"); BUILD_ASSERT(strlen(CONFIG_BROADCAST_CODE) <= BT_ISO_BROADCAST_CODE_SIZE, "Invalid broadcast code");
/* Zephyr Controller works best while Extended Advertising interval to be 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.
*
* I.e. for a 7.5 ms ISO interval use 90 ms minus 10 ms ==> 80 ms advertising
* interval.
* And, for 10 ms ISO interval, can use 90 ms minus 10 ms ==> 80 ms advertising
* interval.
*/
#define BT_LE_EXT_ADV_CUSTOM \
BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV, BT_GAP_MS_TO_ADV_INTERVAL(80), \
BT_GAP_MS_TO_ADV_INTERVAL(80), NULL)
/* When BROADCAST_ENQUEUE_COUNT > 1 we can enqueue enough buffers to ensure that /* When BROADCAST_ENQUEUE_COUNT > 1 we can enqueue enough buffers to ensure that
* the controller is never idle * the controller is never idle
*/ */
@ -576,14 +562,14 @@ int main(void)
uint32_t broadcast_id; uint32_t broadcast_id;
/* Create a connectable advertising set */ /* Create a connectable advertising set */
err = bt_le_ext_adv_create(BT_LE_EXT_ADV_CUSTOM, NULL, &adv); err = bt_le_ext_adv_create(BT_BAP_ADV_PARAM_BROADCAST_FAST, NULL, &adv);
if (err != 0) { if (err != 0) {
printk("Unable to create extended advertising set: %d\n", err); printk("Unable to create extended advertising set: %d\n", err);
return 0; return 0;
} }
/* Set periodic advertising parameters */ /* Set periodic advertising parameters */
err = bt_le_per_adv_set_param(adv, BT_LE_PER_ADV_DEFAULT); err = bt_le_per_adv_set_param(adv, BT_BAP_PER_ADV_PARAM_BROADCAST_FAST);
if (err) { if (err) {
printk("Failed to set periodic advertising parameters (err %d)\n", err); printk("Failed to set periodic advertising parameters (err %d)\n", err);
return 0; return 0;

3
samples/bluetooth/bap_unicast_client/src/main.c

@ -162,8 +162,7 @@ static bool check_audio_support_and_connect(struct bt_data *data,
printk("Audio server found with type %u, contexts 0x%08x and meta_len %u; connecting\n", printk("Audio server found with type %u, contexts 0x%08x and meta_len %u; connecting\n",
announcement_type, audio_contexts, meta_len); announcement_type, audio_contexts, meta_len);
err = bt_conn_le_create(addr, BT_CONN_LE_CREATE_CONN, err = bt_conn_le_create(addr, BT_CONN_LE_CREATE_CONN, BT_BAP_CONN_PARAM_RELAXED,
BT_LE_CONN_PARAM_DEFAULT,
&default_conn); &default_conn);
if (err != 0) { if (err != 0) {
printk("Create conn to failed (%u)\n", err); printk("Create conn to failed (%u)\n", err);

6
samples/bluetooth/bap_unicast_server/prj.conf

@ -2,6 +2,12 @@ CONFIG_BT=y
CONFIG_LOG=y CONFIG_LOG=y
CONFIG_BT_SMP=y CONFIG_BT_SMP=y
CONFIG_BT_PERIPHERAL=y CONFIG_BT_PERIPHERAL=y
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n
# Set preferred values based on BT_BAP_CONN_PARAM_RELAXED
CONFIG_BT_PERIPHERAL_PREF_MIN_INT=50
CONFIG_BT_PERIPHERAL_PREF_MAX_INT=70
CONFIG_BT_PERIPHERAL_PREF_LATENCY=0
CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=400
CONFIG_BT_ISO_PERIPHERAL=y CONFIG_BT_ISO_PERIPHERAL=y
CONFIG_BT_AUDIO=y CONFIG_BT_AUDIO=y
CONFIG_BT_GATT_DYNAMIC_DB=y CONFIG_BT_GATT_DYNAMIC_DB=y

2
samples/bluetooth/bap_unicast_server/src/main.c

@ -778,7 +778,7 @@ int main(void)
} }
/* Create a connectable advertising set */ /* Create a connectable advertising set */
err = bt_le_ext_adv_create(BT_LE_EXT_ADV_CONN, NULL, &adv); err = bt_le_ext_adv_create(BT_BAP_ADV_PARAM_CONN_QUICK, NULL, &adv);
if (err) { if (err) {
printk("Failed to create advertising set (err %d)\n", err); printk("Failed to create advertising set (err %d)\n", err);
return 0; return 0;

6
samples/bluetooth/cap_acceptor/prj.conf

@ -1,6 +1,12 @@
CONFIG_BT=y CONFIG_BT=y
CONFIG_LOG=y CONFIG_LOG=y
CONFIG_BT_PERIPHERAL=y CONFIG_BT_PERIPHERAL=y
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n
# Set preferred values based on BT_BAP_CONN_PARAM_RELAXED
CONFIG_BT_PERIPHERAL_PREF_MIN_INT=50
CONFIG_BT_PERIPHERAL_PREF_MAX_INT=70
CONFIG_BT_PERIPHERAL_PREF_LATENCY=0
CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=400
CONFIG_BT_GATT_DYNAMIC_DB=y CONFIG_BT_GATT_DYNAMIC_DB=y
CONFIG_BT_GATT_CLIENT=y CONFIG_BT_GATT_CLIENT=y
CONFIG_BT_EXT_ADV=y CONFIG_BT_EXT_ADV=y

3
samples/bluetooth/cap_acceptor/src/main.c

@ -12,6 +12,7 @@
#include <zephyr/bluetooth/addr.h> #include <zephyr/bluetooth/addr.h>
#include <zephyr/bluetooth/audio/audio.h> #include <zephyr/bluetooth/audio/audio.h>
#include <zephyr/bluetooth/audio/bap.h>
#include <zephyr/bluetooth/audio/cap.h> #include <zephyr/bluetooth/audio/cap.h>
#include <zephyr/bluetooth/audio/lc3.h> #include <zephyr/bluetooth/audio/lc3.h>
#include <zephyr/bluetooth/audio/pacs.h> #include <zephyr/bluetooth/audio/pacs.h>
@ -104,7 +105,7 @@ static int advertise(void)
{ {
int err; int err;
err = bt_le_ext_adv_create(BT_LE_EXT_ADV_CONN, NULL, &adv); err = bt_le_ext_adv_create(BT_BAP_ADV_PARAM_CONN_QUICK, NULL, &adv);
if (err) { if (err) {
LOG_ERR("Failed to create advertising set: %d", err); LOG_ERR("Failed to create advertising set: %d", err);

6
samples/bluetooth/cap_initiator/src/cap_initiator_broadcast.c

@ -73,16 +73,14 @@ static int setup_extended_adv(struct bt_le_ext_adv **adv)
int err; int err;
/* Create a non-connectable non-scannable advertising set */ /* Create a non-connectable non-scannable advertising set */
err = bt_le_ext_adv_create(BT_LE_EXT_ADV_NCONN, NULL, adv); err = bt_le_ext_adv_create(BT_BAP_ADV_PARAM_BROADCAST_FAST, NULL, adv);
if (err != 0) { if (err != 0) {
LOG_ERR("Unable to create extended advertising set: %d", err); LOG_ERR("Unable to create extended advertising set: %d", err);
return err; return err;
} }
/* Set periodic advertising parameters */ /* Set periodic advertising parameters */
err = bt_le_per_adv_set_param(*adv, BT_LE_PER_ADV_PARAM(BT_GAP_PER_ADV_FAST_INT_MIN_2, err = bt_le_per_adv_set_param(*adv, BT_BAP_PER_ADV_PARAM_BROADCAST_FAST);
BT_GAP_PER_ADV_FAST_INT_MAX_2,
BT_LE_PER_ADV_OPT_NONE));
if (err != 0) { if (err != 0) {
LOG_ERR("Failed to set periodic advertising parameters: %d", err); LOG_ERR("Failed to set periodic advertising parameters: %d", err);
return err; return err;

3
samples/bluetooth/cap_initiator/src/cap_initiator_unicast.c

@ -599,7 +599,8 @@ static bool check_audio_support_and_connect_cb(struct bt_data *data, void *user_
return false; return false;
} }
err = bt_conn_le_create(addr, BT_CONN_LE_CREATE_CONN, BT_LE_CONN_PARAM_DEFAULT, &peer.conn); err = bt_conn_le_create(addr, BT_CONN_LE_CREATE_CONN, BT_BAP_CONN_PARAM_RELAXED,
&peer.conn);
if (err != 0) { if (err != 0) {
LOG_WRN("Create conn to failed: %d, restarting scan", err); LOG_WRN("Create conn to failed: %d, restarting scan", err);
start_scan(); start_scan();

6
samples/bluetooth/hap_ha/prj.conf

@ -1,5 +1,11 @@
CONFIG_BT=y CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y CONFIG_BT_PERIPHERAL=y
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n
# Set preferred values based on BT_BAP_CONN_PARAM_RELAXED
CONFIG_BT_PERIPHERAL_PREF_MIN_INT=50
CONFIG_BT_PERIPHERAL_PREF_MAX_INT=70
CONFIG_BT_PERIPHERAL_PREF_LATENCY=0
CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=400
CONFIG_BT_ISO_PERIPHERAL=y CONFIG_BT_ISO_PERIPHERAL=y
CONFIG_BT_PRIVACY=y CONFIG_BT_PRIVACY=y
CONFIG_BT_GATT_DYNAMIC_DB=y CONFIG_BT_GATT_DYNAMIC_DB=y

2
samples/bluetooth/hap_ha/src/main.c

@ -107,7 +107,7 @@ static void adv_work_handler(struct k_work *work)
if (ext_adv == NULL) { if (ext_adv == NULL) {
/* Create a connectable advertising set */ /* Create a connectable advertising set */
err = bt_le_ext_adv_create(BT_LE_EXT_ADV_CONN, &adv_cb, &ext_adv); err = bt_le_ext_adv_create(BT_BAP_ADV_PARAM_CONN_QUICK, &adv_cb, &ext_adv);
if (err) { if (err) {
printk("Failed to create advertising set (err %d)\n", err); printk("Failed to create advertising set (err %d)\n", err);
} }

4
samples/bluetooth/pbp_public_broadcast_source/src/main.c

@ -150,7 +150,7 @@ static int setup_extended_adv(struct bt_le_ext_adv **adv)
int err; int err;
/* Create a non-connectable advertising set */ /* Create a non-connectable advertising set */
err = bt_le_ext_adv_create(BT_LE_EXT_ADV_NCONN, NULL, adv); err = bt_le_ext_adv_create(BT_BAP_ADV_PARAM_BROADCAST_FAST, NULL, adv);
if (err != 0) { if (err != 0) {
printk("Unable to create extended advertising set: %d\n", err); printk("Unable to create extended advertising set: %d\n", err);
@ -166,7 +166,7 @@ static int setup_extended_adv(struct bt_le_ext_adv **adv)
} }
/* Set periodic advertising parameters */ /* Set periodic advertising parameters */
err = bt_le_per_adv_set_param(*adv, BT_LE_PER_ADV_DEFAULT); err = bt_le_per_adv_set_param(*adv, BT_BAP_PER_ADV_PARAM_BROADCAST_FAST);
if (err) { if (err) {
printk("Failed to set periodic advertising parameters: %d\n", err); printk("Failed to set periodic advertising parameters: %d\n", err);

4
samples/bluetooth/tmap_bms/src/cap_initiator.c

@ -137,7 +137,7 @@ static int setup_extended_adv(struct bt_le_ext_adv **adv)
int err; int err;
/* Create a non-connectable advertising set */ /* Create a non-connectable advertising set */
err = bt_le_ext_adv_create(BT_LE_EXT_ADV_NCONN, NULL, adv); err = bt_le_ext_adv_create(BT_BAP_ADV_PARAM_BROADCAST_FAST, NULL, adv);
if (err != 0) { if (err != 0) {
printk("Unable to create extended advertising set: %d\n", err); printk("Unable to create extended advertising set: %d\n", err);
return err; return err;
@ -151,7 +151,7 @@ static int setup_extended_adv(struct bt_le_ext_adv **adv)
} }
/* Set periodic advertising parameters */ /* Set periodic advertising parameters */
err = bt_le_per_adv_set_param(*adv, BT_LE_PER_ADV_DEFAULT); err = bt_le_per_adv_set_param(*adv, BT_BAP_PER_ADV_PARAM_BROADCAST_FAST);
if (err) { if (err) {
printk("Failed to set periodic advertising parameters: %d\n", printk("Failed to set periodic advertising parameters: %d\n",
err); err);

3
samples/bluetooth/tmap_central/src/main.c

@ -188,8 +188,7 @@ static bool check_audio_support_and_connect(struct bt_data *data, void *user_dat
return false; return false;
} }
err = bt_conn_le_create(addr, BT_CONN_LE_CREATE_CONN, err = bt_conn_le_create(addr, BT_CONN_LE_CREATE_CONN, BT_BAP_CONN_PARAM_RELAXED,
BT_LE_CONN_PARAM_DEFAULT,
&default_conn); &default_conn);
if (err != 0) { if (err != 0) {
printk("Create conn to failed (%u)\n", err); printk("Create conn to failed (%u)\n", err);

6
samples/bluetooth/tmap_peripheral/prj.conf

@ -1,6 +1,12 @@
CONFIG_BT=y CONFIG_BT=y
CONFIG_LOG=y CONFIG_LOG=y
CONFIG_BT_PERIPHERAL=y CONFIG_BT_PERIPHERAL=y
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n
# Set preferred values based on BT_BAP_CONN_PARAM_RELAXED
CONFIG_BT_PERIPHERAL_PREF_MIN_INT=50
CONFIG_BT_PERIPHERAL_PREF_MAX_INT=70
CONFIG_BT_PERIPHERAL_PREF_LATENCY=0
CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=400
CONFIG_BT_ISO_PERIPHERAL=y CONFIG_BT_ISO_PERIPHERAL=y
CONFIG_BT_GATT_CLIENT=y CONFIG_BT_GATT_CLIENT=y
CONFIG_BT_GATT_AUTO_DISCOVER_CCC=y CONFIG_BT_GATT_AUTO_DISCOVER_CCC=y

2
samples/bluetooth/tmap_peripheral/src/main.c

@ -252,7 +252,7 @@ int main(void)
} }
printk("BAP initialized\n"); printk("BAP initialized\n");
err = bt_le_ext_adv_create(BT_LE_EXT_ADV_CONN, &adv_cb, &adv); err = bt_le_ext_adv_create(BT_BAP_ADV_PARAM_CONN_QUICK, &adv_cb, &adv);
if (err) { if (err) {
printk("Failed to create advertising set (err %d)\n", err); printk("Failed to create advertising set (err %d)\n", err);
return err; return err;

12
subsys/bluetooth/host/shell/bt.c

@ -12,6 +12,9 @@
*/ */
#include <errno.h> #include <errno.h>
#include <zephyr/autoconf.h>
#include <zephyr/bluetooth/audio/bap.h>
#include <zephyr/bluetooth/gap.h>
#include <zephyr/types.h> #include <zephyr/types.h>
#include <ctype.h> #include <ctype.h>
#include <stddef.h> #include <stddef.h>
@ -3238,11 +3241,18 @@ static int cmd_subrate_request(const struct shell *sh, size_t argc, char *argv[]
#if defined(CONFIG_BT_CENTRAL) #if defined(CONFIG_BT_CENTRAL)
static int bt_do_connect_le(int *ercd, size_t argc, char *argv[]) static int bt_do_connect_le(int *ercd, size_t argc, char *argv[])
{ {
struct bt_le_conn_param conn_param;
int err; int err;
bt_addr_le_t addr; bt_addr_le_t addr;
struct bt_conn *conn = NULL; struct bt_conn *conn = NULL;
uint32_t options = 0; uint32_t options = 0;
if (IS_ENABLED(CONFIG_BT_BAP_UNICAST) || IS_ENABLED(CONFIG_BT_BAP_BROADCAST_ASSISTANT)) {
conn_param = *BT_BAP_CONN_PARAM_RELAXED;
} else {
conn_param = *BT_LE_CONN_PARAM_DEFAULT;
}
*ercd = 0; *ercd = 0;
/* When no arguments are specified, connect to the last scanned device. */ /* When no arguments are specified, connect to the last scanned device. */
@ -3279,7 +3289,7 @@ static int bt_do_connect_le(int *ercd, size_t argc, char *argv[])
BT_GAP_SCAN_FAST_INTERVAL, BT_GAP_SCAN_FAST_INTERVAL,
BT_GAP_SCAN_FAST_INTERVAL); BT_GAP_SCAN_FAST_INTERVAL);
err = bt_conn_le_create(&addr, create_params, BT_LE_CONN_PARAM_DEFAULT, &conn); err = bt_conn_le_create(&addr, create_params, &conn_param, &conn);
if (err) { if (err) {
*ercd = err; *ercd = err;
return -ENOEXEC; return -ENOEXEC;

8
tests/bluetooth/shell/audio.conf

@ -40,7 +40,6 @@ CONFIG_BT_KEYS_OVERWRITE_OLDEST=y
CONFIG_BT_L2CAP_TX_MTU=128 CONFIG_BT_L2CAP_TX_MTU=128
CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_RX_SIZE=255
CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_SETTINGS=y CONFIG_BT_SETTINGS=y
CONFIG_FLASH=y CONFIG_FLASH=y
CONFIG_FLASH_MAP=y CONFIG_FLASH_MAP=y
@ -53,6 +52,13 @@ CONFIG_BT_AUTO_DATA_LEN_UPDATE=y
CONFIG_BT_USER_PHY_UPDATE=y CONFIG_BT_USER_PHY_UPDATE=y
CONFIG_BT_AUTO_PHY_UPDATE=y CONFIG_BT_AUTO_PHY_UPDATE=y
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n
# Set preferred values based on BT_BAP_CONN_PARAM_RELAXED
CONFIG_BT_PERIPHERAL_PREF_MIN_INT=50
CONFIG_BT_PERIPHERAL_PREF_MAX_INT=70
CONFIG_BT_PERIPHERAL_PREF_LATENCY=0
CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=400
CONFIG_BT_PER_ADV_SYNC_TRANSFER_RECEIVER=y CONFIG_BT_PER_ADV_SYNC_TRANSFER_RECEIVER=y
CONFIG_BT_PER_ADV_SYNC_TRANSFER_SENDER=y CONFIG_BT_PER_ADV_SYNC_TRANSFER_SENDER=y

6
tests/bluetooth/tester/overlay-le-audio.conf

@ -1,5 +1,11 @@
CONFIG_BT_AUDIO=y CONFIG_BT_AUDIO=y
CONFIG_BT_PERIPHERAL=y CONFIG_BT_PERIPHERAL=y
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n
# Set preferred values based on BT_BAP_CONN_PARAM_RELAXED
CONFIG_BT_PERIPHERAL_PREF_MIN_INT=50
CONFIG_BT_PERIPHERAL_PREF_MAX_INT=70
CONFIG_BT_PERIPHERAL_PREF_LATENCY=0
CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=400
CONFIG_BT_CENTRAL=y CONFIG_BT_CENTRAL=y
CONFIG_BT_GATT_CLIENT=y CONFIG_BT_GATT_CLIENT=y
CONFIG_BT_GATT_DYNAMIC_DB=y CONFIG_BT_GATT_DYNAMIC_DB=y

22
tests/bluetooth/tester/src/audio/btp_bap_broadcast.c

@ -16,6 +16,7 @@
#include <zephyr/kernel.h> #include <zephyr/kernel.h>
#include <zephyr/sys/ring_buffer.h> #include <zephyr/sys/ring_buffer.h>
#include <zephyr/bluetooth/audio/audio.h> #include <zephyr/bluetooth/audio/audio.h>
#include <zephyr/bluetooth/audio/bap.h>
#include <zephyr/bluetooth/gap.h> #include <zephyr/bluetooth/gap.h>
#include "bap_endpoint.h" #include "bap_endpoint.h"
@ -368,17 +369,8 @@ 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, uint8_t btp_bap_broadcast_source_setup(const void *cmd, uint16_t cmd_len,
void *rsp, uint16_t *rsp_len) void *rsp, uint16_t *rsp_len)
{ {
struct bt_le_per_adv_param per_adv_param = struct bt_le_per_adv_param per_adv_param = *BT_BAP_PER_ADV_PARAM_BROADCAST_SLOW;
*BT_LE_PER_ADV_PARAM(BT_GAP_MS_TO_PER_ADV_INTERVAL(150), struct bt_le_adv_param ext_adv_param = *BT_BAP_ADV_PARAM_BROADCAST_SLOW;
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; int err;
struct bt_audio_codec_cfg codec_cfg; struct bt_audio_codec_cfg codec_cfg;
const struct btp_bap_broadcast_source_setup_cmd *cp = cmd; const struct btp_bap_broadcast_source_setup_cmd *cp = cmd;
@ -405,6 +397,14 @@ uint8_t btp_bap_broadcast_source_setup(const void *cmd, uint16_t cmd_len,
LOG_DBG(""); LOG_DBG("");
/* 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.
*/
ext_adv_param.interval_min -= BT_GAP_MS_TO_ADV_INTERVAL(10U);
ext_adv_param.interval_max -= BT_GAP_MS_TO_ADV_INTERVAL(10U);
memset(&codec_cfg, 0, sizeof(codec_cfg)); memset(&codec_cfg, 0, sizeof(codec_cfg));
codec_cfg.id = cp->coding_format; codec_cfg.id = cp->coding_format;
codec_cfg.vid = cp->vid; codec_cfg.vid = cp->vid;

21
tests/bluetooth/tester/src/btp_gap.c

@ -7,9 +7,11 @@
*/ */
#include <stdint.h> #include <stdint.h>
#include <zephyr/bluetooth/audio/bap.h>
#include <zephyr/bluetooth/addr.h> #include <zephyr/bluetooth/addr.h>
#include <zephyr/bluetooth/gap.h> #include <zephyr/bluetooth/gap.h>
#include <zephyr/sys/atomic.h> #include <zephyr/sys/atomic.h>
#include <zephyr/sys/util_macro.h>
#include <zephyr/types.h> #include <zephyr/types.h>
#include <string.h> #include <string.h>
@ -1060,20 +1062,21 @@ static uint8_t stop_discovery(const void *cmd, uint16_t cmd_len,
static uint8_t connect(const void *cmd, uint16_t cmd_len, static uint8_t connect(const void *cmd, uint16_t cmd_len,
void *rsp, uint16_t *rsp_len) void *rsp, uint16_t *rsp_len)
{ {
/* The conn interval is set to 60ms (0x30). This is to better support test cases where we struct bt_le_conn_param conn_param;
* need to connect to multiple peripherals (up to 3). The connection interval should also be
* a multiple of 30ms, as that is ideal to support both 7.5ms and 10ms ISO intervals if (IS_ENABLED(CONFIG_BT_BAP_UNICAST) || IS_ENABLED(CONFIG_BT_BAP_BROADCAST_ASSISTANT)) {
*/ conn_param = *BT_BAP_CONN_PARAM_RELAXED;
const uint16_t interval = BT_GAP_MS_TO_CONN_INTERVAL(60U); } else {
const struct bt_le_conn_param *conn_param = conn_param = *BT_LE_CONN_PARAM_DEFAULT;
BT_LE_CONN_PARAM(interval, interval, 0U, BT_GAP_MS_TO_CONN_TIMEOUT(4000U)); }
const struct btp_gap_connect_cmd *cp = cmd; const struct btp_gap_connect_cmd *cp = cmd;
int err; int err;
if (!bt_addr_le_eq(&cp->address, BT_ADDR_LE_ANY)) { if (!bt_addr_le_eq(&cp->address, BT_ADDR_LE_ANY)) {
struct bt_conn *conn = NULL; struct bt_conn *conn = NULL;
err = bt_conn_le_create(&cp->address, BT_CONN_LE_CREATE_CONN, conn_param, &conn); err = bt_conn_le_create(&cp->address, BT_CONN_LE_CREATE_CONN, &conn_param, &conn);
if (err) { if (err) {
LOG_ERR("Failed to create connection (%d)", err); LOG_ERR("Failed to create connection (%d)", err);
return BTP_STATUS_FAILED; return BTP_STATUS_FAILED;
@ -1081,7 +1084,7 @@ static uint8_t connect(const void *cmd, uint16_t cmd_len,
bt_conn_unref(conn); bt_conn_unref(conn);
} else { } else {
err = bt_conn_le_create_auto(BT_CONN_LE_CREATE_CONN, conn_param); err = bt_conn_le_create_auto(BT_CONN_LE_CREATE_CONN, &conn_param);
if (err) { if (err) {
LOG_ERR("Failed to create auto connection (%d)", err); LOG_ERR("Failed to create auto connection (%d)", err);
return BTP_STATUS_FAILED; return BTP_STATUS_FAILED;

5
tests/bsim/bluetooth/audio/prj.conf

@ -54,6 +54,11 @@ CONFIG_BT_ISO_RX_MTU=310
CONFIG_BT_ISO_RX_BUF_COUNT=4 CONFIG_BT_ISO_RX_BUF_COUNT=4
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n
# Set preferred values based on BT_BAP_CONN_PARAM_RELAXED
CONFIG_BT_PERIPHERAL_PREF_MIN_INT=50
CONFIG_BT_PERIPHERAL_PREF_MAX_INT=70
CONFIG_BT_PERIPHERAL_PREF_LATENCY=0
CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=400
# Needed for Periodic Advertising Sync Transfer # Needed for Periodic Advertising Sync Transfer
CONFIG_BT_PER_ADV_SYNC_TRANSFER_RECEIVER=y CONFIG_BT_PER_ADV_SYNC_TRANSFER_RECEIVER=y

18
tests/bsim/bluetooth/audio/src/bap_bass_broadcaster_test.c

@ -7,6 +7,7 @@
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <zephyr/bluetooth/audio/bap.h>
#include <zephyr/bluetooth/bluetooth.h> #include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/byteorder.h> #include <zephyr/bluetooth/byteorder.h>
#include <zephyr/bluetooth/gap.h> #include <zephyr/bluetooth/gap.h>
@ -29,8 +30,7 @@ static void test_main(void)
struct bt_le_ext_adv *adv; struct bt_le_ext_adv *adv;
struct bt_data ad[2] = { struct bt_data ad[2] = {
BT_DATA_BYTES(BT_DATA_FLAGS, BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR), BT_DATA_BYTES(BT_DATA_FLAGS, BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR),
BT_DATA_BYTES(BT_DATA_SVC_DATA16, BT_DATA_BYTES(BT_DATA_SVC_DATA16, BT_UUID_16_ENCODE(BT_UUID_BROADCAST_AUDIO_VAL),
BT_UUID_16_ENCODE(BT_UUID_BROADCAST_AUDIO_VAL),
BT_BYTES_LIST_LE24(broadcast_id)), BT_BYTES_LIST_LE24(broadcast_id)),
}; };
@ -42,19 +42,7 @@ static void test_main(void)
printk("Bluetooth initialized\n"); printk("Bluetooth initialized\n");
/* Create a non-connectable advertising set */ setup_broadcast_adv(&adv);
err = bt_le_ext_adv_create(BT_LE_EXT_ADV_NCONN, NULL, &adv);
if (err) {
FAIL("Failed to create advertising set (err %d)\n", err);
return;
}
/* Set periodic advertising parameters */
err = bt_le_per_adv_set_param(adv, BT_LE_PER_ADV_DEFAULT);
if (err) {
FAIL("Failed to set periodic advertising parameters (err %d)\n", err);
return;
}
/* Set adv data */ /* Set adv data */
err = bt_le_ext_adv_set_data(adv, ad, ARRAY_SIZE(ad), NULL, 0); err = bt_le_ext_adv_set_data(adv, ad, ARRAY_SIZE(ad), NULL, 0);

37
tests/bsim/bluetooth/audio/src/bap_broadcast_assistant_test.c

@ -4,6 +4,7 @@
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#include <errno.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
@ -27,6 +28,7 @@
#include "common.h" #include "common.h"
#include "bap_common.h" #include "bap_common.h"
#include "bstests.h" #include "bstests.h"
#include "syscalls/kernel.h"
#ifdef CONFIG_BT_BAP_BROADCAST_ASSISTANT #ifdef CONFIG_BT_BAP_BROADCAST_ASSISTANT
@ -517,9 +519,12 @@ static void test_bass_mod_source(uint32_t bis_sync)
FAIL("Could not modify source (err %d)\n", err); FAIL("Could not modify source (err %d)\n", err);
return; return;
} }
printk("Source modified, waiting for server to PA sync\n");
WAIT_FOR_AND_CLEAR_FLAG(flag_recv_state_updated); if (recv_state.pa_sync_state == BT_BAP_PA_STATE_NOT_SYNCED) {
printk("Source modified, waiting for server to PA sync\n");
WAIT_FOR_AND_CLEAR_FLAG(flag_recv_state_updated);
}
if (recv_state.pa_sync_state == BT_BAP_PA_STATE_INFO_REQ) { if (recv_state.pa_sync_state == BT_BAP_PA_STATE_INFO_REQ) {
/* Wait for PAST to finish and then a new receive state */ /* Wait for PAST to finish and then a new receive state */
@ -579,10 +584,13 @@ static void test_bass_mod_source(uint32_t bis_sync)
FAIL("Unexpected BIS sync value: %u", remote_bis_sync); FAIL("Unexpected BIS sync value: %u", remote_bis_sync);
return; return;
} }
} else if (remote_bis_sync != subgroup.bis_sync) { } else {
FAIL("Unexpected BIS sync value: %u != %u\n", remote_bis_sync, WAIT_FOR_FLAG(flag_recv_state_updated_with_bis_sync);
subgroup.bis_sync); if (remote_bis_sync != subgroup.bis_sync) {
return; FAIL("Unexpected BIS sync value: %u != %u\n", remote_bis_sync,
subgroup.bis_sync);
return;
}
} }
} }
@ -659,12 +667,17 @@ static void test_bass_broadcast_code(const uint8_t broadcast_code[BT_ISO_BROADCA
printk("Adding broadcast code\n"); printk("Adding broadcast code\n");
UNSET_FLAG(flag_write_complete); UNSET_FLAG(flag_write_complete);
err = bt_bap_broadcast_assistant_set_broadcast_code(default_conn, recv_state.src_id,
broadcast_code); do {
if (err != 0) { err = bt_bap_broadcast_assistant_set_broadcast_code(default_conn, recv_state.src_id,
FAIL("Could not add broadcast code (err %d)\n", err); broadcast_code);
return; if (err == -EBUSY) {
} k_sleep(BAP_RETRY_WAIT);
} else if (err != 0) {
FAIL("Could not add broadcast code (err %d)\n", err);
return;
}
} while (err == -EBUSY);
WAIT_FOR_FLAG(flag_write_complete); WAIT_FOR_FLAG(flag_write_complete);
printk("Broadcast code added\n"); printk("Broadcast code added\n");

20
tests/bsim/bluetooth/audio/src/bap_broadcast_source_test.c

@ -336,30 +336,14 @@ static void test_broadcast_source_get_base(struct bt_bap_broadcast_source *sourc
static int setup_extended_adv(struct bt_bap_broadcast_source *source, struct bt_le_ext_adv **adv) static int setup_extended_adv(struct bt_bap_broadcast_source *source, struct bt_le_ext_adv **adv)
{ {
/* Broadcast Audio Streaming Endpoint advertising data */ /* Broadcast Audio Streaming Endpoint advertising data */
NET_BUF_SIMPLE_DEFINE(ad_buf, NET_BUF_SIMPLE_DEFINE(ad_buf, BT_UUID_SIZE_16 + BT_AUDIO_BROADCAST_ID_SIZE);
BT_UUID_SIZE_16 + BT_AUDIO_BROADCAST_ID_SIZE);
struct bt_le_adv_param adv_param = BT_LE_ADV_PARAM_INIT(
BT_LE_ADV_OPT_EXT_ADV, 0x80, 0x80, NULL);
NET_BUF_SIMPLE_DEFINE(base_buf, 128); NET_BUF_SIMPLE_DEFINE(base_buf, 128);
struct bt_data ext_ad; struct bt_data ext_ad;
struct bt_data per_ad; struct bt_data per_ad;
uint32_t broadcast_id; uint32_t broadcast_id;
int err; int err;
/* Create a non-connectable advertising set */ setup_broadcast_adv(adv);
err = bt_le_ext_adv_create(&adv_param, NULL, adv);
if (err != 0) {
printk("Unable to create extended advertising set: %d\n", err);
return err;
}
/* Set periodic advertising parameters */
err = bt_le_per_adv_set_param(*adv, BT_LE_PER_ADV_DEFAULT);
if (err) {
printk("Failed to set periodic advertising parameters: %d\n",
err);
return err;
}
err = bt_rand(&broadcast_id, BT_AUDIO_BROADCAST_ID_SIZE); err = bt_rand(&broadcast_id, BT_AUDIO_BROADCAST_ID_SIZE);
if (err) { if (err) {

4
tests/bsim/bluetooth/audio/src/bap_common.h

@ -18,6 +18,7 @@
#include <zephyr/bluetooth/audio/bap_lc3_preset.h> #include <zephyr/bluetooth/audio/bap_lc3_preset.h>
#include <zephyr/bluetooth/audio/cap.h> #include <zephyr/bluetooth/audio/cap.h>
#include <zephyr/bluetooth/bluetooth.h> #include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/kernel.h>
#define LONG_META 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, \ #define LONG_META 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, \
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, \ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, \
@ -45,6 +46,9 @@
#define INCORRECT_BROADCAST_CODE \ #define INCORRECT_BROADCAST_CODE \
((uint8_t[]){0xDE, 0xAD, 0xBE, 0xEF, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, \ ((uint8_t[]){0xDE, 0xAD, 0xBE, 0xEF, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, \
0xdd, 0xee, 0xff}) 0xdd, 0xee, 0xff})
#define BAP_RETRY_WAIT K_MSEC(100)
struct unicast_stream { struct unicast_stream {
struct bt_cap_stream stream; struct bt_cap_stream stream;
struct bt_audio_codec_cfg codec_cfg; struct bt_audio_codec_cfg codec_cfg;

20
tests/bsim/bluetooth/audio/src/bap_unicast_client_test.c

@ -37,8 +37,6 @@
#if defined(CONFIG_BT_BAP_UNICAST_CLIENT) #if defined(CONFIG_BT_BAP_UNICAST_CLIENT)
#define BAP_STREAM_RETRY_WAIT K_MSEC(100)
extern enum bst_result_t bst_result; extern enum bst_result_t bst_result;
static struct audio_test_stream test_streams[CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT]; static struct audio_test_stream test_streams[CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT];
@ -426,7 +424,7 @@ static bool parse_ascs_ad_data(struct bt_data *data, void *user_data)
return false; return false;
} }
err = bt_conn_le_create(info->addr, BT_CONN_LE_CREATE_CONN, BT_LE_CONN_PARAM_DEFAULT, err = bt_conn_le_create(info->addr, BT_CONN_LE_CREATE_CONN, BT_BAP_CONN_PARAM_RELAXED,
&default_conn); &default_conn);
if (err) { if (err) {
FAIL("Could not connect to peer: %d", err); FAIL("Could not connect to peer: %d", err);
@ -582,7 +580,7 @@ static int codec_configure_stream(struct bt_bap_stream *stream, struct bt_bap_ep
err = bt_bap_stream_config(default_conn, stream, ep, codec_cfg); err = bt_bap_stream_config(default_conn, stream, ep, codec_cfg);
if (err == -EBUSY) { if (err == -EBUSY) {
k_sleep(BAP_STREAM_RETRY_WAIT); k_sleep(BAP_RETRY_WAIT);
} else if (err != 0) { } else if (err != 0) {
FAIL("Could not configure stream %p: %d\n", stream, err); FAIL("Could not configure stream %p: %d\n", stream, err);
return err; return err;
@ -632,7 +630,7 @@ static void qos_configure_streams(struct bt_bap_unicast_group *unicast_group,
do { do {
err = bt_bap_stream_qos(default_conn, unicast_group); err = bt_bap_stream_qos(default_conn, unicast_group);
if (err == -EBUSY) { if (err == -EBUSY) {
k_sleep(BAP_STREAM_RETRY_WAIT); k_sleep(BAP_RETRY_WAIT);
} else if (err != 0) { } else if (err != 0) {
FAIL("Unable to QoS configure streams: %d\n", err); FAIL("Unable to QoS configure streams: %d\n", err);
return; return;
@ -653,7 +651,7 @@ static int enable_stream(struct bt_bap_stream *stream)
do { do {
err = bt_bap_stream_enable(stream, NULL, 0); err = bt_bap_stream_enable(stream, NULL, 0);
if (err == -EBUSY) { if (err == -EBUSY) {
k_sleep(BAP_STREAM_RETRY_WAIT); k_sleep(BAP_RETRY_WAIT);
} else if (err != 0) { } else if (err != 0) {
FAIL("Could not enable stream %p: %d\n", stream, err); FAIL("Could not enable stream %p: %d\n", stream, err);
return err; return err;
@ -692,7 +690,7 @@ static int metadata_update_stream(struct bt_bap_stream *stream)
do { do {
err = bt_bap_stream_metadata(stream, new_meta, ARRAY_SIZE(new_meta)); err = bt_bap_stream_metadata(stream, new_meta, ARRAY_SIZE(new_meta));
if (err == -EBUSY) { if (err == -EBUSY) {
k_sleep(BAP_STREAM_RETRY_WAIT); k_sleep(BAP_RETRY_WAIT);
} else if (err != 0) { } else if (err != 0) {
FAIL("Could not metadata update stream %p: %d\n", stream, err); FAIL("Could not metadata update stream %p: %d\n", stream, err);
return err; return err;
@ -786,7 +784,7 @@ static int start_stream(struct bt_bap_stream *stream)
do { do {
err = bt_bap_stream_start(stream); err = bt_bap_stream_start(stream);
if (err == -EBUSY) { if (err == -EBUSY) {
k_sleep(BAP_STREAM_RETRY_WAIT); k_sleep(BAP_RETRY_WAIT);
} else if (err != 0) { } else if (err != 0) {
FAIL("Could not start stream %p: %d\n", stream, err); FAIL("Could not start stream %p: %d\n", stream, err);
return err; return err;
@ -851,7 +849,7 @@ static void disable_streams(size_t stream_cnt)
err = bt_bap_stream_disable( err = bt_bap_stream_disable(
bap_stream_from_audio_test_stream(&test_streams[i])); bap_stream_from_audio_test_stream(&test_streams[i]));
if (err == -EBUSY) { if (err == -EBUSY) {
k_sleep(BAP_STREAM_RETRY_WAIT); k_sleep(BAP_RETRY_WAIT);
} else if (err != 0) { } else if (err != 0) {
FAIL("Could not disable stream: %d\n", err); FAIL("Could not disable stream: %d\n", err);
return; return;
@ -885,7 +883,7 @@ static void stop_streams(size_t stream_cnt)
do { do {
err = bt_bap_stream_stop(source_stream); err = bt_bap_stream_stop(source_stream);
if (err == -EBUSY) { if (err == -EBUSY) {
k_sleep(BAP_STREAM_RETRY_WAIT); k_sleep(BAP_RETRY_WAIT);
} else if (err != 0) { } else if (err != 0) {
FAIL("Could not stop stream: %d\n", err); FAIL("Could not stop stream: %d\n", err);
return; return;
@ -911,7 +909,7 @@ static void release_streams(size_t stream_cnt)
err = bt_bap_stream_release( err = bt_bap_stream_release(
bap_stream_from_audio_test_stream(&test_streams[i])); bap_stream_from_audio_test_stream(&test_streams[i]));
if (err == -EBUSY) { if (err == -EBUSY) {
k_sleep(BAP_STREAM_RETRY_WAIT); k_sleep(BAP_RETRY_WAIT);
} else if (err != 0) { } else if (err != 0) {
FAIL("Could not release stream: %d\n", err); FAIL("Could not release stream: %d\n", err);
return; return;

11
tests/bsim/bluetooth/audio/src/cap_acceptor_test.c

@ -40,17 +40,6 @@
#include "bap_common.h" #include "bap_common.h"
#if defined(CONFIG_BT_CAP_ACCEPTOR) #if defined(CONFIG_BT_CAP_ACCEPTOR)
/* Zephyr Controller works best while Extended Advertising interval to be 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.
*/
#define BT_LE_EXT_ADV_CONN_CUSTOM \
BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CONN, \
BT_GAP_MS_TO_ADV_INTERVAL(140), \
BT_GAP_MS_TO_ADV_INTERVAL(140), \
NULL)
extern enum bst_result_t bst_result; extern enum bst_result_t bst_result;
CREATE_FLAG(flag_broadcaster_found); CREATE_FLAG(flag_broadcaster_found);

4
tests/bsim/bluetooth/audio/src/cap_commander_test.c

@ -586,9 +586,7 @@ static bool check_audio_support_and_connect_cb(struct bt_data *data, void *user_
return false; return false;
} }
err = bt_conn_le_create(addr, BT_CONN_LE_CREATE_CONN, err = bt_conn_le_create(addr, BT_CONN_LE_CREATE_CONN, BT_BAP_CONN_PARAM_RELAXED,
BT_LE_CONN_PARAM(BT_GAP_INIT_CONN_INT_MIN, BT_GAP_INIT_CONN_INT_MIN,
0, BT_GAP_MS_TO_CONN_TIMEOUT(4000)),
&connected_conns[connected_conn_cnt]); &connected_conns[connected_conn_cnt]);
if (err != 0) { if (err != 0) {
FAIL("Could not connect to peer: %d", err); FAIL("Could not connect to peer: %d", err);

36
tests/bsim/bluetooth/audio/src/cap_initiator_broadcast_test.c

@ -37,19 +37,6 @@
#if defined(CONFIG_BT_CAP_INITIATOR) && defined(CONFIG_BT_BAP_BROADCAST_SOURCE) #if defined(CONFIG_BT_CAP_INITIATOR) && defined(CONFIG_BT_BAP_BROADCAST_SOURCE)
CREATE_FLAG(flag_source_started); CREATE_FLAG(flag_source_started);
/* Zephyr Controller works best while Extended Advertising interval to be 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.
*/
#define BT_LE_EXT_ADV_CUSTOM \
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)
#define BT_LE_PER_ADV_CUSTOM \
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)
#define BROADCAST_STREMT_CNT CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT #define BROADCAST_STREMT_CNT CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT
#define CAP_AC_MAX_STREAM 2 #define CAP_AC_MAX_STREAM 2
#define LOCATION (BT_AUDIO_LOCATION_FRONT_LEFT | BT_AUDIO_LOCATION_FRONT_RIGHT) #define LOCATION (BT_AUDIO_LOCATION_FRONT_LEFT | BT_AUDIO_LOCATION_FRONT_RIGHT)
@ -215,25 +202,6 @@ static void init(void)
} }
} }
static void setup_extended_adv(struct bt_le_ext_adv **adv)
{
int err;
/* Create a non-connectable advertising set */
err = bt_le_ext_adv_create(BT_LE_EXT_ADV_CUSTOM, NULL, adv);
if (err != 0) {
FAIL("Unable to create extended advertising set: %d\n", err);
return;
}
/* Set periodic advertising parameters */
err = bt_le_per_adv_set_param(*adv, BT_LE_PER_ADV_CUSTOM);
if (err) {
FAIL("Failed to set periodic advertising parameters: %d\n", err);
return;
}
}
static void setup_extended_adv_data(struct bt_cap_broadcast_source *source, static void setup_extended_adv_data(struct bt_cap_broadcast_source *source,
struct bt_le_ext_adv *adv) struct bt_le_ext_adv *adv)
{ {
@ -654,7 +622,7 @@ static void test_main_cap_initiator_broadcast(void)
init(); init();
setup_extended_adv(&adv); setup_broadcast_adv(&adv);
test_broadcast_audio_create_inval(); test_broadcast_audio_create_inval();
test_broadcast_audio_create(&broadcast_source); test_broadcast_audio_create(&broadcast_source);
@ -744,7 +712,7 @@ static int test_cap_initiator_ac(const struct cap_initiator_ac_param *param)
create_param.qos = &qos; create_param.qos = &qos;
init(); init();
setup_extended_adv(&adv); setup_broadcast_adv(&adv);
err = bt_cap_initiator_broadcast_audio_create(&create_param, &broadcast_source); err = bt_cap_initiator_broadcast_audio_create(&create_param, &broadcast_source);
if (err != 0) { if (err != 0) {

4
tests/bsim/bluetooth/audio/src/cap_initiator_unicast_test.c

@ -402,9 +402,7 @@ static bool check_audio_support_and_connect_cb(struct bt_data *data, void *user_
return false; return false;
} }
err = bt_conn_le_create(addr, BT_CONN_LE_CREATE_CONN, err = bt_conn_le_create(addr, BT_CONN_LE_CREATE_CONN, BT_BAP_CONN_PARAM_RELAXED,
BT_LE_CONN_PARAM(BT_GAP_INIT_CONN_INT_MIN, BT_GAP_INIT_CONN_INT_MIN,
0, BT_GAP_MS_TO_CONN_TIMEOUT(4000)),
&connected_conns[connected_conn_cnt]); &connected_conns[connected_conn_cnt]);
if (err != 0) { if (err != 0) {
FAIL("Could not connect to peer: %d", err); FAIL("Could not connect to peer: %d", err);

33
tests/bsim/bluetooth/audio/src/common.c

@ -107,7 +107,7 @@ static void device_found(const struct bt_le_scan_recv_info *info, struct net_buf
return; return;
} }
err = bt_conn_le_create(info->addr, BT_CONN_LE_CREATE_CONN, BT_LE_CONN_PARAM_DEFAULT, err = bt_conn_le_create(info->addr, BT_CONN_LE_CREATE_CONN, BT_BAP_CONN_PARAM_RELAXED,
&default_conn); &default_conn);
if (err) { if (err) {
FAIL("Could not connect to peer: %d", err); FAIL("Could not connect to peer: %d", err);
@ -186,12 +186,13 @@ BT_CONN_CB_DEFINE(conn_callbacks) = {
.security_changed = security_changed_cb, .security_changed = security_changed_cb,
}; };
void setup_connectable_adv(struct bt_le_ext_adv **ext_adv) void setup_connectable_adv(struct bt_le_ext_adv **ext_adv)
{ {
int err; int err;
/* Create a non-connectable advertising set */ /* Create a non-connectable advertising set */
err = bt_le_ext_adv_create(BT_LE_EXT_ADV_CONN, NULL, ext_adv); err = bt_le_ext_adv_create(BT_BAP_ADV_PARAM_CONN_QUICK, NULL, ext_adv);
if (err != 0) { if (err != 0) {
FAIL("Unable to create extended advertising set: %d\n", err); FAIL("Unable to create extended advertising set: %d\n", err);
return; return;
@ -218,6 +219,34 @@ void setup_connectable_adv(struct bt_le_ext_adv **ext_adv)
printk("Advertising started\n"); printk("Advertising started\n");
} }
void setup_broadcast_adv(struct bt_le_ext_adv **adv)
{
struct bt_le_adv_param ext_adv_param = *BT_BAP_ADV_PARAM_BROADCAST_SLOW;
int err;
/* 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.
*/
ext_adv_param.interval_min -= BT_GAP_MS_TO_ADV_INTERVAL(10U);
ext_adv_param.interval_max -= BT_GAP_MS_TO_ADV_INTERVAL(10U);
/* Create a non-connectable advertising set */
err = bt_le_ext_adv_create(&ext_adv_param, NULL, adv);
if (err != 0) {
FAIL("Unable to create extended advertising set: %d\n", err);
return;
}
/* Set periodic advertising parameters */
err = bt_le_per_adv_set_param(*adv, BT_BAP_PER_ADV_PARAM_BROADCAST_SLOW);
if (err) {
FAIL("Failed to set periodic advertising parameters: %d\n", err);
return;
}
}
void test_tick(bs_time_t HW_device_time) void test_tick(bs_time_t HW_device_time)
{ {
if (bst_result != Passed) { if (bst_result != Passed) {

1
tests/bsim/bluetooth/audio/src/common.h

@ -139,6 +139,7 @@ extern uint8_t csip_rsi[BT_CSIP_RSI_SIZE];
void disconnected(struct bt_conn *conn, uint8_t reason); void disconnected(struct bt_conn *conn, uint8_t reason);
void setup_connectable_adv(struct bt_le_ext_adv **ext_adv); void setup_connectable_adv(struct bt_le_ext_adv **ext_adv);
void setup_broadcast_adv(struct bt_le_ext_adv **adv);
void test_tick(bs_time_t HW_device_time); void test_tick(bs_time_t HW_device_time);
void test_init(void); void test_init(void);
uint16_t get_dev_cnt(void); uint16_t get_dev_cnt(void);

5
tests/bsim/bluetooth/audio/src/csip_set_coordinator_test.c

@ -10,6 +10,7 @@
#include <string.h> #include <string.h>
#include <zephyr/autoconf.h> #include <zephyr/autoconf.h>
#include <zephyr/bluetooth/audio/bap.h>
#include <zephyr/bluetooth/audio/csip.h> #include <zephyr/bluetooth/audio/csip.h>
#include <zephyr/bluetooth/addr.h> #include <zephyr/bluetooth/addr.h>
#include <zephyr/bluetooth/bluetooth.h> #include <zephyr/bluetooth/bluetooth.h>
@ -328,8 +329,8 @@ static void connect_set(void)
} }
bt_addr_le_to_str(&addr_found[0], addr, sizeof(addr)); bt_addr_le_to_str(&addr_found[0], addr, sizeof(addr));
err = bt_conn_le_create(&addr_found[0], BT_CONN_LE_CREATE_CONN, err = bt_conn_le_create(&addr_found[0], BT_CONN_LE_CREATE_CONN, BT_BAP_CONN_PARAM_RELAXED,
BT_LE_CONN_PARAM_DEFAULT, &conns[0]); &conns[0]);
if (err != 0) { if (err != 0) {
FAIL("Failed to connect to %s: %d\n", err); FAIL("Failed to connect to %s: %d\n", err);

33
tests/bsim/bluetooth/audio/src/gmap_ugg_test.c

@ -41,18 +41,6 @@
#include "bap_common.h" #include "bap_common.h"
#if defined(CONFIG_BT_GMAP) #if defined(CONFIG_BT_GMAP)
/* Zephyr Controller works best while Extended Advertising interval to be 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.
*/
#define BT_LE_EXT_ADV_CUSTOM \
BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV, BT_GAP_MS_TO_ADV_INTERVAL(80), \
BT_GAP_MS_TO_ADV_INTERVAL(80), NULL)
#define BT_LE_PER_ADV_CUSTOM \
BT_LE_PER_ADV_PARAM(BT_GAP_MS_TO_PER_ADV_INTERVAL(90), BT_GAP_MS_TO_PER_ADV_INTERVAL(90), \
BT_LE_PER_ADV_OPT_NONE)
#define UNICAST_SINK_SUPPORTED (CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT > 0) #define UNICAST_SINK_SUPPORTED (CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT > 0)
#define UNICAST_SRC_SUPPORTED (CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT > 0) #define UNICAST_SRC_SUPPORTED (CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT > 0)
@ -1002,25 +990,6 @@ static void test_gmap_ugg_unicast_ac(const struct gmap_unicast_ac_param *param)
param->src_named_preset != NULL ? param->src_named_preset->name : "None"); param->src_named_preset != NULL ? param->src_named_preset->name : "None");
} }
static void setup_extended_adv(struct bt_le_ext_adv **adv)
{
int err;
/* Create a non-connectable advertising set */
err = bt_le_ext_adv_create(BT_LE_EXT_ADV_CUSTOM, NULL, adv);
if (err != 0) {
FAIL("Unable to create extended advertising set: %d\n", err);
return;
}
/* Set periodic advertising parameters */
err = bt_le_per_adv_set_param(*adv, BT_LE_PER_ADV_CUSTOM);
if (err) {
FAIL("Failed to set periodic advertising parameters: %d\n", err);
return;
}
}
static void setup_extended_adv_data(struct bt_cap_broadcast_source *source, static void setup_extended_adv_data(struct bt_cap_broadcast_source *source,
struct bt_le_ext_adv *adv) struct bt_le_ext_adv *adv)
{ {
@ -1207,7 +1176,7 @@ static int test_gmap_ugg_broadcast_ac(const struct gmap_broadcast_ac_param *para
create_param.qos = &qos; create_param.qos = &qos;
init(); init();
setup_extended_adv(&adv); setup_broadcast_adv(&adv);
err = bt_cap_initiator_broadcast_audio_create(&create_param, &broadcast_source); err = bt_cap_initiator_broadcast_audio_create(&create_param, &broadcast_source);
if (err != 0) { if (err != 0) {

29
tests/bsim/bluetooth/audio/src/pbp_public_broadcast_source_test.c

@ -198,29 +198,6 @@ static int start_extended_adv(struct bt_le_ext_adv *adv)
return 0; return 0;
} }
static int setup_extended_adv(struct bt_le_ext_adv **adv)
{
int err;
/* Create a non-connectable advertising set */
err = bt_le_ext_adv_create(BT_LE_EXT_ADV_NCONN, NULL, adv);
if (err != 0) {
printk("Unable to create extended advertising set: %d\n", err);
return err;
}
/* Set periodic advertising parameters */
err = bt_le_per_adv_set_param(*adv, BT_LE_PER_ADV_DEFAULT);
if (err) {
printk("Failed to set periodic advertising parameters: %d\n", err);
return err;
}
return 0;
}
static int stop_extended_adv(struct bt_le_ext_adv *adv) static int stop_extended_adv(struct bt_le_ext_adv *adv)
{ {
int err; int err;
@ -292,11 +269,7 @@ static void test_main(void)
k_sem_reset(&sem_started); k_sem_reset(&sem_started);
k_sem_reset(&sem_stopped); k_sem_reset(&sem_stopped);
err = setup_extended_adv(&adv); setup_broadcast_adv(&adv);
if (err != 0) {
printk("Unable to setup extended advertiser: %d\n", err);
FAIL("Public Broadcast source failed\n");
}
err = bt_cap_initiator_broadcast_audio_create(&create_param, &broadcast_source); err = bt_cap_initiator_broadcast_audio_create(&create_param, &broadcast_source);
if (err != 0) { if (err != 0) {

4
tests/bsim/bluetooth/audio/src/tmap_client_test.c

@ -10,6 +10,7 @@
#include <stddef.h> #include <stddef.h>
#include <zephyr/autoconf.h> #include <zephyr/autoconf.h>
#include <zephyr/bluetooth/audio/bap.h>
#include <zephyr/bluetooth/audio/tmap.h> #include <zephyr/bluetooth/audio/tmap.h>
#include <zephyr/bluetooth/addr.h> #include <zephyr/bluetooth/addr.h>
#include <zephyr/bluetooth/bluetooth.h> #include <zephyr/bluetooth/bluetooth.h>
@ -87,8 +88,7 @@ static bool check_audio_support_and_connect(struct bt_data *data, void *user_dat
return false; return false;
} }
err = bt_conn_le_create(addr, BT_CONN_LE_CREATE_CONN, err = bt_conn_le_create(addr, BT_CONN_LE_CREATE_CONN, BT_BAP_CONN_PARAM_RELAXED,
BT_LE_CONN_PARAM_DEFAULT,
&default_conn); &default_conn);
if (err != 0) { if (err != 0) {
printk("Create conn to failed (%u)\n", err); printk("Create conn to failed (%u)\n", err);

1
tests/bsim/bluetooth/audio/src/tmap_server_test.c

@ -7,6 +7,7 @@
#include <stdint.h> #include <stdint.h>
#include <zephyr/autoconf.h> #include <zephyr/autoconf.h>
#include <zephyr/bluetooth/audio/bap.h>
#include <zephyr/bluetooth/audio/tmap.h> #include <zephyr/bluetooth/audio/tmap.h>
#include <zephyr/bluetooth/bluetooth.h> #include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/gap.h> #include <zephyr/bluetooth/gap.h>

2
tests/bsim/bluetooth/audio/test_scripts/bap_broadcast_audio_assistant.sh

@ -25,7 +25,7 @@ Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_audio_prj_conf \
Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_audio_prj_conf \ Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_audio_prj_conf \
-v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=2 \ -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -d=2 \
-testid=broadcast_source -RealEncryption=1 -rs=69 -D=3 \ -testid=broadcast_source -RealEncryption=1 -rs=69 -D=3 \
-start_offset=5e3 -argstest subgroup_cnt 1 streams_per_subgroup_cnt 2 -start_offset=2e3 -argstest subgroup_cnt 1 streams_per_subgroup_cnt 2
# Simulation time should be larger than the WAIT_TIME in common.h # Simulation time should be larger than the WAIT_TIME in common.h
Execute ./bs_2G4_phy_v1 -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -D=3 -sim_length=60e6 $@ Execute ./bs_2G4_phy_v1 -v=${VERBOSITY_LEVEL} -s=${SIMULATION_ID} -D=3 -sim_length=60e6 $@

2
tests/bsim/bluetooth/audio_samples/bap_unicast_client/src/unicast_client_sample_test.c

@ -12,7 +12,7 @@
#include "bs_utils.h" #include "bs_utils.h"
#include "bstests.h" #include "bstests.h"
#define WAIT_TIME 10 /* Seconds */ #define WAIT_TIME 20 /* Seconds */
#define PASS_THRESHOLD 100 /* Audio packets */ #define PASS_THRESHOLD 100 /* Audio packets */

Loading…
Cancel
Save