Add unit tests of the CCID functions.
To support these new tests, the GATT mocks need to
support dynamic GATT DB so we can add and remove
a service that contains CCIDs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This change makes sure that when a call to `bt_id_set_scan_own_addr` is
sucessful, i.e., the return value is 0, the `own_addr_type` will
be set by the `bt_id_set_scan_own_addr`.
Not setting the `own_addr_type` in a successful call to
`bt_id_set_scan_own_addr` causes, for example,
the `start_le_scan_ext` method in `scan.c` to use an
uninitialized `own_addr_type`.
Eventually this results in an unexpected failure further down in
`start_le_scan_ext`, when sending HCI command to controller with
an uninitialized `own_addr_type`.
Signed-off-by: Erik Sandgren <erik.sandgren@nordicsemi.no>
Modify the GAP connect to use 30ms. The default parameters
typically ended up with 50ms which is OK in most cases,
but for ISO related test cases, using an ACL interval that
is a multiple of the ISO SDU interval (7.5/10ms) generally
provides better stability. 30ms is the lowest multiple
of both 7.5 and 10ms, and was thus chosen.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If the Broadcast ID is initially set to 0x000000,
which is valid, comparison logic on add of an
actual Broadcast ID of 0x000000 fails.
Likewise for SID.
Moving INVALID_BROADCAST_ID define to bap.h
Signed-off-by: Lars Knudsen <LAKD@demant.com>
Fix of the subnet bridging table function to only
compact the table if elements has been removed, and
fixing the compact function to compact the table if
several elemnts has been removed at the same time.
Fixes zephyrproject-rtos#78794
Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
The host-based adv auto-resume function has both a problematic
implementation and disagreement in the community around how it should
behave. See the issue linked resolved below for details.
This patch makes the deprecation visible to the user. The user will be
better served by a auto-resume tailored their applications use case,
based on more primitive host API like `conn_cb.recycled`, which has
obvious behavior that is unlikely to change.
Resolves: https://github.com/zephyrproject-rtos/zephyr/issues/72567
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
Disable CDC ACM logging in configuraton overlay used in test case
bluetooth.shell.cdc_acm.
The build warning was introduced by the commit e8c4867806
("usb: cdc_acm: disable logging if used for shell with logging")
to preven recursive logging when using the CDC ACM UART as shell or
logging backend
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Adds a semaphor to make sure the stream has properly been stopped by the
controller before returning from btp_bap_broadcast_source_stop.
Signed-off-by: Frode van der Meeren <frode.vandermeeren@nordicsemi.no>
Makes it easier to make sure the CS test code is removed if desired.
It should hopefully allow for a clean split in general.
Signed-off-by: Olivier Lesage <olivier.lesage@nordicsemi.no>
The QoS structure is not related to a codec, but rather a
stream, and should thus not use the "Codec" name.
The BAP and ASCS specs refer to the QoS as
"QoS configuration" several places, so it is an obvious
choice for a name.
Since the structure is defined and used by BAP, the prefix
was changed from bt_audio to bt_bap.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
TBS registration was changed from static to dynamic
and the BT Tester application need to be updated to use
the dynamic registration.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
If a connection update (from central) overlaps a peripheral initiated
conneection param request, then central rejects peripheral request
and continues central procedure. This lead to an assert in peripheral
On instant there would not be an rx_node for notification, as this
would have been discarded by the reception of the REJECT.
This fix ensures that once an rx_node has been 'accepted' for retention
it will not be discarded/overwritten by future rx_nodes
The test will trigger the assert without the fix in.
Signed-off-by: Erik Brockhoff <erbr@oticon.com>
Removes duplicate declaration of the bridging direction, keeping the
one in the public header file.
Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
Adds the `bt_mesh_brg_cfg` prefix to the public Subnet Bridge API, and
aligns the function and callback naming with the rest of the Bluetooth
Mesh API.
Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
Add more parameter checking for the unittests for the
CAP procedure 'broadcast reception stop'
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
The unicast_stop function is changed to primarily do a
BAP disable instead of a release, with optional
support for releasing the streams once they have been disabled.
This also adds unittests for the procedure which also
allow us to remove the invalid param testing from the BSIM tests.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Increasing the number of max tx segments to be able to fit composition
page 0 into composition data status message.
After the subnet bridge config client and server are added to the
tester, the size needed to report composition data page 0 increased.
Current behaviour of the tester is correct, dropping the element when
there is not enough space in data field, however the PTS application
does not handle the composition data status message without element.
Signed-off-by: alperen sener <alperen.sener@nordicsemi.no>
Added support for dynamic registration and unregistration of the
Broadcast Audio Scan Service (BASS) within the scan delegator.
This enables both scan delegator and BASS to be registered or
unregistered dynamically at runtime.
Signed-off-by: Babak Arisian <bbaa@demant.com>
This commit makes the device tree configuration decide
which link layer is compiled in. We do this to avoid
hard-to-understand linker errors referencing device tree nodes.
The following configuration creates a difficult to parse
linker error:
* BT_LL_CHOICE contains multiple entries, BT_LL_SW_SPLIT
is selected.
* Each BT_LL_CHOICE has its own unique device tree node with its
own "compatible".
* Only one of the link layer device tree nodes has status "okay",
but not the one corresponding to BT_LL_SW_SPLIT.
The linker error indicates that code using the HCI driver fails
to link with the controller. This because the HCI driver device
tree node references the link layer selected in devicetree which
is not compiled in.
By adding a dependendency to the device tree node, this can no longer
happen. Instead, if BT_LL_SW_SPLIT is now selected in a configuration
file, a Kconfig warning will be issued:
```
warning: The choice symbol BT_LL_SW_SPLIT
(defined at subsys/bluetooth/controller/Kconfig:129) was
selected (set =y), but BT_LL_SOFTDEVICE (defined at
/home/ruge/ncs/nrf/subsys/bluetooth/controller/Kconfig:11)
ended up as the choice selection.
```
This should be easier to understand than:
```
...(hci_core.c.obj):(.data.bt_dev+0x16c):
undefined reference to `__device_dts_ord_132'
```
After this commit we should consider getting rid of link layer
selection from Kconfig completely as the link layer is in practice
selected through device tree.
Unit tests have been updated to satisfy the dts dependency.
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
native_posix is now deprecated.
Building these tests in both native_sim and native_posix does not
improve coverage for the tests or subsystem but doubles CI time.
As anyhow native_posix will be removed all together in
2 releases, let's remove it already for these.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
native_posix is now deprecated.
Building this sample in both native_sim and native_posix does not
improve coverage for the sample or subsystem but doubles CI time.
As anyhow native_posix will be removed all together in
2 releases, let's remove it already for this sample.
Also let's remove a few redundant test platform filters
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Added helper functions to set and get assisted listening
stream values for codec capabilities and codec configs.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
BAP mandates support for bondable mode for all central and
peripheral roles.
Due to Kconfig circular dependencies, some additional
Kconfig changes had to be made.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Rename the volume flag field from the generic "flags"
to "vol_flags" as the generic "flags" will be used for
other values in a future commit.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Removed deprecated native_posix as test platform.
Added unique sim_ids for tests with the psa as a overlay.
Fixed clang-format issues.
Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
When a message with invalid parameters is received, we must ignore it.
In this commit we check invalid parameters first.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
When a synchronous API is used, the content of `buf` will not be
valid by the time the thread that called the synchronous API is woken up
again.
Therefore, the simplest way to solve this is when a user allocates the
buffer which will be filled up with the content of the buffer passed to
the model callback.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
The initial implementation of RPL check for Subnet Bridge wasn't fully
correct. It decides whether to relay or not a PDU based on RPL of only
received messages. However, the spec section 3.9.8 says:
```
In addition, a Subnet Bridge node shall implement replay protection for
all Access and Transport Control messages that are sent to bridged
subnets.
A Subnet Bridge node shall maintain the most recent IVISeq value for
each source address authorized to send messages to bridged subnets.
Messages received by the Subnet Bridge node with the IVISeq value less
than or equal to the last stored value from that source address shall
be discarded immediately upon reception. When a message is retransmitted
to a bridged subnet, the stored IVISeq value shall be updated. In this
way, bridged subnets are protected against replay attacks from other
subnets.
```
This was noticed with MESH/NODE/SBR/NET/BV-02-C test. It passes when
PTS misses the message at step 3 and 4, and fails when PTS manages to
receive the message.
This commit fixes the wrong behavior by removing argument for
`bt_mesh_rpl_check` function making store a new message and bypassing
`local_match` check in case of Subnet Bridge node.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Though nvs backend checks whether the data passed to it is identical to
the stored one, this isn't guaranteed by other the settings api. We can
also avoid going into the settings subsystem since we know what was
actually changed.
This commit adds 2 flags that allow to control whether Subnet Bridge
or Bridging Table states were changed and skips storing if the certain
state was not changed.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Added support for the Bridge Configuration client and server
to the tester application.
Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
Adds implementation for the Bridge Configuration Server model.
Updates `brg_cfg` module to add sanity check for
bt_mesh_brg_cfg_tbl_remove() API. Also, updates the unit test
accordingly.
Adds documentation for the Bridge Configuration Server model
Signed-off-by: Omkar Kulkarni <omkar.kulkarni@nordicsemi.no>
The `brg_cfg` module implements the states needed for subnet bridge
feature. It provides two states - enable state, and bridging table
state. APIs are provided to access and modify the states. The module
handles responsibility of persistence of the states.
Signed-off-by: Omkar Kulkarni <omkar.kulkarni@nordicsemi.no>
Any places that checked for GTBS is now always enabled
as GTBS is mandatory to support, and the Kconfig option
was removed.
Also removed a duplicate Kconfig option for TBS,
BT_TBS_SERVICE_COUNT, as it was unused.
The other Kconfig option BT_TBS_BEARER_COUNT is used
instead exclusively to set it if needed.
Since GTBS can now exist alone, it must also
support having its own calls and other values.
This means that the GTBS and TBS instances now share
the same underlying struct.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Use a new file and command for this where all CS commands
can live.
Added support for bt_cs_set_default_settings command.
Added test case where shell is built with CS to ensure code
is built in CI.
Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
The unit tests needed to enable the hidden Kconfig
BT_BAP_BASE. Instead of adding an additional Kconfig for this,
just enable one of the roles that enable it.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
There were a couple of controller tests outside the
controller directory which have been moved there to
simplify the structure a bit.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Added option to set the ASE count through the bap API, making ASE
configuration runtime available. The upper limit of ASEs are still
bound by the Kconfig options set for ASEs.
Signed-off-by: Fredrik Danebjer <frdn@demant.com>
Move the network buffer header file from zephyr/net/buf.h to
zephyr/net_buf.h as the implementation now lives outside of the networking
subsystem.
Add (deprecated) zephyr/net/buf.h header to maintain compatibility with old
file path.
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
Move the net_buf implementation from the networking subsystem to a library
as they have no dependency on the networking subsystem.
Network buffers are used in subsystems outside of networking
(e.g. Bluetooth, USB).
Fixes: #36374
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
The TBS client callbacks are just informative so we
provide the information to multiple listeners.
To support this for the long strings, the function
handle_string_long_read was refactored.
This also allows for multiple users of the TBS client.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The CAP commander used bt_audio_valid_ltv which required
BT_BAP_STREAM to be enabled, but the CAP Commander does not
need BT_BAP_STREAM to be enabled.
Moved the function to audio.c which is always compiled for
the CAP Commander, thus removing the requirement for
BT_BAP_STREAM and the accompanying bt_bap_stream.c file.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When calling bt_cap_initiator_unicast_audio_start on a set of streams
that are all in the streaming state we return early with -EALREADY.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The unicast_start procedure should take a stream in any state
and put it in the streaming state. Adds tests with streams
in various states.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>