Commit graph

186 commits

Author SHA1 Message Date
Carles Cufi 22f73992b2 Bluetooth: Rework the HCI header set
In order to have clean, self-contained HCI headers that do not have any
dependencies towards the Host or any other part of the system (except
types), reorganize the headers in the following way:

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

Fixes #58214.

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

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

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

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

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

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-06-08 04:10:58 -04:00
Théo Battrel f5ff886260 Bluetooth: Tests: Remove usage of BT_DEBUG_LOG
Remove usage of Kconfig symbol `CONFIG_BT_DEBUG_LOG` from tests. It has
been deprecated since this PR:
https://github.com/zephyrproject-rtos/zephyr/pull/56183

The Kconfig symbols has been replaced by `CONFIG_LOG=y` on most of the
cases. Or it has been removed when not needed anymore.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2023-06-07 13:56:55 -04:00
Théo Battrel cb48626399 Bluetooth: Test: Update ccc_store bsim test
Update `ccc_store` bsim test to remove the 'expected failure'. The issue
being fixed in the following commit.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2023-05-25 16:32:49 -04:00
Mariusz Skamra 4c93cb8fc9 tests: bsim: tmap: Fix missing execute permission
This fixes missing permission to execute TMAP BSIM tests.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-05-25 08:29:31 +00:00
Emil Gydesen e0b84798c9 BluetootH: Audio: Split CAP broadcast start API
Split the CAP initiator broadcast start API into a create
and a start. This will allow users to create the broadcast source
without starting it immediately, making it possible to get the
BASE etc. without an active advertising set.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-25 08:26:33 +00:00
Aleksander Wasaznik 92fcd9ef40 Bluetooth: Host: Add L2CAP seg_recv API
This is an alternative API for the L2CAP receive functionality. It
allows an application the receive L2CAP segments directly and manage
credits explictly. The API is guarded by an experimental kconfig option.

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

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-05-24 13:15:14 -04:00
Emil Gydesen 579e80540c tests: Bluetooth: Cleanup Audio BSIM prj.conf
Several options were set that should not be set.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-24 16:42:07 +02:00
Silviu Petria 5096aa1c00 Bluetooth: Audio: Add TMAS and two TMAP samples
Add implementation of the Telephony and Media Audio Service, as well as
two sample applications.

tmap_central reflects a smartphone implementing the Unicast Media Sender
and Call Gateway TMAP roles.

tmap_peripheral reflects an earbud implementing the Unicast Media
Receiver and Call Terminal TMAP roles.

Upon connection, tmap_central starts an audio stream using CAP Initiator
APIs.

CCP, MCP and VCP are discovered and used to send example commands.

Future improvements: 2-earbud support, add TMAP Broadcast roles,
update with new CAP Acceptor/Commander APIs as they become available

Signed-off-by: Silviu Petria <silviu.petria@nxp.com>
2023-05-24 16:39:38 +02:00
Emil Gydesen 3074c72d79 Bluetooth: BAP: Move endpoint discovery to new callback
Add a new endpoint callback that is used to report the found
ASEs during BAP discovery, rather than calling
the discovery callback with optional values.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-22 15:24:28 +02:00
Emil Gydesen 1c304d9d23 Bluetooth: BAP: Move pac record discovery to new callback
Add a new pac_record callback that is used to report the found
PAC records during BAP discovery, rather than calling
the discovery callback with optional values.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-22 15:24:28 +02:00
Emil Gydesen 5d498d78ad Bluetooth: BAP: Remove bt_bap_unicast_client_discover_params
Remove the BAP unicast client specific discover parameter struct.
This make the BAP discover work more similar to the other
profiles.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-22 15:24:28 +02:00
Emil Gydesen ffca5f9b2f Bluetooth: BAP: Remove dir from BAP discovery parameters
The direction has been moved to a function parameter instead,
and we keep a local copy of the value in the stack instead.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-22 15:24:28 +02:00
Emil Gydesen 1199e46e0b Bluetooth: BAP: Remove num_eps from BAP discover params
The field is not required and is no longer used.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-22 15:24:28 +02:00
Emil Gydesen 0b10498fb1 Bluetooth: BAP: Remove num_caps from BAP discover params
The field is not needed and no longer used.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-22 15:24:28 +02:00
Emil Gydesen 11f5f3b080 Bluetooth: BAP: Move uni cli discov err to callback
Move the err field from the discover parameters to
the callback.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-22 15:24:28 +02:00
Emil Gydesen 39406a4843 Bluetooth: BAP: Move uni cli discover callback
Move the unicast client discover callback from the
parameters to the callback structure.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-22 15:24:28 +02:00
Vinayak Kariappa Chettimada 6ed100bdc9 Bluetooth: Controller: Add BT_CTLR_SW_SWITCH_SINGLE_TIMER coverage
Add BT_CTLR_SW_SWITCH_SINGLE_TIMER coverage in BabbleSim
tests.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-05-22 12:02:02 +02:00
Emil Gydesen cdc84f7867 tests: Bluetooth: CAP initiator unicast invalid param tests
Add tests for testing invalid parameters for the CAP
initiator unicast APIs.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-18 13:13:13 +00:00
Emil Gydesen bd069c36be tests: Bluetooth: CAP initatior broadcast invalid param testing
Add testing of using invalid parameters for the CAP initiator
broadcast APIs.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-18 13:13:13 +00:00
Emil Gydesen cf39633c80 tests: Bluetooth: CAP Initiator broadcast test to smaller functions
Split the CAP Initiator broadcast test into smaller functions.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-18 13:13:13 +00:00
Emil Gydesen 23b4105b9a tests: Bluetooth: Broadcast Sink test resync
After stopping the sync, try to sync again to see
that the broadcast sink can be restarted.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-15 15:26:04 +02:00
Emil Gydesen a16dbbc76c tests: Bluetooth: BAP Broadcast Sink invalid testing
Add invalid parameter testing for the BAP Broadcast Sink.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-15 15:26:04 +02:00
Emil Gydesen 7b3db7c15d Revert "tests: Bluetooth: Audio: Enable EATT for bsim tests"
This reverts commit f6405d993178c1d1c134981f1457347837bfd05a.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-13 02:29:05 +09:00
Emil Gydesen 2fedefa237 tests: Bluetooth: Audio: Add long metadata for unicast test
Add a 128-octet long metadata for the capabilities to
test the long read functionality.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-12 15:29:17 +02:00
Erik Brockhoff 3daa01c191 Bluetooth: test: adding bsim basic conn test of multiple re-connects
Adding a test that confirms ability to perform 20 (re)connections
between simple peripheral and central

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2023-05-12 12:53:16 +02:00
Erik Brockhoff 5582c009a4 Bluetooth: test: fixing callback declaration in basic conn bsim test
Using the macro for declaring the callback struct does not make
sense in this construct, where test_connect1/2 are compiled into one
image and specific test functionality is selected via test ID

This reverts change made by #8e1682d which is incorrect for the cases
where the compile happens to include more than one declaration of the
callback struct.

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2023-05-12 12:53:16 +02:00
Vinayak Kariappa Chettimada 4f928af21a tests: bsim: Bluetooth: Update the ACL group CIS test to 4 connections
Update the ACL group based scheduling with ACL first being
connected to use 4 connections and 4 streams to be
consistent with the test that does ACL the CIS one after
the other.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-05-12 12:28:51 +02:00
Vinayak Kariappa Chettimada d2602a54c2 tests: bsim: Bluetooth: Use defines for parameters in CIS tests
Use defines for scan, create connection, connection and ISO
parameters in the tests.

Also, use same advertising interval for legacy and extended
advertising test.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-05-12 12:28:51 +02:00
Nithin Ramesh Myliattil 8d6b206064 subsys/bluetooth/host: Make rpa same for adv sets with same id
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>
2023-05-11 08:31:24 +00:00
Emil Gydesen 4b31f8c6f5 tests: Bluetooth: CSIP: Add no rank, size and lock char tests
Add tests for cases where the rank characteristic, the size
characteristic and the lock characteristics are not set on the
set members.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-10 10:14:56 +02:00
Emil Gydesen 65808bb102 tests: Bluetooth: Split CSIP tests to multiple scripts
Split the CSIP tests to multiple scripts to make them
more specific and able to run in parallel.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-10 10:14:56 +02:00
Emil Gydesen 41fd5b80df Bluetooth: CSIP: Add missing and fix Set Coordinator set info
The set info returned by the Set Coordinator did not contain
information about the lockable state. Furthermore the
set info was not properly initiated, as it was missing the
rank, which was set somewhere else.

This commit adds the lockable state to the set info.
This commit removes the rank from internal structure,
and uses a reference to the set info instead, and only
store the rank there.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-10 10:14:56 +02:00
Alberto Escolar Piedras 90b3425320 tests/bsim: run_parallel: Do not set exe permissions if missing
This script tried to be too nice with users, and if they forgot
to set the scripts as executable, set it for them.
But this leads to too many testcases commited to main without
executable permissions.
Which then leads to other developers needing to set those
locally and end with dirty workspaces.

Instead let's not have run_parallel set the executable bit,
and have these tests fail in CI, so developers realize and fix it.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-05-09 13:04:19 +02:00
Alberto Escolar Piedras f11e9ec6a5 tests/bsim: Set all tests scripts as executable
Test scripts need to have executable permissions.
Otherwise, run_parallel will change the mode in CI,
and users need to set them locally which results
in a not clean git workspace.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2023-05-09 13:04:19 +02:00