This refactors the code to use exact copy of bt_gatt_attr_read instead
of mock, as the implementation might call the function with stack
allocated value. Using mock would require deep copy of the value for
further verification. As the buffer where the value is about to placed
is one of the attr->read() parameters, the test may call the read()
callback with stack allocated buffer of defined size and read the value
from the buffer.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Rename the bt_codec struct to bt_audio_codec_conf or
to the new struct bt_audio_codec_cap.
Rename the bt_codec_data to bt_audio_codec_data.
The purpose of this is to split the codec specific configuration
and codec capabilities into seperate structs, as they do not
reflect the same values, or used for the same purpose.
This commit depends on the preset macros workings on either
type of struct (for now), but will be modified in future updates.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This fixes metadata length checks for BT_AUDIO_METADATA_TYPE_EXTENDED
and BT_AUDIO_METADATA_TYPE_VENDOR that should be at least 2 bytes long.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
The CCID list can be empty, as the Assigned Numbers is not strict
regarding it's minimum length.
Fixes: #59666
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This adds tests for receiving ISO Data PDU.
* test_recv_in_streaming_state - test whether received ISO Data PDU is
sent to upper layers.
* test_recv_in_enabling_state - test whether received ISO Data PDu is
dropped because upper layer is not ready to receive the data yet.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
PTS l2cap tests need BT_BUF_ACL_RX_SIZE to be 100.
Signed-off-by: Lang Xie <Lang.Xie@nordicsemi.no>
Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
Some values have been reduced and some have been increased to
better follow the audio configurations in BAP and support
more incoming data.
Also removes HRS as that is not used by LE Audio.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The bt_has_register_param was renamed to bt_has_features_param
recently. Fixes build errors.
Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
The host app should increment the sequence number within SDU interval
whether it has any data to send data to the controller or not.
Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
Following the previous commit that introduce the settings API for the
Bluetooth subsystem, some unit tests needed to be updated to use it.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
A mesh key type has been added to be able to choose the different
key representation for different security libraries.
The type as well as some functionality related to Mesh key
management has been added as a public API.
If tynicrypt is chosen then keys have representation
as 16 bytes array. If mbedTLS with PSA is used then keys are
the PSA key id. Raw value is not kept within BLE Mesh stack
for mbedTLS. Keys are imported into the security library
and key ids are gotten back. This refactoring has been done
for the network(including all derivated keys), application,
device, and session keys.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
In order to have clean, self-contained HCI headers that do not have any
dependencies towards the Host or any other part of the system (except
types), reorganize the headers in the following way:
- Split out the macros and structs from hci.h to a new hci_types.h
- Merge the existing hci_err.h into the new hci_types.h
Fixes#58214.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
ATT attributes can be up to 512 bytes long, so the comparisong needed
fixing.
See spec v5.4, Vol 3, Part F, 3.2.9.
Fixes#57930.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Introduce a Kconfig BT_CTLR_ISOAL_SN_STRICT to relax the Tx
ISO Data SDUs being dropped due to strict check of sequence
numbers in ISOAL, i.e. dropped when ISO Data SDUs are
delayed from upper layer with respect to the current
payload number in the ISO radio events.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Remove usage of Kconfig symbol `CONFIG_BT_DEBUG_LOG` from tests. It has
been deprecated since this PR:
https://github.com/zephyrproject-rtos/zephyr/pull/56183
The Kconfig symbols has been replaced by `CONFIG_LOG=y` on most of the
cases. Or it has been removed when not needed anymore.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
-- Updated test cases to include missing / lost SDUs.
-- Included tests for receiving only framed padding PDUs.
-- Removed tests linked to sink and source configuration params as these
were unused and removed.
Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
Testing:
-- Receiving only padding PDUs for an SDU
-- Receiving leading padding PDUs (not an expected use case)
Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
Added Kconfig options to make HAS characteristics that has notify as
optional property selectable and thus optional. These settings are
global, meaning that a chosen notify property will be used for all
registered has instances.
Signed-off-by: Fredrik Danebjer <frdn@demant.com>
Add support for long writes for the unicast client and server.
This reuses the ATT buffer for long reads.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
After removing the high default for MCS, it was discovered that
the TBS client requires a significant amount of buffers to work
properly as well. Added the requirement as a build assert that
depends on which optional TBS client features are enabled.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
A recent change in MCS significantly reduced the requirement
of L2CAP_TX_BUF_COUNT and should now work with any value.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Until now iterable sections APIs have been part of the toolchain
(common) headers. They are not strictly related to a toolchain, they
just rely on linker providing support for sections. Most files relied on
indirect includes to access the API, now, it is included as needed.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Continue test execution even if assumption failed. This won't break the
test execution prematurely and allow to perform a cleanup.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
This change makes VCS Volume Flag characteristic Notify property
optional and selectable through Kconfig.
Signed-off-by: Fredrik Danebjer <frdn@demant.com>
This is required by GATT/SR/GAW/BV-14-C where PTS does a lot of small
writes to characteristic of 512 bytes.
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
Several duplicates were found with
scripts/twister -T samples/ -T tests/ --dry-run --list-test-duplicates
This is an issue since duplicated names causes overwriting of
results. Most duplicates looked like obvious copy-pase errors.
New names where addopted looking at other tests in the same yaml
or looking at the directory/descriptio.
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
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>
There is no need to store the RPA in bt_addr_le_t structure, as the
bt_addr_le_t.type is unused anyway. Both bt_rpa_create and
bt_id_set_adv_random_addr take bt_addr_t as parameter.
Saves 1 byte of address type.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
Add check to see if RPA is already generated for adv sets
with same id. If generated use the same address for all adv sets
with same id else create new RPA.
Signed-off-by: Nithin Ramesh Myliattil <niym@demant.com>
Twister now supports using YAML lists for all fields that were written
as space-separated lists. Used twister_to_list.py script. Some artifacts
on string length are due to how ruamel dumps content.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Check RPL when rescheduling happens during the reset operation
started by bt_mesh_rpl_reset.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
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>
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>
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>
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>
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>
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>
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>
This adds tests that validate the implementation handles invalid length
Control Point operations.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
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>
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>
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>
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>
-- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
This fixes merge conflict issue by adding missing function
parameters that were introduced in
57784df5f0.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
(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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
* 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>
- 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>
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>
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>
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>
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>
- 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>
Test Dev Key Refresh, Node Composition Refresh and Node Address Refresh
procedures for robutness.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
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>
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>
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>
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>
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>
- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
`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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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
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>
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>
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>
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>
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
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>
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
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>
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
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
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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
-- 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
This fixes check whether shell application can be built without CAP
Acceptor Set Member support.
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
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>
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>
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>
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>
Updates the broadcast source API to create subgroups and
to set BIS specific codec configuration
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>