samples: Bluetooth: Audio: Change names to <profile>_<role>

Modify the BAP and PBP samples to start with the profile name
(BAP or PBP) and the role of the sample.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2024-05-29 12:47:12 +02:00 committed by David Leach
commit 1bcc3d8efa
106 changed files with 156 additions and 167 deletions

View file

@ -446,11 +446,10 @@ Bluetooth Audio:
- tests/bluetooth/shell/audio.conf
- tests/bluetooth/tester/overlay-le-audio.conf
- doc/connectivity/bluetooth/api/audio/
- samples/bluetooth/broadcast_audio*/
- samples/bluetooth/bap*/
- samples/bluetooth/hap*/
- samples/bluetooth/public_broadcast*/
- samples/bluetooth/pbp*/
- samples/bluetooth/tmap*/
- samples/bluetooth/unicast_audio*/
labels:
- "area: Bluetooth Audio"
- "area: Bluetooth"

View file

@ -200,6 +200,13 @@ REDIRECTS = [
('reference/usermode/syscalls', 'kernel/usermode/syscalls'),
('reference/util/index', 'kernel/util/index'),
('samples/application_development/with_mcuboot/README', 'samples/sysbuild/with_mcuboot/README'),
('samples/bluetooth/broadcast_audio_assistant/README', 'samples/bluetooth/bap_broadcast_assistant/README'),
('samples/bluetooth/broadcast_audio_sink/README', 'samples/bluetooth/bap_broadcast_sink/README'),
('samples/bluetooth/broadcast_audio_source/README', 'samples/bluetooth/bap_broadcast_source/README'),
('samples/bluetooth/public_broadcast_sink/README', 'samples/bluetooth/pbp_public_broadcast_sink/README'),
('samples/bluetooth/public_broadcast_source/README', 'samples/bluetooth/pbp_public_broadcast_source/README'),
('samples/bluetooth/unicast_audio_client/README', 'samples/bluetooth/bap_unicast_client/README'),
('samples/bluetooth/unicast_audio_server/README', 'samples/bluetooth/bap_unicast_server/README'),
('samples/drivers/adc/README', 'samples/drivers/adc/adc_dt/README'),
('samples/drivers/kscan_touch', 'samples/subsys/input/input'),
('samples/drivers/led_apa102/README', 'samples/drivers/led_strip/README'),

View file

@ -105,6 +105,14 @@ Bluetooth
* Removed ``err`` from :c:struct:`bt_bap_broadcast_assistant_cb.recv_state_removed` as it was
redundant.
* The broadcast_audio_assistant sample has been renamed to bap_broadcast_assistant.
The broadcast_audio_sink sample has been renamed to bap_broadcast_sink.
The broadcast_audio_source sample has been renamed to bap_broadcast_source.
The unicast_audio_client sample has been renamed to bap_unicast_client.
The unicast_audio_server sample has been renamed to bap_unicast_server.
The public_broadcast_sink sample has been renamed to pbp_public_broadcast_sink.
The public_broadcast_source sample has been renamed to pbp_public_broadcast_source.
* Host
* Added Nordic UART Service (NUS), enabled by the :kconfig:option:`CONFIG_BT_ZEPHYR_NUS`.

View file

@ -2,7 +2,7 @@
cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(public_broadcast_source)
project(bap_broadcast_assistant)
target_sources(app PRIVATE
src/main.c

View file

@ -1,4 +1,4 @@
.. zephyr:code-sample:: bluetooth_broadcast_audio_assistant
.. zephyr:code-sample:: bluetooth_bap_broadcast_assistant
:name: Bluetooth: Broadcast Audio Assistant
:relevant-api: bt_bap
@ -19,7 +19,7 @@ a set of LE Audio Broadcast capable earbuds) and a source (e.g. the Broadcast Au
Source sample).
This sample can be found under
:zephyr_file:`samples/bluetooth/broadcast_audio_assistant` in the Zephyr tree.
:zephyr_file:`samples/bluetooth/bap_broadcast_assistant` in the Zephyr tree.
Check the :ref:`bluetooth samples section <bluetooth-samples>` for general information.
@ -51,6 +51,6 @@ Building for an nrf52840dk
--------------------------
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/broadcast_audio_assistant/
:zephyr-app: samples/bluetooth/bap_broadcast_assistant/
:board: nrf52840dk/nrf52840
:goals: build

View file

@ -2,7 +2,7 @@ sample:
description: Bluetooth Low Energy Broadcast Assistant sample
name: Bluetooth Low Energy Broadcast Assistant sample
tests:
sample.bluetooth.broadcast_audio_assistant:
sample.bluetooth.bap_broadcast_assistant:
harness: bluetooth
platform_allow:
- nrf52840dk/nrf52840

View file

@ -2,7 +2,7 @@
cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(unicast_audio_client)
project(bap_unicast_server)
target_sources(app PRIVATE
src/main.c

View file

@ -1,4 +1,4 @@
.. zephyr:code-sample:: bluetooth_broadcast_audio_sink
.. zephyr:code-sample:: bluetooth_bap_broadcast_sink
:name: Bluetooth: Broadcast Audio Sink
:relevant-api: bluetooth
@ -12,7 +12,7 @@ Starts by scanning for LE Audio broadcast sources and then synchronizes to
the first found and listens to it until the source is (potentially) stopped.
This sample can be found under
:zephyr_file:`samples/bluetooth/broadcast_audio_sink` in the Zephyr tree.
:zephyr_file:`samples/bluetooth/bap_broadcast_sink` in the Zephyr tree.
Check the :ref:`bluetooth samples section <bluetooth-samples>` for general information.
@ -40,7 +40,7 @@ You can build both the application core image and an appropriate controller imag
core with:
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/broadcast_audio_sink/
:zephyr-app: samples/bluetooth/bap_broadcast_sink/
:board: nrf5340dk/nrf5340/cpuapp
:goals: build
:west-args: --sysbuild
@ -48,7 +48,7 @@ core with:
If you prefer to only build the application core image, you can do so by doing instead:
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/broadcast_audio_sink/
:zephyr-app: samples/bluetooth/bap_broadcast_sink/
:board: nrf5340dk/nrf5340/cpuapp
:goals: build
@ -62,7 +62,7 @@ Building for a simulated nrf5340bsim
Similarly to how you would for real HW, you can do:
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/broadcast_audio_sink/
:zephyr-app: samples/bluetooth/bap_broadcast_sink/
:board: nrf5340bsim/nrf5340/cpuapp
:goals: build
:west-args: --sysbuild
@ -74,7 +74,7 @@ Building for a simulated nrf52_bsim
-----------------------------------
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/broadcast_audio_sink/
:zephyr-app: samples/bluetooth/bap_broadcast_sink/
:board: nrf52_bsim
:goals: build
:gen-args: -DOVERLAY_CONFIG=overlay-bt_ll_sw_split.conf

View file

@ -2,7 +2,7 @@ sample:
description: Bluetooth Low Energy Audio Broadcast Sink sample
name: Bluetooth Low Energy Audio Broadcast Sink sample
tests:
sample.bluetooth.broadcast_audio_sink:
sample.bluetooth.bap_broadcast_sink:
harness: bluetooth
platform_allow:
- qemu_cortex_m3
@ -14,7 +14,7 @@ tests:
- nrf5340dk/nrf5340/cpuapp
tags: bluetooth
sysbuild: true
sample.bluetooth.broadcast_audio_sink.bt_ll_sw_split:
sample.bluetooth.bap_broadcast_sink.bt_ll_sw_split:
harness: bluetooth
platform_allow:
- nrf52_bsim

View file

@ -2,7 +2,7 @@
cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(unicast_audio_server)
project(bap_unicast_server)
target_sources(app PRIVATE
src/main.c

View file

@ -1,4 +1,4 @@
.. zephyr:code-sample:: bluetooth_broadcast_audio_source
.. zephyr:code-sample:: bluetooth_bap_broadcast_source
:name: Bluetooth: Broadcast Audio Source
:relevant-api: bluetooth
@ -15,7 +15,7 @@ broadcast audio source endpoint (BASE) and finally the BIGinfo together with
The broadcast source will reset every 30 seconds to show the full API.
This sample can be found under
:zephyr_file:`samples/bluetooth/broadcast_audio_source` in the Zephyr tree.
:zephyr_file:`samples/bluetooth/bap_broadcast_source` in the Zephyr tree.
Check the :ref:`bluetooth samples section <bluetooth-samples>` for general information.
@ -39,7 +39,7 @@ You can build both the application core image and an appropriate controller imag
core with:
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/broadcast_audio_source/
:zephyr-app: samples/bluetooth/bap_broadcast_source/
:board: nrf5340dk/nrf5340/cpuapp
:goals: build
:west-args: --sysbuild
@ -47,7 +47,7 @@ core with:
If you prefer to only build the application core image, you can do so by doing instead:
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/broadcast_audio_source/
:zephyr-app: samples/bluetooth/bap_broadcast_source/
:board: nrf5340dk/nrf5340/cpuapp
:goals: build
@ -61,7 +61,7 @@ Building for a simulated nrf5340bsim
Similarly to how you would for real HW, you can do:
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/broadcast_audio_source/
:zephyr-app: samples/bluetooth/bap_broadcast_source/
:board: nrf5340bsim/nrf5340/cpuapp
:goals: build
:west-args: --sysbuild
@ -73,7 +73,7 @@ Building for a simulated nrf52_bsim
-----------------------------------
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/broadcast_audio_source/
:zephyr-app: samples/bluetooth/bap_broadcast_source/
:board: nrf52_bsim
:goals: build
:gen-args: -DOVERLAY_CONFIG=overlay-bt_ll_sw_split.conf

View file

@ -2,7 +2,7 @@ sample:
description: Bluetooth Low Energy Broadcast Audio Source sample
name: Bluetooth Low Energy Broadcast Audio Source sample
tests:
sample.bluetooth.broadcast_audio_source:
sample.bluetooth.bap_broadcast_source:
harness: bluetooth
platform_allow:
- qemu_cortex_m3
@ -14,7 +14,7 @@ tests:
- nrf5340dk/nrf5340/cpuapp
tags: bluetooth
sysbuild: true
sample.bluetooth.broadcast_audio_source.bt_ll_sw_split:
sample.bluetooth.bap_broadcast_source.bt_ll_sw_split:
harness: bluetooth
platform_allow:
- nrf52_bsim

View file

@ -22,14 +22,13 @@ BUILD_ASSERT(strlen(CONFIG_BROADCAST_CODE) <= BT_AUDIO_BROADCAST_CODE_SIZE,
* 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, 0x0080, 0x0080, NULL)
#define BT_LE_EXT_ADV_CUSTOM BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV, 0x0080, 0x0080, NULL)
/* When BROADCAST_ENQUEUE_COUNT > 1 we can enqueue enough buffers to ensure that
* the controller is never idle
*/
#define BROADCAST_ENQUEUE_COUNT 3U
#define TOTAL_BUF_NEEDED (BROADCAST_ENQUEUE_COUNT * CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT)
#define TOTAL_BUF_NEEDED (BROADCAST_ENQUEUE_COUNT * CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT)
BUILD_ASSERT(CONFIG_BT_ISO_TX_BUF_COUNT >= TOTAL_BUF_NEEDED,
"CONFIG_BT_ISO_TX_BUF_COUNT should be at least "
@ -41,7 +40,7 @@ static struct bt_bap_lc3_preset preset_active = BT_BAP_LC3_BROADCAST_PRESET_16_2
BT_AUDIO_LOCATION_FRONT_LEFT | BT_AUDIO_LOCATION_FRONT_RIGHT,
BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED);
#define BROADCAST_SAMPLE_RATE 16000
#define BROADCAST_SAMPLE_RATE 16000
#elif defined(CONFIG_BAP_BROADCAST_24_2_1)
@ -49,14 +48,14 @@ static struct bt_bap_lc3_preset preset_active = BT_BAP_LC3_BROADCAST_PRESET_24_2
BT_AUDIO_LOCATION_FRONT_LEFT | BT_AUDIO_LOCATION_FRONT_RIGHT,
BT_AUDIO_CONTEXT_TYPE_UNSPECIFIED);
#define BROADCAST_SAMPLE_RATE 24000
#define BROADCAST_SAMPLE_RATE 24000
#endif
#if defined(CONFIG_BAP_BROADCAST_16_2_1)
#define MAX_SAMPLE_RATE 16000
#define MAX_SAMPLE_RATE 16000
#elif defined(CONFIG_BAP_BROADCAST_24_2_1)
#define MAX_SAMPLE_RATE 24000
#define MAX_SAMPLE_RATE 24000
#endif
#define MAX_FRAME_DURATION_US 10000
#define MAX_NUM_SAMPLES ((MAX_FRAME_DURATION_US * MAX_SAMPLE_RATE) / USEC_PER_SEC)
@ -70,12 +69,12 @@ static struct bt_bap_lc3_preset preset_active = BT_BAP_LC3_BROADCAST_PRESET_24_2
#include <zephyr/sys/ring_buffer.h>
/* USB Audio Data is downsampled from 48kHz to match broadcast preset when receiving data */
#define USB_SAMPLE_RATE 48000
#define USB_DOWNSAMPLE_RATE BROADCAST_SAMPLE_RATE
#define USB_FRAME_DURATION_US 1000
#define USB_NUM_SAMPLES ((USB_FRAME_DURATION_US * USB_DOWNSAMPLE_RATE) / USEC_PER_SEC)
#define USB_BYTES_PER_SAMPLE 2
#define USB_CHANNELS 2
#define USB_SAMPLE_RATE 48000
#define USB_DOWNSAMPLE_RATE BROADCAST_SAMPLE_RATE
#define USB_FRAME_DURATION_US 1000
#define USB_NUM_SAMPLES ((USB_FRAME_DURATION_US * USB_DOWNSAMPLE_RATE) / USEC_PER_SEC)
#define USB_BYTES_PER_SAMPLE 2
#define USB_CHANNELS 2
#define RING_BUF_USB_FRAMES 20
#define AUDIO_RING_BUF_BYTES (USB_NUM_SAMPLES * USB_BYTES_PER_SAMPLE * RING_BUF_USB_FRAMES)
@ -84,7 +83,7 @@ static struct bt_bap_lc3_preset preset_active = BT_BAP_LC3_BROADCAST_PRESET_24_2
#include <math.h>
#define AUDIO_VOLUME (INT16_MAX - 3000) /* codec does clipping above INT16_MAX - 3000 */
#define AUDIO_TONE_FREQUENCY_HZ 400
#define AUDIO_TONE_FREQUENCY_HZ 400
/**
* Use the math lib to generate a sine-wave using 16 bit samples into a buffer.
@ -128,9 +127,7 @@ static struct broadcast_source_stream {
} streams[CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT];
static struct bt_bap_broadcast_source *broadcast_source;
NET_BUF_POOL_FIXED_DEFINE(tx_pool,
TOTAL_BUF_NEEDED,
BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU),
NET_BUF_POOL_FIXED_DEFINE(tx_pool, TOTAL_BUF_NEEDED, BT_ISO_SDU_BUF_SIZE(CONFIG_BT_ISO_TX_MTU),
CONFIG_BT_CONN_TX_USER_DATA_SIZE, NULL);
static int16_t send_pcm_data[MAX_NUM_SAMPLES];
@ -140,7 +137,7 @@ static bool stopping;
static K_SEM_DEFINE(sem_started, 0U, ARRAY_SIZE(streams));
static K_SEM_DEFINE(sem_stopped, 0U, ARRAY_SIZE(streams));
#define BROADCAST_SOURCE_LIFETIME 120U /* seconds */
#define BROADCAST_SOURCE_LIFETIME 120U /* seconds */
#if defined(CONFIG_LIBLC3)
static int freq_hz;
@ -163,8 +160,7 @@ static void send_data(struct broadcast_source_stream *source_stream)
buf = net_buf_alloc(&tx_pool, K_FOREVER);
if (buf == NULL) {
printk("Could not allocate buffer when sending on %p\n",
stream);
printk("Could not allocate buffer when sending on %p\n", stream);
return;
}
@ -179,8 +175,8 @@ static void send_data(struct broadcast_source_stream *source_stream)
}
#if defined(CONFIG_USB_DEVICE_AUDIO)
uint32_t size = ring_buf_get(&source_stream->audio_ring_buf,
(uint8_t *)send_pcm_data, sizeof(send_pcm_data));
uint32_t size = ring_buf_get(&source_stream->audio_ring_buf, (uint8_t *)send_pcm_data,
sizeof(send_pcm_data));
if (size < sizeof(send_pcm_data)) {
const size_t padding_size = sizeof(send_pcm_data) - size;
@ -190,8 +186,8 @@ static void send_data(struct broadcast_source_stream *source_stream)
}
#endif
ret = lc3_encode(source_stream->lc3_encoder, LC3_PCM_FORMAT_S16,
send_pcm_data, 1, octets_per_frame, lc3_encoded_buffer);
ret = lc3_encode(source_stream->lc3_encoder, LC3_PCM_FORMAT_S16, send_pcm_data, 1,
octets_per_frame, lc3_encoded_buffer);
if (ret == -1) {
printk("LC3 encoder failed - wrong parameters?: %d", ret);
net_buf_unref(buf);
@ -264,8 +260,8 @@ static void init_lc3_thread(void *arg1, void *arg2, void *arg3)
/* Create the encoder instance. This shall complete before stream_started() is called. */
for (size_t i = 0U; i < ARRAY_SIZE(streams); i++) {
printk("Initializing lc3 encoder for stream %zu\n", i);
streams[i].lc3_encoder = lc3_setup_encoder(frame_duration_us, freq_hz,
0, &streams[i].lc3_encoder_mem);
streams[i].lc3_encoder = lc3_setup_encoder(frame_duration_us, freq_hz, 0,
&streams[i].lc3_encoder_mem);
if (streams[i].lc3_encoder == NULL) {
printk("ERROR: Failed to setup LC3 encoder - wrong parameters?\n");
@ -282,16 +278,14 @@ static void init_lc3_thread(void *arg1, void *arg2, void *arg3)
}
}
#define LC3_ENCODER_STACK_SIZE 4 * 4096
#define LC3_ENCODER_PRIORITY 5
#define LC3_ENCODER_STACK_SIZE 4 * 4096
#define LC3_ENCODER_PRIORITY 5
K_THREAD_DEFINE(encoder, LC3_ENCODER_STACK_SIZE, init_lc3_thread,
NULL, NULL, NULL, LC3_ENCODER_PRIORITY, 0, -1);
K_THREAD_DEFINE(encoder, LC3_ENCODER_STACK_SIZE, init_lc3_thread, NULL, NULL, NULL,
LC3_ENCODER_PRIORITY, 0, -1);
#if defined(CONFIG_USB_DEVICE_AUDIO)
static void data_received(const struct device *dev,
struct net_buf *buffer,
size_t size)
static void data_received(const struct device *dev, struct net_buf *buffer, size_t size)
{
static int count;
int16_t *pcm;
@ -322,13 +316,13 @@ static void data_received(const struct device *dev,
}
for (size_t i = 0U; i < MIN(ARRAY_SIZE(streams), 2); i++) {
const uint32_t size_put = ring_buf_put(&(streams[i].audio_ring_buf),
(uint8_t *)(usb_pcm_data[i]), nsamples * USB_BYTES_PER_SAMPLE);
const uint32_t size_put =
ring_buf_put(&(streams[i].audio_ring_buf), (uint8_t *)(usb_pcm_data[i]),
nsamples * USB_BYTES_PER_SAMPLE);
if (size_put < nsamples * USB_BYTES_PER_SAMPLE) {
printk("Not enough room for samples in %s buffer: %u < %u, total capacity: %u\n",
i == 0 ? "left" : "right",
size_put,
nsamples * USB_BYTES_PER_SAMPLE,
printk("Not enough room for samples in %s buffer: %u < %u, total capacity: "
"%u\n",
i == 0 ? "left" : "right", size_put, nsamples * USB_BYTES_PER_SAMPLE,
ring_buf_capacity_get(&(streams[i].audio_ring_buf)));
}
}
@ -341,9 +335,7 @@ static void data_received(const struct device *dev,
net_buf_unref(buffer);
}
static const struct usb_audio_ops ops = {
.data_received_cb = data_received
};
static const struct usb_audio_ops ops = {.data_received_cb = data_received};
#endif /* defined(CONFIG_USB_DEVICE_AUDIO) */
#endif /* defined(CONFIG_LIBLC3) */
@ -376,10 +368,7 @@ static void stream_sent_cb(struct bt_bap_stream *stream)
}
static struct bt_bap_stream_ops stream_ops = {
.started = stream_started_cb,
.stopped = stream_stopped_cb,
.sent = stream_sent_cb
};
.started = stream_started_cb, .stopped = stream_stopped_cb, .sent = stream_sent_cb};
static int setup_broadcast_source(struct bt_bap_broadcast_source **source)
{
@ -390,9 +379,9 @@ static int setup_broadcast_source(struct bt_bap_broadcast_source **source)
struct bt_bap_broadcast_source_param create_param = {0};
const size_t streams_per_subgroup = ARRAY_SIZE(stream_params) / ARRAY_SIZE(subgroup_param);
uint8_t left[] = {BT_AUDIO_CODEC_DATA(BT_AUDIO_CODEC_CFG_CHAN_ALLOC,
BT_BYTES_LIST_LE32(BT_AUDIO_LOCATION_FRONT_LEFT))};
BT_BYTES_LIST_LE32(BT_AUDIO_LOCATION_FRONT_LEFT))};
uint8_t right[] = {BT_AUDIO_CODEC_DATA(BT_AUDIO_CODEC_CFG_CHAN_ALLOC,
BT_BYTES_LIST_LE32(BT_AUDIO_LOCATION_FRONT_RIGHT))};
BT_BYTES_LIST_LE32(BT_AUDIO_LOCATION_FRONT_RIGHT))};
int err;
for (size_t i = 0U; i < ARRAY_SIZE(subgroup_param); i++) {
@ -420,8 +409,7 @@ static int setup_broadcast_source(struct bt_bap_broadcast_source **source)
}
printk("Creating broadcast source with %zu subgroups with %zu streams\n",
ARRAY_SIZE(subgroup_param),
ARRAY_SIZE(subgroup_param) * streams_per_subgroup);
ARRAY_SIZE(subgroup_param), ARRAY_SIZE(subgroup_param) * streams_per_subgroup);
err = bt_bap_broadcast_source_create(&create_param, source);
if (err != 0) {
@ -465,11 +453,10 @@ int main(void)
(void)memset(streams, 0, sizeof(streams));
for (size_t i = 0U; i < ARRAY_SIZE(streams); i++) {
ring_buf_init(&(streams[i].audio_ring_buf),
sizeof(streams[i]._ring_buffer_memory),
ring_buf_init(&(streams[i].audio_ring_buf), sizeof(streams[i]._ring_buffer_memory),
streams[i]._ring_buffer_memory);
printk("Initialized ring buf %zu: capacity: %u\n", i,
ring_buf_capacity_get(&(streams[i].audio_ring_buf)));
ring_buf_capacity_get(&(streams[i].audio_ring_buf)));
}
usb_audio_register(hs_dev, &ops);
@ -486,8 +473,7 @@ int main(void)
while (true) {
/* Broadcast Audio Streaming Endpoint advertising data */
NET_BUF_SIMPLE_DEFINE(ad_buf,
BT_UUID_SIZE_16 + BT_AUDIO_BROADCAST_ID_SIZE);
NET_BUF_SIMPLE_DEFINE(ad_buf, BT_UUID_SIZE_16 + BT_AUDIO_BROADCAST_ID_SIZE);
NET_BUF_SIMPLE_DEFINE(base_buf, 128);
struct bt_data ext_ad[2];
struct bt_data per_ad;
@ -496,16 +482,14 @@ int main(void)
/* Create a connectable advertising set */
err = bt_le_ext_adv_create(BT_LE_EXT_ADV_CUSTOM, NULL, &adv);
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;
}
/* 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"
" (err %d)\n", err);
printk("Failed to set periodic advertising parameters (err %d)\n", err);
return 0;
}
@ -532,8 +516,7 @@ int main(void)
sizeof(CONFIG_BT_DEVICE_NAME) - 1);
err = bt_le_ext_adv_set_data(adv, ext_ad, 2, NULL, 0);
if (err != 0) {
printk("Failed to set extended advertising data: %d\n",
err);
printk("Failed to set extended advertising data: %d\n", err);
return 0;
}
@ -549,24 +532,21 @@ int main(void)
per_ad.data = base_buf.data;
err = bt_le_per_adv_set_data(adv, &per_ad, 1);
if (err != 0) {
printk("Failed to set periodic advertising data: %d\n",
err);
printk("Failed to set periodic advertising data: %d\n", err);
return 0;
}
/* Start extended advertising */
err = bt_le_ext_adv_start(adv, BT_LE_EXT_ADV_START_DEFAULT);
if (err) {
printk("Failed to start extended advertising: %d\n",
err);
printk("Failed to start extended advertising: %d\n", err);
return 0;
}
/* Enable Periodic Advertising */
err = bt_le_per_adv_start(adv);
if (err) {
printk("Failed to enable periodic advertising: %d\n",
err);
printk("Failed to enable periodic advertising: %d\n", err);
return 0;
}
@ -595,8 +575,7 @@ int main(void)
/* Never stop streaming when using USB Audio as input */
k_sleep(K_FOREVER);
#endif /* defined(CONFIG_LIBLC3) && defined(CONFIG_USB_DEVICE_AUDIO) */
printk("Waiting %u seconds before stopped\n",
BROADCAST_SOURCE_LIFETIME);
printk("Waiting %u seconds before stopped\n", BROADCAST_SOURCE_LIFETIME);
k_sleep(K_SECONDS(BROADCAST_SOURCE_LIFETIME));
printk("Stopping broadcast source\n");
stopping = true;
@ -624,22 +603,19 @@ int main(void)
err = bt_le_per_adv_stop(adv);
if (err) {
printk("Failed to stop periodic advertising (err %d)\n",
err);
printk("Failed to stop periodic advertising (err %d)\n", err);
return 0;
}
err = bt_le_ext_adv_stop(adv);
if (err) {
printk("Failed to stop extended advertising (err %d)\n",
err);
printk("Failed to stop extended advertising (err %d)\n", err);
return 0;
}
err = bt_le_ext_adv_delete(adv);
if (err) {
printk("Failed to delete extended advertising (err %d)\n",
err);
printk("Failed to delete extended advertising (err %d)\n", err);
return 0;
}
}

View file

@ -2,7 +2,7 @@
cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(unicast_audio_server)
project(bap_unicast_client)
target_sources(app PRIVATE
src/main.c

View file

@ -1,4 +1,4 @@
.. _bluetooth_unicast_audio_client:
.. _bluetooth_bap_unicast_client:
Bluetooth: Unicast Audio Client
###############################
@ -10,7 +10,7 @@ Application demonstrating the LE Audio unicast client functionality. Scans for a
connects to a LE Audio unicast server and establishes an audio stream.
This sample can be found under
:zephyr_file:`samples/bluetooth/unicast_audio_client` in the Zephyr tree.
:zephyr_file:`samples/bluetooth/bap_unicast_client` in the Zephyr tree.
Check the :ref:`bluetooth samples section <bluetooth-samples>` for general information.
@ -31,7 +31,7 @@ Building for an nrf52840dk
--------------------------
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/unicast_audio_client/
:zephyr-app: samples/bluetooth/bap_unicast_client/
:board: nrf52840dk/nrf52840
:goals: build
:gen-args: -DOVERLAY_CONFIG=overlay-bt_ll_sw_split.conf
@ -43,7 +43,7 @@ You can build both the application core image and an appropriate controller imag
core with:
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/unicast_audio_client/
:zephyr-app: samples/bluetooth/bap_unicast_client/
:board: nrf5340dk/nrf5340/cpuapp
:goals: build
:west-args: --sysbuild
@ -51,7 +51,7 @@ core with:
If you prefer to only build the application core image, you can do so by doing instead:
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/unicast_audio_server/
:zephyr-app: samples/bluetooth/bap_unicast_server/
:board: nrf5340dk/nrf5340/cpuapp
:goals: build
@ -65,7 +65,7 @@ Building for a simulated nrf52_bsim
Similarly to how you would for real HW, you can do:
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/unicast_audio_client/
:zephyr-app: samples/bluetooth/bap_unicast_client/
:board: nrf52_bsim
:goals: build
:gen-args: -DOVERLAY_CONFIG=overlay-bt_ll_sw_split.conf
@ -77,7 +77,7 @@ Building for a simulated nrf5340bsim
------------------------------------
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/unicast_audio_client/
:zephyr-app: samples/bluetooth/bap_unicast_client/
:board: nrf5340bsim/nrf5340/cpuapp
:goals: build
:west-args: --sysbuild

View file

@ -2,7 +2,7 @@
cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(unicast_audio_server)
project(bap_unicast_server)
target_sources(app PRIVATE
src/main.c

View file

@ -1,4 +1,4 @@
.. _bluetooth_unicast_audio_server:
.. _bluetooth_bap_unicast_server:
Bluetooth: Unicast Audio Server
###############################
@ -10,7 +10,7 @@ Application demonstrating the LE Audio unicast server functionality.
Starts advertising and awaits connection from a LE Audio unicast client.
This sample can be found under
:zephyr_file:`samples/bluetooth/unicast_audio_server` in the Zephyr tree.
:zephyr_file:`samples/bluetooth/bap_unicast_server` in the Zephyr tree.
Check the :ref:`bluetooth samples section <bluetooth-samples>` for general information.
@ -31,7 +31,7 @@ Building for an nrf52840dk
--------------------------
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/unicast_audio_server/
:zephyr-app: samples/bluetooth/bap_unicast_server/
:board: nrf52840dk/nrf52840
:goals: build
:gen-args: -DOVERLAY_CONFIG=overlay-bt_ll_sw_split.conf
@ -43,7 +43,7 @@ You can build both the application core image and an appropriate controller imag
core with:
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/unicast_audio_server/
:zephyr-app: samples/bluetooth/bap_unicast_server/
:board: nrf5340dk/nrf5340/cpuapp
:goals: build
:west-args: --sysbuild
@ -51,7 +51,7 @@ core with:
If you prefer to only build the application core image, you can do so by doing instead:
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/unicast_audio_server/
:zephyr-app: samples/bluetooth/bap_unicast_server/
:board: nrf5340dk/nrf5340/cpuapp
:goals: build
@ -65,7 +65,7 @@ Building for a simulated nrf52_bsim
Similarly to how you would for real HW, you can do:
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/unicast_audio_server/
:zephyr-app: samples/bluetooth/bap_unicast_server/
:board: nrf52_bsim
:goals: build
:gen-args: -DOVERLAY_CONFIG=overlay-bt_ll_sw_split.conf
@ -77,7 +77,7 @@ Building for a simulated nrf5340bsim
------------------------------------
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/unicast_audio_server/
:zephyr-app: samples/bluetooth/bap_unicast_server/
:board: nrf5340bsim/nrf5340/cpuapp
:goals: build
:west-args: --sysbuild

View file

@ -13,7 +13,7 @@ the first found source which defines a Public Broadcast Announcement including
a High Quality Public Broadcast Audio Stream configuration.
This sample can be found under
:zephyr_file:`samples/bluetooth/public_broadcast_sink` in the Zephyr tree.
:zephyr_file:`samples/bluetooth/pbp_public_broadcast_sink` in the Zephyr tree.
Check the :ref:`bluetooth samples section <bluetooth-samples>` for general information.
@ -37,7 +37,7 @@ You can build both the application core image and an appropriate controller imag
core with:
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/public_broadcast_sink/
:zephyr-app: samples/bluetooth/pbp_public_broadcast_sink/
:board: nrf5340dk/nrf5340/cpuapp
:goals: build
:west-args: --sysbuild
@ -45,7 +45,7 @@ core with:
If you prefer to only build the application core image, you can do so by doing instead:
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/public_broadcast_sink/
:zephyr-app: samples/bluetooth/pbp_public_broadcast_sink/
:board: nrf5340dk/nrf5340/cpuapp
:goals: build
@ -59,7 +59,7 @@ Building for a simulated nrf5340bsim
Similarly to how you would for real HW, you can do:
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/public_broadcast_sink/
:zephyr-app: samples/bluetooth/pbp_public_broadcast_sink/
:board: nrf5340bsim/nrf5340/cpuapp
:goals: build
:west-args: --sysbuild
@ -71,7 +71,7 @@ Building for a simulated nrf52_bsim
-----------------------------------
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/public_broadcast_sink/
:zephyr-app: samples/bluetooth/pbp_public_broadcast_sink/
:board: nrf52_bsim
:goals: build
:gen-args: -DOVERLAY_CONFIG=overlay-bt_ll_sw_split.conf

View file

@ -2,7 +2,7 @@ sample:
description: Bluetooth Low Energy Audio PBP Broadcast Sink sample
name: Bluetooth Low Energy Audio PBP Broadcast Sink sample
tests:
sample.bluetooth.public_broadcast_sink:
sample.bluetooth.pbp_public_broadcast_sink:
harness: bluetooth
platform_allow:
- qemu_cortex_m3
@ -14,7 +14,7 @@ tests:
- nrf5340dk/nrf5340/cpuapp
tags: bluetooth
sysbuild: true
sample.bluetooth.public_broadcast_sink.bt_ll_sw_split:
sample.bluetooth.pbp_public_broadcast_sink.bt_ll_sw_split:
harness: bluetooth
platform_allow:
- nrf52_bsim

View file

@ -2,7 +2,7 @@
cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(broadcast_audio_assistant)
project(pbp_public_broadcast_source)
target_sources(app PRIVATE
src/main.c

View file

@ -13,7 +13,7 @@ The advertised broadcast audio stream quality will cycle between high and standa
every 15 seconds.
This sample can be found under
:zephyr_file:`samples/bluetooth/public_broadcast_source` in the Zephyr tree.
:zephyr_file:`samples/bluetooth/pbp_public_broadcast_source` in the Zephyr tree.
Check the :ref:`bluetooth samples section <bluetooth-samples>` for general information.
@ -37,7 +37,7 @@ You can build both the application core image and an appropriate controller imag
core with:
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/public_broadcast_source/
:zephyr-app: samples/bluetooth/pbp_public_broadcast_source/
:board: nrf5340dk/nrf5340/cpuapp
:goals: build
:west-args: --sysbuild
@ -45,7 +45,7 @@ core with:
If you prefer to only build the application core image, you can do so by doing instead:
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/public_broadcast_source/
:zephyr-app: samples/bluetooth/pbp_public_broadcast_source/
:board: nrf5340dk/nrf5340/cpuapp
:goals: build
@ -59,7 +59,7 @@ Building for a simulated nrf5340bsim
Similarly to how you would for real HW, you can do:
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/public_broadcast_source/
:zephyr-app: samples/bluetooth/pbp_public_broadcast_source/
:board: nrf5340bsim/nrf5340/cpuapp
:goals: build
:west-args: --sysbuild
@ -71,7 +71,7 @@ Building for a simulated nrf52_bsim
-----------------------------------
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/public_broadcast_source/
:zephyr-app: samples/bluetooth/pbp_public_broadcast_source/
:board: nrf52_bsim
:goals: build
:gen-args: -DOVERLAY_CONFIG=overlay-bt_ll_sw_split.conf

View file

@ -2,7 +2,7 @@ sample:
description: Bluetooth Low Energy Public Broadcast Source sample
name: Bluetooth Low Energy Public Broadcast Source sample
tests:
sample.bluetooth.public_broadcast_source:
sample.bluetooth.pbp_public_broadcast_source:
harness: bluetooth
platform_allow:
- qemu_cortex_m3
@ -14,7 +14,7 @@ tests:
- nrf5340dk/nrf5340/cpuapp
tags: bluetooth
sysbuild: true
sample.bluetooth.public_broadcast_source.bt_ll_sw_split:
sample.bluetooth.pbp_public_broadcast_source.bt_ll_sw_split:
harness: bluetooth
platform_allow:
- nrf52_bsim

View file

@ -19,8 +19,8 @@ bt_peripheral,default,nrf52840dk/nrf52840,samples/bluetooth/peripheral,
bt_central_hr,default,nrf52840dk/nrf52840,samples/bluetooth/central_hr,
bt_mesh_demo,default,bbc_microbit,samples/bluetooth/mesh_demo,
bt_hap_ha,default,nrf5340dk/nrf5340_cpuapp,samples/bluetooth/hap_ha,
bt_unicast_audio_client,default,nrf5340dk/nrf5340/cpuapp,samples/bluetooth/unicast_audio_client,
bt_unicast_audio_server,default,nrf5340dk/nrf5340/cpuapp,samples/bluetooth/unicast_audio_server,
bt_bap_unicast_client,default,nrf5340dk/nrf5340/cpuapp,samples/bluetooth/bap_unicast_client,
bt_bap_unicast_server,default,nrf5340dk/nrf5340/cpuapp,samples/bluetooth/bap_unicast_server,
bt_tmap_central,default,nrf5340dk/nrf5340/cpuapp,samples/bluetooth/tmap_central,
bt_tmap_peripheral,default,nrf5340dk/nrf5340/cpuapp,samples/bluetooth/tmap_peripheral,
bt_tmap_bms,default,nrf5340dk/nrf5340/cpuapp,samples/bluetooth/tmap_bms,

View file

@ -3,16 +3,16 @@
cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(broadcast_audio_sink_self_tets)
project(bap_broadcast_sink_self_tets)
set(broadcast_audio_sink_path ${ZEPHYR_BASE}/samples/bluetooth/broadcast_audio_sink)
set(bap_broadcast_sink_path ${ZEPHYR_BASE}/samples/bluetooth/bap_broadcast_sink)
target_sources(app PRIVATE
${broadcast_audio_sink_path}/src/main.c
${bap_broadcast_sink_path}/src/main.c
)
target_sources(app PRIVATE
src/broadcast_audio_sink_test.c
src/broadcast_sink_test.c
src/test_main.c
)

View file

@ -1,4 +1,4 @@
# Copyright (c) 2023 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
source "${ZEPHYR_BASE}/samples/bluetooth/broadcast_audio_sink/Kconfig"
source "${ZEPHYR_BASE}/samples/bluetooth/bap_broadcast_sink/Kconfig"

View file

@ -1,7 +1,7 @@
# Copyright (c) 2023 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
source "${ZEPHYR_BASE}/samples/bluetooth/broadcast_audio_sink/Kconfig.sysbuild"
source "${ZEPHYR_BASE}/samples/bluetooth/bap_broadcast_sink/Kconfig.sysbuild"
config NATIVE_SIMULATOR_PRIMARY_MCU_INDEX
int

View file

@ -0,0 +1,2 @@
# Please build using the sample configuration file:
# ${ZEPHYR_BASE}/samples/bluetooth/bap_broadcast_sink/prj.conf

View file

@ -59,7 +59,7 @@ static void test_broadcast_sink_sample_tick(bs_time_t HW_device_time)
static const struct bst_test_instance test_sample[] = {
{
.test_id = "broadcast_audio_sink",
.test_id = "bap_broadcast_sink",
.test_descr = "Test based on the broadcast audio sink sample. "
"It expects to be connected to a compatible broadcast audio source, "
"waits for " STR(WAIT_TIME) " seconds, and checks how "
@ -67,8 +67,7 @@ static const struct bst_test_instance test_sample[] = {
.test_pre_init_f = test_broadcast_sink_sample_init,
.test_tick_f = test_broadcast_sink_sample_tick,
},
BSTEST_END_MARKER
};
BSTEST_END_MARKER};
struct bst_test_list *test_broadcast_sink_test_install(struct bst_test_list *tests)
{

View file

@ -1,6 +1,6 @@
# Copyright (c) 2023 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
include(${ZEPHYR_BASE}/samples/bluetooth/unicast_audio_client/sysbuild.cmake)
include(${ZEPHYR_BASE}/samples/bluetooth/bap_broadcast_sink/sysbuild.cmake)
native_simulator_set_primary_mcu_index(${DEFAULT_IMAGE} ${NET_APP})

View file

@ -16,12 +16,12 @@ EXECUTE_TIMEOUT=200
cd ${BSIM_OUT_PATH}/bin
Execute ./bs_${BOARD_TS}_samples_bluetooth_broadcast_audio_source_prj_conf \
Execute ./bs_${BOARD_TS}_samples_bluetooth_bap_broadcast_source_prj_conf \
-v=${verbosity_level} -s=${simulation_id} -d=0 -RealEncryption=1
Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_audio_samples_broadcast_audio_sink_prj_conf \
Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_audio_samples_bap_broadcast_sink_prj_conf \
-v=${verbosity_level} -s=${simulation_id} -d=1 -RealEncryption=1 \
-testid=broadcast_audio_sink
-testid=bap_broadcast_sink
Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \
-D=2 -sim_length=120e6 $@

View file

@ -3,9 +3,9 @@
cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(unicast_audio_client_self_tets)
project(bap_unicast_client_self_tets)
set(unicast_client_path ${ZEPHYR_BASE}/samples/bluetooth/unicast_audio_client)
set(unicast_client_path ${ZEPHYR_BASE}/samples/bluetooth/bap_unicast_client)
target_sources(app PRIVATE
${unicast_client_path}/src/main.c

View file

@ -1,7 +1,7 @@
# Copyright (c) 2023 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
source "${ZEPHYR_BASE}/samples/bluetooth/unicast_audio_client/Kconfig.sysbuild"
source "${ZEPHYR_BASE}/samples/bluetooth/bap_unicast_client/Kconfig.sysbuild"
config NATIVE_SIMULATOR_PRIMARY_MCU_INDEX
int

Some files were not shown because too many files have changed in this diff Show more