Commit graph

2102 commits

Author SHA1 Message Date
Aleksander Wasaznik bb1ede6a9b Bluetooth: Use bt_addr_eq
Refactor. Using `bt_addr_eq` instead of `bt_addr_cmp`.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-05-09 09:23:52 +02:00
Emil Gydesen 2ec1a506a4 Bluetooth: Audio: Fix enum mismatch for codec get chan alloc
The function bt_codec_cfg_get_chan_allocation_val takes a pointer
to an enum, rather than an uint32_t, but was wrongly defined in
the header files and incorrectly used a few places.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-05 16:18:07 +02:00
Vinayak Kariappa Chettimada 5152672d06 Bluetooth: Controller: Include remainder when calculating cis_offset
Include ticker expire remainder value when calculating the
cis_offset to acheive fine timing in scheduling the CIG
radio events relative to its associated ACL radio events.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-05-05 12:26:31 +02:00
Erik Brockhoff 44df982d0b Bluetooth: controller: disallow enc start/pause when CIS established
Start/pause encryption should not be initiated on ACL with CIS
established (BT Core Spec 5.4, Vol 6, Part B, Sect. 5.1.3)
Adding test for the added procedure peek function

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2023-05-04 10:47:37 +02:00
Mariusz Skamra 229d049d4d tests: Bluetooth: ascs: Add sink/source ASE only test variants
This adds tests to test Sink/Source only build configurations.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-05-03 15:11:27 +02:00
Mariusz Skamra 49b6684dbb tests: Bluetooth: ascs: Add invalid ASE state transition tests
This verifies whether implementation rejects invalid ASE Operation
in given state.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-05-03 15:11:27 +02:00
Mariusz Skamra 748b062c15 tests: Bluetooth: ascs: Fix missing bt_bap_stream_start call
Calling bt_bap_stream_start moves the ASE to streaming state.
If the function is not called the Sink ASE stays in enabling state.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-05-03 15:11:27 +02:00
Magdalena Kasenberg fc0a0c5bfb bluetooth: tester: Remove overlay for leaudio tests on nrf52
Prime target for LE Audio testing is nRF53.

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
2023-04-28 14:49:35 +02:00
Andries Kruithof 954c4f2a56 Tests: Bluetooth: fix memcpy out of bounds error
In the helper-module we do a memcpy of a structure but the size
is possibly incorrect.

This PR ensures that the correct sizes are used.

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2023-04-27 16:00:33 +02:00
Mariusz Skamra d6405cf999 tests: Bluetooth: ascs: Add multiple parameters test cases
This adds 2 new test cases that test whether arrayed parameters are
handled properly.
This improves the existing test_codec_configure_invalid_ase_id_unavailable
test case by handling request conatining 2 ASE_ID's where the 1st is
invalid.
This reproduces the issue fixed in
419772db94238debe114dfac337f5b238a15436e.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-04-25 12:21:23 +02:00
Emil Gydesen 303bcfdcb7 Bluetooth: Shell: Add testcases for AUDIO_RX and TX disabled
Add configurations where CONFIG_BT_AUDIO_TX and CONFIG_BT_AUDIO_RX
are disabled.

Fixes issues found in the BT shell implemented caused by these
configurations.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-04-25 12:20:38 +02:00
Pavel Vasilyev c4fa085ec4 Bluetooth: Mesh: Add async API for Large Comp Data Client
Add asynchronous API for Large Composition Data Client.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-04-24 13:31:27 +02:00
Mariusz Skamra d47120fad4 tests: Bluetooth: ascs: Remove unused variables
This removes unused variables from test functions.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-04-21 13:01:42 +02:00
Mariusz Skamra 280aff80bb tests: Bluetooth: ascs: Add ASE Control Point invalid len tests
This adds tests that validate the implementation handles invalid length
Control Point operations.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-04-21 13:01:42 +02:00
Mariusz Skamra 413f5c5d32 tests: Bluetooth: ascs: Factor out ASE control parameters validation tests
Move the tests to separate source file.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-04-21 13:01:42 +02:00
Magdalena Kasenberg 0b5f976073 bluetooth: tester: Restore removed nrf5340_hci_rpmsg.conf
This overlay is still needed for non-leaudio tests.

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
2023-04-20 16:11:15 +02:00
Magdalena Kasenberg bf2825168e bluetooth: tester: Update btp for codec and qos config
Update BTP_ASCS_CONFIGURE_CODEC to send codec specific configuration
in LTV format.

Update parameters of BTP_ASCS_CONFIGURE_QOS to match the BT spec
defined lengths.

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
2023-04-20 16:11:15 +02:00
Mariusz Skamra 6c1363e34d tests: Bluetooth: ascs: Add server initiated ASE state transition tests
This adds tests for server initiated ASE Operations for Sink and Source
ASE.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-04-20 10:52:42 +02:00
Vinayak Kariappa Chettimada 4b90d01398 Bluetooth: Controller: Fix cis_offset_min used in CIS Create Response
Use the minimum supported cis_offset_min considering that
ACL radio event does not overlap with CIG event. Use the
calculated maximum of local and remote cis_offset_min in the
Response PDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-04-19 03:47:19 -04:00
Gerard Marull-Paretas 667eeb11fb shell: fix MISRA 5.7 violations on struct shell
MISRA Rule 5.7 requires uniqueness of tag identifiers. Shell is
frequently problematic because many code uses `const struct shell
*shell`. This causes CI noise every time one of these shell files is
edited, so let's update all of them with `const struct shell *sh`
instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-14 12:21:08 +02:00
Jonathan Rico 20f82253ac tests: Bluetooth: update buf UT behavior
a6e5755da8 changed the behavior of
`bt_buf_get_cmd_complete`, update the test accordingly.

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

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

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

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

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-04-14 07:49:41 +09:00
Nirosharn Amarasinghe dc21de3acd tests: bluetooth: controller: Unit test for SDU interval consideration
-- Unit test to check that the correct payload number is selected based
   on the SDU packet number and the time stamp when fragmenting SDUs
   into PDUs.
-- Ran clang-format on isoal_test_tx and isoal_test_rx

Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
2023-04-13 16:09:39 +02:00
Gerard Marull-Paretas 4863c5f05b sys/util: extend usage of DIV_ROUND_UP
Many areas of Zephyr divide and round up without using the DIV_ROUND_UP
macro. Make use of it, so that we make use of a tested system macro and
at the same time we make code more readable.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-12 16:42:29 +02:00
Magdalena Kasenberg 661f07ba0f bluetooth: tester: Add CONFIG_BTTESTER_LOG_LEVEL
to set a different log level than the default.

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
2023-04-12 13:05:32 +02:00
Magdalena Kasenberg 58784b7899 bluetooth: tester: Move LE Audio overlays
The overlays are needed for both single and dual core boards.

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
2023-04-12 13:05:32 +02:00
Magdalena Kasenberg 96facf2875 bluetooth: tester: Add overlay file for LE Audio controller
for testing on single core board like nrf52840.

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
2023-04-12 13:05:32 +02:00
Magdalena Kasenberg 569d892e7e bluetooth: tester: Update CONFIG_LOG_DEFAULT_LEVEL
Since behavior of CONFIG_LOG_DEFAULT_LEVEL was changed, if set to debug
level, causes stack overflow on nrf52 board.

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
2023-04-12 13:05:32 +02:00
Mariusz Skamra 2234b16893 tests: Bluetooth: ascs: Add Source ASE state transition tests
This adds source ASE state transition tests.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-04-12 13:05:20 +02:00
Mariusz Skamra 4862200e57 tests: Bluetooth: ascs: Factor out test preambles
Factor out test preambles, to deduplicate the code and improve it's
readablility.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-04-12 13:05:20 +02:00
Mariusz Skamra 26e99d9c8c tests: Bluetooth: ascs: Rework expect_bt_bap_stream_ops_stopped_called_once
Make the parameters optional allowing to skip the function parameter
verification.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-04-12 13:05:20 +02:00
Mariusz Skamra d3c8f32364 tests: Bluetooth: ascs: Fix minor typo
This fixes invalid value comparison argument.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-04-12 13:05:20 +02:00
Mariusz Skamra 0ede0f57df tests: Bluetooth: ascs: Fix missing inline
This fixes missing inline function specifier.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-04-12 13:05:20 +02:00
Mariusz Skamra 7b16658156 tests: Bluetooth: ascs: Reset mocks after test preamble
This adds test_mocks_reset function to be called after test case
preamble. The motivation is to reset the function call state that might
be affected by steps perfromed in the preamble stage, which is not the
code under test.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-04-12 13:05:20 +02:00
Mariusz Skamra 6c6cec9880 tests: Bluetooth: ascs: Fix invalid NULL assignment
The iso_server shall be not set to NULL in mock_bt_iso_cleanup(), as
it's UUT responsibility to call bt_iso_server_unregister(). Cleaning
the iso_server in mock_bt_iso_cleanup() might hide bug in the code.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-04-12 13:05:20 +02:00
Mariusz Skamra 6fec930c09 tests: Bluetooth: ascs: Set pacs_cap_foreach_custom_fake as default mock
This moves pacs_cap_foreach_custom_fake to mocks to be default mock.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-04-12 13:05:20 +02:00
Kumar Gala dca600bd19 samples/tests: bluetooth: Remove qemu_cortex_m3
Remove qemu_cortex_m3 from various bluetooth tests and samples since
they enable NVS which requires CONFIG_FLASH_PAGE_LAYOUT which is
not supported on qemu_cortex_m3 since there is no flash driver.

We get build failures with the arm-clang compiler because nvs.c
is referencing z_impl_flash_get_page_info_by_offs which does not
exist.

Switch to qemu_x86 as the integration_platforms if it was
qemu_cortex_m3 before.

Removed the bluetooth.mesh.mesh_shell.reduced_legacy as this was
added specifically for building on qemu_cortex_m3.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-12 09:01:34 +02:00
Gerard Marull-Paretas 0ebe14beb4 sys: util: migrate all files to DIV_ROUND_UP
ceiling_fraction is deprecated, use DIV_ROUND_UP.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-11 12:00:37 +02:00
Magdalena Kasenberg 196261d4ab bluetooth: tester: Add ASCS and BAP tests handling
Support for tests that use ASCS operations Codec Config, Config QOS,
Enable, Disable, Update Metadata, Release.

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
2023-04-05 14:51:30 +02:00
Mariusz Skamra 92d6b78fe6 Bluetooth: audio: Introduce helper BT_AUDIO_RX(TX) flags
This adds new hidden compilation flags that indicate whether the
implementation is configured to be able to receive/transmit audio data.
The flags are profile agnostic to loosen dependencies between
modules/services.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-04-04 13:35:56 +02:00
Emil Gydesen 90dd914e11 Bluetooth: Shell: Guard HRS adv calls with broadcaster
There is no requirement that HRS shall be on a peripheral device
as far as I can tell, and as such the device with HRS may not
be a GAP Broadcaster. Guards the advertising with
CONFIG_BT_BROADCASTER.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-04-03 14:48:59 +00:00
Szymon Janc aa861727e8 bluetooth: tester: Use fixed value for BT_BUF_ACL_RX_SIZE
Default BT_BUF_ACL_RX_SIZE value varies based on selected host options.
Many buffers size (L2CAP COC MPS in particular) depends on that value
and those may affect qualification test cases steps.

To make core tests more predictable just use fixed values big enough to
comply with all configurations requirements.

This was affecting L2CAP/COS/ECFC/BV-04-C.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-31 14:00:48 +02:00
Szymon Czapracki 33bf1fa0c6 Bluetooth: audio: Expand AICS API
This commit adds new API functions for AICS
Setting automatic/manual only gain modes
Setting mute disabled
Use new functions in btp.vcp

Signed-off-by: Szymon Czapracki <szymon.czapracki@codecoup.pl>
2023-03-31 09:20:15 +02:00
Szymon Janc 06c6a9cb1c bluetooth: tester: Enable extended advertising
Some peripheral tests are failing if CONFIG_BT_EXT_ADV=n.
That was previously implicitly enabled by MESH but it has
dedicated overlay.

Affected tests:
GAP/BROB/BCST/BV-03-C
GAP/CONN/UCON/BV-06-C
GAP/PRIV/CONN/BV-10-C

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-30 13:48:30 +02:00
Mariusz Skamra 64ccf9eb2a tests: Bluetooth: ascs: Add Sink ASE state machine test cases
This adds another set of test cases to cover the ASE state
transitions.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-03-30 13:48:22 +02:00
Mariusz Skamra 067d4bf41d tests: Bluetooth: ascs: Stop using hardcoded ASE_ID in tests
This adds ASE_ID getter function to be used in the tests. The function
performs read operation on ASE charateristic. The characteristic value
is ensured to be ASE Idle state characterisitic value, which carries
information about ASE_ID value.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-03-30 13:48:22 +02:00
Mariusz Skamra 8ce062bd37 tests: Bluetooth: ascs: Refactor ase getter function
This refactors the function used to get the ASE for the tests.
Reworked function allows to get several ASE's for the test with a single
function call.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-03-30 13:48:22 +02:00
Mariusz Skamra 87214c3f5a tests: Bluetooth: ascs: Factor out ASE state transition test cases
This cleans up the code by moving the ASE State Machine transition
test cases to separate source file.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-03-30 13:48:22 +02:00
Szymon Janc b4db4d3ad1 bluetooth: tester: Validate key size when reading local database
Key size validation was missing on getting local database which
resulted in selecting invalid characteristic by PTS for key size
validation tests.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-29 09:02:59 +02:00
Mariusz Skamra 507cd32072 tests: Bluetooth: ascs: Add test for Sink entering streaming state
This adds unit test for Sink ASE entering streaming state.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-03-28 15:07:09 +02:00
Mariusz Skamra 33767540d9 tests: Bluetooth: audio: Extend kernel mocks
This adds basic functionality that mocks the k_work API. The ASCS uses
delayed work to defer the CIS disconnection.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-03-28 15:07:09 +02:00
Mariusz Skamra 73e4a736fb tests: Bluetooth: audio: Extend ISO mock implementation
This adds ISO mock with very basic functionality that is needed to mock
the `bt_iso_` functions used by ASCS.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-03-28 15:07:09 +02:00
Mariusz Skamra 58de595c70 Bluetooth: audio: ascs: Register ISO server on ASCS init
This moves the ISO server registration to bt_ascs_init.
When the ASCS gets cleaned up (the callbacks are unregistered), the ISO
server gets unregistered.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-03-28 15:07:09 +02:00
Mariusz Skamra f5b31c21a9 Bluetooth: audio: ascs: Fix Response_Code for mandatory opcodes
This fixes invalid Unsupported Opcode Response_Code that
happened to be sent in ASE Control Point notification
as the response to operation initiated with Mandatory opcode
to support.
When the Unicast Server callbacks are not registered, every
operation that is initiated by client will fail with
Unspecified Error instead.

Fixes: #56139
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-03-28 15:07:09 +02:00
Mariusz Skamra 31aa555890 Bluetooth: audio: ascs: Cleanup ASCS on callback unregister
This adds cleanup of ASCS that is called when upper layer unregisters
it's callbacks. Without callbacks registered, the service is unusable.
The ASE's that were in non-idle state stay in this state, because the
implementation returns an error on every operation that is performed by
the client. The cleanup added moves all the ASE's to idle state.

Fixes: #56111
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-03-28 15:07:09 +02:00
Krzysztof Kopyściński 03c966d9ef tests: Bluetooth: Mesh: add unit tests for blob_io_flash module
This tests functions accessible from blob_io_flash via `bt_mesh_blob_io`
object. Whole partition of slot1 is filled with test data using
flash_map API and then read using blob_io_flash, by reading it as blocks
and chunks. `chunk_wr` is tested my writing sample data of size of slot1
partition and checked if each chunk is written correctly, and if whole
partition is filled with correct data at the end. Both of these test
use `bt_mesh_blob_io_flash_init` and `io_open` to prepare stream and
call `block_start` at every new block to check if flash is prepared
correctly.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2023-03-28 15:06:44 +02:00
Krzysztof Kopyściński 4bcd03d2cb Tests: Bluetooth: Make space for Mesh tests
This commit moves app from /tests/bluetooth/mesh to
tests/bluetooth/mesh/basic. This allows to reuse /tests/bluetooth/mesh
directory as location for more tests.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2023-03-28 15:06:44 +02:00
Szymon Janc 70a0364c2a bluetooth: tester: Add support for BTP GATT Change Database command
This command allows for more predictable GATT database changed tests
and allows to reduce custom test configurations from autopts.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-28 15:06:24 +02:00
Szymon Janc 577d4b004f bluetooth: tester: Add MESH and LE Audio overlays
Initially I was hoping we can avoid dedicated overlays and have all
config options enabled but it turned out that built-in services
may affect other tests (especially core related like GAP and GATT).

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-27 09:50:09 +02:00
Szymon Janc fc8560fc85 Bluetooth: tester: Fix not updating value length on write
Previously tests were passing only because initial value in
database and PTS value used for testing had same length.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-24 17:37:37 +00:00
Mariusz Skamra 7c6f2d78d2 tests: Bluetooth: ascs: Fix bap_unicast_server_cb mocks
This fixes merge conflict issue by adding missing function
parameters that were introduced in
57784df5f0.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-03-22 21:20:43 +01:00
Mariusz Skamra b176c51785 tests: Bluetooth: audio: Add initial ASCS unit tests
This adds initial ASCS unit tests.
Failing test cases have been conditionally skipped with Zephyr issue
number.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-03-22 11:39:18 +01:00
Mariusz Skamra 269290d614 tests: bluetooth: audio: Add mocks for audio
This adds common mocks to be used while unit testing Bluetooth Audio
code.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-03-22 11:39:18 +01:00
Ahmed Moheb 48000cd5a4 tests: bluetooth: host: Add UT for bt_dh_key_gen()
Unit test project for bt_dh_key_gen().
This is part of subsys/bluetooth/host/ecc.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-03-22 09:33:42 +01:00
Ahmed Moheb aebd5d84a0 tests: bluetooth: host: Add UT for bt_pub_key_get()
Unit test project for bt_pub_key_get().
This is part of subsys/bluetooth/host/ecc.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-03-22 09:33:42 +01:00
Ahmed Moheb fac21b3616 tests: bluetooth: host: Add UT for bt_pub_key_gen()
Unit test project for bt_pub_key_gen().
This is part of subsys/bluetooth/host/ecc.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-03-22 09:33:42 +01:00
Ahmed Moheb a774314e69 tests: bluetooth: host: Add UT for bt_pub_key_is_debug()
Unit test project for bt_pub_key_is_debug().
This is part of subsys/bluetooth/host/ecc.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-03-22 09:33:42 +01:00
Ahmed Moheb 3c76bd06e4 tests: bluetooth: host: Add mocks for ecc.c
Add required mocks to be able to compile/test /bluetooth/host/ecc.c

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-03-22 09:33:42 +01:00
Théo Battrel a3ac4421d2 Bluetooth: Tests: Fix bt_buf_get_evt test
Fix #55957. The `bt_buf_get_evt` test was using `net_buf` structures
without allocating it properly.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-03-21 22:49:34 +09:00
Sebastian Panceac 2e7c02bef6 Bluetooth: pairing: OOB: Separate LE SC OOB from legacy OOB logic
Some systems can support only legacy OOB pairing while others only
LE SC OOB pairing.

The existent API function "bt_set_oob_data_flag" was removed.

Two new API functions were added:

 * "bt_le_oob_set_legacy_flag" to signal that legacy OOB pairing is used
 * "bt_le_oob_set_sc_flag" to signal that LE SC OOB pairing is used

The code will now advertise the presence of OOB flag depending
on the type of pairing method(SC vs legacy)

Signed-off-by: Sebastian Panceac <sebastian.panceac@ext.grandcentrix.net>
2023-03-20 16:13:18 +01:00
Aleksander Wasaznik 6b6178be30 Bluetooth: Shell: Make gatt notify more general
Make `gatt notify` take the source handle and the data to send.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-03-20 09:51:24 +01:00
Alberto Escolar Piedras f27c0b4905 tests bsim: Change folder structure
Bsim won't be limited anymore to BT tests.
In preparation for adding more tests in network areas
swap the tests/bluetooth/bsim with tests/bsim/bluetooth

There is no other changes in this commit beyond that.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-03-17 19:59:50 +01:00
Andries Kruithof dca33a126d Bluetooth: controller: update permutation script
Updated the script that compiles all different permutations so
that it starts with the correct configuration file

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2023-03-17 15:05:05 +01:00
Andries Kruithof 2ada005d7c Bluetooth: controller: removing legacy LLCP code
This commit removes the legacy LLCP code including the
Kconfig option
It also updates the babblesim tests, and removes the
tests for the legacy controller

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2023-03-17 15:05:05 +01:00
Krzysztof Kopyściński d638811be1 tests: Bluetooth: Mesh: Test API and persistent storage of DFU slots
Tests behaviour of API (addition and deletion of slots, setting valid
state, iteration through slot list). Tests if slots are correctly
saved, recovered and deleted from persistent storage.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2023-03-17 14:19:56 +01:00
Szymon Janc 3e7205876c bluetooth: tester: Fix BTP L2CAP listen command
Fixes regression introduced in 26cf0b6850
"bluetooth: tester: Add support for missing BTP L2CAP listen param".

Success status was missing resulting in BTP to fail for tests that
require success on connection.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-17 10:07:15 +01:00
Emil Gydesen ba7656d05f tests: Bluetooth: Audio: Streamline connection handling in tests
Modify the tests to only have a single set of connection
callbacks, where all the tests can use the same default_conn
and flag_connected.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-17 09:31:28 +01:00
Alberto Escolar Piedras 2ca438fc55 tests/bluetooth/mesh: Synchronize devices before boot
To ensure no indeterminism, synchronize devices before they
boot, and therefore before the test main function is executed.

Note that at this point, there is no actual indeterminism
to correct.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-03-17 09:30:26 +01:00
Pavel Vasilyev 58f35ead65 tests: Bluetooth: Mesh: Remove device synchronization API
This API was creating more problems than solving. We should not use back
channel in bsim tests unless there is no other way to communicate
between devices. To synchronize devices we should use k_sleep.

This addresses
https://github.com/zephyrproject-rtos/zephyr/issues/55821

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-03-16 14:52:05 +01:00
Pavel Vasilyev ec6433e889 tests: Bluetooth: Mesh: Set resync offset to 100ms for all mesh tests
Since this becomes de facto a default value for most of our tests, set
it by default.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-03-16 14:52:05 +01:00
Mariusz Skamra 253d0806d3 test: Bluetooth: host: Add unit tests for bt_data_parse
This adds unit tests for bt_data_parse.
The sample data concept used in test is based on AD Structures of
Advertising, Periodic Advertising, and Scan Response presented in
Core specification.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-03-16 11:46:36 +01:00
Emil Gydesen db7bb2c9b1 tests: Bluetooth: Audio: Add unicast client CP notification bsim testing
Adds waiting for the control point operation callbacks in the
unicast client BSIM test, ensuring that the callbacks work, but also
testing that the server is correctly sending them.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-16 09:18:00 +01:00
Nirosharn Amarasinghe 52db790700 tests: bluetooth: controller: release of padding PDUs for framed prod.
Implemented tests to check release of framed padding PDUs as the end of
the event.

Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
2023-03-16 09:17:19 +01:00
Henrik Brix Andersen c6c5d5842d tests: remove test_framework tag from tests non-framework tests
Remove the "test_framework" tag from tests that are not testing the ztest
framework itself.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-15 15:03:02 +01:00
Henrik Brix Andersen b721f0b3a1 tests: bluetooth: fix testcase.yaml line indentations
Fix the line indentations used in the Bluetooth testcase.yaml files.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-15 15:03:02 +01:00
Szymon Janc b07f474d71 bluetooth: tester: Fix copy paste issue in config_mod_sub_ovw
stuct btp_mesh_cfg_model_sub_add_cmd was used instead of struct
btp_mesh_cfg_model_sub_ovw_cmd for parsing command.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-15 15:02:07 +01:00
Szymon Janc 26cf0b6850 bluetooth: tester: Add support for missing BTP L2CAP listen param
BTP_L2CAP_CONNECTION_RESPONSE_INSUFF_ENCRYPTION is used to indicate
encryption is required (but not authentication).

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-15 15:01:52 +01:00
Magdalena Kasenberg 40b4cccf83 bluetooth: tester: Add nrf5340_hci_rpmsg.conf file
To apply when the hci_rpmsg controller with overlay
nrf5340_cpunet_iso-bt_ll_sw_split.conf is used on the netcore.

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
2023-03-15 15:01:34 +01:00
Alperen Sener 2a76e05d0c Bluetooth: Tester: fixing mesh btp cmds
fix mesh btp command structs for btp commands
cfg_model_sub_ovw and cfg_model_app_get

Signed-off-by: Alperen Sener <alperen.sener@nordicsemi.no>
2023-03-14 10:50:49 +01:00
Andrei Emeltchenko 545ecbb947 tests: bluetooth: Correct unsigned compare
(unsigned - unsigned) is always >= 0, so I believe the right compare
string is (unsigned > unsigned), otherwise we would check for (is
equal).

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-03-14 10:50:19 +01:00
Ahmed Moheb 15ed0457b5 tests: bluetooth: host: Add UT for bt_encrypt_be()
Unit test project for bt_encrypt_be().
This is part of subsys/bluetooth/host/crypto.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-03-14 10:48:55 +01:00
Ahmed Moheb 3638889505 tests: bluetooth: host: Add UT for bt_encrypt_le()
Unit test project for bt_encrypt_le().
This is part of subsys/bluetooth/host/crypto.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-03-14 10:48:55 +01:00
Ahmed Moheb 574d78483c tests: bluetooth: host: Add UT for bt_rand()
Unit test project for bt_rand().
This is part of subsys/bluetooth/host/crypto.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-03-14 10:48:55 +01:00
Ahmed Moheb ebf96f4148 tests: bluetooth: host: Add UT for prng_init()
Unit test project for prng_init().
This is part of subsys/bluetooth/host/crypto.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-03-14 10:48:55 +01:00
Ahmed Moheb 593dea7f36 tests: bluetooth: host: Add mocks for crypto.c
Add required mocks to be able to compile/test /bluetooth/host/crypto.c

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-03-14 10:48:55 +01:00
Aleksander Wasaznik 6648da731b Bluetooth: Host: SMP Keypress Notification
Add experimental support for SMP Keypress Notification.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-03-13 14:04:25 +01:00
Emil Gydesen a87d395610 tests: Bluetooth: Add nrf5340_audio_dk board config for shell
Add a nrf5340_audio_dk board config the for BT shell which
enables support for LC3.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-13 14:02:33 +01:00
Alberto Escolar Piedras 546b8476fd tests/bt/bsim/mesh: Fix tests dependent on RSSI
The friendship tests are dependent on the attenuation
level as they take (much) longer with higher channel
attenuation.

As BabbleSim's "magic" modem model (default one used in these
tests) has been updated to provide a somehow accurate
RSSI measurement, one of these tests fails
tests/bluetooth/bsim/mesh/tests_scripts/friendship/msg_mesh_low_lat.sh
fails with the default channel attenuation of 60dBs.
Reduce the channel attenuation to 35dBs to approach the
previous RSSI values this tests were seeing on the DUTs with the
default modem.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-03-13 09:15:03 +01:00
Emil Gydesen 190701178d tests: Bluetooth: Shell: Add LC3 support for native_posix
The native_posix board can also be used for audio, and
thus should have LC3 support similar to the nrf5340.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-13 09:14:55 +01:00
Erik Brockhoff 1028cab11e Revert "Bluetooth: controller: use RX node piggy-back for NTF when possible"
This reverts commit 6dbc446342.

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2023-03-10 09:30:23 +01:00
Alberto Escolar Piedras ef58fef8c8 tests/bluetooth/bsim: Fail CI on build failure
After 1de363d9d5, compile.sh stopped failing on build
failures as failing jobs in the background would neither stop
the script nor have their status propagated.
Fix it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-03-09 17:23:02 +01:00
Alberto Escolar Piedras 8cf65fa282 tests: bluetooth gatt settings: Fix random test failures
These tests are creating and deleting temporary files.
But they deleted them with a wildcard that
matched each other's temporary files causing failures
when the tests run in parallel.
Avoid it by only deleting the files for each test.

As a freeby: Add the option to pass arbitrary commands to Phy from the
calling script, as with most other tests

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-03-09 15:37:13 +01:00
Szymon Janc f19e6d4811 bluetooth: tester: Use one-time advertising in GAP tests
This avoids potencial races where PTS is changing type of advertising
during tests.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-08 11:34:43 +01:00
Szymon Janc 51adfd7172 bluetooth: tester: Use define for variable length BTP commands
This makes code a bit easier to follow.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-08 11:34:43 +01:00
Szymon Janc c978a2ae05 bluetooth: tester: Add explicit functions for event and response
This make is easier to verify if proper use of BTP is maintained.
tester_rsp and tester_rsp_full will be removed eventually when
BTP is fully async.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-08 11:34:43 +01:00
Szymon Janc 06a418346a bluetooth: tester: Keep BTP command in buffer for delayed response
This allows to avoid copying data for async callbacks.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-08 11:34:43 +01:00
Szymon Janc 1e2ca26a27 bluetooth: tester: Unify BTP index handling
We always have 0 index (and occasional NONE index) so there is no
point in validating those in each handler.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-08 11:34:43 +01:00
Szymon Janc 7363d37300 bluetooth: tester: Convert PACS service to new BTP API
This makes PACS service to use new BTP command handlers API.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-08 11:34:43 +01:00
Szymon Janc 77acd8857f bluetooth: tester: Convert MESH service to new BTP API
This makes MESH service to use new BTP command handlers API.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-08 11:34:43 +01:00
Szymon Janc df5fbbcc10 bluetooth: tester: Refactor VCP BTP
Split register functions, convert to new BTP API and fix some bugs
in BTP handlers.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-08 11:34:43 +01:00
Szymon Janc 59b75401a9 bluetooth: tester: Fix IAS service registration
Make sure we don't send events if service was not registered.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-08 11:34:43 +01:00
Szymon Janc c1efda1cb1 bluetooth: tester: Cleanup BTP definitions
Cleanup and unify names and conventions in BTP headers.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-08 11:34:43 +01:00
Szymon Janc 43bf912e60 bluetooth: tester: Convert L2CAP service to new BTP API
This makes L2CAP service to use new BTP command handlers API.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-08 11:34:43 +01:00
Szymon Janc bc9df109c6 bluetooth: tester: Convert GATT service to new BTP API
This makes GATT service to use new BTP command handlers API.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-08 11:34:43 +01:00
Szymon Janc 2d53525ad2 bluetooth: tester: Convert BTP to use bt_addr_le_t
bt_addr_le_t matches BTP convention for addresses and it makes it
so much better to handle those directly from command structures.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-08 11:34:43 +01:00
Szymon Janc 79f1df9f5b bluetooth: tester: Refactor BTP handling
This changes the way of BTP commmand handlers are called. Instead of
calling functions to handle service we now provide API for registering
callbacks per command. This allows to keep common checks (size etc)
in single place for (most) commands. Also provide common buffer for
reponses forcing callbacks to handle replay in common way.

In this commit only Core and GAP services are converted. This leaves
rest of services unfuntional (but code stil compiles correctly).
Other services are converted in following commits.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-08 11:34:43 +01:00
Szymon Janc 4683fabb1e bluetooth: tester: Initialize GAP service synchronously
There is no need to initialize in asynchronous way as BTP is blocked
anyway until init is done.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-08 11:34:43 +01:00
Szymon Janc d53e48d84b bluetooth: tester: Move core service to separate file
There is no need to keep it in same file as BTP protocol handler.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-08 11:34:43 +01:00
Szymon Janc 4dfca4282d bluetooth: tester: Prefix tester BTP protocol defines
Make all BTP related defines and structures prefixed with BTP.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-08 11:34:43 +01:00
Emil Gydesen b147f86392 tests: Bluetooth: Fix VCP Vol rend standalone tests not being run
Due to a missing backslash, the VCP vol rend tests were not being run.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-08 11:07:00 +01:00
Emil Gydesen 89ef99ce44 tests: Bluetooth: Fix vocs location error strings
Some of the error strings were incorrect.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-08 11:07:00 +01:00
Aleksandr Khromykh 41814f8c3b tests: Bluetooth: Mesh: fix read access to uninitialized memory
There are a couple of places where read access to uninitialized memory
happens in new mesh-1.1 tests. Valgrind highlights them.
PR fixes them.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2023-03-08 08:58:37 +01:00
Emil Gydesen e2765d7bd5 Bluetooth: Audio: Rename bt_audio_iso to bt_bap_iso
Rename the internal bt_audio_iso struct and API to bt_bap_iso

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-07 16:21:44 +01:00
Emil Gydesen 271ff1d1a3 Bluetooth: Audio: Add new bap_lc3_preset and move macros
Added a new header file bap_lc3_preset.h which contains
the definitions of the LC3 (pre)sets defined by the
BAP spec.

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

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

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

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

Also adds the _bap_ infix to the bt_unicast_client functions.

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

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

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

This also adds the _bap_ infix for bt_unicast_server.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-07 16:21:44 +01:00
Emil Gydesen 7fc051967f Bluetooth: Audio: Add bap prefix to BAP internal files
All internal files that implement BAP now has the
bap_ prefix.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-07 16:21:44 +01:00
Pavel Vasilyev 30e30f10a9 tests: Bluetooth: Mesh: Use different sim id for mesh-1.1 tests
Use different simulation id for mesh-1.1 tests so that they don't
overwrite log files from 1.0.1 tests.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-03-07 15:50:27 +01:00
Pavel Vasilyev 8dbc5902ae tests: Bluetooth: Mesh: Send unseg msg to friend reliably
This is done to guarantee delivery of an unsegmented message from a
regular node to a friend node.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-03-07 11:12:23 +01:00
Vinayak Kariappa Chettimada 55c4084c8b Bluetooth: Controller: Fix scan window value corruption
Fix scan window value corruption due to modification of
stored ticks_window value when enabling continuous scan.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-03-07 11:12:23 +01:00
Szymon Janc 56436e5172 bluetooth: tester: Disable GATT auto-retry on security error
This is causing races with PTS WIDs. Lets explicitly handle security
elevation when asked by PTS.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-07 11:12:03 +01:00
Emil Gydesen 59a9f8a3b0 Bluetooth: Audio: Add reason to BAP stream stopped callback
Forwards the reason parameter from the ISO disconnect to
the stream stopped callback.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-07 09:44:20 +01:00
Emil Gydesen e75fc5e318 Bluetooth: Audio: Remove pac_cache from unicast_client
Removes the unused pac_pache from the unicast_client.

This moves the storing of the PAC records (in the form of
struct bt_codec) from the stack to the upper layers.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-07 09:44:10 +01:00
Emil Gydesen a8c6cdd536 tests: Bluetooth: Audio: Add missing write checks for VCP vol ctlr
There were several cases of write requests where we should
wait for the g_write_complete value to ensure that the write
request has completed.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-07 09:34:02 +01:00
Krzysztof Kopyściński 392f95705c tests: bluetooth: mesh: add Proxy Solicitation to shell
This adds commands to advertise Solicitation PDUs, configure
On-Demand Private Proxy and manage Solicitation PDU RPL.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2023-03-06 13:52:15 +01:00
Stine Akredalen 56298dff73 tests: Bluetooth: Mesh: add LCD metadata test. Refactor existing tests.
* Test that the Large Composition Data server can send a max access
payload metadata status message.
* Test that the Large Composition Data client can request large chunks
of metadata from the server, and correctly merge samples.
* Refactoring of existing LCD tests.

Signed-off-by: Stine Akredalen <stine.akredalen@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Stine Akredalen 87a3e31412 Bluetooth: mesh: added OPcode aggregator Bsim test
The test checks the Opcode aggregator (SIG) model basic behaviour.

Signed-off-by: Stine Akredalen <stine.akredalen@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Michał Narajowski 0bd0071e4a Bluetooth: Mesh: Add Opcodes Aggregator models to shell
- Add entry for client and server in composition data.
- Add Client commands to aggregate and send messages.

MESH/SR/AGG/BV-02-C requires more key slots.

Co-authored-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Pavel Vasilyev d46480c36b Bluetooth: Mesh: Add shell commands for Private Beacon Client
Add shell commands for Private Beacon Client.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Krzysztof Kopyściński e2086c22bc tests: Bluetooth: Mesh: Test SAR with slowest possible timings
Add test that sends longest possible PDU with slowest possible timings
and default retransmission values.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2023-03-06 13:52:15 +01:00
Stine Akredalen 37386552d5 tests: Bluetooth: Mesh: added SAR stress test
Test that a maximum length SDU can be processed with SAR
with "stressed" transmitter and receiver configurations.

Signed-off-by: Stine Akredalen <stine.akredalen@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Michał Narajowski b5d6733d53 Bluetooth: Mesh: Add Transport SAR Configuration models to shell
Add Transport SAR Configuration models to shell.

Co-authored-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Michał Narajowski dd59a45c65 Bluetooth: Mesh: Transport SAR Configuration
Add support for:
- SAR Configuration Client and Server models
- Transport SAR configuration states
- Using SAR Transmitter/Receiver states in segmentation
and reassembly process.

Bsim tests fixes:
- Fix failing replay attack test. The replay attack test doesn't
consider retransmission attempts at the transport layer. When
retransmission happens, SeqNums get increased and the test logic
doesn't work anymore. The simplest fix would be to disable
retransmissions at the transport layer.
- Add device synchronization API to synchronize transport va test.
Device configuration may take different time on transmitter and
receiver. Add synchronisation barrier between devices.
- Fix msg_frnd test. Timing in transport sar behavior has been
changed, which affected test_friend_msg test. Now acknowledgments
are sent much faster and this needs to be considered in the test.
- Fix unicast_low_lat test. Increase number of retransmission
attempts when long segmented message is sent.
- Reduce timeout in kr_old_key test.
- Relax SAR RX state configuration in DFU and BLOB tests.

Co-authored-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Co-authored-by: Anders Storrø <anders.storro@nordicsemi.no>
Co-authored-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Stine Akredalen 2c1abb61b3 tests: Bluetooth: mesh: added LCD bsim test
Testing the basic behaviour of the Large Composition Data model.

Signed-off-by: Stine Akredalen <stine.akredalen@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Michał Narajowski 8a60dfcd51 shell: Add Large Composition Data Server
- Adds Large Comp Data Server and Client
- Defines some dummy metadata for Health Server

Co-authored-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Pavel Vasilyev 316d7fcd57 tests: Bluetooth: Mesh: Test Node Composition refresh with settings
Test Node Composition Refresh procedure with persistence settings.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Pavel Vasilyev 89c01e8686 tests: bluetooth: mesh: Implement robustness test for NPPI procedures
Test Dev Key Refresh, Node Composition Refresh and Node Address Refresh
procedures for robutness.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Pavel Vasilyev bfc618dc0b tests: Bluetooth: Mesh: Test reprovisioning through RPR models
Test that Remote Provisioning models can re-provision a remote node
multiple times.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Trond Einar Snekvik f7f3241628 Bluetooth: Mesh: Shell support for remote provisioning
Adds commands in the mesh shell for remote provisioning client
operation, including scanning, provisioning and reprovisioning.

Co-authored-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Trond Einar Snekvik 3c185e1764 Bluetooth: Mesh: Remote provisioning
Adds remote provisioning models rpr_srv and rpr_cli, and exposes them as
a bearer for the provisioning process.

The remote provisioning models provide the following features:
- Remote provisioning of new devices, using a remote provisioning server
  as a proxy.
- Reprovisioning of existing devices, generating a new device key and
  changing addresses and composition data.

Co-authored-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Co-authored-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Pavel Vasilyev 341cbfb3eb tests: Bluetooth: Mesh: Add tests for BLOB Transfer in Pull mode
This commit adds several BabbleSim tests for BLOB transfer:
- A sanity test checking that BLOB Transfer completes successfully in
both, Push and Pull modes that runs transfer for 4 targets
- blob_cli_trans_resume test for Pull mode
- Test checking that BLOB client continues BLOB transfer if one of
targets times out while sending chunks.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Pavel Vasilyev 435ad72147 tests: Bluetooth: Mesh: Add distributor self update tests
Add a test where distributor is a single target and performs self
update. Add a test where distributor performs self update with multiple
targets.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Pavel Vasilyev 38c5042e82 tests: bluetooth: mesh: Check DFU Client persistency
Check that DFU client continues DFU procedure as long as there is at
least one active target.

Co-authored-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Anders Storrø fa7edc576a Tests: Bluetooth: Mesh: BLOB cli no response
- Tests that BLOB Client suspends if no target responds to Block get.
- Tests that BLOB Client transfer ends if no target responds to Xfer
  get.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Anders Storrø 40ff3743ea Tests: Bluetooth: Mesh: BLOB cli transfer persist
Tests that BLOB Client continues the Push BLOB Transfer procedure
as long as there is at least one active target.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Pavel Vasilyev 4c2c1fe9d1 tests: bluetooth: mesh: Test confirm step in DFU with different effects
This commit implements the following tests:
- Test that DFU finishes successfully with all different effects;
- Test that DFU fails at confirm step with all different effects;

Co-authored-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Anders Storrø cb2bc394df Tests: Bluetooth: Mesh: BLOB cli push & pull trans resume
Add bsim test for resuming push & pull mode transfer on the BLOB client
after BLOB server has been suspended during initial attempt.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Anders Storrø 7e135e57db Tests: Bluetooth: Mesh: BLOB cli broadcast unicast
Add bsim test using unicast addr for broadcast API of the BLOB client
model.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Anders Storrø 47446a22f1 Tests: Bluetooth: Mesh: BLOB cli ret caps suspend
Add bsim test for suspending retrieve capabilities procedure of the BLOB
client model.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Anders Storrø 21184c13f0 Tests: Bluetooth: Mesh: BLOB cli mod broadcast API
Add bsim test for broadcast API of the BLOB client model.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Anders Storrø c4a8b55752 Tests: Bluetooth: Mesh: BLOB cli mod ret caps test
Add bsim test for retrieve capabilities of the BLOB client model.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Omkar Kulkarni 644589849a Bluetooth: Mesh: Update mesh shell's config
This updates some of the defaults in the mesh shell's config to allow
various Mesh 1.1 models to be used in the shell.

EPA provisioning and DFU requires much larger multisegment messages,
therefore support for maximum sized message is enabled by default and
stack sizes are increased working values.

Additionally, log buffer is increased and thread sleep time is reduced
to avoid dropping of useful logs.

Signed-off-by: Omkar Kulkarni <omkar.kulkarni@nordicsemi.no>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Trond Einar Snekvik 417d328796 Bluetooth: Mesh: DFU and BLOB models in shell
Adds conditional support for the BLOB and DFU models in the mesh shell.
Additionally creates a dummy BLOB stream for testing.

Co-authored-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Co-authored-by: Anders Storrø <anders.storro@nordicsemi.no>
Co-authored-by: Ludvig Samuelsen Jordet <ludvig.jordet@nordicsemi.no>
Co-authored-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
Co-authored-by: Mia Koen <mia.koen@nordicsemi.no>
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Aleksandr Khromykh ffddd9ffc0 Bluetooth: Mesh: enhanced provisioning authentication
Implementation of the enhanced provisioning authentication (EPA)
that is based on SHA256 and HMAC security algorithms.
OOB authentication mandates EPA usage.

Co-authored-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Aleksandr Khromykh a9df7e19a1 tests: Bluetooth: Mesh: run bsim mesh on both v1.0.1 and v1.1
Add ability to run bsim mesh for both ble mesh versions
v1.0.1 and v1.1

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-03-06 13:52:15 +01:00
Szymon Janc e8e66c85ef bluetooth: tester: Enable unicast server by default
Default config should have all bells and whistles enabled to minimize
number of overlays needed in autopts.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-06 13:51:55 +01:00
Erik Brockhoff 6dbc446342 Bluetooth: controller: use RX node piggy-back for NTF when possible
When possible re-use the already allocated RX node for notifications.
Store (retain) RX node and Link element on RX if NTF could occur.
Pass link element to LLCP (ull_cp_rx()) together with RX node.
New RX node type RETAIN introduced to signal retention

When no RX node is available allocate one and hold off TX on procedures
until such time that a node is available for NTF.

In case waiting for NTF buffer avail is needed, allocate and store TX
node to use for TX once NTF becomes available.

CIS Established (incl. timeout handling) is now handled entirely as a
specific event driven by ull_conn_iso - ie removal of procedure check
of cis->established and cis->expire, as this is doubling mechanism
in the conn_iso context.

Unit test and helpers updated to handle new node type.
Function ull_cp_release_ntf() was used only in unit test, so moved to
helper context.
Updating release_ntf to handle the fact that with piggy-backing in test
context the node used for NTF can be from two different memory pools

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2023-03-06 09:35:10 +01:00
Aleksandr Khromykh ee3d089e37 tests: Bluetooth: Mesh: remove nrf51dk* and microbit for mesh tests
nrf51 has been discontinued. There is no reason to support
ble mesh tests for nrf51 DK platform. As alternative support
of nrf52840 has been added if there wasn't before.

Also, microbit lacks significant amount of RAM (about 800 bytes)
to build mesh test.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2023-03-03 14:08:24 +01:00
Emil Gydesen 6ecc6c3cec tests: Bluetooth: Audio: Add start stream to unicast tests
Add support for starting streams as the unicast client, which
will connect the CISes.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-03 11:00:48 +01:00
Jamie McCrae 0bad35de45 samples and tests: Use non-environmental zephyr base variable
This drops using the environmental part when referencing ZEPHYR_BASE
as the environment value does not have to be set and, in most cases,
is no longer set at all.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-03 10:49:10 +01:00
Emil Gydesen b1415c57e1 tests: Bluetooth: Add missing encryption value for CAP broadcaster
The field was uninitialized, causing the test to fail.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-02 13:49:07 +01:00
Emil Gydesen a73d2fc1ff tests: Bluetooth: Add VCP Vol ctlr invalid BSIM tests
Call all VCP Vol ctlr APIs with invalid values and ensure that
they return an error.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-02 10:56:27 +01:00
Emil Gydesen 63e055b165 tests: Bluetooth: VCP: Move vol ctlr tests into smaller functions
Move the volume controller test steps into smaller functions for more
reusability and easier to expand with invalid test steps.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-02 10:56:27 +01:00
Emil Gydesen 9e23eb6a4b tests: Bluetooth: Add VCP Vol rend invalid BSIM tests
Call all VCP Vol rend APIs with invalid values and ensure that
they return an error.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-02 10:56:27 +01:00
Emil Gydesen 92530778e2 tests: Bluetooth: VCP: Move vol rend tests into smaller functions
Move the volume renderer test steps into smaller functions for more
reusability and easier to expand with invalid test steps.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-03-02 10:56:27 +01:00
Andries Kruithof a395093acb Tests: bluetooth: controller: add correct number of max connections
The number of connections for the tx_buffer_alloc needs to be at least 3
For one of the tests it was set to default 1, which leads to unspecified
behaviour.

This is fixed by setting the maximum nr. of connections to 4

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2023-03-02 10:01:51 +01:00
Jamie McCrae af78cbdc99 samples and tests: Add REQUIRED to Zephyr find_package call
Adds REQUIRED to samples and tests for finding the zephyr package
to align all samples and tests with the same call and parameters.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2023-03-02 09:58:27 +01:00
Emil Gydesen d192c1b1e4 Tests: Bluetooth: Fix missing CAP broadcast packing field
Set uninitialized packing field in the broadcast create
parameter.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-02-28 10:29:52 +01:00
Emil Gydesen 6760b9e68b Tests: Bluetooth: Add delay between IAS client write operations
Since there is no way for the client to read or get notified about
the state, we insert a delay between each operation to allow the
server to handle the alerts before getting a new alert request.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-02-27 13:20:33 +01:00
Emil Gydesen 29eec51dc3 Tests: Bluetooth: Fix bad err check in ias_test.c
The error check was == 0 where it should have been != 0.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-02-27 13:20:33 +01:00
Jonathan Rico 02edcd6494 Bluetooth: host: calculate GATT DB hash on settings load
Prevent race condtions between the stack and the low-priority thread by
calculating the hash (and acting on it, e.g. for marking peers
change-aware, sending SC indications, etc) in the settings_load() context.

Fixes #54773

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-02-27 10:48:15 +01:00
Jonathan Rico b3671666e1 Bluetooth: host: clear ATT pending flag on failure to send
`ATT_PENDING_SENT` wasn't cleared when L2CAP reported an error when sending
the packet. This resulted in the channel being unusable for ever, since we
only clear that bit on a response (that will never be sent).

Found when setting `CONFIG_SYS_CLOCK_TICKS_PER_SEC=32768` in the
`notify_multiple` test. The kicker was the bug didn't manifest when EATT
wasn't enabled:
- we were queuing two unsubscribes back to back in the test
- on UATT we have to wait for a req-rsp pair before enqueuing a new one
- on UATT we only have one channel anyways

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-02-27 10:32:13 +01:00
Andries Kruithof 226c99b455 tests: bluetooth: add prefix to exposed API
In ull_llcp* some functions used in unittesting did not have
the llcp_ prefix
Although this is not a big issue since they are only used when
testing the module this commit adds the prefix so that we
have a more consistent naming

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2023-02-24 11:46:39 +01:00
Andries Kruithof e6ba1eed90 bluetooth: controller: update unittests for LLCP to use proper ZTEST API
Update unittests for the following areas/controll procedures
- API
- collision handling
- invalid PDUs
- unsupported procedures
- buffer allocation
- TX queue
- Data Length Update
- PHY update
- Encryption
- Ping
- Version
- Channel map update
- Min. used channels
- Connection update
- SCA
- Terminate connection
- CTE request
- CIS create
- CIS terminate

Also moved the internal API tests from the ull_llcp* files
to the proper unittest C-file

Unused files  are removed

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2023-02-24 11:46:39 +01:00
Jonathan Rico 219e8b3b1a test: Bluetooth: split compile.sh
Split into layers for now, we can have more granular splits later.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-02-23 14:35:05 +01:00
Jonathan Rico 2a9eda226b tests: Bluetooth: restructure bsim_bt directory
This commit separates each test by layer level.

Obviously the tests will run the whole stack, but they should be separated
by which component/layer they intend on testing.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-02-23 14:35:05 +01:00
Théo Battrel a95811e677 Bluetooth: tests: Add tests for Bluetooth privacy
Add tests to check the following aspects of the Bluetooth privacy feature:

- On device privacy mode, scanner shall accept advertising packets from
  peer with any address type. That, even if they have previously exchanged
  IRK;
- After devices have exchanged IRK, they must correctly resolve RPA.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-02-23 09:08:25 +01:00
Théo Battrel 7753f77461 Bluetooth: Add test for the CCM function
Add a test for the cryptographic function CCM.

The tests data are from the
[RFC3610](https://www.rfc-editor.org/rfc/rfc3610).

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-02-22 12:19:39 +01:00
Alberto Escolar Piedras e20862f0e8 tests: bsim_bt: edtt tests: Use latest EDTT without the bridge
The latest EDTT does not use the bridge anymore.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-02-22 12:17:42 +01:00
Emil Gydesen 928e5bbcf0 Bluetooth: Audio: CAP inittiator broadcast stop procedure
Implemented support for stopping and deleting a
CAP broadcast source.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-02-20 13:24:34 +01:00
Emil Gydesen 9d0ec99315 Bluetooth: Audio: CAP initiator broadcast metadata update
Add support for the update metadata for broadcast audio
procedure.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-02-20 13:24:34 +01:00
Emil Gydesen a64281d904 Bluetooth: Audio: Expand CAP tests for CAP broadcast
Expand the CAP tests to also have a test case for CAP
acceptor and CAP initiator broadcast, which is heavily
inspired from the BAP broadcast tests.

The tests only tests that a broadcast source can be created
with the CAP API and that the metadata is correct.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-02-20 13:24:34 +01:00
Magdalena Kasenberg 69a6ead783 bluetooth: tester: Add PACS test handling
Add support for testing Published Audio Capabilities Service server
with PTS.

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
2023-02-20 11:19:42 +01:00
Krzysztof Kopyściński f31b3f03ad Tests: Bluetooth: Tester: improve stability by Flow Control and UARTE
Some tests may be unstable because of missing data from BTP frames.
Enabling Flow Control fixes the issue, but seems to work reliably
only along with UARTE.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2023-02-20 09:55:09 +01:00
Troels Nilsson c57095740f Tests: Bluetooth: Update EDTT and add new test cases
Updates EDTT to newest version and adds the new test cases

Update _controller_tests_inner.sh to support using packet inspection
and the new low-level device feature in EDTT

Build configs for the BSim test apps updated to support extended
advertising

Signed-off-by: Troels Nilsson <trnn@demant.com>
2023-02-20 09:54:54 +01:00
Alexandre Dauphinais cd95f1cf88 tests: Bluetooth: bsim: Added tests for RPA
This adds two tests to ensure the resolvable
private address is rotated for the peripheral
and central after their respective timeout.

Signed-off-by: Alexandre Dauphinais <alexandre.dauphinais@nordicsemi.no>
2023-02-20 09:51:09 +01:00
Magdalena Kasenberg 460ca5bac8 tests: bsim: audio: Add example usage of foreach ase
and get ase info to verify its correctness in CI.

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
2023-02-20 09:49:09 +01:00
Alberto Escolar Piedras 70830b5b88 tests: bsim_bt: audio: Do not reuse sim_ids
Even if the tests are not run in parallel
do not reuse sim_ids as that overwrites the result data
preventing re-running in check mode, and inspecting
the test results.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-02-19 20:59:04 -05:00
Jonathan Rico 3ad452663e tests: Bluetooth: reproduce gatt settings bug
Reproduce #54470.

- client connects
- client writes to CF & CCC
- client bonds
- server reboots

After this, we would expect to have the CCC and CF values be correctly
restored from settings but they are not.

Additionally add the same test with BT_PRIVACY=y, which shows that the
feature is broken with that config (fixed in a subsequent commit).

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-02-16 00:21:07 +09:00
Jonathan Rico 67236de058 Bluetooth: host: add test for some GATT settings bugs
This test is designed to check the soundness of GATT caching across
reboots.

It will fail if the fixes for #54173 and #54172 are not present.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-02-13 12:55:02 +01:00
Pierce Lowe 205a077118 tests: bluetooth: added bsim test for longer per adv data
Added a bsim_bt host test to test the handling of periodic adv
report data received across multiple packets

Signed-off-by: Pierce Lowe <pierce.lowe@nordicsemi.no>
2023-02-09 13:12:24 +01:00
Lars Knudsen 333d48b56d Bluetooth: has: Fix uninitialized bt_has_register_param
Zero initialize has_param in BSIM test.
Also, specify all bt_has_register_param members in hap_ha sample.

Signed-off-by: Lars Knudsen <larsgk@gmail.com>
2023-02-08 08:14:23 -08:00
Emil Gydesen bebb98efb1 tests: Bluetooth: Unicast client BSIM used group size as stream_cnt
Instead of setting the stream_cnt based on the number
of streams configurer, we use the number of streams actually
added to the group, and then configure that amount.

This should ensure that we do not try to configure any
streams that we have not already added to the group.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-02-08 01:11:03 +09:00
Emil Gydesen b18fcdbade tests: Bluetooth: Expand unicast audio BSIM tests
Expands the unicast audio babblesim tests up until
the start procedure (which is not yet supported by the
babblesim). This increases the test coverage of the unicast
implemetations.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-02-08 01:11:03 +09:00
Emil Gydesen 54d31d0a13 tests: Bluetooth: Unicast client remove CIG guards
The unicast client will now actually create the CIG in the
test regardless of the `CONFIG_BT_CTLR_CENTRAL_ISO` value.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-02-08 01:11:03 +09:00
Andries Kruithof 5329319d7a Tests: bluetooth: Fix failing df unittests
Due to recent refactoring following unittests are failing:
tests/bluetooth/df/*
tests/bluetooth/ctrl_user_ext

This commit fixes these by adding the include files containing the
missing type definitions

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2023-02-02 17:59:45 +01:00
Jonathan Rico c2e4029aad Bluetooth: host: resume advertising even when BT_EXT_ADV=y
When using extended advertising commands, the advertising set is not
considered to be over until we receive `BT_HCI_EVT_LE_ADV_SET_TERMINATED`
from the controller. Only then do we clear the `BT_ADV_ENABLED` flag.

The problem is that `bt_le_adv_resume` is called on connection established,
which can happen before adv set terminated, and in that case it will
early-return because `BT_ADV_ENABLED` is still set.

This change triggers `bt_le_adv_resume` when we get
`BT_HCI_EVT_LE_ADV_SET_TERMINATED`.

Fixes #53048

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2023-02-02 17:05:48 +02:00
Vinayak Kariappa Chettimada 5e3117d44e tests: Bluetooth: Enabled Controller Connected ISO support
Enable Controller Connected ISO support in bsim_bt_audio
test.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-01-27 23:04:45 +09:00
Vinayak Kariappa Chettimada cd2796e047 Bluetooth: Controller: Refactor ll_setup_iso_path
Refactor ll_setup_iso_path to support Synchronous Receiver
and Connected ISO to be built together.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-01-27 23:04:45 +09:00
Vinayak Kariappa Chettimada 8cf58edb8b Bluetooth: Controller: Use instant_latency to detect event skipped
Use instant_latency at the CIG start event count to detect
skipped connection event around the instant. In the future
add implementation to compensate for skipped ACL connection
event and adjust the CIS event count at CIG start.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-01-27 23:04:45 +09:00
Vinayak Kariappa Chettimada aba5176340 Bluetooth: Controller: Fix CIG offset and add time reservations
Fix CIG offset such that it follows after the ACL connection
time reservation to avoid overlapping.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-01-27 23:04:45 +09:00
Vinayak Kariappa Chettimada 6f0b6ec90b Bluetooth: Controller: Fix ISO Buffer allocation for SDU fragmentation
Fix ISO Tx Buffer allocation counts considering required SDU
fragmentations.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-01-27 23:04:45 +09:00
Vinayak Kariappa Chettimada 4d3f8697a3 Bluetooth: Controller: Make PDU octet3 vendor specific
Make Data, ISO, BIS and CIS PDU structure's octet 3 vendor
specific.

This will allow vendors not supporting the octet 3 or
CTEInfo (8 bits) to save 1 octet in their PDU structures.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-01-26 13:25:11 +01:00
Vinayak Kariappa Chettimada 117bdbbf64 Bluetooth: Controller: Use len instead of length in PDU structs
To be consistent in naming as len instead of length in PDU
struct definitions.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-01-26 13:25:11 +01:00
Vinayak Kariappa Chettimada cc1f937d61 Bluetooth: Fix endianness of cryptographic toolbox function h8
Convert endianness of supplied parameters before calculating
the AES-CMAC. Bluetooth stores values in little-endian and
crypto traditionally operates on big-endian storage.

Relates to commit e9c542ab5b ("Bluetooth: Add the
cryptographic toolbox function h8").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-01-26 13:25:11 +01:00
Hein Wessels 1480b2083e tests: bluetooth: edtt_ble_test_app: NATIVE_TASK has no return value
Remove the return value of edtt_stop because it's ignored by NATIVE_TASK.

Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-01-26 09:30:36 +01:00
Morten Priess 921846731e Bluetooth: controller: Hotfix auto-merge error
Remove introduced duplicate mock function.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2023-01-24 15:43:36 +01:00
Vinayak Kariappa Chettimada c104fda34f Bluetooth: Controller: Fix filter accept list and privacy default
Fix filter accept list and privacy feature Kconfig default
based on whether host has them enabled.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-01-24 15:13:36 +01:00
Vinayak Kariappa Chettimada 00dbf6188c Revert "Bluetooth: Controller: Fix filter accept list and privacy default"
This reverts commit 59eef60665.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-01-24 15:13:36 +01:00
Alberto Escolar Piedras 1e7d2c83aa tests: bsim_bt compile: Provide more info during errors
As we are now compiling in parallel all apps, build errors
are not anymore next to the compile line, so let's tell
developers for app we are printing the build output
to ease debugging.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-01-24 14:20:33 +01:00
Morten Priess a982c9f9f6 Bluetooth: controller: Start CIG immediately if instant is next event
To be able to timely start the first CIS/CIG, if the requested instant
is the next connection event, call ull_peripheral_iso_start directly
from rp_cc_state_wait_rx_cis_ind instead of waiting for next time
through the state machine.

To enable ULL/LLL to prevent adding latency when LLCP is waiting for
instant, local- and remote procedures with instant now expose a function
for checking this state.

Fixed event_counter function to prevent one-off in RX path. Unified to
use single function ull_conn_event_counter.

Fixed LLCP unit tests and added new mock function.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2023-01-24 11:09:51 +00:00
Emil Gydesen 64f3bccdb7 tests: Bluetooth: Add per_adv sync with privacy
Add test where privacy is enabled and where
the two devices are bonded and have exchanged IRK
before doing the periodic advertising sync.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-01-24 09:43:59 +01:00
Emil Gydesen 11945688fb tests: Bluetooth: Add per_adv connection tests
Expand the periodic advertising tests with connections,
to verify that two devices can simultaneously be connected
and keep a periodic advertising sync.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-01-24 09:43:59 +01:00
Emil Gydesen 2db5d4d790 tests: Bluetooth: Add per_adv BSIM tests
Adds a test suite exclusively for testing
periodic advertising sync.

The first test added is a simple test that does a periodic
advertising sync, and passes afterwards.

The test suite will be expanded with testing PA syncs
with PAST (both from remote and local transfer) as well
as privacy handling.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-01-24 09:43:59 +01:00
Aleksandr Khromykh 83207d4a9a tests: Bluetooth: Mesh: use overlays for mesh bsim
Add the overlays usage for bsim mesh configurations instead of
multiple configurations that duplicate each other a lot.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2023-01-24 09:43:38 +01:00
Szymon Czapracki 7941a88121 bluetooth: tester: Add VCP & IAS test handling
This commit introduces Volume Control Profile and
Immediate Alert Service into btp.

VCP includes:
Audio Input Control Service
Volume Control Service
Volume Offset Control Service

Signed-off-by: Szymon Czapracki <szymon.czapracki@codecoup.pl>
2023-01-20 16:12:15 +01:00
Andries Kruithof f0c610ce0d bluetooth: controller: update unittests for improved ZTEST framework
Update the unittests for feature exchange to use the new ZTEST API
Here we only update the feature exchange procedure. The remaining
unittests will be done in a next PR

Mocks, helper routines and the Unit Under Test are splitted out as
a library instead of adding them to the file list

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2023-01-20 14:35:08 +01:00
Vinayak Kariappa Chettimada d6c3e04eb8 Bluetooth: Controller: Central maximum data PDU size time spacing
Use the maximum data PDU size time reservation space
considering the Data length could be updated from default
27 bytes to maximum support size.

If maximum time reservation is disabled then time space
reservation corresponding to the default data length at the
time of the start/enable of Central role is used.

Note, currently this value is only used to space multiple central
connections and not for actual ticker time reservations.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-01-20 12:16:43 +01:00
Vinayak Kariappa Chettimada 680e29dd0e Bluetooth: Controller: legacy: Fix conn param request to be cacheable
Fix connection parameter request  procedure to be cacheable
if a remote control procedure is in progress.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-01-20 12:16:43 +01:00
Andries Kruithof e7d60e3ed6 Bluetooth: controller: fix post DLE/PHY update event length
Fix the controller implementation to perform connection
event length reservation based on the completed Data Length
Update and/or PHY Update Procedure.

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2023-01-19 11:18:51 +01:00
Andrei Emeltchenko 5bdb1faffe tests: bluetooth: Fix memset() wrong buffer size
Use correct structure in sizeof().

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-01-19 10:15:40 +01:00
Mariusz Skamra f30eb1b9fb tests: bsim: audio: Create unicast group prior stream configuration
This updates the test to create the unicast group with non-configured
streams.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-01-18 09:56:52 +01:00
Mariusz Skamra 36058480e7 Bluetooth: audio: Improve stream coupling for CIS as the unicast client
Allow  the streams to be paired when creating unicast group. This will
allow to reuse the same ISO for the paired streams.

Fixes: #51796
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-01-18 09:56:52 +01:00
Ahmed Moheb 5eb19ab352 tests: bluetooth: host: Add UT for bt_le_oob_get_sc_data()
Unit test project for bt_le_oob_get_sc_data().
This part of subsys/bluetooth/host/id.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-01-17 13:13:28 +01:00
Ahmed Moheb 6c7a5aa930 tests: bluetooth: host: Add UT for bt_le_oob_set_sc_data()
Unit test project for bt_le_oob_set_sc_data().
This part of subsys/bluetooth/host/id.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-01-17 13:13:28 +01:00
Ahmed Moheb 7abdb2c9b2 tests: bluetooth: host: Add UT for bt_le_oob_set_legacy_tk()
Unit test project for bt_le_oob_set_legacy_tk().
This part of subsys/bluetooth/host/id.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-01-17 13:13:28 +01:00
Ahmed Moheb 811bdf8986 tests: bluetooth: host: Add UT for bt_le_ext_adv_oob_get_local()
Unit test project for bt_le_ext_adv_oob_get_local().
This part of subsys/bluetooth/host/id.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-01-17 13:13:28 +01:00
Ahmed Moheb e1d0df2bb3 tests: bluetooth: host: Add UT for bt_le_oob_get_local()
Unit test project for bt_le_oob_get_local().
This part of subsys/bluetooth/host/id.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>

# Conflicts:
#	tests/bluetooth/host/id/CMakeLists.txt
2023-01-17 13:13:28 +01:00
Ahmed Moheb ae32ce93d1 tests: bluetooth: host: Add UT for bt_br_oob_get_local()
Unit test project for bt_br_oob_get_local().
This part of subsys/bluetooth/host/id.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-01-17 13:13:28 +01:00
Ahmed Moheb 9338965c58 tests: bluetooth: host: Add UT for bt_id_set_adv_own_addr()
Unit test project for bt_id_set_adv_own_addr().
This part of subsys/bluetooth/host/id.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-01-17 13:13:28 +01:00
Ahmed Moheb b31a4b3f70 tests: bluetooth: host: Add UT for bt_id_set_scan_own_addr()
Unit test project for bt_id_set_scan_own_addr().
This part of subsys/bluetooth/host/id.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-01-17 13:13:28 +01:00
Ahmed Moheb 15748f9a79 tests: bluetooth: host: Add UT for bt_id_set_create_conn_own_addr()
Unit test project for bt_id_set_create_conn_own_addr().
This part of subsys/bluetooth/host/id.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-01-17 13:13:28 +01:00
Ahmed Moheb 61c2f2e08a tests: bluetooth: host: Add UT for bt_id_delete()
Unit test project for bt_id_delete().
This part of subsys/bluetooth/host/id.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-01-17 13:13:28 +01:00
Ahmed Moheb 1f37971e08 tests: bluetooth: host: Add UT for bt_id_reset()
Unit test project for bt_id_reset().
This part of subsys/bluetooth/host/id.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-01-17 13:13:28 +01:00
Ahmed Moheb 7456b85e7e tests: bluetooth: host: Add UT for bt_id_get()
Unit test project for bt_id_get().
This part of subsys/bluetooth/host/id.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-01-17 13:13:28 +01:00
Ahmed Moheb e6356c2770 tests: bluetooth: host: Add UT for bt_id_del()
Unit test project for bt_id_del().
This part of subsys/bluetooth/host/id.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-01-17 13:13:28 +01:00
Ahmed Moheb af92e7f9d1 tests: bluetooth: host: Add UT for bt_id_add()
Unit test project for bt_id_add().
This part of subsys/bluetooth/host/id.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>

# Conflicts:
#	tests/bluetooth/host/id/CMakeLists.txt
2023-01-17 13:13:28 +01:00
Ahmed Moheb 10001af2b9 tests: bluetooth: host: Add UT for bt_id_adv_random_addr_check()
Unit test project for bt_id_adv_random_addr_check().
This part of subsys/bluetooth/host/id.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-01-17 13:13:28 +01:00
Ahmed Moheb 05ebdbbabc tests: bluetooth: host: Add UT for bt_id_scan_random_addr_check()
Unit test project for bt_id_scan_random_addr_check().
This part of subsys/bluetooth/host/id.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>

# Conflicts:
#	tests/bluetooth/host/id/CMakeLists.txt
2023-01-17 13:13:28 +01:00
Ahmed Moheb 053a7fdd37 tests: bluetooth: host: Add UT for bt_id_set_adv_random_addr()
Unit test project for bt_id_set_adv_random_addr().
This part of subsys/bluetooth/host/id.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-01-17 13:13:28 +01:00
Ahmed Moheb 7cf0ded736 tests: bluetooth: host: Add UT for bt_id_set_adv_private_addr()
Unit test project for bt_id_set_adv_private_addr().
This part of subsys/bluetooth/host/id.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>

# Conflicts:
#	tests/bluetooth/host/id/mocks/adv.c
#	tests/bluetooth/host/id/mocks/adv.h
2023-01-17 13:13:28 +01:00
Ahmed Moheb 4e6a92408e tests: bluetooth: host: Add UT for bt_id_set_private_addr()
Unit test project for bt_id_set_private_addr().
This part of subsys/bluetooth/host/id.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>

# Conflicts:
#	tests/bluetooth/host/id/CMakeLists.txt
2023-01-17 13:13:28 +01:00
Ahmed Moheb 9a0f610652 tests: bluetooth: host: Add UT for bt_lookup_id_addr()
Unit test project for bt_lookup_id_addr().
This part of subsys/bluetooth/host/id.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>

# Conflicts:
#	tests/bluetooth/host/id/CMakeLists.txt
2023-01-17 13:13:28 +01:00
Ahmed Moheb abb7e8bfc2 tests: bluetooth: host: Add UT for bt_id_init()
Unit test project for bt_id_init().
This part of subsys/bluetooth/host/id.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-01-17 13:13:28 +01:00
Ahmed Moheb 28b14f7936 tests: bluetooth: host: Add UT for bt_setup_random_id_addr()
Unit test project for bt_setup_random_id_addr().
This part of subsys/bluetooth/host/id.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-01-17 13:13:28 +01:00
Ahmed Moheb 7df78a3785 tests: bluetooth: host: Add UT for bt_id_create()
Unit test project for bt_id_create().
This part of subsys/bluetooth/host/id.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-01-17 13:13:28 +01:00
Ahmed Moheb 8949f3da81 tests: bluetooth: host: Add UT for bt_setup_public_id_addr()
Unit test project for bt_setup_public_id_addr().
This part of subsys/bluetooth/host/id.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-01-17 13:13:28 +01:00
Ahmed Moheb 60345c1ddc tests: bluetooth: host: Add UT for bt_keys_update_usage()
Unit test project for bt_keys_update_usage().
This part of subsys/bluetooth/host/keys.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-01-17 13:13:02 +01:00
Ahmed Moheb 5768c45a9d tests: bluetooth: host: Add UT for bt_keys_store()
Unit test project for bt_keys_store().
This part of subsys/bluetooth/host/keys.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2023-01-17 13:13:02 +01:00
Théo Battrel 75c86730ee Bluetooth: Add BabbleSim test for MTU Update sample
Test that the Central receive the rigtht data from the Peripheral
notification.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-01-16 10:01:27 +01:00
Szymon Czapracki 35bd427927 Bluetooth: audio: Add configurable PACS supported contexts
Add the ability to change supported contexts in PACS.
Enhance the context command in the shell module to make it configurable.

Signed-off-by: Szymon Czapracki <szymon.czapracki@codecoup.pl>
2023-01-13 13:47:19 +01:00
Andries Kruithof 0239a2cf88 tests: Bluetooth: update unittests for Audio codecs
An LE controller shall no longer support
HCI_Read_Local_Supported_Codecs [v1]
The code in subsys/bluetooth/controller was updated for this
behaviour, and this commit updates the unittest

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2023-01-13 09:43:18 +01:00
Andries Kruithof 5f5f79486b tests: Bluetooth: update unittests for DF
Due to some refactoring the unittests for direction finding
started failing. This commit fixes the failing unittests

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2023-01-13 09:43:18 +01:00
Pavel Vasilyev 69a0058578 tests: bluetooth: mesh: Add separate assert macro with message support
ASSERT_OK macro is confusing as it accepts additional arguments, but
don't use them. This commit removes the confusion by making ASSERT_OK
macro accept only one argument. An additional macro ASSERT_OK_MSG is
added that mandates a format string that will be printed and optionally
arguments for the format string.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-01-11 10:47:06 +00:00
Pavel Vasilyev abce1b9e42 tests: bluetooth: mesh: extend friend queue overflow test
Extend Friend Queue overflow test by overflow with segmented messages:
- when a segmented message is preempted by an unsegmented message;
- when a segmented message is preempted by another segmented message;

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-01-11 10:47:06 +00:00
Aleksandr Khromykh 8a58e86d42 tests: Bluetooth: Mesh: create reduced legacy configuration
mesh_shell application has been included recently some set new
abilities that added more functionality for testing.
That caused the application cannot fit in some supported plarforms
like qemu_cortex_m3. The reduced legacy configuration has been
added to fit stack into it. This platform is used in CI.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2023-01-11 09:39:34 +01:00
Emil Gydesen a9071b361f Bluetooth: Audio: Add missing codec debug Kconfig
Add misisng codec debug Kconfig for the codec.c file.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-01-09 15:27:28 +00:00
Erik Brockhoff 2f61771948 Bluetooth: controller: consider host ctrl feature bits in feat exchange
Host controlled feature bits were not considered in feature exchange
procedure. This is fixed.

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2023-01-08 19:48:38 +01:00
Emil Gydesen 8d86fa0125 Bluetooth: Audio: Add support for encrypted broadcast
Add support for adding a broadcast code to the broadcast
source.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-01-06 10:35:25 +00:00
Fabio Baltieri f5b4acac57 yamllint: indentation: fix files in tests/
Fix the YAML files indentation for files in tests/.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-04 14:23:53 +01:00
Emil Gydesen 1e5be3f020 Bluetooth: Audio: Fix issue with unicast client src/snk ASE count
If either the sink or source ASE count was zero, calls to
ARRAY_SIZE(srcs) or ARRAY_SIZE(sinks) would cause a build warning.

The arrays should actually not be there at all if the respective
ASE count was 0, as that is just a waste of memory. The arrays,
and all uses of them, have been properly guarded.

This also adds a build assert to ensure that at least one
of them is non-zero, and that we also test building either
of them with the value 0.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-01-04 10:35:14 +01:00
Emil Gydesen b9a6e04cb3 Bluetooth: Audio: Add AUDIO_ISO debug logging
Add a logging module for the audio_iso.c file, to enable
logging for that.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-01-04 10:35:14 +01:00
Fabio Baltieri 7dd902d035 yamllint: fix all yamllint comments-indentation errors
Fix all comments-indentation errors detected by yamllint:

yamllint -f parsable -c .yamllint $( find -regex '.*\.y[a]*ml' ) | \
  grep '(comments-indentation)'

This checks that the comment is aligned with the content.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-04 01:16:45 +09:00
Ahmed Moheb 4f3d5a10c4 tests: bluetooth: host: Add UT for bt_id_read_public_addr()
Unit test project for bt_id_read_public_addr().
This part of subsys/bluetooth/host/id.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-12-27 15:34:34 +01:00
Ahmed Moheb ea6076116b tests: bluetooth: host: Add mocks for id.c
Add required mocks to be able to compile and test /bluetooth/host/id.c

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-12-27 15:34:34 +01:00
Ahmed Moheb eceb8341e0 tests: bluetooth: host: Add UT for bt_keys_clear()
Unit test project for bt_keys_clear().
This part of subsys/bluetooth/host/buf.c unit testing

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-12-27 15:33:40 +01:00
Emil Gydesen 4e3205d238 Bluetooth: Audio: Add packing to unicast group create
Add the ISO packing field when creating a unicast group.

This refactors the structure of the unicast group create,
as it now takes both the packing as a group parameter, as well
as an array of stream-specific parameters.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-12-22 10:59:16 +01:00
Emil Gydesen ba1949759d Bluetooth: Audio: Add packing field to broadcast source
Add support for setting the ISO packing field when
creating a broadcast source.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-12-22 10:59:16 +01:00
Erwan Gouriou 66d4c64966 all: Fix "#if IS_ENABLED(CONFIG_FOO)" occurrences
Clean up occurrences of "#if IS_ENABLED(CONFIG_FOO)" an replace
with classical "#if defined(CONFIG_FOO)".

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-12-21 10:09:23 +01:00
Lars Knudsen 081b83531b Bluetooth: has: Make HAS registration dynamic
This changes HAS registration to be dynamic and let's the
application set Hearing Aid Type and binaural features.

Often, devices are flashed with generic firmware with some
features stored post factory production, requiring
the settings to be moved from compile time to run-time.

This change will increase the RAM usage as the GATT
service is moved from ROM to RAM.

Signed-off-by: Lars Knudsen <larsgk@gmail.com>
Co-author: Soren Engquist <soren@engquist.dk>
2022-12-20 17:04:45 +00:00
Emil Gydesen 281a846060 Bluetooth: Audio: Move common broadcast sink test code to function
Move the functionality that is common between the two
broadcast sink test to a common function.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-12-20 09:23:08 +01:00
Emil Gydesen 1424df424c Bluetooth: Audio: Add broadcast source metadata update function
Add API to do the BAP Broadcast Source Metadata update procedure,
which updates the metadata of a broadcast source while
it is streaming.

This is also makes all checks for the "head stream" the same.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-12-20 09:23:08 +01:00
Pavel Vasilyev d0a660c87c tests: bluetooth: mesh: Update BT_MESH_LPN_RECV_DELAY default value
Update the default value of BT_MESH_LPN_RECV_DELAY to align with new
lower boundary for legacy advertiser.

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

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2022-12-19 15:31:55 +01:00
Alperen Sener 1af9b40f6f Bluetooth: Test: Mesh: change mesh shell test log mode
Changing the log mode to minimal to reduce flash size

Signed-off-by: Alperen Sener <alperen.sener@nordicsemi.no>
2022-12-19 10:09:53 +00:00
Jonathan Rico 57d7d62bee Bluetooth: host: add bsim test for #52059
The test should fail.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2022-12-19 09:37:25 +00:00
Emil Gydesen 0114bc8199 Bluetooth: Audio: Shell: Add TBS Client debug logging in audio.conf
Add TBS client debug logging like all the other modules.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-12-16 14:46:57 +01:00
Emil Gydesen 18fe973df2 Bluetooth: Audio: Shell: Enable optional TBS features
Enable the optional TBS features to provide a full TBS experience.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-12-16 14:46:57 +01:00
Emil Gydesen 24d22ebbdb Bluetooth: Audio: Shell: Add support for more connections
Add support for 3 connections. Mainly we need to support
at least 2 connection to use the CSIP Set Coordinator role,
but some sets may also be 3 or even larger.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-12-16 14:46:57 +01:00
Emil Gydesen cc9006f211 Bluetooth: Audio: Shell: Add EATT to audio.conf
Add EATT support for audio.conf as that is quite useful
for LE Audio.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-12-16 14:46:57 +01:00
Troels Nilsson c0a5b1ef7b bluetooth: controller: Reduce user ops status to uint8_t
The status field is currently a uint32_t even though there are only
3 possible values. Reducing it to a uint8_t allows status to fit in
existing padding in the struct, saving 4 bytes per ticker_user_op

Updated function signatures to match; ticker_op_func left as-is
to avoid having to update a whole bunch of files for no real benefit

Signed-off-by: Troels Nilsson <trnn@demant.com>
2022-12-16 11:02:30 +00:00
Jonathan Rico 8bc094610c Bluetooth: host: update l2cap stress test
Do these things:
- use the proper macros for reserving the SDU header
- make every L2CAP PDU fragment into 3 ACL packets
- set tx data and verify rx matches the pattern
- measure segment pool usage

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2022-12-15 09:58:07 +00:00
Jonathan Rico ef19c64f1b Bluetooth: host: poll on CTLR buffers instead of host TX queue
When there are no buffers, it doesn't make sense to repeatedly try to send
the host TX queue.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2022-12-15 09:58:07 +00:00
Erik Brockhoff 1f97652998 Bluetooth: controller: refactor ull_rx_put/sched
Instead of calling both ull_rx_put and ull_rx_sched, combine into one
function

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-12-09 12:44:39 +01:00
Erik Brockhoff ddeb0e9f6e Bluetooth: controller: refactor ll_rx_put/sched
Instead of calling both ll_rx_put and ll_rx_sched, combine into one
function

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-12-09 12:44:39 +01:00
Morten Priess a803588d2c Bluetooth: controller: Add handle to ll_data_path_sink_create
For making handle available in vendor sink creation, add ISO handle
to function prototype.
Expose datapath allocation via new ull_iso_datapath_alloc function.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2022-12-09 11:18:49 +01:00
Krzysztof Kopyściński bfb3ec5253 tests: bluetooth: tester: allow to add more CCCs
Specification states that: "Only one Client Characteristic Configuration
declaration shall exist in a characteristic definition." This was
wrongly understood as "Ony one CCC can exist in GATT Server". When we
add next characteristic `ccc_added` flag is cleared so next CC can be
added (for this characteristic).

Added array for CCC values so it's no longer shared between CCCs.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2022-12-09 11:18:39 +01:00
Nirosharn Amarasinghe e4e5ef97eb tests: Bluetooth: controller: corrected input PDU time stamps
-- Corrected PDU time stamps to match expected reference anchor point
-- Corrected failing test_rx_unframed_dbl_split according to expected
   time stamps.

Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
2022-12-07 10:15:17 +00:00
Szymon Czapracki f9db7fe065 Bluetooth: tester: Extract services from bttester
This commits extracts mesh, gat, gap, l2cap from
bttester.h into corresponding header files for
better readability.

Signed-off-by: Szymon Czapracki <szymon.czapracki@codecoup.pl>
2022-12-02 13:35:50 +02:00
Christian Taedcke 0308167cea tests: Bluetooth: Remove setting a unused define
The underlying Kconfig setting NET_BUF_USER_DATA_SIZE is not used anywhere,
so this define is removed here.

Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
2022-12-01 15:50:35 +01:00
Erik Brockhoff 0604a4d2f1 Bluetooth: controller: store STO value instead of pre-calculated reload
Instead of storing the calculated reload value (in conn intervals) in
the conn object, now store the timeout value, and perform calculation
when used. This allows using the timeout value across all CIS's without
having to re-calc and store on change of TO

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-12-01 10:32:34 +01:00
Thomas Ebert Hansen f192fccf3a Bluetooth: controller: Add lock around LLCP data
Add mayfly locking around the access to the local pending procedure list
as it is accessed by both thread and mayfly.

Fixes #45427

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2022-11-30 12:49:15 +01:00
Ahmed Moheb 71aa52d79d tests: bluetooth: host: Add UT for bt_keys_find_addr()
Unit test project for bt_keys_find_addr().
This part of subsys/bluetooth/host/keys.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-11-30 12:31:46 +01:00
Anas Nashif ba7d730e9b tests/samples: use integration_plaforms in more tests/samples
integration_platforms help us control what get built/executed in CI and
for each PR submitted. They do not filter out platforms, instead they
just minimize the amount of builds/testing for a particular
tests/sample.
Tests still run on all supported platforms when not in integration mode.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-11-29 16:03:23 +01:00
Emil Gydesen bbc85e0b2c Bluetooth: Audio: Use bt_vcp_vol_ctlr instead of bt_vcp
Use the `bt_vcp_vol_ctlr` opaque type instead of the more
generic `bt_vcp`.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-11-28 17:43:40 +01:00
Emil Gydesen ae11b5879b Bluetooth: Audio: Remove bt_vcp from vol rend API
Remove the struct bt_vcp pointer from the volume
renderer API, as there is only ever a single
Volume Renderer instance on a device.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-11-28 17:43:40 +01:00
Emil Gydesen c82af2885e Bluetooth: Audio: Split vol_ctlr and vol_rend callback structure
Split the `bt_vcp_cb` struct into separate structure for
the volume controller and the volume renderer.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-11-28 17:43:40 +01:00
Emil Gydesen 7f69b866f0 Bluetooth: Audio: Specify bt_vcp_vol_rend API
The VCP server, known as the volume renderer, has a
more explicity bt_vcp_vol_rend API naming scheme now.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-11-28 17:43:40 +01:00
Emil Gydesen 71bd487cc4 Bluetooth: Audio: Add separate API for VCP vol controller
Add a separate API for the VCP volume controller (client).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-11-28 17:43:40 +01:00
Emil Gydesen 966c9f80e7 Bluetooth: Audio: Remove the bt_vcp_vocs API
Remove the bt_vcp_vocs API as it did the same as the
bt_vocs API, and did not really any functionality.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-11-28 17:43:40 +01:00
Emil Gydesen bfbb704c8e Bluetooth: Audio: Remove the bt_vcp_aics API
The AICS functionality can be exercised using the
bt_aics API instead. These functions did very little
besides cluttering up the bt_vcp API.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-11-28 17:43:40 +01:00
Emil Gydesen ce2b8f9fe1 Bluetooth: Audio: Rename VCS to VCP
Renames almost all occurences of VCS to VCP, as we want to
use the profile as the namespace for volume control.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-11-28 17:43:40 +01:00
Emil Gydesen aaac86dada Bluetooth: Audio: Rename vcs.h to vcp.h as well as the Kconfig file
Rename vcs.h to vcp.h to better detail what the
file contains, as it is more than just VCS. This also
renames the Kconfig file.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-11-28 17:43:40 +01:00
Stephanos Ioannidis 5a5e15fc95 tests: bluetooth: bsim_test_multiple: Increase test timeout
This commit increases the timeout value for the `bsim_test_multiple`
BSIM test because it may take longer to complete with the
parallelisation enabled due to the context switching overhead and the
overallocation of the CPU cores.

Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
2022-11-27 03:41:11 +09:00
Stephanos Ioannidis 1de363d9d5 tests: bluetooth: bsim_bt: Enable parallel compilation
This commit updates the Bluetooth BSIM test compilation script to build
multiple tests simultaneously in order to improve CPU utilisation.

Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
2022-11-27 03:41:11 +09:00
Théo Battrel e458f5aae6 Bluetooth: Use Zephyr standard log system instead of bluetooth/common/log
The `bluetooth/common/log.h` and `bluetooth/common/log.c` files have been
removed. Files that were using them have been updated to use
`zephyr/logging/log.h` instead.

Those replacement have been done consequently:
- `/BT_DBG/LOG_DBG/`
- `/BT_ERR/LOG_ERR/`
- `/BT_WARN/LOG_WRN/`
- `/BT_INFO/LOG_INF/`
- `/BT_HEXDUMP_DBG/LOG_HEXDUMP_DBG/`
- `/BT_DBG_OBJ_ID/LOG_DBG_OBJ_ID/`

Also, some files were relying on the `common/log.h` include to include
`zephyr/bluetooth/hci.h`, in those cases the include of `hci.h` has
been added.

For files that were including `common/log.h` but not using any logs,
the include has been removed and not replaced.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2022-11-25 17:08:36 +01:00
Mariusz Skamra 55b7d904ed Bluetooth: tests: shell: Fix build test for CAP Acceptor
This fixes check whether shell application can be built without CAP
Acceptor Set Member support.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-11-25 10:44:51 +01:00
Emil Gydesen 292db21a18 Bluetooth: Audio: Use svc_inst instead of bt_csip for set_member
Use the service instance struct instead of the more generic
`bt_csip` for the CSIP set member API.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-11-24 15:23:48 +01:00
Emil Gydesen 87f86cebe2 Bluetooth: Audio: Rename bt_csip to bt_csip_set_member
Renamed remaining structs and functions that are not
for the set coordinator to use the set member CSIP
role name.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-11-24 15:23:48 +01:00
Emil Gydesen 93b3944a51 Bluetooth: Audio: Rename CSIS to CSIP
Renamed the coordinated set implementation to use the
profile (CSIP) name instead of the service (CSIS) name, as
the former is more general.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-11-24 15:23:48 +01:00
Théo Battrel 53ee728227 Bluetooth: Bluetooth: tests: host: Replace host_mocks/print_utils.h
Replace `host_mocks/print_utils.h` which does not exist anymore with
`common/bt_str.h`.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2022-11-24 15:21:39 +01:00
Jonathan Rico 77f7acace0 Bluetooth: tests: host: Update CMakeLists files
Update CMakeLists files to include new required files and new paths.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2022-11-24 15:21:39 +01:00
Jonathan Rico c12709b1ef Bluetooth: tests: host: disable logging in UT
A PR got in after some changes were done to the BT logging system. This
nulls the error by not including the logging framework in this unit test.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2022-11-24 15:21:39 +01:00
Emil Gydesen 40e3930ebd Bluetooth: Audio: Broadcast source subgroup and BIS codec support
Updates the broadcast source API to create subgroups and
to set BIS specific codec configuration

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-11-24 10:21:36 +01:00
Ahmed Moheb 37de395fc5 tests: bluetooth: host: Add UT for prng_init()
Unit test project for prng_init().
This is part of subsys/bluetooth/host/crypto.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-11-24 10:06:05 +01:00
Ahmed Moheb b86150ff0c tests: bluetooth: host: Add mocks for crypto.c
Add required mocks to be able to compile/test /bluetooth/host/crypto.c

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-11-24 10:06:05 +01:00
Ahmed Moheb cba3ed9ad1 tests: bluetooth: host: Add UT for bt_keys_add_type()
Unit test project for bt_keys_add_type().
This part of subsys/bluetooth/host/buf.c unit testing

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-11-24 10:05:54 +01:00
Ahmed Moheb f674a56a13 tests: bluetooth: host: Add UT for bt_keys_find_irk()
Unit test project for bt_keys_find_irk().
This part of subsys/bluetooth/host/keys.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-11-24 10:05:40 +01:00
Ahmed Moheb 932e49e020 tests: bluetooth: host: Add UT for bt_keys_get_type()
Unit test project for bt_keys_get_type().
This part of subsys/bluetooth/host/keys.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-11-24 10:05:32 +01:00
Aleksandr Khromykh 75f562cfe6 tests: Bluetooth: Mesh: improve test system clock precision
Increase system clock precision in the test system.
It helps for some events happen in more precise time and
prevents time overlapping between them.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2022-11-24 10:03:04 +01:00
Aleksandr Khromykh 8b4548c599 tests: Bluetooth: Mesh: fix bsim settings backend
PR fixes bsim settings backend issue.
Backend looses line if setting name of new line is
the occurence of the any existing lines.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2022-11-24 10:03:04 +01:00
Ahmed Moheb 5b1c6566b8 tests: bluetooth: host: Add UT for bt_keys_find()
Unit test project for bt_keys_find().
This part of subsys/bluetooth/host/keys.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-11-24 09:35:04 +01:00
Morten Priess afd14d6573 Bluetooth: controller: CIS Central fixes from EBQ run
Various fixes for issues found during EBQ run.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2022-11-18 12:48:13 +01:00
Vinayak Kariappa Chettimada a6beef4b26 Bluetooth: Controller: Replace Central connection spacing Kconfig
Replace the BT_CTLR_ADVANCED_SCHEDULING_CENTRAL_CONN_SPACING
Kconfig with BT_CTLR_CENTRAL_SPACING to configure the
the spacing from the beginning of a central connection event
to beginning of the next central connection when supporting
multiple simulataneous central connections.

If the BT_CTLR_CENTRAL_SPACING in microseconds is smaller
then the required time reservation for a connection event,
for given maximum data length and PHY in use, then the
calculated time reservation will be used as the spacing
between consecution central connection events.

The change fixes an issue wherein use of old Kconfig with
higher values causes new central connections to be placed
in between already connected central role if there was
free time space available to fit the new connections time
reservation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-11-17 14:44:17 +01:00
Emil Gydesen ecb7591d6b Bluetooth: Audio: Rename BASS and BASS client
Rename BASS to BAP Scan Delegator and BASS Client
to BAP Broadcast Assistant. This is the first step towards
integrating the BASS with the rest of BAP.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-11-16 11:17:52 +01:00
Emil Gydesen 1d83e561e6 Bluetooth: Audio: Refactor use of cur_mcs_inst
Removes the global cur_mcs_inst and replace it
with lookup functionality.

This fixes an issue with bt_mcc_discover_mcs not being able
to be called more than once, as well
as streamline the implementation significantly.

This is also the first step towards not only supporting
multipe MCS instances for a single device, but also a
step towards handling multiple devices.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-11-15 12:18:50 +00:00
Troels Nilsson fc8651746b bluetooth: Fix occasional BSim mesh test failure
Two tests were using the same simulation id, causing occasional failures
when all tests were run in parallel

Signed-off-by: Troels Nilsson <trnn@demant.com>
2022-11-14 16:31:10 +01:00
Carles Cufi b90c27238a Bluetooth: crypto: Refactor a few items
After merging #51809, a few things were spotted that needed tweaking.
Among them:

- Rename the folder from bt_crypto to crypto, since the prefix is
  unnecesary
- Remove the include folder
- Remove the path from the global include paths

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-11-10 17:54:14 +02:00
Nirosharn Amarasinghe 05940a8f66 tests: bluetooth: controller: restructured and update ISO-AL unit tests
-- Included TX tests
-- Re-factored to use FFF

Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
2022-11-10 09:29:42 +01:00
Théo Battrel e9c542ab5b Bluetooth: Add the cryptographic toolbox function h8
Add to the cryptographic toolbox the h8 function, defined in the Bluetooth
Core Vol. 6, part E 1.1.1.

Also add test and SMP self test for this function. The data used for those
are from the Bluetooth Core.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2022-11-10 09:28:28 +01:00
Théo Battrel f16738b62b Bluetooth: Move crypto toolbox functions from smp.c to their own files
Move functions defined in the Cryptographic toolbox of the Bluetooth
specification inside their own files in the following folder:
`zephyr/subsys/bluetooth/bt_crypto`. The functions were previously
implemented in `zephyr/subsys/bluetooth/host/smp.c`.

The cryptographic toolbox functions can now be accessed from outside of the
host.

In addition to that, tests for each cryptographic toolbox functions have
been added.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2022-11-10 09:28:28 +01:00
Erik Brockhoff c180afec11 Bluetooth: controller: Adding user ext. anchor point move to ctrl/CPR
Adding support for allowing user extension code to support deferring
anchor point moves. Refactored LLCP only.
Note: This is NOT supported by LEGACY LLCP impl.
KConfig'd by BT_CTLR_USER_CPR_ANCHOR_POINT_MOVE
Modified ll_conn_update API, to accommodate passing offsets
Modified CPR/CU context data structure
Modified CPR/CU procedure to handle anchor point move wait state
Fixed up unit tests, adding anchor point move cases to CPR/CU test

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-11-09 10:43:17 +01:00
Erik Brockhoff 2a236e52db Bluetooth: controller: rename pdu_data_llctr struct SCA member
Rename struct member to adhere to general naming pattern

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-11-09 09:34:35 +00:00
Sean Madigan 34cd4e520d Tests: Bluetooth: Add bt_disable babblesim test with gatt
Add babblesim test for bt_disable which enables bt, starts a connection,
GATT discovers, reads, writes then disables BT in a loop.

Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
2022-11-09 09:03:50 +00:00
Sean Madigan c3711ebc43 Tests: Bluetooth: Add bt_disable babblesim test
Add babblesim test for bt_disable which just enables and disables BT in
a loop.

Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
2022-11-09 09:03:50 +00:00
Alberto Escolar Piedras cd3c3cf6eb Bluetooth: Audio: CAP test: Fix sim_id
The cap test was reusing another test sim_id which
causes trouble at random when tests are parallelized.
Fix it by giving it its own id.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2022-11-08 14:37:30 +01:00
Emil Gydesen 20aa2f0f22 tests: Bluetooth: Audio shell tests for ASE SNK/SRC = 0
Add build tests for setting the counter of sink or
source ASEs to 0.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-11-08 10:48:54 +01:00
Pavel Vasilyev 8fdec22fc0 test: bluetooth: mesh_shell: Remove setting BT_MAX_CONN
Only 1 connection is needed with default setting of mesh_shell.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2022-11-08 10:47:24 +01:00
Erik Brockhoff 76439d0ba4 Bluetooth: controller: integrating SCA procedure and adding HCI API
Adding controller support for updating SCA in ACL and ISO peripherals
Adding HCI API support for le_request_peer_sca and complete event.

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-11-08 10:44:54 +01:00
Erik Brockhoff b3b4b9e322 Bluetooth: controller: implementing SCA update procedure PDU flow
Adding PDU flow and unittest for Sleep clock accuracy procedure

Signed-off-by: Erik Brockhoff <erbr@oticon.com>

wip kconf
2022-11-08 10:44:54 +01:00
Erik Brockhoff 6b324122e7 Bluetooth: controller: fix CIS REQ event generation and rejection
Check LE event mask state as well as host controlled feature mask state
and reject CIS request accordingly.
Release pre-allocated ISO resources on rejection of request

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-11-08 09:38:21 +00:00
Pavel Vasilyev e42d9d80ac tests: bluetooth: mesh_shell: Disable BT_EXT_ADV for qemu_cortex_m3
mesh_shell sample doesn't fit into flash with the extended advertising.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2022-11-05 19:55:39 +01:00
Théo Battrel effb76c61e Bluetooth: Move re-implementation of snprintk
Move the function in the `subsys/testsuite/ztest/src/ztest_mock.c` files.

This is motivated by the fact that there is others re-implementation of
`*printk` functions using libc counterparts in the `ztest_mock.c` file.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2022-11-02 13:28:57 +01:00
Théo Battrel a57dbb15db Bluetooth: Consolidate duplicated code
The file `tests/bluetooth/host/keys/bt_keys_get_addr/src/main.c` was using
functions from `tests/bluetooth/host/host_mocks/print_utils.c` which were
exactly the same as the one in `common/log.h`.

The code was duplicated because the test author wanted to include
`common/log.h` to get the stringifying functions, but could not due to
unwanted side-effects.

See the comment from the unit test author here:
https://github.com/zephyrproject-rtos/zephyr/pull/48676#discussion_r973672151

The new `common/bt_str.h` does not have side-effects, so it is
suitable for unit tests.

The `snprintk` function has been redefined inside the `main.c` to use the
libc because of the kernel being not compiled entirely.

Also, the `CONFIG_LOG`, `CONFIG_BT_DEBUG_LOG` and
`CONFIG_TEST_LOGGING_DEFAULTS` have been disabled in the Kconfig files
of each `keys` tests. That so logs are not compiled and so, there is
no need to link the `printk` functions that are used by the logs.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
Co-authored-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2022-11-02 13:28:57 +01:00
Ingar Kulbrandstad 7367980bea Bluetooth: Mesh: Extended advertiser as default
Setting the extended advertiser as default advertiser
to improve both preformence and reliability.

Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
2022-11-01 08:52:56 +00:00
Yuval Peress f460c21578 test: update how unit tests set sources
Replaces cases of setting SOURCES before calling find_package with
proper target_sources.

Signed-off-by: Yuval Peress <peress@google.com>
2022-10-31 17:01:59 +01:00
Emil Gydesen 2fd9c82658 Bluetooth: Audio: Increase some values for the audio shell
Increase some value for the shell to be more useful when
working with some audio devices.

Also adds debugging for more services and profiles.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-10-31 16:43:41 +09:00
Mariusz Skamra 3ea297960d Bluetooth: audio: Remove capablilities leftovers
Remove dead code that remained after
https://github.com/zephyrproject-rtos/zephyr/pull/51425 was merged.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-10-31 16:39:05 +09:00
Keith Packard 268087646d tests/bluetooth: Use memcpy to put data into net_buf
net_buf does not hold strings, it holds counted bytes. Use memcpy to place
data into the buffer during testing rather than strncpy as the latter
generates warnings because the destination will not be nul-terminated.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-10-29 11:32:06 +03:00
Emil Gydesen 460ac477c1 tests: Bluetooth: Update broadcast_iso test to support PA sync term cb
The callback is now called whenever the PA sync is terminated,
even if it was locally terminated. The test case has been
updated to handle that.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-10-28 07:56:41 +00:00
Aleksander Wasaznik 339ac358cd Bluetooth: Host: BS tests: bsim_test_bond_overwrite_allowed/denied
These tests prove the existence of a bug in the local identity feature.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2022-10-27 13:16:59 +02:00
Jonathan Rico d870df0054 Bluetooth: tests: use a single definition of the fff global
Linking fails on ubuntu 22.04 because of multiple definitions of the `fff`
global, which is defined by `DEFINE_FFF_GLOBALS`.

Only define it in the tests' `main.c` instead of the mocks.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2022-10-26 13:29:19 +02:00
Mariusz Skamra 2627063ab2 Bluetooth: audio: pacs: Replace capabilities API with pacs
This changes the API to use proper naming convention, as the code has
been moved out of capabilities.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-10-26 08:49:00 +02:00
Emil Gydesen 7a1e827a8b Bluetooth: Audio: Make CAP acceptor more explicit
Remove the generic CONFIG_BT_CAP and CONFIG_BT_DEBUG_CAP
and only use Kconfigs specific to the individual roles.

This also includes renaming cap.c to cap_acceptor.c.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-10-24 10:39:11 +02:00
Emil Gydesen ce05cb5c2c Bluetooth: Audio: CAP initiator discover CSIS
The CAP initiator will now discover, or return a
known, CSIS instance included by CAS (if any).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-10-24 10:39:11 +02:00
Emil Gydesen 2e42105df0 Bluetooth: Audio: CSIS: Refactor CSIS client discover API
The API will now take a simple bt_conn instead of a
set member struct. This is due to the set member struct
being moved to the stack. The reasoning for this is that
having the struct in the stack, rather than in the
application, the stack itself can initiate the CSIS
discovery which is useful if the remote device
has a service that includes a CSIS.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-10-24 10:39:11 +02:00
Emil Gydesen 7a49de12af Bluetooth: Audio: Implement CAP initiator discover
This is the primary discovery of the CAS on the remote device,
but does not include discovering the (optional) CSIS.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-10-24 10:39:11 +02:00
Emil Gydesen 760177b1be Bluetooth: Audio: Add CAP initiator skeleton
Add skeleton for the expected APIs and
implementation. May be subject to change as
implementation progresses.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-10-24 10:39:11 +02:00
Emil Gydesen 31bf99cbd2 Bluetooth: ISO: Change ISO seq_num to 16-bit
The sequence number is by the core spec defined as 16-bit.
We had implemented a workaround for the wrapping of the
sequence number, which required the type to be larger
than 16-bit (32-bit).

However, since the definition of the sequence number,
and the use of, is poorly defined by the core spec, we
are reverting this workaround and reducing the sequence
number to 16-bit again. This way it is more in line
with the core spec, as well as more intuitive given the
other uses for the sequence number.

This change moves the responsibility of using the
right value to the upper layers, as the stack can
and will no longer provide any guarantees.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-10-24 10:38:49 +02:00
Aleksander Wasaznik e2e326dded Bluetooth: Add unit tests for bt_addr_le_eq
Add some basic unit tests for bt_addr_le_eq.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2022-10-19 15:40:18 +03:00
Aleksander Wasaznik 17fc4b811c Bluetooth: Replace 'bt_addr_le_cmp(x) != 0' with 'bt_addr_le_eq(x)'
These should be equivalent. The '_eq'-form is more readable.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2022-10-19 15:40:18 +03:00
Aleksander Wasaznik ea558187b5 Bluetooth: Replace bt_addr_le_cmp in bool context with !bt_addr_le_eq
These should be equivalent. The new form is more readable.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2022-10-19 15:40:18 +03:00
Aleksander Wasaznik 21e5dcb42a Bluetooth: Replace 'bt_addr_le_cmp(x) == 0' with 'bt_addr_le_eq(x)'
These should be equivalent. The '_eq'-form is more readable.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2022-10-19 15:40:18 +03:00
Aleksander Wasaznik 9db3fa82d1 Bluetooth: Replace all '!bt_addr_le_cmp' with 'bt_addr_le_eq'
There should be functional equivalence between these two forms. And the
'_eq'-form is more readable.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2022-10-19 15:40:18 +03:00
Ahmed Moheb d354179a68 include: Add missed 'zephyr' prefix while including header files
Add missed 'zephyr' prefix to files paths while including.
Also, remove that paths from libraries include paths to generate
compilation error if shortened path is used.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-10-18 14:12:45 +02:00
Sean Madigan 5b1dd71f3e Bluetooth: kconfig: Add config options for PAST
Add config options specific for periodic advertising sync transfer.

Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
2022-10-17 10:14:10 +02:00
Ahmed Moheb 7ef05751a3 tests: bluetooth: host: Fix CI failures with bt_keys_get_addr() UT
CI tests were failing due to a recent change to zassume_true()
implementation.
While the test case is still skipped when assumption fails, but it is
now causing the final execution result to fail.

zassume_true() was replaced by ztest_test_skip() combined with
a conditional 'if' statement to get the required effect.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-10-14 12:40:46 +02:00
Emil Gydesen 7ab1cafbc2 Bluetooth: Audio: Add Broadcast source application AD
This refactors how the BAP broadcast source handles the
extended and periodic advertising.

First it removes the start and stop of the extended
advertising, and instead expects the application
(or upper layers) to do this.

Second it exposes API functions to get the
necessary advertising data from BAP (service data and
the BASE), which the upper layers will then also
be responsible for setting and updating.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-10-14 09:51:39 +02:00
Krzysztof Kopyściński aa0c52f212 tests: bluetooth: tester: Improve stability of MESH/NODE/TNPT/BV-05-C
IUT is requested to send 2 multi-segmented model messages. In mean time,
third may be sent from Config Model Publication Status may be sent,
which is also segmented. One of the 3 messages will fail to be sent,
but test is passing if it is Status one. Let's increase number of
possible concurrent transmissions to allow all three messages to be
sent.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2022-10-13 09:56:38 +02:00
Ahmed Moheb 385527bdd6 tests: bluetooth: Remove deprecated definitions
Remove ZTest deprecated definitions that aren't used anymore.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-10-11 11:29:42 +02:00
Ahmed Moheb b8d5aaccd2 tests: bluetooth: Use ZTest new APIs with bt_buf_get_cmd_complete() UT
Migrate bt_buf_get_cmd_complete() UT to use the new APIs of ZTest
framework.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-10-11 11:29:42 +02:00
Ahmed Moheb c7c0e2d654 tests: bluetooth: Use ZTest new APIs with bt_buf_get_evt() UT
Migrate bt_buf_get_evt() UT to use the new APIs of ZTest framework.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-10-11 11:29:42 +02:00
Ahmed Moheb 8c9235c2b0 tests: bluetooth: Use ZTest new APIs with bt_buf_get_rx() UT
Migrate bt_buf_get_rx() UT to use the new APIs of ZTest framework.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-10-11 11:29:42 +02:00
Ahmed Moheb ea67890fdc tests: bluetooth: Use ZTest new APIs with bt_buf_get_type() UT
Migrate bt_buf_get_type() UT to use the new APIs of ZTest framework.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-10-11 11:29:42 +02:00
Ahmed Moheb 2254fab332 tests: bluetooth: host: Add UT for bt_foreach_bond()
Unit test project for bt_foreach_bond().
This part of subsys/bluetooth/host/keys.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-10-11 11:29:29 +02:00
Ahmed Moheb 0d5a49e815 tests: bluetooth: host: Add UT for bt_keys_foreach_type()
Unit test project for bt_keys_foreach_type().
This part of subsys/bluetooth/host/keys.c unit testing.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-10-11 11:14:10 +02:00
Ingar Kulbrandstad 8e6d5561f6 tests: Bluetooth: Mesh: adv test buffer management
The advertiser runs in a loop, pulling advertising buffers from a queue.
Features covered:
Queue overflow
Sending order
Buffer freeing
Dedicated buffer pools

Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
2022-10-11 11:11:57 +02:00
Troels Nilsson 6137e8bc60 tests: Bluetooth: bsim: Ext. adv. duration handling change fixes
Update bsim test to account for timing difference introduced
by Extended Advertising duration fixes.

Signed-off-by: Troels Nilsson <trnn@demant.com>
2022-10-10 13:55:37 +02:00
Emil Gydesen 02d6661d71 Bluetooth: Shell: Add support for sending sine tone with the audio shell
added `audio start_sine` and `audio stop_sine` to start/stop
sending an LC3 encoded sine tone.

This code is heavily inspired from the sine tone implementation
from the unicast_client sample implementation.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-10-07 13:22:53 +02:00
Mariusz Skamra 28ce0a96b1 Bluetooth: audio: capabilities: Remove redundant direction parameter
The direction is used to identify the list to append the registered
capabilities. There is no need to keep it in the bt_audio_capabilities,
it can be provided as a function parameter instead.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-10-06 22:41:27 +00:00
Gerard Marull-Paretas 97ef197d05 include: add missing zephyr/ prefix
Some files still manage to get into the tree without the zephyr/ include
prefix (likely because they lack CI coverage).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-06 10:41:02 +02:00
Emil Gydesen 9e256681a4 Bluetooth: Audio: Fix syncing to multiple BIS for broadcast sink shell
Fixed an issue with syncing to multiple BIS as the broadcast
sink in the shell. Also changed a check in the broadcast
sink implementation from an assert to a `if` to provide
a better way of handling bad input.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-10-05 12:42:09 +02:00
Anders Storrø bea54c5691 Bluetooth: Mesh: Shell: Make prov features dynamic
Alters several provisioning related features to allow commands to be
functional with application defined Provisioning properties &
capabilities.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2022-10-04 10:33:30 +02:00
Nirosharn Amarasinghe c56f546670 tests: Bluetooth: controller: Disabled ISO-AL Unit Tests
Tests will be restructured in a future commit. Temporarily disabled to
partition the changes to allow tests to be a separate PR.

Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
2022-10-03 13:22:13 +02:00
Nirosharn Amarasinghe 896049bae2 tests: bluetooth: controller: updated BSIM ISO ISO-AL emit callback I/F
Updated callback function parameters to match new interface parameters.

Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
2022-10-03 13:22:13 +02:00
Mariusz Skamra 9ecbee2587 Bluetooth: audio: capabilities: Remove callbacks
This removes the callbacks from capabilities. The callbacks are used for
unicast server role only, while the capabilities are used for the
broadcast sink role as well. Thus the callbacks can be removed as there
is another bt_audio_unicast_server_cb API that is specific for unicast
server role.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-10-03 10:17:21 +02:00
Mariusz Skamra 124d66e885 Bluetooth: audio: tbs_client: Make GTBS client only build option
Refactor Kconfig to add a way to enable GTBS only client.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-10-03 10:15:03 +02:00
Troels Nilsson a96dfe9ce9 tests: bluetooth: BSIM tests compile function enhancement
Allow ZEPHYR_MODULES to be specified to support non-west builds

Return the error code when/if a build fails instead of always 0

Signed-off-by: Troels Nilsson <trnn@demant.com>
2022-10-03 10:13:51 +02:00
Aleksandr Khromykh be18ed7a98 tests: Bluetooth: Mesh: optimize mesh bsim compilation
Remove not used test suites from compilations for low latency
configuration.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2022-10-03 10:12:34 +02:00
Aleksandr Khromykh bab80595df tests: Bluetooth: Mesh: add proxy mix mesh bsim test
The commit adds proxy mix advertiser test that checks
mix of transmission between pb gatt, proxy and adv bearers.
The exact test scenario is described in proxy_mixin.sh file.

Additionally, the separate test configuration has been added.
All bsim mesh tests have been implemented not considering that
GATT frames are possible if PB-GATT or GATT Proxy are enabled.
The solution to avoid this misimplementation is to create
the separate configuration for tests with enabled
PB-GATT and GATT Proxy features. The commit adds this as well.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Signed-off-by: Artur Dobrynin <artur.dobrynin@nordicsemi.no>
2022-10-03 10:12:34 +02:00
Anders Storrø 901767a47a Bluetooth: Mesh: Shell: Add cfg opt for health srv
Adds Kconfig option for the Mesh Shell Health server.

The shell implementation of Health Server test commands is
dependent on the user adding and initializing the shell Health
Server instance in their application to make the commands functional.
To prevent any confussion about how these commands work, a Kconfig
option has been added to allow conditional compilation of these
commands. In this way the user must actively enable this feature, making
the conditional requirements more clear.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2022-10-03 10:12:25 +02:00
Szymon Janc f09220d050 test: Bluetooth: EDTT: Disable invalid tests
Some tests assume that if IUT accepted HCI_LE_Set_Data_Length command
than HCI_LE_Data_Length_Change event will always be sent. This is not
the case anymore as HCI_LE_Data_Length_Change is sent only if effective
parameters changed.

Those tests should be re-enabled when EDDT implementation is updated.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-10-03 10:08:34 +02:00
Szymon Janc 6673cb1f60 Bluetooth: Controller: Fix DLE HCI params parsing
LE Write Suggested Default Data Length and LE Set Data Length commands
are suggestions from host and should be validated only as per HCI
specification regarding internal setting of LLCP.

LLCP is allowed to use other values if needed.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-10-03 10:08:34 +02:00
Ahmed Moheb a341792ca0 tests: bluetooth: host: Remove unused definitions and inclusions
Clean up sources by removing unused definitions and inclusions.

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-09-29 10:17:38 +00:00
Jonathan Rico 5f8e657a22 Bluetooth: att: limit EATT MTU to max buffer size
If a device sends an MTU that is bigger than our maximum tx buffer size,
that could cause assertion failures down the line.

This PR limits it to the maximum we support (CONFIG_BT_L2CAP_TX_MTU).

The issue has been observed with a gatt discovery procedure, but is likely
present in other places in att.c.

To reproduce it, we need two zephyr shell devices, with one having a larger
MTU than the other:
- connect
- do data length update to the bigger MTU
- set security to 2, EATT channels get connected
- launch a gatt discovery from the device with the larger MTU
- observe kernel panic on the other device when it attempts to add too much
memory to a net buf.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2022-09-29 10:16:57 +00:00
Herman Berget a5ce3da6ab Bluetooth: Tests: Fix uninitialized value in eatt_notif test
The chan_opt field was not set, and on some platforms it ended up with
an invalid value. Explicitly set the field on all GATT parameter structs
and make the discovery params static.

Fixes #50520

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-09-28 13:12:08 +02:00
Erik Brockhoff 183370277b Bluetooth: controller: fixing slot reservation for connection setup
With introduction of refactored LLCP was also introduced an error
re. calculation of initial slot reservation in connection setups.

Due to this error a bigger slot was reserved, leading to failure due to
connection overlaps in multiple.sh test.
Also the removal of this 'overhead' in slot reservations calls for
bigger time-allowance for l2pcap_stress test.

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-09-27 10:02:07 +00:00
Emil Gydesen 874c45241e Bluetooth: Audio: Remove caching ASE on release
Remove the support for caching ASEs on release.

This is mainly due to the 2-stage design in Zephyr: We
have the bt_audio_stream and the bt_audio_ep, where the
the latter represents an ASE in most cases.

However, once the endpoint goes into the codec configured
state, then a stream must be bound to it. This would be fine
(although a stream is technically not established at this point),
except that a stream is also, for unicast, specified for a
specific ACL. Once the ACL disconnects, the stream technically
becomes invalid, and if the stream is invalid, so is the endpoint.

Based on that, there's no reason (or even option) to keep the
endpoint in a codec configured state, as it would not
have a valid stream associated with it.

If we want to support an ASE going into the codec
configured state on ASE release (or ACL disconnect),
the relationsship between ASEs and streams needs to
be redefined.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-09-27 09:16:21 +00:00
Vinayak Kariappa Chettimada 9b30a91e9b tests: Bluetooth: Upload Launch Studio Project and ICS
Uploaded the Bluetooth Launch Studio generated projects and
ICS files. These files can be imported into Bluetooth users
Launch Studio, with their Bluetooth SIG account, and
generate the test plans.

This file provide detailed information in Launch Studio of
the supported Core features, Host Services and Profiles,
and Audio services.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-09-26 13:21:08 +02:00
Ahmed Moheb fab9c5a140 tests: bluetooth: host: Add UT for bt_keys_get_addr()
Unit test project for bt_keys_get_addr().
This part of subsys/bluetooth/host/buf.c unit testing

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-09-26 13:05:47 +02:00
Ahmed Moheb fd888df41d tests: bluetooth: host: Add mocks for keys.c
Add required mocks to be able to compile and test /bluetooth/host/keys.c

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-09-26 13:05:47 +02:00
Jonathan Rico 77e1a9dcad Bluetooth: host: l2cap: add alloc_seg callback
This callback allows use-cases where the SDU is much larger than the l2cap
MPS. The stack will then try to allocate using this callback if specified,
and fall-back on using the buffer's pool (previous behavior).

This way one can define two buffer pools, one with a very large buffer
size, and one with a buffer size >= MPS, and the stack will allocate from
that instead.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2022-09-26 11:05:04 +02:00
Jonathan Rico 7a6872d837 Bluetooth: host: add l2cap stress-test
This test reproduces more-or-less #34600.

It has a central that connects to multiple peripherals, opens one l2cap CoC
channel per connection, and transmits a few SDUs largely exceeding the MPS
of the channel.

In this commit, the test doesn't pass, but when it passes (after the
subsequent commits), error and warning messages are expected from the
stack, as this is not the happy path.

We can later debate on whether these particular error messages should be
downgraded to debug.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2022-09-26 11:05:04 +02:00
Aleksandr Khromykh 43fe45af0f tests: Bluetooth: Mesh: add adv tx complete cb tests
Add bsim tests to check tx callback behavior for advertiser.
Feature coverage:
TX Complete callback execution
Callback order
Packets are freed before the end callback is called

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2022-09-15 16:30:34 +00:00
Aleksandr Khromykh 0cc0249fe4 tests: Bluetooth: Mesh: create skeleton for adv bsim tests
Create skeleton for bsim adv tests with stub for
tx complete callback tests.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2022-09-15 16:30:34 +00:00
Michał Barnaś dae8efa692 ztest: remove the obsolete NULL appended to zassert macros
This commit removes the usage of NULL parameter as message in
zassert_* macros after making it optional

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-09-09 07:05:38 -04:00
Ahmed Moheb db5ef779c4 tests: bluetooth: host: Add UT for bt_buf_get_type()
Unit test project for bt_buf_get_type().
This part of subsys/bluetooth/host/buf.c unit testing

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-09-09 10:06:19 +02:00
Ahmed Moheb e544792ae1 tests: bluetooth: host: Add UT for bt_buf_get_evt()
Unit test project for bt_buf_get_evt().
This part of subsys/bluetooth/host/buf.c unit testing

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-09-09 10:06:19 +02:00
Ahmed Moheb 13203cc801 tests: bluetooth: host: Add UT for bt_buf_get_cmd_complete()
Unit test project for bt_buf_get_cmd_complete().
This part of subsys/bluetooth/host/buf.c unit testing

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-09-09 10:06:19 +02:00
Ahmed Moheb 4abff8a625 tests: bluetooth: host: Add UT for bt_buf_get_rx()
Unit test project for bt_buf_get_rx().
This part of subsys/bluetooth/host/buf.c unit testing

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-09-09 10:06:19 +02:00
Ahmed Moheb cb5ba5bea8 tests: bluetooth: host: Add mocks for buf.c
Add required mocks to be able to compile and test /bluetooth/host/buf.c

Signed-off-by: Ahmed Moheb <ahmed.moheb@nordicsemi.no>
2022-09-09 10:06:19 +02:00
Szymon Czapracki 1e4960b28e Bluetooth: Add IAS tests
Add babblesim tests for IAS.

Signed-off-by: Szymon Czapracki <szymon.czapracki@codecoup.pl>
2022-09-09 10:05:46 +02:00
Szymon Czapracki ac6c35728a Bluetooth: Add IAS shell
This commit adds IAS functionality to the shell.

Signed-off-by: Szymon Czapracki <szymon.czapracki@codecoup.pl>

shell fixes
2022-09-09 10:05:46 +02:00
Vinayak Kariappa Chettimada b304eaa29b Bluetooth: Controller: Add Kconfig for experimental AD Data Chaining
Add a Kconfig for Advertising Data Chaining in Extended and
Periodic Advertising, permitting AD data lengths of upto
1650 bytes. The implementation is experimental and needs
further testing.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-09-08 10:12:56 +02:00
Vinayak Kariappa Chettimada 34154e3efe Bluetooth: Controller: Fix BT_CTLR_ADV_DATA_LEN_MAX Kconfig dependency
Fix BT_CTLR_ADV_DATA_LEN_MAX and other Kconfig dependencies,
and clean up the use of PDU_AC_LL_SIZE_MAX which is used to
allocate scratch packet to be atleast able to accommodate
the minimum 31 bytes AD data such that it is sufficient to
transmit and/or receive scan response PDUs when either
broadcaster or observer alone is supported.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-09-08 10:12:56 +02:00
Anders Storrø 36e34fce41 Bluetooth: Mesh: Add CDB depend on to prov Kconfig
The current implementation of provisioning features is dependent on CDB
to compile, which is reflected poorly in the Kconfig options for mesh.

This commit alters the Kconfig options for provisioning to be dependent
on the CDB option to compile.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2022-09-06 12:35:48 +02:00
Gerard Marull-Paretas 79e6b0e0f6 includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.

The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.

NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-05 16:31:47 +02:00
Michal Narajowski 5c27067dcd Bluetooth: Mesh: Align Config Client API with Health Client API
This PR adds a `*_cli_*` infix to the Config Client API to match
the changes in Health Client. The old API is marked as deprecated.

Signed-off-by: Michal Narajowski <michal.narajowski@codecoup.pl>
2022-09-05 13:56:25 +03:00
Torsten Rasmussen abc3be5965 cmake: remove obsolete CONFIG_ZTEST_NEW_API from CMakeLists.txt
Follow-up: #49243, #48732

With the introduction of Kconfig for unit_testing board and setting
ZTEST_NEW_API in testcase.yaml, the need and support of setting this
directly in CMakeLists.txt is obsolete.

Remove the code line.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-09-05 10:24:10 +02:00
Emil Gydesen 0753ec558d Bluetooth: Shell: Remove nRF board overlays
The board overlays were added to increase the baud rate,
which was useful when scanning when there were many devices.

For that scenario it is probably better to use the
scan filters.

The changed baudrate in the overlays made it harder
to easily switch between e.g. the BT shell and other
applications, as the default baudrate is different, and
you'd need to restablish a connection to the boards UART
to handle the changes.

The other values in the overlays also do not really
provide any advantage to have for just the shell
application.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-09-05 10:17:31 +02:00
Herman Berget 02894c720c Bluetooth: Test: Add test to verify L2CAP sending not changing user data
Regression test for an issue where in cases where sending a buffer over
L2CAP failed, the buffer user data was not restored.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-09-01 14:58:08 +00:00
Aleksandr Khromykh 85fdede4b4 tests: Bluetooth: Mesh: make ext adv default in bsim mesh
Make extended advertiser as deafult advertiser for
general and persistent bsim BLE Mesh tests.
Leave legacy advertiser as default advertiser for
low latency bsim BLE Mesh tests.

The legacy advertiser provides quite poor performance.
Even more, it is not fully compatible with specification
since might spur more frames occasionally then requested.
This is fundamental issue since it cannot stop an advertisement
in exact time. The extended advertiser doesn't have such problem.
However, it is not well tested yet. Since extended advertiser is
not experimental anymore in both controller and host this is
the right time to make ext advertiser as a default in Mesh either.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2022-08-31 21:55:53 +00:00
Erik Brockhoff 7719bc6785 Bluetooth: controller: llcp: fix unhandled rsp in periph phy upd proc
Re. peripheral phy update procedure: UNKNOWN_RSP from central was not
handled, leading to stall of procedure and subsequent procedure timeout

Proper handle and unit test for case added.

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-08-26 11:56:33 +02:00
Vinayak Kariappa Chettimada 649a6250bf tests: Bluetooth: bsim: Verify multiple broadcaster and chain PDU
Added BabbleSim test to reuse the Broadcaster Multiple and
Oberver samples to verify multiple advertising sets and
transmission of Extended Advertising Chain PDU.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-08-23 16:21:00 +02:00
Lang Xie b41d19d85e Bluetooth: Host: Add bsim test for GATT multi notify
Checks that bt_gatt_notify_multiple works as expected.

Signed-off-by: Lang Xie <lang.xie@nordicsemi.no>
2022-08-19 14:09:43 +02:00
Aleksandr Khromykh 46f0d86227 tests: Bluetooth: Mesh: adapt bsim beacon tests for ext adv
Beacon test had trick for extended advertiser. That has been added as
conditional compilation. Additionally, waiting beacon procedure
waits for 1 more second to avoid boundary case since
the extended advertiser is more precisionive.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2022-08-19 12:08:27 +02:00
Aleksandr Khromykh be8d357775 tests: Bluetooth: Mesh: fix reprovisioning test with ext adv
Extended advertiser has better latency without any delays than legacy one.
If couple of config model commands start sequently then
the first ones are received normally but the next one are transmitted in
parallel with leftover communication (retransmissions) of the previous one.
That causes collisions and broken test despite the functionality itself
is ok. Adding delays between commands solves crossovering tx time.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2022-08-19 12:08:27 +02:00
Aleksandr Khromykh f7c77da5c8 tests: Bluetooth: Mesh: adapt bsim lpn tests for ext adv
mesh extended advertiser is not well tested. As the first step
the mesh babblesim tests should pass on extended advertiser as well
as on legacy advertiser. Minor fix to avoid lpn collisions in
friendship tests with multi lpns.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2022-08-19 12:08:27 +02:00
Mariusz Skamra 6219c12035 Bluetooth: csis: Expose bt_csis_generate_rsi function
The function will be used to update the RSI value. The returned value
can be later used in advertisement data for set identification. This
removes the need of specific bt_csis_advertise function so that the user
can call the API to generate new RSI once needed (e.g. on RPA change).
This allows the user to manage the advertisement data to fit it's needs.

< HCI Command: LE Set Extended Advertising Enable (0x08|0x0039) plen 6
        Extended advertising: Disabled (0x00)
        Number of sets: 1 (0x01)
        Entry 0
          Handle: 0x00
          Duration: 0 ms (0x00)
          Max ext adv events: 0
> HCI Event: Command Complete (0x0e) plen 4
      LE Set Extended Advertising Enable (0x08|0x0039) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Extended Advertising Data (0x08|0x0037) plen 33
        Handle: 0x00
        Operation: Complete extended advertising data (0x03)
        Fragment preference: Minimize fragmentation (0x01)
        Data length: 0x1d
        Flags: 0x06
          LE General Discoverable Mode
          BR/EDR Not Supported
        Unknown EIR field 0x2e: 16e61d64dc45
        Name (complete): audio test shell
> HCI Event: Command Complete (0x0e) plen 4
      LE Set Extended Advertising Data (0x08|0x0037) ncmd 1
	Status: Success (0x00)
< HCI Command: LE Set Advertising Set Random Address (0x08|0x0035) plen 7
        Advertising handle: 0x00
        Advertising random address: 4E:21:29:F8:94:93 (Resolvable)
> HCI Event: Command Complete (0x0e) plen 4
      LE Set Advertising Set Random Address (0x08|0x0035) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Extended Advertising Enable (0x08|0x0039) plen 6
        Extended advertising: Enabled (0x01)
        Number of sets: 1 (0x01)
        Entry 0
          Handle: 0x00
          Duration: 0 ms (0x00)
          Max ext adv events: 0
> HCI Event: Command Complete (0x0e) plen 4
      LE Set Extended Advertising Enable (0x08|0x0039) ncmd 1
        Status: Success (0x00)

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-08-19 12:07:31 +02:00
Herman Berget 3a02e60398 Bluetooth: Tests: Add tests for EATT flag API
Checks that both notifications and requests work using the different
channel options.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-08-19 11:59:52 +02:00
Herman Berget 8873b7f05d Bluetooth: Tests: Use chan_opt BT_ATT_CHAN_ANY
The chan_opt field of GATT parameter structs must be set.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-08-19 11:59:52 +02:00
Gerard Marull-Paretas aa1d2cf3d0 tests: bluetooth: initialize devices at compile time
Initialize devices at compile time, allowing to constify device pointer.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Torsten Rasmussen 1a119b4121 tests: use CONFIG_ZTEST_NEW_API=y for bluetooth/controller/ctrl_cte_req
The bluetooth/controller/ctrl_cte_req wrongly defaulted to old Ztest API
after the introduction of the new unit_testing board.

Enforce use of CONFIG_ZTEST_NEW_API to get test working again.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-08-19 05:15:07 +09:00
Torsten Rasmussen c23be568fb tests: add Kconfig file to bluetooth ctrl_data_length_update testcases
With Kconfig support in unittest the bluetooth ctrl_data_length_update
test fails because the symbols being configured are promptless or
disabled because of dependencies.

Add a Kconfig file to make needed symbols visible in unittest mode.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-08-18 14:29:14 +02:00
Torsten Rasmussen 0f15d89a26 tests: remove testing for board unit_testing
Remove boilerplate code:
> if (NOT BOARD STREQUAL unit_testing)
>    message(FATAL_ERROR "This project can only be used with...")
> endif()

as that is now handled by boards.cmake when validating the board.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-08-18 14:29:14 +02:00
Mariusz Skamra 541d946d10 Bluetooth: audio: Add HAS client support for preset switching
This adds client support for switching the active preset along with bsim
tests implementation.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-08-18 12:46:27 +02:00