Commit graph

48 commits

Author SHA1 Message Date
Alberto Escolar Piedras b3447ec068 tests bsim: Add simple tests for broadcast audio source/sink samples
Add an initial test based on the broadcast audio source/sink samples
which runs them together and after waiting for a predefined
amount of time, checks how many audio packets has the
sink received, and if over a threshold, passes the test.

This test can be expanded after to cover more functionality from
these samples.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-06 15:17:15 +01:00
Alberto Escolar Piedras 11fddf4a41 Bluetooth samples: broadcast audio: Improve documentation
With examples of how to build for several boards.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-06 15:17:15 +01:00
Alberto Escolar Piedras c929ac5c23 Bluetooth samples: broadcast audio: Add support for more nrf targets
Add support for the simulated nrf5340 and nrf52 in these samples,
as well as explicit overlays for the nrf5340dk.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-06 15:17:15 +01:00
Alberto Escolar Piedras 1aa6f85252 Bluetooth samples: broadcast audio sink: Fix overlay for nrf52
Fix controller configuration overlay used when
building the controller (for nrf52 targets),
so the sample can connect to the source and get
audio through.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-06 15:17:15 +01:00
Alberto Escolar Piedras c9f09b1d66 Bluetooth samples: broadcast audio: Add more test Kconfig options
Instead of handling some of the configuation thru
board overlays let's handle it thru the sample Kconfig
file, which reduces the amount of duplicate lines.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-06 15:17:15 +01:00
Alberto Escolar Piedras c4628a795f Bluetooth samples: broadcast audio sink: Add sysbuild support
So that for both the simulated nrf5340 and real HW nrf5340dk
we build both network and application core images.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-06 15:17:15 +01:00
Alberto Escolar Piedras c914c512a0 samples/tests: Remove REQUIRES_FULL_LIBC=y due to LIBLC3
As now this is handled by the LIBLC3 kconfig

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-06 10:10:27 +01:00
Ping Wang f0728ce0aa samples: Bluetooth: Add LC3 to broadcast audio samples
The broadcast audio samples (broadcast_audio_sink
and broadcast_audio_source) are sending mock data,
the apps are improved by using the LC3 module as
the unicast audio samples do.

Signed-off-by: Ping Wang <pinw@demant.com>
2023-10-30 09:27:17 +01:00
Michele Imbriani - Oticon a8f2dc21b5 bluetooth: audio: added broadcast source filtering
Added filtering the broadcast sources by CONFIG_BT_DEVICE_NAME.

Signed-off-by: Michele Imbriani - Oticon <mbim@demant.com>
2023-10-20 15:02:28 +02:00
Emil Gydesen 82552b8627 samples: Bluetooth: Add rx stats for BAP Broadcast Sink
Add additional RX stats for the BAP broadcast sink so that a
user can easily follow how well the RX is working, and
for several streams.

This also adds some additional logging to better see
what we are syncing to.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-10-20 15:00:49 +02:00
Andries Kruithof 125e65a976 samples: Bluetooth: remove dup pointer in broadcast_audio_sink
In the broadcast_audio_sink sample there are two pointers defined,
both referencing the same address. We reduce this to one pointer

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2023-10-11 18:29:34 +03:00
Emil Gydesen 34c9587539 samples: Bluetooth: Add broadcast sink data validation
Add validation of incoming ISO data for the broadcast sink
sample.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-28 13:18:07 +02:00
Emil Gydesen 53502cb417 Bluetooth: Audio: Make codec_cap const
There is no reason why the capabilities
should be modified by the stack after registration,
nor any reason why a the unicast client application
needs to modify the reported remote capabilities, so
all have been marked as const.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-08-15 11:14:29 +00:00
Emil Gydesen aa990ae6dc Bluetooth: Audio: Refactor bt_audio_codec_cap to flat arrays
Refactor the bt_audio_codec_cap to use flat arrays to store
metadata and codec specific capabilities.

The purpose of this is to make it easier to copy the data
between layers, but also to support non-LTV data for non-LC3
codec capabilities.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-08-15 11:14:29 +00:00
Emil Gydesen 171273d967 samples: Bluetooth: Broadcast Sink: Update to use new sink API
The broadcast sink API has been modified so that all scanning, etc.
will be done by the application, rather than the stack. This commit
updates the sample to use this updated API.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-08-14 13:34:26 +00:00
Emil Gydesen 69f7fd9cb2 Bluetooth: Audio: Rename bt_codec to bt_audio_codec_{cap, conf, data}
Rename the bt_codec struct to bt_audio_codec_conf or
to the new struct bt_audio_codec_cap.
Rename the bt_codec_data to bt_audio_codec_data.

The purpose of this is to split the codec specific configuration
and codec capabilities into seperate structs, as they do not
reflect the same values, or used for the same purpose.

This commit depends on the preset macros workings on either
type of struct (for now), but will be modified in future updates.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-06-30 12:39:50 +02:00
Théo Battrel e9ee3e0af0 Bluetooth: Samples: Remove usage of BT_DEBUG_LOG
Remove usage of Kconfig symbol `CONFIG_BT_DEBUG_LOG` from samples. It
has been deprecated since this PR:
https://github.com/zephyrproject-rtos/zephyr/pull/56183

The Kconfig symbols has been replaced by `CONFIG_LOG=y` on most of the
cases. Or it has been removed when not needed anymore.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-06-07 13:56:55 -04:00
Torsten Rasmussen 1120934874 doc: samples: update OVERLAY_CONFIG to EXTRA_CONF_FILE
Update rst files to use EXTRA_CONF_FILE instead of OVERLAY_CONFIG.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2023-05-23 16:40:21 +02:00
Gerard Marull-Paretas 93b63df762 samples, tests: convert string-based twister lists to YAML lists
Twister now supports using YAML lists for all fields that were written
as space-separated lists. Used twister_to_list.py script. Some artifacts
on string length are due to how ruamel dumps content.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-10 09:52:37 +02:00
Alberto Escolar Piedras aee70b0ff6 samples/bluetooth/broadcast_audio_sink: Fix return to int
Main now has a int return type.
Fix return values, so this sample can be compiled.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-04-14 09:55:48 +02:00
Keith Packard 0b90fd5adf samples, tests, boards: Switch main return type from void to int
As both C and C++ standards require applications running under an OS to
return 'int', adapt that for Zephyr to align with those standard. This also
eliminates errors when building with clang when not using -ffreestanding,
and reduces the need for compiler flags to silence warnings for both clang
and gcc.

Most of these changes were automated using coccinelle with the following
script:

@@
@@
- void
+ int
main(...) {
	...
-	return;
+	return 0;
	...
}

Approximately 40 files had to be edited by hand as coccinelle was unable to
fix them.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-04-14 07:49:41 +09:00
Andries Kruithof 6892d3c0bc Sample: Bluetooth: fix broadcast audio source sink conf file
The platform nrf52_bsim was specified as an integration platform,
but was missing from the allow list.
This commit adds this platform to the allow list.

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2023-04-13 16:08:53 +02:00
Vinayak Kariappa Chettimada 5648d02b29 sample: Bluetooth: Fix broadcast audio source sink conf file
Fix broadcast audio source and sink samples' conf file to
use Broadcast ISO feature in Zephyr Bluetooth Controller.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-04-13 13:19:19 +02:00
Emil Gydesen e00500af49 samples: Bluetooth: Add Scan Delegator support to Broadcast Audio Sink
Add support for the Scan Delegator for the Broadcast
Audio Sink sample. This include advertising connectable
as well as handling PAST.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-04-11 11:26:28 +02:00
Emil Gydesen 6bbda2cbfd Bluetooth: Audio: Add Scan Delegator dependency for Broadcast Sink
Per the BAP specification, if the Broadcast Sink role is
supported, then the Scan Delegator shall also be supported.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-04-11 11:26:28 +02:00
Emil Gydesen 4224b45838 Bluetooth: Audio: Rename bt_audio_unicast_group to bt_bap_...
Rename the bt_audio_unicast_group API to bt_bap_unicast_group
and move the API to bap.h

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-07 16:21:44 +01:00
Emil Gydesen 77853f43f2 Bluetooth: Audio: Rename bt_audio_stream to bt_bap_stream
Rename the bt_audio_stream API to bt_bap_stream
and move the API to bap.h

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-07 16:21:44 +01:00
Emil Gydesen 06d00ff5f9 Bluetooth: Audio: Rename bt_audio_broadcast_sink to bt_bap_...
Rename the bt_audio_broadcast_sink API to bt_bap_broadcast_sink
and move the API to bap.h

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-07 16:21:44 +01:00
Emil Gydesen 59a9f8a3b0 Bluetooth: Audio: Add reason to BAP stream stopped callback
Forwards the reason parameter from the ISO disconnect to
the stream stopped callback.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-07 09:44:20 +01:00
Ladislav Podivin 5a488c3891 Samples: Bluetooth: Fix scanning restart for broadcast audio sink
If waiting on the first semaphore in the main loop times out, the main
loop starts from the beginning and attempts to start scanning for
broadcast sources. But since the first semaphore was not passed, the
scan_recv_cb callback was not called yet and thus the previously started
scanning was not stopped. As a result, an attempt to start the scanning
will fail with -EALREADY and the main thread will end. To solve this,
-EALREADY is now ignored when checking the return value of
bt_audio_broadcast_sink_scan_start.

Signed-off-by: Ladislav Podivin <ladislav.podivin@tietoevry.com>
2023-03-02 10:00:56 +01:00
Anas Nashif ba7d730e9b tests/samples: use integration_plaforms in more tests/samples
integration_platforms help us control what get built/executed in CI and
for each PR submitted. They do not filter out platforms, instead they
just minimize the amount of builds/testing for a particular
tests/sample.
Tests still run on all supported platforms when not in integration mode.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-11-29 16:03:23 +01:00
Emil Gydesen d8e7a0db42 samples: Bluetooth: Increase subgroup count for broadcast audio sink
Imcrease the supported number of subgroups to 2 as well as the number of
streams to 2, so that it matches the default configuration of the
broadcast audio source sample.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-11-28 14:38:25 +01:00
Mariusz Skamra 2627063ab2 Bluetooth: audio: pacs: Replace capabilities API with pacs
This changes the API to use proper naming convention, as the code has
been moved out of capabilities.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-10-26 08:49:00 +02:00
Mariusz Skamra 28ce0a96b1 Bluetooth: audio: capabilities: Remove redundant direction parameter
The direction is used to identify the list to append the registered
capabilities. There is no need to keep it in the bt_audio_capabilities,
it can be provided as a function parameter instead.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-10-06 22:41:27 +00:00
Vinayak Kariappa Chettimada 0c88407a28 samples: Bluetooth: Increase adv data Len for broadcast audio source
Increase the Controller supported Advertising Data Length
Maximum so that Advertising Data set by Broadcast Audio
Source sample is accepted by the controller.

Also, tune down the supported ISO Tx PDU size to suffice the
Broadcast Audio Source usecase.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-09-06 17:44:38 +02:00
Emil Gydesen c699ae5850 Bluetooth: Audio: Expose broadcast sink adv data to application
In the broadcast sink `scan_recv` which is called when we
scan for broadcast source, we now also provide the entire
AD struct to the application.

The reason for this is that the advertising data may
contain other information that is useful for the application
like the broadcaster device name or any other
vendor/application specific data.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-12 14:17:02 +02:00
Emil Gydesen f46842a788 Samples: Bluetooth: Fix missing codec reference for broadcast audio sink
The broadcast audio sink sample had a bad codec reference after
multiple commits were merged.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-05 06:15:59 -04:00
Erik Robstad 06586e960d samples: Bluetooth: broadcast_audio_sink sample bugfix
Fixed handling of k_sem_take() return codes.
Also some minor cleanup in broadcast_audio samples.

Signed-off-by: Erik Robstad <erik.robstad@nordicsemi.no>
2022-07-04 16:22:28 +02:00
Emil Gydesen 4c471914b9 Bluetooth: Audio: Remove codec from bt_audio_broadcast_sink_sync
The codec (or rather codec configuration) is now taken from the
previously received BASE. This also means that the BASE (with
the codec configurations) is now also stored statically.

When the application attempts to synk to the broadcaster
the stack will lookup the codec configuration based on the
bis index, as a BASE may have multiple subgroups
with multiple codec configurations.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-04 16:08:52 +02:00
Emil Gydesen bb6c0866d8 Bluetooth: Audio: Add PACS for broadcast sink
Add support for using PACS and/or capabilities for
the broadcast sink role. PACS and capabilities were
originally only supported for the unicast server
role, so the PACS callbacks were moved their own
struct, as if a device supports both the unicast
server role and the broadcast sink role, it will
only have a single PACS instance.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-07-04 15:59:09 +02:00
Emil Gydesen c5fc32756a Bluetooth: Audio: Remove hardcoded location and context for LC3 macros
The BT_CODEC_LC3_CONFIG_* macros had a hardcoded location
and context, which makes them a lot less usable.

Updates the macro, and the macros that used them.
This also removes the BT_CODEC_LC3_CONFIG and instead
just uses the BT_CODEC_LC3_CONFIG_N macro, which has
then been renamed to BT_CODEC_LC3_CONFIG.

As an addition, the macros and their input has
also been better documented.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-06-29 10:24:49 +02:00
Emil Gydesen 78962268c2 samples: Bluetooth: Broadcast audio scan and adv data size increase
Increases the scan and adv data sizes to better support
the extended advertising data and periodic advertising
data (BASE).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-05-19 13:21:19 +02:00
Emil Gydesen a263308cf2 samples: Bluetooth: Audio sample board files cleanup
Clean up some of the board specific configuration files.
Removed all CONFIG_BT_CTLR* configs from the nRF5340
appcore conf files as that does not compile the controller.

Ensured that the ISO buffer in the controller for
nRF52840 can contain SDUs from all BAP LC3 minimum
requirements, as the controller does not yet
support segmentation of SDUs.

Also fixed a few bad configurations (broadcast sink not
enabling the sync support etc.).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-05-19 13:21:19 +02:00
Vinayak Kariappa Chettimada f755550ec0 samples: Bluetooth: Remove explicit Ext and Periodic Adv Kconfig enable
Remove the explicit enable of Extended and Periodic
Advertising support in Controller, the feature is no
longer experimental in the Controller and is now enabled
by default when application uses them by enabling as
Host feature.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-05-16 18:25:14 +02:00
Emil Gydesen 83c7baf34a Bluetooth: Audio: Add recv_info to audio recv callback
The audio stream receive callback now contains a
recv_info struct, which contain crucial information
such as timestamps and packet validity.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-05-10 18:56:28 +02:00
Emil Gydesen d72126d2d9 samples: Bluetooth: Update broadcast audio samples to new API
The broadcast audio source API changed the array type
when creating a source or sink.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-05-09 09:28:14 +02:00
Gerard Marull-Paretas c7b5b3c419 samples: migrate includes to contain <zephyr/...> prefix
In order to bring consistency in-tree, migrate all samples to the use
the new prefix <zephyr/...>. Note that the conversion has been scripted:

```python
from pathlib import Path
import re

EXTENSIONS = ("c", "h", "cpp", "rst")

for p in Path(".").glob("samples/**/*"):
    if not p.is_file() or p.suffix and p.suffix[1:] not in EXTENSIONS:
        continue

    content = ""
    with open(p) as f:
        for line in f:
            m = re.match(r"^(.*)#include <(.*)>(.*)$", line)
            if (m and
                not m.group(2).startswith("zephyr/") and
                (Path(".") / "include" / "zephyr" / m.group(2)).exists()):
                content += (
                    m.group(1) +
                    "#include <zephyr/" + m.group(2) +">" +
                    m.group(3) + "\n"
                )
            else:
                content += line

    with open(p, "w") as f:
        f.write(content)
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 11:29:59 +02:00
Emil Gydesen 9dd7efa4f1 samples: Bluetooth: Add broadcast audio sink sample
Add sample for the Basic Audio Profile (BAP) broadcast
audio sink role, that can scan for a receive audio
data over ISO from BAP broadcast sources.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-04-02 15:39:48 +02:00