Skip to content

Commit

Permalink
samples: Add Broadcast Assistant sample
Browse files Browse the repository at this point in the history
First version of Broadcast Assistant sample
with hard coded selection of sink and source.

Signed-off-by: Lars Knudsen <[email protected]>
  • Loading branch information
larsgk committed Jan 30, 2024
1 parent 1e1d272 commit b955fb6
Show file tree
Hide file tree
Showing 6 changed files with 524 additions and 0 deletions.
11 changes: 11 additions & 0 deletions samples/bluetooth/broadcast_assistant/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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(broadcast_assistant)

target_sources(app PRIVATE
src/main.c
)

zephyr_library_include_directories(${ZEPHYR_BASE}/samples/bluetooth)
24 changes: 24 additions & 0 deletions samples/bluetooth/broadcast_assistant/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright (c) 2024 Demant A/S
# SPDX-License-Identifier: Apache-2.0

mainmenu "Bluetooth: Broadcast Assistant"

config SELECT_SOURCE_NAME
string "Selected Broadcast Source name"
default ""
help
Name of broadcast source device to select. This will be used as a
substring matched against both BT device name and broadcast name.
If empty, the first broadcast source found will be chosen.
Matching is not case sensitive.

config SELECT_SINK_NAME
string "Selected Broadcast Sink name"
default ""
help
Name of broadcast sink device to select. This will be used as a
substring matched against the BT device name.
If empty, the first broadcast sink found will be chosen.
Matching is not case sensitive.

source "Kconfig.zephyr"
51 changes: 51 additions & 0 deletions samples/bluetooth/broadcast_assistant/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
.. zephyr:code-sample:: bluetooth_broadcast_assistant
:name: Bluetooth: Broadcast Assistant
:relevant-api: bt_bap

Bluetooth: Broadcast Assistant

Overview
********

Application demonstrating the LE Audio broadcast assistant functionality.

The sample will automatically try to connect to a device in the BAP Scan Delegator
role (advertising support for the Broadcast Audio Scan Service (BASS)).
It will then search for a broadcast source and (if found) add the broadcast ID to
the BAP Scan Delegator.

This sample can be found under
:zephyr_file:`samples/bluetooth/broadcast_assistant` in the Zephyr tree.

Check the :ref:`bluetooth samples section <bluetooth-samples>` for general information.

Requirements
************

* BlueZ running on the host, or
* A board with Bluetooth Low Energy 5.2 support

Building and Running
********************

The application will act as a broadcast assistant with optionally preconfigured
filtering of broadcast sink and broadcast source names. By default, the application will
search for and connect to the first broadcast audio sink found (advertising PACS and
BASS UUIDs) and then search for and select the first broadcast audio source found
(advertising a broadcast ID).

Filter these by modifying the following configs:

``CONFIG_SELECT_SINK_NAME``: Substring of BT name of the sink.

and

``CONFIG_SELECT_SOURCE_NAME``: Substring of BT name or broadcast name of the source.

Building for an nrf52840dk
--------------------------

.. zephyr-app-commands::
:zephyr-app: samples/bluetooth/broadcast_assistant/
:board: nrf52840dk_nrf52840
:goals: build
13 changes: 13 additions & 0 deletions samples/bluetooth/broadcast_assistant/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CONFIG_BT=y
CONFIG_LOG=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_AUDIO=y
CONFIG_BT_SMP=y
CONFIG_BT_BUF_ACL_RX_SIZE=255
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=191

CONFIG_BT_TINYCRYPT_ECC=y

CONFIG_BT_EXT_ADV=y
CONFIG_BT_BAP_BROADCAST_ASSISTANT=y
11 changes: 11 additions & 0 deletions samples/bluetooth/broadcast_assistant/sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
sample:
description: Bluetooth Low Energy Broadcast Assistant sample
name: Bluetooth Low Energy Broadcast Assistant sample
tests:
sample.bluetooth.broadcast_assistant:
harness: bluetooth
platform_allow:
- nrf52840dk_nrf52840
integration_platforms:
- nrf52840dk_nrf52840
tags: bluetooth
Loading

0 comments on commit b955fb6

Please sign in to comment.