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

@ -0,0 +1,11 @@
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(bap_unicast_server)
target_sources(app PRIVATE
src/main.c
)
zephyr_library_include_directories(${ZEPHYR_BASE}/samples/bluetooth)

View file

@ -0,0 +1,83 @@
# Copyright (c) 2022 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
mainmenu "Bluetooth: Broadcast Audio Sink"
config SCAN_OFFLOAD
bool "Whether to wait for a Broadcast Assistant"
default y
# enable PAST support if we can
select BT_PER_ADV_SYNC_TRANSFER_RECEIVER if !BT_CTLR || BT_CTLR_SYNC_TRANSFER_RECEIVER_SUPPORT
help
If set to true, the sample will start advertising connectable for
Broadcast Assistants.
config SCAN_SELF
bool "Whether to scan for Broadcast Sources without Broadcast Assistant"
default y
help
If set to true, the sample will start scanning for Broadcast Sources
without waiting for a Broadcast Assistant to connect.
config SCAN_DELAY
int "Delay before starting scan (in seconds)"
range 0 255
default 10
depends on SCAN_SELF
help
Time to advertise connectable for a Broadcast Assistant to connect
before starting scanning for Broadcast Sources.
config TARGET_BROADCAST_NAME
string "Target Broadcast Device Name"
default ""
help
Name of target broadcast device. If not empty string, sink device
will only listen to the specified broadcast source. Not case sensitive.
config MAX_CODEC_FRAMES_PER_SDU
int "The maximum number of codec frame per SDU supported"
default 1
range 1 255
help
Maximum number of codec frames per SDU supported by this device. Increasing this value
allows support for a greater variaty of broadcasts, but also increases memory usage.
config ENABLE_LC3
bool "Enable the LC3 codec"
# By default let's enable it in the platforms we know are capable of supporting it
default y
depends on CPU_HAS_FPU && \
(ARCH_POSIX || SOC_COMPATIBLE_NRF52X || SOC_COMPATIBLE_NRF5340_CPUAPP)
select LIBLC3
select FPU
config USE_USB_AUDIO_OUTPUT
bool "Use USB Audio as output"
depends on ENABLE_LC3
select USB_DEVICE_STACK
select USB_DEVICE_AUDIO
select RING_BUFFER
help
Enables USB audio as output as a USB peripheral. This does not support providing USB
audio to e.g. speakers that are also USB peripherals, but can be connected to e.g. a
phone or PC as a USB-in device (such as a USB microphone).
USB audio only supports a single audio channel.
config USE_SPECIFIC_BROADCAST_CHANNEL
bool "Use specific Broadcast Channel Audio Location"
default y
depends on USE_USB_AUDIO_OUTPUT
help
Enables the use of a specific Channel Audio Location (see config TARGET_BROADCAST_CHANNEL).
config TARGET_BROADCAST_CHANNEL
int "Broadcast Channel Audio Location to sync to"
range 0 3
default 1
depends on USE_SPECIFIC_BROADCAST_CHANNEL
help
Channel Audio Location to sync to. These corresponds to the bt_audio_location,
supporting mono, left and right channels
source "Kconfig.zephyr"

View file

@ -0,0 +1,15 @@
# Copyright 2023 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
source "share/sysbuild/Kconfig"
config NET_CORE_BOARD
string
default "nrf5340dk/nrf5340/cpunet" if "$(BOARD)" = "nrf5340dk"
default "nrf5340_audio_dk/nrf5340/cpunet" if "$(BOARD)" = "nrf5340_audio_dk"
default "nrf5340bsim/nrf5340/cpunet" if $(BOARD_TARGET_STRING) = "NRF5340BSIM_NRF5340_CPUAPP"
config NET_CORE_IMAGE_HCI_IPC
bool "HCI IPC image on network core"
default y
depends on NET_CORE_BOARD != ""

View file

@ -0,0 +1,80 @@
.. zephyr:code-sample:: bluetooth_bap_broadcast_sink
:name: Bluetooth: Broadcast Audio Sink
:relevant-api: bluetooth
Bluetooth: Broadcast Audio Sink
Overview
********
Application demonstrating the LE Audio broadcast sink functionality.
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/bap_broadcast_sink` in the Zephyr tree.
Check the :ref:`bluetooth samples section <bluetooth-samples>` for general information.
Use `CONFIG_TARGET_BROADCAST_NAME` Kconfig to specify the name (CONFIG_BT_DEVICE_NAME)
of a broadcast source to listen to. With default value (empty string), sink
device will listen to all available broadcast sources.
Requirements
************
* BlueZ running on the host, or
* A board with Bluetooth Low Energy 5.2 support
Building and Running
********************
When building targeting an nrf52 series board with the Zephyr Bluetooth Controller,
use `-DOVERLAY_CONFIG=overlay-bt_ll_sw_split.conf` to enable the required ISO
feature support.
Building for an nrf5340dk
-------------------------
You can build both the application core image and an appropriate controller image for the network
core with:
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/bap_broadcast_sink/
:board: nrf5340dk/nrf5340/cpuapp
:goals: build
:west-args: --sysbuild
If you prefer to only build the application core image, you can do so by doing instead:
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/bap_broadcast_sink/
:board: nrf5340dk/nrf5340/cpuapp
:goals: build
In that case you can pair this application core image with the
:ref:`hci_ipc sample <bluetooth-hci-ipc-sample>`
:zephyr_file:`samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf` configuration.
Building for a simulated nrf5340bsim
------------------------------------
Similarly to how you would for real HW, you can do:
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/bap_broadcast_sink/
:board: nrf5340bsim/nrf5340/cpuapp
:goals: build
:west-args: --sysbuild
Note this will produce a Linux executable in `./build/zephyr/zephyr.exe`.
For more information, check :ref:`this board documentation <nrf5340bsim>`.
Building for a simulated nrf52_bsim
-----------------------------------
.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/bap_broadcast_sink/
:board: nrf52_bsim
:goals: build
:gen-args: -DOVERLAY_CONFIG=overlay-bt_ll_sw_split.conf

View file

@ -0,0 +1,3 @@
# Use USB Audio as audio sink
CONFIG_USE_USB_AUDIO_OUTPUT=y
CONFIG_USB_DEVICE_PRODUCT="USB Broadcast Sink"

View file

@ -0,0 +1,15 @@
zephyr_udc0: &usbd {
compatible = "nordic,nrf-usbd";
status = "okay";
hs_0: hs_0 {
compatible = "usb-audio-hs";
mic-feature-mute;
mic-channel-l;
mic-channel-r;
hp-feature-mute;
hp-channel-l;
hp-channel-r;
};
};

View file

@ -0,0 +1,3 @@
# Use USB Audio as audio sink
CONFIG_USE_USB_AUDIO_OUTPUT=y
CONFIG_USB_DEVICE_PRODUCT="USB Broadcast Sink"

View file

@ -0,0 +1,15 @@
zephyr_udc0: &usbd {
compatible = "nordic,nrf-usbd";
status = "okay";
hs_0: hs_0 {
compatible = "usb-audio-hs";
mic-feature-mute;
mic-channel-l;
mic-channel-r;
hp-feature-mute;
hp-channel-l;
hp-channel-r;
};
};

View file

@ -0,0 +1,3 @@
# Use USB Audio as audio sink
CONFIG_USE_USB_AUDIO_OUTPUT=y
CONFIG_USB_DEVICE_PRODUCT="USB Broadcast Sink"

View file

@ -0,0 +1,3 @@
# Use USB Audio as audio sink
CONFIG_USE_USB_AUDIO_OUTPUT=y
CONFIG_USB_DEVICE_PRODUCT="USB Broadcast Sink"

View file

@ -0,0 +1,15 @@
zephyr_udc0: &usbd {
compatible = "nordic,nrf-usbd";
status = "okay";
hs_0: hs_0 {
compatible = "usb-audio-hs";
mic-feature-mute;
mic-channel-l;
mic-channel-r;
hp-feature-mute;
hp-channel-l;
hp-channel-r;
};
};

View file

@ -0,0 +1,17 @@
# Zephyr Bluetooth Controller
CONFIG_BT_LL_SW_SPLIT=y
# Enable support for Broadcast ISO Sync
CONFIG_BT_CTLR_SYNC_ISO=y
# Supports the highest SDU size required by any BAP LC3 presets (155)
CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=155
# Supports the highest advertising data that is set in a single HCI command in
# Zephyr Bluetooth Controller
CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=191
# Number of supported streams
CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=2
CONFIG_BT_CTLR_ISOAL_SINKS=2
CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=50

View file

@ -0,0 +1,20 @@
CONFIG_BT=y
CONFIG_LOG=y
CONFIG_BT_AUDIO=y
CONFIG_BT_SMP=y
CONFIG_BT_PAC_SNK=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_BAP_BROADCAST_SINK=y
CONFIG_BT_BAP_SCAN_DELEGATOR=y
CONFIG_BT_ISO_MAX_CHAN=2
# Allocate 2 RX buffers per channel
CONFIG_BT_ISO_RX_BUF_COUNT=4
CONFIG_BT_BAP_BROADCAST_SNK_SUBGROUP_COUNT=2
CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT=2
CONFIG_BT_BAP_BASS_MAX_SUBGROUPS=2
CONFIG_BT_BUF_ACL_RX_SIZE=255
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_DEVICE_NAME="Broadcast Audio Sink"
CONFIG_BT_TINYCRYPT_ECC=y

View file

@ -0,0 +1,28 @@
sample:
description: Bluetooth Low Energy Audio Broadcast Sink sample
name: Bluetooth Low Energy Audio Broadcast Sink sample
tests:
sample.bluetooth.bap_broadcast_sink:
harness: bluetooth
platform_allow:
- qemu_cortex_m3
- qemu_x86
- nrf5340dk/nrf5340/cpuapp
- nrf5340bsim/nrf5340/cpuapp
integration_platforms:
- qemu_x86
- nrf5340dk/nrf5340/cpuapp
tags: bluetooth
sysbuild: true
sample.bluetooth.bap_broadcast_sink.bt_ll_sw_split:
harness: bluetooth
platform_allow:
- nrf52_bsim
- nrf52833dk/nrf52833
- nrf52840dongle/nrf52840
integration_platforms:
- nrf52_bsim
- nrf52833dk/nrf52833
- nrf52840dongle/nrf52840
extra_args: OVERLAY_CONFIG=overlay-bt_ll_sw_split.conf
tags: bluetooth

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,24 @@
# Copyright (c) 2023 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
if(SB_CONFIG_NET_CORE_IMAGE_HCI_IPC)
# For builds in the nrf5340, we build the netcore image with the controller
set(NET_APP hci_ipc)
set(NET_APP_SRC_DIR ${ZEPHYR_BASE}/samples/bluetooth/${NET_APP})
ExternalZephyrProject_Add(
APPLICATION ${NET_APP}
SOURCE_DIR ${NET_APP_SRC_DIR}
BOARD ${SB_CONFIG_NET_CORE_BOARD}
)
set(${NET_APP}_CONF_FILE
${NET_APP_SRC_DIR}/nrf5340_cpunet_iso-bt_ll_sw_split.conf
CACHE INTERNAL ""
)
native_simulator_set_child_images(${DEFAULT_IMAGE} ${NET_APP})
endif()
native_simulator_set_final_executable(${DEFAULT_IMAGE})