Commit graph

517 commits

Author SHA1 Message Date
Mariusz Skamra 0b8b67e346 tests: bsim: has: Clean up the #ifdef
Use if(IS_ENABLED(...)) {...} instead.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-12-14 19:07:28 +00:00
Anders Storrø 25d44a828d Bluetooth: Mesh: Rename prov_dev->provisionee
Renames "prov device" references and options to
"provisionee" to align implementation with Mesh
Protocol specification v1.1, section 5.4.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-12-13 13:57:46 +01:00
Jonathan Rico 2dab5dd0a0 tests: Bluetooth: add babblesim connection stress test
This is supposed to stress the host buffer and metadata handling.

It is not really testing any particular thing, ie. the pass criteria is
just that each peripheral can send and receive a fixed number of GATT
notifications without any device crashing or locking up.

Original version by Ahmed Moheib (from cloud2ground).

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-12-12 21:43:45 +02:00
Mariusz Skamra 3b4ce7f8e9 tests: bsim: gatt: ccc_store: Reproduce the subscription lost issue
Zephyr by default renews the characteristic value subscription on every
reconnection. If the ACL is disconnected in the middle of this
procedure, all the subscriptions waiting to be renewed are removed, even
if the device was successfully subscribed already.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-12-12 15:32:45 +01:00
Mariusz Skamra 90770afa23 tests: bsim: gatt: ccc_store: Replace bt_gatt_write with bt_gatt_subscribe
This changes the way the GATT Client subscribes to the characteristic
value changes. The bt_gatt_write usage was replaced by dedicated
bt_gatt_subscribe API function call, so that the test verifies the GATT
Client API side as well.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-12-12 15:32:45 +01:00
Emil Gydesen cdd4bc6a48 Bluetooth: GMAP: Add GMAP BSIM test
Add BSIM testing of GMAP, with all spec-specified audio
configuration combinations added and tested.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-12-11 18:30:57 +01:00
Mariusz Skamra a42fb9d586 tests: bsim: gatt: Fix missing connection reference release
This fixes missing connection reference release.
The bt_conn_le_create returns the connection object reference that needs
to be released by API caller.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-12-11 09:54:13 +01:00
Lingao Meng 683098728a Bluetooth: Mesh: Use memslab replace with net_buf_pool
Use memslab more efficiency than net_buf_pool and consume
less ram with flash resource.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2023-12-08 20:19:10 +00:00
Lingao Meng 786b9a0ad4 Bluetooth: Host: Add const prefix for UUID
Add const prefix for service uuid and char uuid.

Since Service UUID and Char UUID should not change in the service
definition, they are most reasonably defined as rodata, also for
save some ram footprint.

The field `attr->user_data` type is `void *`, as this PR change
all Service UUID to rodata, so there must add (void *) to avoid warning.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2023-12-07 16:16:43 +00:00
Emil Gydesen 3fec3964e0 Bluetooth: CAP: Move initiator/commander common code to cap_common
The CAP Initiator and the CAP Commendar share quite a lot of
functionality in terms of discovery and performing set-based
procedures.

The code for handling most of this has been moved to
cap_common.c to avoid duplicating code.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-12-07 16:14:42 +00:00
Mariusz Skamra 6e856f1038 tests: bsim: pacs: Test bt_pacs_{set, get}_available_contexts_for_conn
This extends existing PACS BSIM tests with the new API function calls.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-12-06 17:54:14 +00:00
Mariusz Skamra 1b0e0fbd14 tests: bsim: pacs: Change printk to LOG
Replace combination of printk() to LOG_DBG() to fix the order of the
test execution logs. The printk() is printed immediately, while logs are
buffered, thus the messages from test are printed out before the stack
logs.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-12-06 17:54:14 +00:00
Jonathan Rico b68987fe9e tests: Bluetooth: add pipelined ATT write test
This verifies the zephyr host can tolerate a spec violating peer sending
ATT requests without waiting for responses.

It also tests the opposite, that is that the Zephyr host does not
pipeline requests over the air.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Co-authored-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-12-06 17:53:54 +00:00
Emil Gydesen c9daed9712 Bluetooth: BAP: Refactor bt_bap_base
This removes the fixed size bt_bap_base, which provides
2 improvements:
1) The RAM usage of the broadcast sink has been reduced.
   For the Broadcast Sink sample it is a reduction of 120
   octets, but with much better scaling for supporting
   more or larger BASEs.
2) The functions to parse BASEs now support arbitrary sized
   BASEs, where they were previously restricted by our
   local Kconfig options. This allow us to parse any BASE
   from a remote device, without encounting memory issues.
   We are still memory restricted on the devices we
   actually want to sync to.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-12-06 17:51:47 +00:00
Jonathan Rico 20057b6564 tests: Bluetooth: add missing param to testlib
The lib was refactored, but CI didn't run the tests that used it for
some reason.
A parameter was forgotten.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-12-05 15:09:18 +01:00
Håvard Reierstad c1bbd48659 bsim: Bluetooth: Mesh: fix provision timeout
Adapts the `pb_remote_timeout` test to the updated `bt_mesh_suspend`
API.
Suspension is scheduled with a small delay to allow publications to be
sent before suspending Mesh.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2023-12-04 14:38:13 +01:00
Håvard Reierstad 1025906331 bsim: Bluetooth: Mesh: Add suspension test
Adds two test-cases; one for suspending and resuming Mesh,
and one for suspending Mesh and disabling Bluetooth before
re-enabling Bluetooth and resuming Mesh.

Both tests checks that periodic publication is stopped during
suspension.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2023-12-04 14:38:13 +01:00
Alberto Escolar Piedras 41f4826f27 tests/bsim/bluetooth: Reduce sysbuild boilerplate
Reduce the sysbuild boilerplate required for
the nrf5340bsim targets.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-12-02 07:53:11 -05:00
Mia Koen 0bcad09392 bluetooth: mesh: Doc fix Bluetooth mesh to Mesh
SIG has changed Bluetooth mesh to Bluetooth Mesh
Updating zephyr docs accordingly
Leaving out old release notes

Signed-off-by: Mia Koen <mia.koen@nordicsemi.no>
2023-12-01 10:56:18 +00:00
Aleksander Wasaznik 535e003a00 Bluetooth: Use CONFIG_BT_CONN_TX_USER_DATA_SIZE
Replace hardcoded value `8` with `CONFIG_BT_CONN_TX_USER_DATA_SIZE`,
that is `8` but is going to change.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-11-30 10:06:19 +01:00
Jonathan Rico 3fe9aaa0f1 tests: Bluetooth: add ATT clopen test
Open. Close. Do it a bunch of times. Cry a lot.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-11-30 10:06:19 +01:00
Alberto Escolar Piedras 15b2f7166a tests/bsim/compile: Add option to pass extra cmake arguments
Add an extra optional input to the script which can be used
to pass more options to cmake.
Background: With sysbuild needing to pass extra options is quite
normal. Users would normally want to add options, without necessarily
wanting to change the default cmake_args, so this new options
provides that.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-28 16:45:00 -05:00
Vinayak Kariappa Chettimada 411731f778 tests: bsim: Bluetooth: Enable nrf5340bsim CIS ACL group test
Enable testing CIS ACL group test on nrf5340bsim.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-11-27 19:59:13 +01:00
Aleksander Wasaznik 589f3ad904 Bluetooth: testlib: Create testlib/conn.h
This header file declares the functions that rely on `bluetooth/conn.h`.

This collects `testlib/connect.h`, `conn_ref.h` and `conn_wait.h` into one.

Initial documentation for the functions in this file is also added.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-11-22 14:55:43 +00:00
Pavel Vasilyev 3bc17d1d18 Bluetooth: Mesh: Fix async behavior of Private Beacon Client API
The Private Beacon Client API requires a response argument to allow to
call the API in the asynchronous manner
(https://github.com/zephyrproject-rtos/zephyr/pull/56426).

Because the removal of the EXPERIMENTAL tag for this API was not
released yet, it should be OK to change this API.
The EXPERIMENTAL tag has been removed here:
https://github.com/zephyrproject-rtos/zephyr/pull/64866

Coverity-CID: 330039
Coverity-CID: 330029
Coverity-CID: 329977

Fixes #65336
Fixes #65338
Fixes #65354

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-11-20 09:23:56 +01:00
Lingao Meng 5f1c2f199b Bluetooth: Mesh: Make element as rodata
the reason is that the Mesh Profile clearly stipulates that Mesh nodes
cannot change their own element definitions.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2023-11-20 09:22:55 +01:00
Lingao Meng 2cd8d40b97 Bluetooth: Mesh: Split Model Structure
Split Model Variables to separate structue.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2023-11-16 16:52:14 +01:00
Lingao Meng ab08f34fd9 Bluetooth: Mesh: Make bt_mesh_model as rodata
Since model struct most of member should not change at run time,
so mark as const will be suitable and safely.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2023-11-16 16:52:14 +01:00
Lingao Meng e1d4451976 bsim: bluetooth: mesh: Increase Net Transmit Count value on the node
This is to increase probability of reception of responses (Config Status
messages) from the node when the provisioner sends a Set message and the
node response with a Status message at the same time so that the message
collide.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2023-11-15 10:01:47 +01:00
Vinayak Kariappa Chettimada 09c69731cd Bluetooth: Controller: Reduce RTN for requested Max Transport Latency
Add implementation to reduce CIG's CIS retransmissions so as
to meet the Host requested Maximum Transport Latency.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-11-14 09:46:02 +01:00
Kamil Piszczek ae05c5ea30 tests: bsim: bluetooth: host: privacy: peripheral: test rpa sharing mode
Added a new configuration to the BabbleSim Bluetooth Peripheral Privacy
test to cover the code path for the RPA sharing mode.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2023-11-14 09:22:51 +01:00
Kamil Piszczek f6d6742ca1 bluetooth: id: make sharing RPA between adv sets optional
Added a Kconfig option that makes the RPA sharing feature optional. By
default, the Zephyr Bluetooth stack now uses the RPA rotation policy
that was active before the introduction of the RPA sharing functionality
in the following PR:

https://github.com/zephyrproject-rtos/zephyr/pull/55449

The new Kconfig option configures the advertising sets linked with the
same Bluetooth identity to use the same Resolvable Private Address in
a given rotation period. After the RPA timeout, the new RPA is
generated and shared between the advertising sets in the subsequent
rotation period.

When this option is disabled, the generated RPAs of the advertising
sets differ from each other in a given rotation period.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2023-11-14 09:22:51 +01:00
Emil Gydesen 89612932b0 tests: Bluetooth: Enable passing CAP AC 441 tests
Enable some previously disabled CAP AC tests for 44.1 KHz,
as they are now passing.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-11-13 09:46:57 +01:00
Mariusz Skamra f80b237e30 tests: Bluetooth: Add tests for ATT automatic security elevation
This adds tests for automatic security elevation and retry on security
errors. This includes two tests:
1. where the security is elevated by the central
2. the security is elevated by security request, so pairing is already
   in progress.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-11-13 09:45:20 +01:00
Emil Gydesen 9f3858aad9 tests: bsim: Bluetooth: Remove broadcast_source_get_base_inval
Removed the tests for invalid bt_bap_broadcast_source_get_base
parameters and state, as those tests now implemented as unit tests.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-11-13 09:41:56 +01:00
Emil Gydesen 175a2f3287 tests: bsim: Bluetooth: Remove broadcast_source_get_id_inval
Removed the tests for invalid bt_bap_broadcast_source_get_id
parameters and state, as those tests now implemented as unit tests.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-11-13 09:41:56 +01:00
Aleksandr Khromykh c5ee143d77 Bluetooth: Mesh: no more tinycrypt in ble mesh tfm image
PR allows to get rid of tinycrypt objects from
the final binary of the ble mesh apps based on
PSA TFM crypto.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2023-11-08 15:09:50 +00:00
Kamil Piszczek b182c92af5 tests: bsim: bluetooth: host: privacy: peripheral: add RPA check
Modified the BabbleSim test for the Bluetooth test under the
host/privacy/peripheral category. Added the RPA check in the scan
callback context of the scanning tester device to validate if the
DUT advertising address is correct.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2023-11-08 15:09:22 +00:00
Kamil Piszczek 069bd8376c tests: bsim: bluetooth: host: privacy: peripheral: test after reboot
Extended the scope of the BabbleSim test for the Bluetooth test under
the host/privacy/peripheral category. The tests ensures correct RPA
advertising after the system a reboot when the Bluetooth identities
are preloaded from the Settings subsystem.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2023-11-08 15:09:22 +00:00
Aleksander Wasaznik bfff0f9f4c Bluetooth: Host: Tests: Move testlib to common
This is the first patch with the goal of establishing a common library
for Bluetooth utilities that are commonly used for setup in Bluetooth
Host tests. The ultimate goal is to remove redundant (near) copies of
these utilities and other more ad-hoc solutions.

This patch moves one instance of testlib (from
tests/bsim/bluetooth/host/att/long_read) to
tests/bluetooth/common/testlib and makes it a proper CMake library.

The long_read test is updated to link to the new CMake library.

Further changes and de-duplication will come in later patches.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-11-07 10:09:33 +01:00
Emil Gydesen 9e58ad31e9 tests: Bluetooth: BAP Broadcast sink RX fail fix
Added an additional check before failing a BSIM test
on ISO error, so that when we stop the broadcast source
(after the sink have received the expected data), lost data
does not trigger a test failure.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-11-07 09:55:14 +01:00
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 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
Emil Gydesen 9a73cbadc0 tests: Bluetooth: Update BAP broadcast tests to use sync
Update the BAP broadcast tests to use the BSIM sync API
instead of sleeps, to ensure that everything is sent
and receive correctly, regardless of timing.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-11-06 10:03:45 +01:00
Emil Gydesen b2174662d6 tests: Bluetooth: Audio: Add BSIM sync API
Add mechanism and API to sync devices via the babblesim
backchannels.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-11-06 10:03:45 +01:00
Alberto Escolar Piedras a0ed29409b tests bsim: Add tests for unicast client/server samples
Add a test based on the unicase client/server samples
which runs them together and after waiting for a predefined
amount of time, checks how many audio packets has the
client received, and if over a threshold, passes the test.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-11-03 08:35:38 +01:00
Carles Cufi 9cf07bbdb5 bluetooth: Rename rpmsg HCI driver and sample to ipc
The existing driver and sample:

- drivers/bluetooth/hci/rpmsg
- samples/bluetooth/hci_rpmsg

are no longer correctly named, since they now use the IPC subsystem to
send and receive data. The IPC subsystem can use RPMsg as a transport,
but that is one of several selectable backends.

I initially wanted to deprecated both the BT_RPMSG Kconfig option as
well as the zephyr,bt-hci-rpmsg-ipc chosen node in Devicetree. However,
this proved to be undoable in the case of the Kconfig option. This is
because it's a choice option, and those have special behavior. In
particular, the only practical way to deprecate would've been to keep
the old Kconfig option outside the choice (much like it's done in this
commit) but then also add a 'depends on !BT_RPMSG' on each of the
remaining choice symbols *except* on the new BT_HCI_IPC one. This, however,
only works correctly for .conf files. If a board instead sets the
default BT_HCI_BUS_TYPE in the Kconfig.defconfig file then the Kconfig
tree parsing would fail, because it'd try to set it to a value
(BT_RPMSG) that is no longer part of the choice.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-11-02 08:32:20 +02:00
Alberto Escolar Piedras 482416db01 tests/bsim bis: Reduce the test verbosity
The test was printing one line for each packet it was sending
by default. That creates a huge log and slows things down.
Instead, let's only print those with verbosity set at 4 or higher.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-31 09:31:42 -05:00
Alberto Escolar Piedras 464435e22b CI bsim workflow: Also run some split BT stack tests
Also run some split BT stack tests on the nrf5340 platform
to test this configuration.

Move the selection of which BT tests are built and run
in each platform to files in the tests/bsim/ folder.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-31 09:31:42 -05:00
Alberto Escolar Piedras 21f755d651 tests/bsim run_parallel: Allow TESTS_FILE with search paths
With TESTS_FILE the user could provide a file with a list of
tests to run.
Now we also support that file containing a mix of
tests and paths in which to search for tests.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-31 09:31:42 -05:00
Alberto Escolar Piedras 10d7b1908e tests/bsim run_parallel: Ignore any script with compile in its name
Note just those called exactly compile.sh

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-31 09:31:42 -05:00
Alberto Escolar Piedras c6f2cca515 tests/bsim/bt bis: Add support for split build with sysbuild
Add sysbuild build files, which allows building this test
both for the targets we could already before
(nrf52_bsim & nrf5340bsim_nrf5340_cpunet)
and also adds support for the a split build with the
nrf5340bsim_nrf5340_cpuapp.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-31 09:31:42 -05:00
Alberto Escolar Piedras a84349280b tests/bsim/bt conn: Add support for split build with sysbuild
Add sysbuild build files, which allows building this test
both for the targets we could already before
(nrf52_bsim & nrf5340bsim_nrf5340_cpunet)
and also adds support for the a split build with the
nrf5340bsim_nrf5340_cpuapp.

Note that when doing a split build the controller is
taken from the hci_rpmsg BT sample, and therefore the
controller configuration in this folder is not used.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-31 09:31:42 -05:00
Alberto Escolar Piedras c5d6ef1487 tests/bsim compile: Add support for sysbuild
Add support for sysbuild builds, which can be selected
by settings the variable sysbuild.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-31 09:31:42 -05:00
Alberto Escolar Piedras e934e49aa9 tests bsim cis: Fix sim_id collision
This test was reusing the sim_id from an l2cap test,
which was colliding with the corresponding l2cap test
when they were run in parallel.
Fix it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-30 11:35:45 +01:00
Alberto Escolar Piedras b12785f86d tests/bsim/bt bis: Do not call into controller in split builds
Use the HCI layer to update the channel map instead of calling directly
into the controller.

Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/64441

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-30 09:26:06 +01:00
Keith Packard 565c9376f1 tests: Switch from NEWLIB_LIBC to REQUIRES_FULL_LIBC
Instead of forcing use of NEWLIB_LIBC, select any available complete C
library implementation. Add CONFIG_REQUIRES_FLOAT_PRINTF where needed.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-10-25 08:32:06 +02:00
Andries Kruithof 8b3b8cf2ad Bluetooth: ISO: extend API for setting SDU interval
The BT Core Spec v5.4 allows separate SDU_Interval to
be set on C_To_P and P_To_C directions,
but this is not possible with the existing interface.

This PR splits the interval parameter in the call to
bt_iso_sig_create into one for C_To_P
and one for P_To_C

It also splits the latency parameter into one for
C_To_P and one for P_To_C

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>

Bluetooth: ISO: update UI for extended API

The API for setting the SDU interval and latency have been updated.
This PR also updates the setting of these by the user in the shell
and the iso_connected_benchmark sample

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2023-10-23 15:22:10 +02:00
Aleksander Wasaznik 9f42c92e26 Bluetooth: Host: Fix GATT Long Read for EATT
When EATT is established, the value returned from `bt_att_get_mtu` is
not useful to determine the ATT_MTU that applies to a ATT response. This
is because `bt_att_get_mtu` may return the value for a different bearer
than the request is serviced on.

To fix this, the params struct for the GATT read operation is given a
new field that will record the ATT_MTU that applies to this ATT
operation. This value is then used to determine if the GATT long read
operation is concluded.

Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/61741

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-10-23 11:01:21 +02:00
Alberto Escolar Piedras 18d6919092 tests bsim: Disable bap_broadcast_audio_assistant
The test is currently broken in main and blocking
all other development when triggered.
Let's disable it by now as a provisional measure.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-20 15:20:32 -05:00
Anders Storrø fe9ffdaded tests: Bluetooth: Mesh: Op_agg coex loopback test
Adds coexistence Bsim test for Opcode Aggregator models using loopback.
The test verifies that the Opcode Aggregator server and client can send
messages to each other on the loopback interface.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-10-20 15:16:33 +02:00
Anders Storrø fc152c8e43 tests: Bluetooth: Mesh: Add op_agg coex test
Adds coexistence Bsim test for Opcode Aggregator models.
The test verifies that the Opcode Aggregator server and client can be
present and functional when operating on the same device.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-10-20 15:16:33 +02:00
Emil Gydesen 0e67c990cd tests: Bluetooth: BAP: Add broadcast sink with assistant test
Add a test for the broadcast sink that uses the BAP
Scan Delegator functionality with a Broadcast Assistant
device adding the broadcast source.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-10-20 15:10:37 +02:00
Jonathan Rico 098b5bd05b tests: bsim: send SIGKILL if app doesn't respond to SIGTERM
I have seen the CI hang (both downstream and upstream) as the executable
doesn't always respond to the SIGTERM sent by `timeout`.

This will prevent that behavior. 5 whole seconds ought to be enough to
clean-up a small program.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-10-20 15:07:58 +02:00
Anders Storrø cc87833116 tests: Bluetooth: Mesh: Add priv beacon cache test
Adds Bsim test that verifies private beacon cache functionality.
The test checks that replays of the same private beacon
message is discarded.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-10-20 15:07:51 +02:00
Anders Storrø eb480a7599 tests: Bluetooth: Mesh: Add SNB cache test
Adds Bsim test that verifies SNB cache functionality.
The test checks that replays of the same SNB
message is discarded.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-10-20 15:07:51 +02:00
Anders Storrø f9ee38060d tests: Bluetooth: Mesh: Arg bug in beacon creation
Fixes bug in private_beacon_create function in beacon test
implementation.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-10-20 15:07:51 +02:00
Jonathan Rico 028cf8037b tests: Bluetooth: add sleep in notify cb testcase
Validates that nothing nefarious happens if the application decides to
wait an arbitrary amount of time in notification callbacks.

Also validates that a disconnection during said waiting works as
expected.

E.g. in #48505, the user was trying to send data synchronously over UART
_inside_ the notification callback. Then the device was disconnected
whilst still waiting.

This kind of pattern is not recommended, but the stack should still
function correctly, stalling the "BT RX" thread shouldn't result in
state corruption or resource leakage.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-10-20 15:05:45 +02:00
Emil Gydesen 779f725db3 Bluetooth: CAP: Add verification of CCIDs as the initiator
When the initiator provides CCID in the metadata, we verify
that the CCIDs exist on the device.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-10-20 15:05:33 +02:00
Anders Storrø 49bd77ad54 tests: Bluetooth: Mesh: Priv Proxy GATT test
Adds test verifying that Private Beacons are received
over a GATT proxy connection.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-10-20 15:04:54 +02:00
Emil Gydesen a2ab57c240 Bluetooth: Audio: Update bsim and shell to use codec set chan alloc
Update the BSIM test and the shell to use
bt_audio_codec_cfg_set_chan_allocation rather than implementing
their own versions.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-10-20 15:00:27 +02:00
Emil Gydesen f67f840def tests: Bluetooth: Add tx/rx and data verification for BAP unicast
The BAP unicast babblesim tests now does RX and TX
and verifies that the data is correctly received on both
the client and server.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-10-20 14:56:28 +02:00
Emil Gydesen ab60f5e6bc tests: bsim: Bluetooth: BAP Broadcast data validation
Add validation of sending and receiving dummy data.
Previously, due to a bug, we actually never sent any data
and still passed the test.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-10-20 14:56:28 +02:00
Pavel Vasilyev 7c7ea38471 bsim: bluetooth: mesh: Increase Net Transmit Count value on the node
This is to increase probability of reception of responses (Config Status
messages) from the node when the provisioner sends a Set message and the
node response with a Status message at the same time so that the message
collide.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-10-20 14:54:17 +02:00
Lingao Meng c2b2641fc1 Bluetooth: Mesh: Move ext adv sector to vector
Obviously, it looks obscure by putting it in a sector,
so, let's move to vector.

refs: https://github.com/zephyrproject-rtos/zephyr/pull/57883

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2023-10-20 14:54:17 +02:00
Lingao Meng 141467a261 Bluetooth: Mesh: Rename adv relay to adv simultaneous
Since notice that simultaneous advertising is not only used
by relay message, provision over pb-adv can also be used.
so it was changed to a more general name.

refs:https://github.com/zephyrproject-rtos/zephyr/pull/48903

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2023-10-20 14:54:17 +02:00
Mariusz Skamra 2735339a82 tests: Bluetooth: has: Add test Preset Changed Offline Behavior
Verify that a HAS Server IUT sends changed characteristic notifications
or indications when the Lower Tester reconnects.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-10-20 14:53:37 +02:00
Emil Gydesen 0521ffd5a3 Bluetooth: ISO: Rename BT_ISO_ADVANCED to BT_ISO_TEST_PARAMS
Rename the Kconfig option from BT_ISO_ADVANCED to
BT_ISO_TEST_PARAMS to more explicitly denote that it
enables support for using the ISO test parameters.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-10-20 14:50:48 +02:00
Håvard Reierstad 393c5ce065 bsim: Bluetooth: mesh: fix model extension
In 'test_access.c', model 3 on element 1 extending model 3 on element 0
is now registered correctly. When calling 'bt_mesh_model_extend' on
models on different elements, this needs to called from the
model with the highest element index to be registered correctly.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2023-10-17 19:11:42 +03:00
Håvard Reierstad 5969ad7811 bsim: Bluetooth: mesh: Implement CDP1 test
Adds bsim test to verify that composition data page 1 (CDP1) is
encoded and decoded correctly.

Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
2023-10-09 15:06:06 +03:00
Anders Storrø 2e3ae017e3 tests: Bluetooth: Mesh: LCD test all comp pages
Adds test for verifying split get operation for all
composition data pages.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-10-06 16:21:02 +03:00
Ingar Kulbrandstad a5d15ec017 Bluetooth: Mesh: Fixed issue with RPR server and client.
Fixed issue when reprovisioning is done on a device with
both RPR client and server on the same device.

Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
2023-10-06 16:06:12 +03:00
Andries Kruithof e04c963d9c Test: Bluetooth: controller: add CI testing for advertising chaining
Update babblesim tests for testing chaining for advertising to ensure that
we spill over to the next PDU

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2023-10-06 16:04:11 +03:00
Andries Kruithof d00d44c925 Bluetooth: controller: fix failing EBQ advertising tests
Updates the chaining for advertising.
Instead of unconditionally adding a new PDU when new data
is added we now instead fill the last PDU in the chain with
the incoming data, only adding a new PDU when there is
not enough room.

This reduces the nr. of PDUs used for advertising, and also
fixes some qualification failures

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2023-10-06 16:04:11 +03:00
Mateusz Kapala 3c0c634340 bluetooth: tests: Improve bondable_per_connection bsim test
Added fail on pairing_failed callback for both central and peripheral.
Added pairing status checks in peripheral.

It has been done to test the case when multi-role BT device tried to
pair without bonding (peripheral role) while already previously bonded
with the same device on another Bluetooth identity as it seems that
there was an issue with it previously.

Signed-off-by: Mateusz Kapala <mateusz.kapala@nordicsemi.no>
2023-10-04 14:53:26 +01:00
Emil Gydesen e67d6c2fa4 tests: bsim: Bluetooth: Remove broadcast_source_stop_inval
Removed the tests for invalid bt_bap_broadcast_source_stop
parameters and state, as those tests now implemented as unit tests.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-10-03 14:28:19 +01:00
Alberto Escolar Piedras 55940f701c tests bsim: Limit parallel build
The compile script had been modified
to fully parallelize all images builds
in 1de363d9d5

And has been kept building everything in parallel since then.
Over time we have seen an increase in the number of hangs
for this job in CI.
This is understood as being the result of the number of images
having increased, leading to a too high load
on the worker machines which cause them to timeout their
connection to the github CI scheduler.

In b83a828825
these jobs priority was lowered to aleviate this issue,
but again we see an increased number of CI runner
disconnects.

Let's parallelize this compile jobs a bit less.
With this change, we do not build anymore the sets of
host ll and mesh test images in parallel but sequencially.
On a local test this reduces peak load from
~1700 to ~700, and eliminates issues with system
unresponsiveness; while there is no statistically measurable
increase in overall build time.
Note that the single audio image is still built in parallel
to the other 3 sets, as this was seen to improve total
build time by 2 seconds out of 1m51s.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-10-02 15:54:10 +03:00
Vinayak Kariappa Chettimada a178aa9855 Bluetooth: Controller: Review rework flush timeout support
Review rework changed related to flush timeout support.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-10-02 10:00:27 +02:00
Vinayak Kariappa Chettimada 27c92fe238 tests: bsim: Bluetooth: Test RTN=2, FT=2, Cen skip 4 SE in Controller
Test RTN=2, FT=2 in Controller with 4 subevents dropped by
central.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-10-02 10:00:27 +02:00
Vinayak Kariappa Chettimada 291cd03818 tests: bsim: Bluetooth: Test RTN=2, FT=2, Cen skip 2 SE in Controller
Test RTN=2, FT=2 in Controller with 2 subevents dropped by
central.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-10-02 10:00:27 +02:00
Vinayak Kariappa Chettimada a7d2fdd02b tests: bsim: Bluetooth: Test RTN=2, FT=2, Per skip 4 SE in Controller
Test RTN=2, FT=2 in Controller with 4 subevents dropped by
peripheral.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-10-02 10:00:27 +02:00
Vinayak Kariappa Chettimada 2935d3b731 tests: bsim: Bluetooth: Test RTN=2, FT=2, Per skip 2 SE in Controller
Test RTN=2, FT=2 in Controller with 2 subevents dropped by
peripheral.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-10-02 10:00:27 +02:00
Emil Gydesen 1442a6cf5b tests: bsim: Bluetooth: Remove bsim testing of broadcast create inval
Removing the babblesim testing of the invalid parameters for
bt_bap_broadcast_source_create as they are now done in a unit
test instead.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-29 12:59:54 +02:00
Emil Gydesen 62787bd208 tests: bsim: Bluetooth: Remove broadcast_source_delete_inval
Removed the tests for invalid bt_bap_broadcast_source_delete
parameters and state, as those tests now implemented as unit tests.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-29 12:59:41 +02:00
Alberto Escolar Piedras 25897f8baa tests bluetooth mesh: Fix ASSERT_TRUE/FALSE with messages
The previous ASSERT_TRUE/FALSE macros looked like
they could take extra printf like parameters but did not
(those extra arguments were just dropped).

Define 2 new macros that can take those extra parameters
and fix all uses that intended to print those extra messages.

Also add an extra "\n" as the underlaying print functions
do not add end of lines on their own.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-09-28 13:43:51 +02:00
Alberto Escolar Piedras 146d025aa0 tests bluetooth mesh: Fix a incorrect assert
This ASSERT_TRUE should have been an assert equal
(ASSERT_TRUE checks that the first paramters != 0)
and the condition was not correct.
Fix it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-09-28 13:43:51 +02:00
Jonathan Rico c1baa8282d tests: Bluetooth: Add ATT sequential procedures test
The purpose of this test is to prove that the zephyr host can handle the
behavior described in the Bluetooth Core Specification Vol.3 Part.F
3.3.2 "Sequential protocol".

The host should be able to handle all of those in parallel: one
indication, one write request, multiple commands and multiple
notifications.

The "tester" part had to be written with a "tiny host" implementation
instead of the Zephyr host, as the ZH conflates GATT client and server
and doesn't allow a device to enqueue an ATT request + an ATT indication
on the same bearer.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-09-28 14:21:27 +03:00
Emil Gydesen b470e82a95 tests: bsim: Bluetooth: Remove broadcast_source_reconfigure_inval
Removed the tests for invalid bt_bap_broadcast_source_reconfigure
parameters and state, as those tests now implemented as unit tests.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-28 13:14:49 +02:00
Emil Gydesen 0f9f528214 tests: bsim: Bluetooth: ISO: Add host CIS tests
Add a simple central and peripheral CIS test that
exercises the ISO host API for unicast ISO (CIS).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-28 13:12:19 +02:00
Théo Battrel 2e13802a38 Bluetooth: Test: Update security/ccc_update
Previous commit reverted the `link_encrypted` filed of CCC config.
Update the test to match the new expected behavior.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-09-28 09:21:57 +02:00
Théo Battrel 888a8c644c Bluetooth: Test: SC Indication
Test that SC Indication is correctly sent when the client reconnect and
the server updated the GATT database since last connection. Test that
the indication is sent even if the bond is not restored.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-09-28 09:21:57 +02:00
Fredrik Danebjer 078b00b155 Bluetooth: Audio: Add resend mechanic to CSIP notifications
Added retry mechanic to CSIP notifications by adding them into system
workqueue. Bookkeeping is done for notifications for all clients, and
potentially disconncted clients will also receive notifications on
reconnect. This also adds mechanic to restore the local clients list
upon registration of the service, as well as BSIMs to test notify on
reconnect.

Signed-off-by: Fredrik Danebjer <frdn@demant.com>
2023-09-27 15:47:33 +02:00
Anders Storrø c2677fe2e4 tests: Bluetooth: Mesh: Add PRB proxy bsim test
Adds Bsim test for checking behavior of private Net ID
and private Node ID.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-09-27 15:47:06 +02:00
Anders Storrø 8d253086c3 tests: Bluetooth: Mesh: Fix bug in priv beacon
Fix several pointer related bugs in the private beacon test
framework.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-09-27 15:47:06 +02:00
Alberto Escolar Piedras 03b601f0a9 tests BT privacy: Simplify a bit scripts
Reduce the unnecessary hidding and indirection,
as it makes the scripts more difficult to follow
for no benefit.
If somebody wants to debug these tests, they'll want
to see the sim_id, and won't benefit from going around
opening files needlessly.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-09-26 08:38:36 +02:00
Alberto Escolar Piedras 0ff2ba8c8e tests: BT privacy: Fix printf format
Fix the print format string so the "%" is printed
instead of a bogus value.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-09-25 19:48:15 +02:00
Fabio Baltieri 09f02edfa4 Bluetooth: CAP: drop non existing qos
qos got dropped from bt_cap_unicast_audio_start_stream_param in
71b1591337.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-09-21 12:44:08 +02:00
Emil Gydesen f0cc8d4cb1 Bluetooth: CAP: Add support for long read/write
Add support for reading and writing long values (> MTU)
when using the CAP API.

This change does make it slightly slower to execute the
CAP procedures as it is now done on a one-by-one basis,
which affect multi-ACL setups, but that also means
that the buffer requirements for CAP will generally be lower.

There is still room for improvement as we can perform the BAP
operations in parallel on each ACl, which should return this to
its former performance.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-20 20:24:27 +01:00
Emil Gydesen 68751b8990 tests: Bluetooth: Audio: Add testing of source stream
Expand the CAP tests to also discover and setup a source
stream, so that the CAP procedures are run on multiple
streams.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-20 20:24:27 +01:00
Emil Gydesen 01f7d108f3 tests: bsim: Bluetooth: Add BAP unicast disconnect test
The purpose of this test is to verify that the stack has
the correct behavior if the ACL disconnects while one or
more streams are in the streaming state.

The main point it validates is that unicast server device
can restart advertising using a simple k_work in the
disconnected callback.

The number of connections supported by the test suite has
also been reduced to 3, to avoid some seen issues with
scheduling when CONFIG_BT_MAX_CONN=5.

A part of implementing the test for this purpose, the
unicast client and unicast server have been extended
to also advertise and scan for proper ASCS advertising
data.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-20 20:20:27 +01:00
Emil Gydesen 9064170cf8 tests: Bluetooth: Audio: Modify bsim tests to use bt_le_scan_cb_register
Update the tests to use bt_le_scan_cb_register and the "new"
scan callback, as that is better suited to handle extended
advertising.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-20 20:20:27 +01:00
Emil Gydesen f93caa3903 Bluetooth: Audio: BT_AUDIO_CODEC_LC3_ID -> BT_HCI_CODING_FORMAT_LC3
Replace the BT_AUDIO_CODEC_LC3_ID macro with the
BT_HCI_CODING_FORMAT_LC3 as there is no reason to
define and use the LC3 ID different than the other
allowed codec IDs.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-20 20:19:50 +01:00
Emil Gydesen b92422afb8 tests: bsim: Bluetooth: Remove broadcast_source_start_inval
Removed the tests for invalid bt_bap_broadcast_source_start
parameters and state, as those tests now implemented as unit tests.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-20 20:17:34 +01:00
Emil Gydesen 6dd90c1ab0 tests: Bluetooth: BAP: Update test for bt_bap_broadcast_source_reconfig
Added additional testing for bt_bap_broadcast_source_reconfig after
the API changed.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-20 20:16:52 +01:00
Théo Battrel 4e467a9bee Bluetooth: Test: Remove dead code
Remove unused code in `host/gatt/settings` test. The conditional block
could never be reached because the type of the discovery parameter is
`BT_GATT_DISCOVER_CHARACTERISTIC`.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-09-20 08:56:57 +02:00
Vinayak Kariappa Chettimada 3a690f62dd tests: bsim: Bluetooth: mesh: Adjust test sleep durations
Adjust test sleep durations to compensate towards timing
changes in Zephyr Controller radio scheduling.

With the change in the radio scheduling, there is overlap
of advertising PDU from multiple nodes that relay the PDU,
hence increase test timeout so that next advertising
interval that uses random delay will get received by nodes
without collisions on air.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-09-18 14:25:02 +02:00
Ludvig Samuelsen Jordet b990a74f8b Bluetooth: Mesh: Add support for Upload OOB Start
This adds support for the Upload OOB Start message to the DFD server, by
providing callbacks that the application can use to hook any OOB scheme
into the model behavior.

There are also extensive changes to the dfu_slot module, to accomodate
the new needs that appeared with the support for OOB transfer (mainly,
fwid, size and metadata are no longer available when the slot is
allocated, they appear later in the handling).

Signed-off-by: Ludvig Samuelsen Jordet <ludvig.jordet@nordicsemi.no>
2023-09-18 10:55:20 +01:00
Gerard Marull-Paretas aaeb0a672e toolchain: only include <zephyr/toolchain.h>
It is wrong to use toolchain-specific header files.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-09-15 09:27:30 +02:00
Donatien Garnier 185a6117c0 Bluetooth: Host: Amend existing L2CAP accept callbacks
This patch amends the existing L2CAP accept callbacks to use the new
accept signature that includes a pointer to the L2CAP server structure.

Signed-off-by: Donatien Garnier <donatien.garnier@blecon.net>
2023-09-14 14:36:34 +02:00
Gerard Marull-Paretas 691facc20f include: always use <> for Zephyr includes
Double quotes "" should only be used for local headers.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-09-14 13:49:58 +02:00
Jonathan Rico 0f8b357d0a tests: Bluetooth: split id_addr_update test
Split FW into two images, one for central one for peripheral.

The SoftDevice controller's connection contexts are not role-agnostic:
some are reserved for the peripheral roles some for the central roles.

Splitting the test into two images is anyway "The right thing (TM)",
it's just that we sometimes take the shortcut of using a single image to
go faster.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-09-11 19:58:16 +02:00
Anders Storrø cf8301d01e tests: Bluetooth: Mesh: OD priv proxy pst test
Adds test for persistent storage in On-Demand Private Proxy
implementation.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-09-11 19:58:05 +02:00
Anders Storrø 893a239f85 tests: Bluetooth: Mesh: Priv beacon pst test
Adds test for persistent storage in private beacon
implementation.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-09-11 19:58:05 +02:00
Anders Storrø 0e966cceb2 tests: Bluetooth: Mesh: Add comp p2 test to bsim
Adds testing of composition data page 2 and 130 in the
mesh_prov_pst_pb_remote_ncrp bsim test.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-09-08 14:44:25 +02:00
Théo Battrel 95ac71893c Bluetooth: Test: Add tests to reproduce SMP issues
This test reproduce two issues, #59788 and #61465.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-09-06 09:35:01 +02:00
Kamil Piszczek 2f90ef488a bluetooth: tests: add bsim test for identity address update
Added a BabbleSim test to check the update of the destination address
of all active connections during the identity resolution operation.
All connection objects associated with the same private peer address
should convert it to the identity address.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2023-09-04 18:41:48 +02:00
Vinayak Kariappa Chettimada 0c5b07838f tests: bsim: Bluetooth: Add verification of Broadcast ISO recv data
Add test implementation to verify correct broadcast ISO
receive data.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-09-04 18:22:41 +02:00
Carles Cufi 8c748fd005 kernel: Modify the signature of k_mem_slab_free()
Modify the signature of the k_mem_slab_free() function with a new one,
replacing the old void **mem with void *mem as a parameter.

The following function:
void k_mem_slab_free(struct k_mem_slab *slab, void **mem);

has the wrong signature. mem is only used as a regular pointer, so there
is no need to use a double-pointer. The correct signature should be:
void k_mem_slab_free(struct k_mem_slab *slab, void *mem);

The issue with the current signature, although functional, is that it is
extremely confusing. I myself, a veteran Zephyr developer, was confused
by this parameter when looking at it recently.

All in-tree uses of the function have been adapted.

Fixes #61888.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-09-03 18:20:59 -04:00
Emil Gydesen 76e35635b6 Bluetooth: Audio: Rename codec qos framing
Rename BT_AUDIO_CODEC_QOS_[UN]FRAMED to
BT_AUDIO_CODEC_QOS_FRAMING_[UN]FRAMED and give a name
to the enum, which is then used by the
struct bt_audio_codec_qos.

The rename was needed as we had a codec_qos initializer of the
same name, so the values were renamed to avoid duplicated
macro names.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-01 09:54:18 +02:00
Anders Storrø b11c5dd398 tests: Bluetooth: Mesh: Add comp p129 test to bsim
Adds testing of composition data page 129 in the
mesh_prov_pst_pb_remote_ncrp bsim test.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-08-30 14:14:49 +02:00
Tom Finet 4474860744 tests: fix bsim bt l2cap send_on_connect to fail on err < 0
bt_l2cap_chan_send returns the total bytes sent from the buf,
hence test should only fail when it returns a negative error code
and not a positive number of bytes sent.

Signed-off-by: Tom Finet <tom.codeninja@gmail.com>
2023-08-30 10:23:05 +02:00
Fabio Baltieri a16f1cee4a bluetooth: host: fix few mismatched CONTAINER_OF
Fix a bunch of mismatched CONTAINER_OF, few missing
k_work_delayable_from_work conversions but also many
bt_l2cap_le_chan/bt_l2cap_chan and few others.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-30 10:22:37 +02:00
Emil Gydesen 71b1591337 Bluetooth: CAP: Remove qos from start_stream_param
Remove the qos field from
bt_cap_unicast_audio_start_stream_param as it was not used.

The QOS values are set when creating the unicast group,
and not when starting the streams.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-08-29 10:22:43 +02:00
Emil Gydesen 6ccd112c56 Bluetooth: Audio: Refactor bt_audio_codec_cfg to flat arrays
Refactor the bt_audio_codec_cfg to use flat arrays to store
metadata and codec specific configurations.

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 configurations.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-08-28 15:56:53 +02:00
Fredrik Danebjer 32b00dd6f4 Bluetooth: Audio: Make BSIM tests for PACS notify functionality
Added a BSIM tests for PACS notification functionality. This test
tests that all optional notifies are working, as well as verifying
that a disconnected subscribed client will be notified on reconnect.

Signed-off-by: Fredrik Danebjer <frdn@demant.com>
2023-08-28 15:56:26 +02:00
Mariusz Skamra 2b27b4ebe0 Bluetooth: audio: tbs_client: Subscribe to all required notifications
This removes odd `subscribe` parameter from bt_tbs_client_discover
function parameters list. As the API user enables specific
CONFIG_BT_TBS_CLIENT_* option, the client implementation should
subscribe to the characteristic notifications so that the user receives
the value updates.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-08-23 15:44:07 +02:00
Aleksandr Khromykh b7141005f1 tests: Bluetooth: Mesh: opposite slot order for bsim settings backend
DFU slot sequence depends on the settings backend.
Commit adapts test after changing bsim settings backend.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2023-08-23 10:06:26 +02:00
Aleksandr Khromykh 695010fad0 tests: Bluetooth: Mesh: use bsim settings backend
Commit adds using BabbleSim's settings backend instead of
proprietary one that is based on POSIX files.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2023-08-23 10:06:26 +02:00
Aleksandr Khromykh 8a51176877 tests: Bluetooth: Mesh: move psa its emulator out of bt subtree
PSA ITS settings area does not belong to Bluetooth.
It should be restored before Bluetooth persistent data.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2023-08-23 10:06:26 +02:00
Mariusz Skamra d28f180473 Bluetooth: audio: ascs: Move metadata validation to stack
As the metadata has to be validated anyway, let the initial vaidation of
metadata to be done in ASCS. The application can still reject the
metadata, but the length validation and supported type validation can be
performed by the stack.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-08-22 09:59:53 +02:00
Emil Gydesen 9d6f48690a tests: Bluetooth: CAP: Fix ext_ad.data_len value
The value should not have included the size of the type.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-08-18 10:13:46 +02:00
Emil Gydesen 431a778b8c tests: bsim: Remove superfluous empty line in sh_common
Remove the empty line so there is only 1.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-08-17 22:44:28 +01:00
Aleksandr Khromykh 2cdacb3fa8 tests: Bluetooth: Mesh: add cfg mesh with mbedtls PSA to bsim CI
Commit adds configuration for mesh with mbedtls PSA
to CI BabbleSim tests as well as emulation of
the Internal Trustable Storage(ITS) based on Zephyr's
settings to run in parallel environment.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2023-08-17 15:14:19 +02:00
Pavel Vasilyev 00f59936b3 tests: bsim: bluetooth: mesh: Add test for fixed addresses
Test fixed group address acceptance condition, which has been clarified
in Mesh Protocol 1.1: A node shall deliver a message to the model
subscribed to a fixed group address even if the corresponding feature
is disabled.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-08-16 10:20:51 +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
Pavel Vasilyev 18dfcbc28b testes: bsim: bluetooth: mesh: Increase boundary for proxy adv int test
Time between the start of 2 consequtive advertising events consists
of advertising interval and delay. If delay is zero and the measured
interval is the interval between the last or prelast packet and the
first packet of the next adv event, the measured time can be less than
adv interval.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-08-14 18:09:54 +00:00
Pavel Vasilyev f997dc3842 Bluetooth: Mesh: Keep Composition Data Page 128 if RPR Server is present
According to section 4.2.2.4, Compositiion Data page 128 shall be
present if the node supports Remote Provisioning Server (section
4.2.2.4).

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-08-14 13:35:19 +00:00
Emil Gydesen 7ced52fdb5 tests: Bluetooth: Audio: Update broadcast tests 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 tests to use this updated API.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-08-14 13:34:26 +00:00
Emil Gydesen de041dba5e tests: Bluetooth: Update CAP broadcast to use cap send and tx sync
This will effectively test both the BAP and CAP TX sync functions
as well as the CAP send function.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-08-14 13:33:57 +00:00
Alberto Escolar Piedras 6d0aa678ef tests bsim ccc_store: Fix main return
Since 3a197934fc
main() should be int main(void) instead of void main(void)

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-08-09 16:09:47 +00:00
Alberto Escolar Piedras c0e2b97948 tests bsim settings: Fix main return
Since 3a197934fc
main() should be int main(void) instead of void main(void)

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-08-09 16:09:47 +00:00
Alberto Escolar Piedras f514ff887f tests bsim ccc_update: Fix main return
Since 3a197934fc
main() should be int main(void) instead of void main(void)

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-08-09 16:09:47 +00:00
Jonathan Rico a7cf7eb393 Bluetooth: l2cap: change connected cb call condition for ECRED
This was recently refactored (in #58440). But it introduced a bug in which
some channels were connected but not the whole list asked for by the peer.

In that case, `result` will not be `SUCCESS` but we still want to call the
`connected` callback as the peer will consider those channels to be
connected when we send the response.

The symptom is that EATT channels are being instantiated, but not
considered connected (ie. usable by the stack).

Also introduce a test that has asymmetric channel resources (5 on central
vs 2 on peripheral) to reproduce the bug.

Fixes #60212

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-07-31 19:39:09 +00:00
Emil Gydesen 5555ac331c tests: Bluetooth: Add advanced BIG create BSIM test
Extended the ISO broadcaster BSIM test with an additional
step to create a BIG using the test parameters.

Since this isn't properly implemented in the controller,
CONFIG_BT_ISO_ADVANCED has not been enabled in the
prj.conf yet.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-07-31 09:04:52 +00:00
Emil Gydesen 076df4ebe2 tests: Bluetooth: Refactor ISO broadcast ISO BSIM test
Refactor the test function to split it into multiple
smaller functions. This makes the main function much shorter
and easier to follow, and allows reusing of the individual
steps.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-07-31 09:04:52 +00:00
Stine Åkredalen e5fcca6e99 Bluetooth: mesh: Update default values for transport SAR configuration
Updated SAR default values to align with the latest mesh 1.1 drafts,
and relevant Bsim tests.

Signed-off-by: Stine Åkredalen <stine.akredalen@nordicsemi.no>
2023-07-19 11:07:07 +00:00
Emil Gydesen bbe6bb231a tests: Bluetooth: Add testing of invalid input for BAP broadcast source
Add tests to verify that the stack does not allow any
invalid data.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-07-18 16:20:14 +02:00
Aleksandr Khromykh b8f7c81dd3 tests: Bluetooth: Mesh: fix omitted names
PR fixes using of the parameter with omitted names.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2023-07-18 11:15:27 +00:00
Mariusz Skamra c09c4181cf Bluetooth: audio: tbs_client: Minor Kconfig refactor
This intoduces dedicated Kconfig option to enable TBS client,
that makes the configuration more intuitive.
While configuring GTBS only, the user does not have to explicitly set
the BT_TBS_CLIENT_MAX_TBS_INSTANCES to 0 to disable the TBS client
functionality.
This adds also `tbs_only_client` test case to test the TBS only build
option.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-07-18 11:06:57 +00:00
Emil Gydesen b140b70a17 tests: CAP: Add testing of all audio configs
Add test cases to test all audio configurations with
all presets.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-07-18 11:04:03 +00:00
Lingao Meng c16647d02a tests: bluetooth: Add iv[1 0 --> 1 1] test cast
Add testcast for 1, 1 --> 1, 0

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2023-07-11 18:19:27 +00:00
Mateusz Kapala 8e5673ccd1 bluetooth: tests: Add bsim test for setting bondable flag per-conn
Added test for the bt_conn_set_bondable API function.
Check if we can pair without setting the bonding flag on the
per-connection basis if the device was already bonded on the
other identity.

Signed-off-by: Mateusz Kapala <mateusz.kapala@nordicsemi.no>
2023-07-07 14:55:29 +03:00
Aleksandr Khromykh eba4d34b68 tests: Bluetooth: Mesh: test 32-bytes auth static OOB
Mesh 1.1 specification extended static OOB authentication
value till 32bytes. PR adds one more test vector in
provisioning bsim test to check it.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2023-07-07 11:11:32 +02:00
Théo Battrel ac7cabf991 Bluetooth: Tests: Use the correct ad data size
The device privacy test was using the wrong value for the advertising
data.

To fix the error, the test now use the `BT_DATA_BYTES` macro to create
the `bt_data` structure.

Also use `BT_DATA_NAME_COMPLETE` instead of the raw value.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-07-07 09:17:56 +02:00
Emil Gydesen 28dbbebc96 tests: Bluetooth: Split cap initiator unicast inval test to new func
Add a new test function to test invalid behavior to keep the
valid behavior test cleaner.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-06-30 16:11:32 +02: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
Mariusz Skamra 17223f136f Bluetooth: audio: Fix metadata length checks
This fixes metadata length checks for BT_AUDIO_METADATA_TYPE_EXTENDED
and BT_AUDIO_METADATA_TYPE_VENDOR that should be at least 2 bytes long.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-06-29 21:06:58 +02:00
Mariusz Skamra db5767e50f Bluetooth: audio: Accept empty CCID list in audio metadata
The CCID list can be empty, as the Assigned Numbers is not strict
regarding it's minimum length.

Fixes: #59666
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-06-29 21:06:58 +02:00
Vinayak Kariappa Chettimada 87d65dc502 samples: Bluetooth: hci_rpmsg/uart: Fix BT_CTLR_ISO_TX_BUFFER_SIZE
Restore back BT_CTLR_ISO_TX_BUFFER_SIZE to 251 after fix in
commit e460847b60 ("Bluetooth: host: don't fragment ISO
if len <= MTU").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-06-29 10:06:19 +00:00
Emil Gydesen 82e5eba817 Bluetooth: BAP: Fix bt_bap_scan_delegator_find_state
The bt_bap_scan_delegator_find_state did not properly return the
correct receive state due to confusing return value of the
iterator function.

Modify it to use a simple bool.

This fixes all issues with "Failed to find receive state for sink"
when using the Broadcast Sink.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-06-27 12:16:50 +00:00
Przemyslaw Bida 936dc5b6dd bsim: net: Add delay to echo client in ot bsim tests.
This change ensures that openthread network topology will be formed
properly, by delaing start of echo client application.

Signed-off-by: Przemyslaw Bida <przemyslaw.bida@nordicsemi.no>
2023-06-23 09:20:23 +02:00
Jonathan Rico 8a65b3f337 tests: Bluetooth: don't assume handle is 0
Don't assume the connection handle will always be 0. This is currently the
case with the Zephyr link layer, but recently changed in the Softdevice
Controller.

Another problem is that apparently the spec allows the controller to just
blackhole data instead of returning `BT_HCI_ERR_UNKNOWN_CONN_ID` if the
host uses a wrong handle.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-06-21 16:07:05 +02:00
Pavel Vasilyev 6bb97cc417 tests: bsim: bluetooth: mesh: Test friendship subs virtual addrs coll
Test that LPN correctly sends Friend Subscription List Add and Remove
messages to Friend when subscribed and unsubscribed to virtual addresses
wirth collision.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-06-17 08:00:55 -04:00
Pavel Vasilyev 45369f78ed tests: bsim: bluetooth: mesh: Test tran to virtual addr with collision
Test that transport layer correctly encrypts and decrypts messages to
virtual addresses with collision.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-06-17 08:00:55 -04:00
Pavel Vasilyev 98f27db189 tests: bsim: bluetooth: mesh: Test persistent storage of virtual addrs
Test that:
- virtual addresses in subscription list and publication states are
stored and restored correctly
- virtual addresses with collisions are stored and restored correctly

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-06-17 08:00:55 -04:00
Pavel Vasilyev 648378b292 Bluetooth: Mesh: Add full virtual addresses support
This commit adds the following features related to virtual addresses
support:
- Allows to store Label UUIDs which virtual addresses collide;
- Allows to decrypt messages encrypted with a virtual address with
collision;
- Allows to publish a message to a specific Label UUID to avoid virtual
addresses collision by adding a pointer to Label UUID to
struct bt_mesh_msg_ctx and struct bt_mesh_model_pub;
- Allows to differentiate Label UUIDs in the model's Subscription List
by storing all subscribed UUIDs in struct bt_mesh_model.uuids field.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-06-17 08:00:55 -04:00
Aleksandr Khromykh 29895d8275 Bluetooth: Mesh: refactor mesh to use both tinycrypt and psa based crypto
A mesh key type has been added to be able to choose the different
key representation for different security libraries.
The type as well as some functionality related to Mesh key
management has been added as a public API.
If tynicrypt is chosen then keys have representation
as 16 bytes array. If mbedTLS with PSA is used then keys are
the PSA key id. Raw value is not kept within BLE Mesh stack
for mbedTLS. Keys are imported into the security library
and key ids are gotten back. This refactoring has been done
for the network(including all derivated keys), application,
device, and session keys.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2023-06-17 07:46:03 -04:00
Jonathan Rico 931a089e2c Bluetooth: host: invalidate the RPA when starting legacy adv
This fixes the failure to use a resolvable private address in this
scenario.

1. call `bt_le_oob_get_local`, will generate and mark RPA as valid
2. start connectable adv w/ IDENTITY bit
3. start connectable adv w/o IDENTITY
4. RPA is not set (in `bt_id_set_private_addr`) because RPA
   is still marked as valid

When EXT_ADV is enabled and the controller supports it, a different code
path is taken that doesn't have this issue.

Unconditionally invalidating the RPA when starting advertising works around
this issue.

Fixes #56326

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-06-17 07:36:58 -04:00
Donatien Garnier 477dd86b78 Bluetooth: Host: Add sending L2CAP data from connection callback test
Add BabbleSim test to make sure data can be sent immediately upon
connection from the L2CAP channel connection callback

Signed-off-by: Donatien Garnier <donatien.garnier@blecon.net>
2023-06-17 07:33:11 -04:00
Théo Battrel 14200f82db Bluetooth: Tests: New bsim test for ID
Add a new BabbleSim test checking that the value of the Bluetooth
identity stored in the settings is correct.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-06-16 07:57:46 -04:00
Carles Cufi 22f73992b2 Bluetooth: Rework the HCI header set
In order to have clean, self-contained HCI headers that do not have any
dependencies towards the Host or any other part of the system (except
types), reorganize the headers in the following way:

- Split out the macros and structs from hci.h to a new hci_types.h
- Merge the existing hci_err.h into the new hci_types.h

Fixes #58214.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-06-12 06:20:24 -04:00
Emil Gydesen 9ed72eb0e6 tests: Bluetooth: CAP: BSIM: Set initiator as d=0 and acceptor as d=1
Typically the client is the first device in our babblesim tests, so
reordered the initiator and acceptor for the CAP tests to conform to
that.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-06-10 05:16:39 -04:00
Emil Gydesen b635a47c70 tests: Bluetooth: CAP: Add bsim test for unicast_audio_cancel
Add test of the unicast audio cancel that can cancel any pending
procedures. This is done by adding a new blocking behavior in the
cap acceptor.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-06-10 05:16:39 -04:00
Emil Gydesen 8eaeb73753 tests: Bluetooth: Split CAP initiator tests to unicast and broadcast
Split the cap_initiator_test.c to two new files
cap_initiator_broadcast_test.c and
cap_initiator_unicast_test.c as the two barely had any
common functionality, and the file was getting too large.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-06-09 11:42:39 -04:00
Vinayak Kariappa Chettimada 273e233d60 tests: bsim: Bluetooth: Fix BIS test ISO Tx Buffers in Controller
Fix BIS test for ISO Tx Buffers in Controller to be 2 for
ISO TX MTU size of 502 bytes.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-06-08 06:47:48 -04:00
Théo Battrel 24ea25827c Bluetooth: Tests: Check CCC Update
Check that if a bonded peer subscribed to a CCC, a non-bonded peer with
the same address cannot update the CCC.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-06-08 04:10:58 -04:00
Théo Battrel f5ff886260 Bluetooth: Tests: Remove usage of BT_DEBUG_LOG
Remove usage of Kconfig symbol `CONFIG_BT_DEBUG_LOG` from tests. 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
Théo Battrel cb48626399 Bluetooth: Test: Update ccc_store bsim test
Update `ccc_store` bsim test to remove the 'expected failure'. The issue
being fixed in the following commit.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-06-05 13:54:37 -04:00
Théo Battrel f4ecc4e102 Bluetooth: Tests: Check CCC Store
The first test check that if a bonded peer subscribe to a CCC, this
change is correctly stored to flash.

The second test, which is currently failing, is included to reproduce a
bug that occur when CCC or CF store on write is disabled and the other
one is enabled, leading to the delayed store being enabled. Causing the
value of the corresponding `n` selected option to not be stored at all.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-06-01 14:58:39 +02:00
Emil Gydesen f8676f59c9 tests: Bluetooth: Add CAP initaitor test iterations
Add iterations to test_cap_initiator_unicast so that
we test starting again after stopping, as well as recreating
the group.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-06-01 10:04:36 +02:00
Keith Packard 3c8a96532c tests/bluetooth/ll/cis: Switch main return type to int
Zephyr now requires that main return int instead of void.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-05-31 10:36:17 +02:00
Krzysztof Kopyściński 972f40db57 Tests: Bluetooth: Mesh: add BSim tests for Private Beacons
This set tests if Private Beacons are advertised properly, with address
changed for every beacon and Random value changing appropriately
regarding the scenario (IV Update, Key Refresh, advertisements on device
with friendship support) and Random Interval state.

All tests contain two devices: tx advertises Private Beacon (has Private
Beacon Server in composition) and rx sets Private Beacon state on tx
device (has Private Beacon Client). On rx device, scan callback is
registered to monitor Private Beacon advertisements.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2023-05-30 06:30:25 -04:00
Fredrik Danebjer 7457bcf0a2 Bluetooth: Audio: Make HAS optional notify characteristics optional
Added Kconfig options to make HAS characteristics that has notify as
optional property selectable and thus optional. These settings are
global, meaning that a chosen notify property will be used for all
registered has instances.

Signed-off-by: Fredrik Danebjer <frdn@demant.com>
2023-05-26 09:09:06 -04:00
Emil Gydesen 5a7c57cc96 Tests: Bluetooth: Audio: Add write of long metadata
Add test of long metadata write.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-26 05:55:15 -04:00
Emil Gydesen 870d8b350a Bluetooth: BAP: Add support for long ASE notifications
Add support for long notifications ASE notifications
by doing a long read if the notification has length of
the maximum MTU.

This behavior is currently not defined by the BAP spec,
so may not work with all devices.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-26 05:55:15 -04:00
Emil Gydesen e8ade2356a Bluetooth: BAP: Add unicast client and server write long support
Add support for long writes for the unicast client and server.
This reuses the ATT buffer for long reads.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-26 05:55:15 -04:00
Emil Gydesen 5109c941f2 Bluetooth: Audio: Add TBS client TX buffer count requirement
After removing the high default for MCS, it was discovered that
the TBS client requires a significant amount of buffers to work
properly as well. Added the requirement as a build assert that
depends on which optional TBS client features are enabled.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-26 05:54:58 -04:00
Emil Gydesen 5c3241ca5b Bluetooth: MCS: Remove requirement for TX_BUF_COUNT
A recent change in MCS significantly reduced the requirement
of L2CAP_TX_BUF_COUNT and should now work with any value.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-26 05:54:58 -04:00
Krzysztof Kopyściński 504a41bd6e Tests: Bluetooth: Mesh: test Remote provisioning timeout
Test timeout of Remote Provisioning procedure when provisioned device
is unresponsive. Test covers two cases: unresponsive unprovisioned
device, which causes timeout on RPR Server and unresponsive RPR Server,
which causes RPR timeout on RPR Client.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2023-05-25 16:32:49 -04:00