Commit graph

2414 commits

Author SHA1 Message Date
Alberto Escolar Piedras
14e870d8d3 tests/bluetooth/host/keys/bt_keys_get_addr: Correct mock prototypes
In 82d8f09de1
the bt_conn_foreach prototype was changed, but these unit tests
kept using the old prototype which leads to a build warning.
Let's fix the prototype in the tests.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-10-29 09:24:13 -07:00
Aleksander Wasaznik
abeca24702 Bluetooth: testlib: Add BT_TESTLIB_ADDR_LE_RANDOM_C0_00_00_00_00_
This is shorthand for random static addresses. It's similar to
`bt_addr_le_from_str`, but is a macro that results in an object literal,
making it more versatile and less verbose.

This macro only gives access to the first 255 random static addresses,
but this ought to be enough addresses for testing.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-10-26 17:13:45 +02:00
Reto Schneider
17d9e75e3b bluetooth: shell: Test BT_CTLR_DTM
This ensures that enabling BT_CTLR_DTM does not break the compilation of
the Bluetooth shell.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-10-26 03:55:41 +01:00
Emil Gydesen
1dd59ea203 Bluetooth: Audio: Remove BT_AUDIO_BROADCAST_CODE_SIZE
Removed the LE Audio specific definition and instead
refer to the value defined by iso.h as it is ISO/Core
that defines this size, and not BAP/Audio.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-10-25 22:43:40 +01:00
Fredrik Danebjer
f970b066d2 Bluetooth: audio: Add possibility to use static broadcast id
Removed the generation of broadcast id inside the stack. It is now up
to the application to generate this by itself. The CAP sample has
been modified to allow either a static broadcast, or a random one.
All of this is handled in the application.

Signed-off-by: Fredrik Danebjer <frdn@demant.com>
2024-10-25 14:07:25 +02:00
Olivier Lesage
7e72d46e2e bluetooth: host: Add helper function for parsing PCTs
The 12-bit signed values for the results of PBR are a bit
cumbersome, so this adds a helper function to make it easier to work
with the HCI formatted steps.

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2024-10-25 14:06:25 +02:00
Olivier Lesage
635d03b7e0 bluetooth: host: Unit tests for bt_le_cs_step_data_parse
Add unit tests for bt_le_cs_step_data_parse.
Also exit early (without calling the function pointer) if the next
step would seem to read out of bounds.

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2024-10-25 14:06:25 +02:00
Abderrahmane Jarmouni
94b000591d tests: testcase.yaml: replace deprecated OVERLAY_CONFIG w\ EXTRA_CONF_FILE
Replace some OVERLAY_CONFIG that were missed in a pervious PR.

Signed-off-by: Abderrahmane Jarmouni <git@jarmouni.me>
2024-10-24 14:06:54 +02:00
Emil Gydesen
fb6c4427b8 Bluetooth: Audio: Add helpers for broadcast name
Added helper functions to set and get broadcast name
for codec capabilities and codec configs.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-10-23 16:54:28 +02:00
Lucas Mathias Balling
cb0e3a7646 Bluetooth: Controller: Implement PAST support in ULL
Implement PAST support in ULL and fixed test after changed
dependencies in ull_sync_internal.c

Signed-off-by: Lucas Mathias Balling <lutb@demant.com>
2024-10-23 16:53:58 +02:00
Lucas Mathias Balling
c7ffce3eb2 tests: Bluetooth: LLCP unittests for Periodic Sync Procedure
Added LLCP PDU Periodic Sync Indication unittests

Signed-off-by: Lucas Mathias Balling <lutb@demant.com>
2024-10-23 16:53:58 +02:00
Emil Gydesen
2dc1113a94 Bluetooth: CAP: Add support for handling ASE errors
If we get an error/rejection from the CAP acceptor when
performing the Unicast Audio Start or Stop procedure then
we need to abort the procedure and let the application determine
what the next step is.

This change triggered a corner case when connecting to multiple
CAP acceptors as the CAP initiatior. This was also fixed as part
of this.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-10-23 16:53:44 +02:00
Babak Arisian
7f820d59c0 Bluetooth: Audio: Update SCAN_DELEGATOR dependency to GATT_DYNAMIC_DB
Changed dependency of the BT_BAP_SCAN_DELEGATOR to GATT_DYNAMIC_DB
from 'select' to 'depends on' and solved all loop dependencies
caused by this change.

Fixes #79108

Signed-off-by: Babak Arisian <bbaa@demant.com>
2024-10-23 16:53:37 +02:00
Emil Gydesen
da2e8c3c96 Bluetooth: Add and use missing own_addr_type defines
The own_addr_type used for various HCI commands sometimes
had a BT_HCI_OWN_ADDR_* type value or a BT_ADDR_* type
value. Those are 2 different value spaces, and if the public
address types would ever change, it would start have incorrect
behavior.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-10-23 16:53:23 +02:00
Emil Gydesen
afb7d961d2 tests: Bluetooth: tester: Add nRF5340 ADK as platform
Add support for building and running the BT tester on the
nrf5340_audio_dk.

This is copying the configuration used for the nRF5340 DK.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-10-22 20:39:30 +02:00
Szymon Janc
298c01cb97 Bluetooth: Tester: Set ISO MTU to 310
This makes sure we always fit all configurations. Worst case is two
audio streams in 48_6 configuration in single ISO channel (2x155).

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2024-10-22 14:05:31 +02:00
Szymon Janc
5453acb9b7 Bluetooth: Tester: Fix BTP response for BAP Send Data command
struct btp_bap_send_rp is already fixed size and contain extra
response byte.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2024-10-22 14:05:31 +02:00
Szymon Janc
3e5472d4c3 Bluetooth: Tester: Send test data when entering streaming state
For now this seems to be required by PTS as there is not Upper Tester
action for this in Test Specification.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2024-10-22 14:05:31 +02:00
Pavel Vasilyev
1fbcc0e6f9 tests: bluetooth: host: conn: Add bt_conn_le_create unit test
Add a test that checks behavior of
CONFIG_BT_CONN_CHECK_NULL_BEFORE_CREATE Kconfig option.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-10-18 17:46:04 +01:00
Johan Hedberg
a20f842728 Bluetooth: HCI: Use lower-case values for bus and quirks in devicetree
It's more common (and more readable) convention to use lower-case
names for string-based device tree property values. Convert the HCI bus
and quirks to follow this convention. Also take advantage of the
recently added support for string-array enums to enforce that the
correct values are used.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2024-10-17 15:36:49 -04:00
alperen sener
a5010504bc tests: bluetooth: tester: Add nrf54l15dk and remove nrf54l15pdk
Rename the config files according to nrf54l15dk.

Signed-off-by: alperen sener <alperen.sener@nordicsemi.no>
2024-10-16 16:35:32 +01:00
Szymon Janc
4a3807789d bluetooth: tester: Enable support for writable appearance
This was affecting GAP/GAT/BV-06-C qualification test.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2024-10-15 13:53:03 +02:00
Emil Gydesen
cd5a9f62bb tests: Bluetooth: CCID: Add unit testing of CCID
Add unit tests of the CCID functions.
To support these new tests, the GATT mocks need to
support dynamic GATT DB so we can add and remove
a service that contains CCIDs.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-10-15 04:10:28 -04:00
Erik Sandgren
5f59b35b42 Bluetooth: Host: Fix issue where uninitialized value was used
This change makes sure that when a call to `bt_id_set_scan_own_addr` is
sucessful, i.e., the return value is 0, the `own_addr_type` will
be set by the `bt_id_set_scan_own_addr`.

Not setting the `own_addr_type` in a successful call to
`bt_id_set_scan_own_addr` causes, for example,
the `start_le_scan_ext` method in `scan.c` to use an
uninitialized `own_addr_type`.

Eventually this results in an unexpected failure further down in
`start_le_scan_ext`, when sending HCI command to controller with
an uninitialized `own_addr_type`.

Signed-off-by: Erik Sandgren <erik.sandgren@nordicsemi.no>
2024-10-15 04:07:50 -04:00
Emil Gydesen
730b2f7c69 Bluetooth: Tester: Force initial conn param to 30ms
Modify the GAP connect to use 30ms. The default parameters
typically ended up with 50ms which is OK in most cases,
but for ISO related test cases, using an ACL interval that
is a multiple of the ISO SDU interval (7.5/10ms) generally
provides better stability. 30ms is the lowest multiple
of both 7.5 and 10ms, and was thus chosen.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-10-15 04:06:53 -04:00
Lars Knudsen
e0a262b33f Bluetooth: Audio: Fix initial Broadcast source values
If the Broadcast ID is initially set to 0x000000,
which is valid, comparison logic on add of an
actual Broadcast ID of 0x000000 fails.

Likewise for SID.

Moving INVALID_BROADCAST_ID define to bap.h

Signed-off-by: Lars Knudsen <LAKD@demant.com>
2024-10-14 13:04:31 +02:00
Ingar Kulbrandstad
b32eb0d2b2 Bluetooth: Mesh: Fix out of bounds write
Fix of the subnet bridging table function to only
compact the table if elements has been removed, and
fixing the compact function to compact the table if
several elemnts has been removed at the same time.

Fixes zephyrproject-rtos#78794

Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
2024-10-08 18:09:57 -04:00
Aleksander Wasaznik
8cfad44852 Bluetooth: Deprecate adv auto-resume
The host-based adv auto-resume function has both a problematic
implementation and disagreement in the community around how it should
behave. See the issue linked resolved below for details.

This patch makes the deprecation visible to the user. The user will be
better served by a auto-resume tailored their applications use case,
based on more primitive host API like `conn_cb.recycled`, which has
obvious behavior that is unlikely to change.

Resolves: https://github.com/zephyrproject-rtos/zephyr/issues/72567

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-10-08 16:57:01 +02:00
Johann Fischer
470cbe36d7 tests: bluetooth: disable CDC ACM logging
Disable CDC ACM logging in configuraton overlay used in test case
bluetooth.shell.cdc_acm.
The build warning was introduced by the commit e8c4867806
("usb: cdc_acm: disable logging if used for shell with logging")
to preven recursive logging when using the CDC ACM UART as shell or
logging backend

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2024-10-08 05:58:30 -04:00
Frode van der Meeren
29b78abd16 bluetooth: tester: audio: Add verification for bis stopping
Adds a semaphor to make sure the stream has properly been stopped by the
controller before returning from btp_bap_broadcast_source_stop.

Signed-off-by: Frode van der Meeren <frode.vandermeeren@nordicsemi.no>
2024-10-07 13:39:33 +02:00
Olivier Lesage
9e3943d13e bluetooth: host: Add CONFIG_BT_CHANNEL_SOUNDING_TEST
Makes it easier to make sure the CS test code is removed if desired.
It should hopefully allow for a clean split in general.

Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
2024-10-04 16:34:45 +01:00
Emil Gydesen
dc97bbd35f Bluetooth: Audio: Rename bt_audio_codec_qos -> bt_bap_qos_cfg
The QoS structure is not related to a codec, but rather a
stream, and should thus not use the "Codec" name.

The BAP and ASCS specs refer to the QoS as
"QoS configuration" several places, so it is an obvious
choice for a name.

Since the structure is defined and used by BAP, the prefix
was changed from bt_audio to bt_bap.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-10-04 16:34:22 +01:00
Emil Gydesen
a4d628efcb tests: Bluetooth: tester: Implement TBS registration
TBS registration was changed from static to dynamic
and the BT Tester application need to be updated to use
the dynamic registration.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-10-04 10:47:03 +01:00
Erik Brockhoff
670bd3bed2 Bluetooth: controller: fixing issue re. assert on overlapping conn upd proc
If a connection update (from central) overlaps a peripheral initiated
conneection param request, then central rejects peripheral request
and continues central procedure. This lead to an assert in peripheral
On instant there would not be an rx_node for notification, as this
would have been discarded by the reception of the REJECT.

This fix ensures that once an rx_node has been 'accepted' for retention
it will not be discarded/overwritten by future rx_nodes

The test will trigger the assert without the fix in.

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2024-10-04 10:46:06 +01:00
Yong Cong Sin
52a202309b zephyr: bulk update to DT_NODE_HAS_STATUS_OKAY
Change instances of:

DT_NODE_HAS_STATUS(<node_id>, okay)

to

DT_NODE_HAS_STATUS_OKAY(<node_id>)

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2024-10-03 17:06:52 +01:00
Håvard Reierstad
0fe6d34f8a Bluetooth: Mesh: Remove duplicate brg declaration
Removes duplicate declaration of the bridging direction, keeping the
one in the public header file.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2024-10-02 14:54:13 +01:00
Håvard Reierstad
8049c24994 Bluetooth: Mesh: Add prefix to Subnet Bridge API
Adds the `bt_mesh_brg_cfg` prefix to the public Subnet Bridge API, and
aligns the function and callback naming with the rest of the Bluetooth
Mesh API.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2024-10-02 14:54:13 +01:00
Andries Kruithof
a63665438a Bluetooth: Audio: improve broadcast reception stop unittest
Add more parameter checking for the unittests for the
CAP procedure 'broadcast reception stop'

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2024-10-02 09:59:23 +02:00
Andries Kruithof
8295deb966 Bluetooth: Audio: CAP implement broadcast reception stop
Implement the CAP broadcast reception stop procedures and
add unit tests

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2024-10-02 09:59:23 +02:00
Emil Gydesen
fa4f2ffc47 Bluetooth: CAP: Add support for doing just disable for unicast stop
The unicast_stop function is changed to primarily do a
BAP disable instead of a release, with optional
support for releasing the streams once they have been disabled.

This also adds unittests for the procedure which also
allow us to remove the invalid param testing from the BSIM tests.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-10-01 09:54:04 +02:00
alperen sener
9ae8ebfade Tests: Bluetooth: Tester: Increase the number of max mesh tx segments
Increasing the number of max tx segments to be able to fit composition
page 0 into composition data status message.

After the subnet bridge config client and server are added to the
tester, the size needed to report composition data page 0 increased.
Current behaviour of the tester is correct, dropping the element when
there is not enough space in data field, however the PTS application
does not handle the composition data status message without element.

Signed-off-by: alperen sener <alperen.sener@nordicsemi.no>
2024-09-30 17:12:34 +01:00
Babak Arisian
c0cfe49a54 Bluetooth: BASS: Add support for dynamic registration of BASS
Added support for dynamic registration and unregistration of the
Broadcast Audio Scan Service (BASS) within the scan delegator.
This enables both scan delegator and BASS to be registered or
unregistered dynamically at runtime.

Signed-off-by: Babak Arisian <bbaa@demant.com>
2024-09-26 17:42:39 -04:00
Rubin Gerritsen
417a9e81ec Bluetooth: Controller: Add device tree dependency to selection
This commit makes the device tree configuration decide
which link layer is compiled in. We do this to avoid
hard-to-understand linker errors referencing device tree nodes.

The following configuration creates a difficult to parse
linker error:
* BT_LL_CHOICE contains multiple entries, BT_LL_SW_SPLIT
  is selected.
* Each BT_LL_CHOICE has its own unique device tree node with its
  own "compatible".
* Only one of the link layer device tree nodes has status "okay",
  but not the one corresponding to BT_LL_SW_SPLIT.

The linker error indicates that code using the HCI driver fails
to link with the controller. This because the HCI driver device
tree node references the link layer selected in devicetree which
is not compiled in.

By adding a dependendency to the device tree node, this can no longer
happen. Instead, if BT_LL_SW_SPLIT is now selected in a configuration
file, a Kconfig warning will be issued:

```
warning: The choice symbol BT_LL_SW_SPLIT
(defined at subsys/bluetooth/controller/Kconfig:129) was
selected (set =y), but BT_LL_SOFTDEVICE (defined at
/home/ruge/ncs/nrf/subsys/bluetooth/controller/Kconfig:11)
ended up as the choice selection.
```

This should be easier to understand than:

```
...(hci_core.c.obj):(.data.bt_dev+0x16c):
undefined reference to `__device_dts_ord_132'
```

After this commit we should consider getting rid of link layer
selection from Kconfig completely as the link layer is in practice
selected through device tree.

Unit tests have been updated to satisfy the dts dependency.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-09-26 11:10:22 +01:00
Alberto Escolar Piedras
66a70a2ffd tests/bluetooth: Don't test on native_posix
native_posix is now deprecated.
Building these tests in both native_sim and native_posix does not
improve coverage for the tests or subsystem but doubles CI time.
As anyhow native_posix will be removed all together in
2 releases, let's remove it already for these.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-09-25 04:04:36 -04:00
Alberto Escolar Piedras
13a986d63a tests/bluetooth/shell: Don't test on native_posix
native_posix is now deprecated.
Building this sample in both native_sim and native_posix does not
improve coverage for the sample or subsystem but doubles CI time.
As anyhow native_posix will be removed all together in
2 releases, let's remove it already for this sample.

Also let's remove a few redundant test platform filters

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-09-25 04:04:36 -04:00
Emil Gydesen
7ef2f81413 Bluetooth: Audio: Add helpers for assisted listening stream
Added helper functions to set and get assisted listening
stream values for codec capabilities and codec configs.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-23 10:03:47 +02:00
Emil Gydesen
f57a040808 Bluetooth: BAP: Add bondable requirement for BAP
BAP mandates support for bondable mode for all central and
peripheral roles.

Due to Kconfig circular dependencies, some additional
Kconfig changes had to be made.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-19 18:27:53 +01:00
Emil Gydesen
ae58f474a1 Bluetooth: VCP: Vol ctlr rename flags to vol_flags
Rename the volume flag field from the generic "flags"
to "vol_flags" as the generic "flags" will be used for
other values in a future commit.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-09-17 14:52:37 -04:00
Ingar Kulbrandstad
d41e834bbe tests: bluetooth: mesh: Removed native_posix and renamed sim_ids
Removed deprecated native_posix as test platform.
Added unique sim_ids for tests with the psa as a overlay.
Fixed clang-format issues.

Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
2024-09-17 05:22:32 -04:00
Pavel Vasilyev
e0f5f3acf4 bluetooth: mesh: brg_cfg_srv: ignore message with invalid parameters
When a message with invalid parameters is received, we must ignore it.

In this commit we check invalid parameters first.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2024-09-17 05:22:32 -04:00