Commit graph

2414 commits

Author SHA1 Message Date
Mariusz Skamra
b86355b2e6 tests: bsim: Add HAS test for reading of preset list
This adds Read Presets operation bsim test.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-05-13 08:46:21 -07:00
Mariusz Skamra
305d5bc119 tests: shell: Add shell for HAS client
This adds shell module for HAS client with it's initial functionality.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-05-13 08:46:21 -07:00
Piotr Pryga
e1c441d4c4 tests: Bluetooth: cte_req: Set missing is_enabled flag
CTE request tests were not working because there was missing
a code that sets conn.llcp.cte_req.is_enabled flag.
If the flag is not set, then the CTE request state machine
comletes its execution immediately as if the request was
disabled by Host in the meantime.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-05-13 10:25:39 -05:00
Piotr Pryga
e81414d28f Bluetooth: Controller: Fix CTE_REQ disable lock if there is no CTE_RSP
The periodic CTE_REQ disable command, requested by Host, may be locked
until connection is dropped due to missing CTE_RSP from peer device.
That is caused by implementation of CTE_REQ disable and CTE_REQ
control procedure handling.

The procedure is marked as active when CTE request was send to peer
device. It is marked as inactive after completion of the procedure.
That caused locking of CTE disable on a semaphore.

The BT 5.3 Core Spec, Vol 4, Part E, section 7.8.85 says the HCI_LE_-
Connection_CTE_Request_Enable should be considered active on a conne-
ction from when Host successfully issues the command with Enable=0x1
until a command is issued with Enable=0x0 or single LLCP CTE request
has finished (CTE_Request_Interval=0x0). Also there is a clarification
from BT SIG that the command with Enable=0x0 does not affect any
initiated LLCP CTE request. That means Controller is allowed to finish
already started procedure and it is not allowed to start new LLCP CTE
request procedure after completion of the command with Enable=0x0.

Taking that into account, there is no need to synchronize ULL and LLL
in regard of disable the LLCP CTE request while the procedure is
pending. Controller is free to complete the procedure or terminate it.

The change removes all code related with cte_req.is_active, disable
callback and waiting of ULL for LLL to finish the LLCP CTE request.

The ULL will complete the HCI_LE_Connection_Request_Enable with
Enable=0x0 immediately. In case the procedure is disabled in before
the response arrives, then further processing of the response is
dropped and the procedure context released.

The context is not released by the code responsible for disable
handling, to have single place where it is done.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-05-13 10:25:39 -05:00
Emil Gydesen
83c7baf34a Bluetooth: Audio: Add recv_info to audio recv callback
The audio stream receive callback now contains a
recv_info struct, which contain crucial information
such as timestamps and packet validity.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-05-10 18:56:28 +02:00
Emil Gydesen
6191a76f55 Bluetooth: Audio: Add _DIR_ infix to BT_AUDIO_SINK/SOURCE
The values represent an enum, and it makes sense for the
enum values to follow the enum type name, so an
_DIR_ infix was added to the values.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-05-10 18:56:00 +02:00
Emil Gydesen
19d7420f07 Bluetooth: Audio: Standadize the use of enum bt_audio_dir
Many functions and struct fields had the directory/type
value, but named in different ways and stored in different ways.

This change updates all uses of it to use the same name
and type.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-05-10 18:56:00 +02:00
Emil Gydesen
6b41e9991d Bluetooth: Audio: Rename enum bt_audio_pac_type
The enum bt_audio_pac_type does not fully
represent the what the value is used for.

The typical use of it is not for just published
audio capabilities (PAC), but rather describes the
type, or direction, of audio endpoints.

For the unicast client, the type/direction is
relative to the unicast server.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-05-10 18:56:00 +02:00
Morten Priess
ffc07e0293 tests: bluetooth: Added VS RX data path to ISO test
Verifies ISOAL functionality for VS RX data path by implementing weak
function ll_data_path_sink_create, and implementing sink callbacks.

Test verifies construction of sink and checks that SDUs are emitted in
VS sink implementation.

Test relies on the Nordic synchronous receiver implementation, and is
compiled under CONFIG_BT_CTLR_ISO_VENDOR_DATA_PATH, which is enabled in
the project file.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2022-05-10 18:55:35 +02:00
Vinayak Kariappa Chettimada
7fff64f65a tests: Bluetooth: bsim: Assign BT_CTLR_ADV_DATA_LEN_MAX value
Assign BT_CTLR_ADV_DATA_LEN_MAX value to 255 to match the
corresponding BT_CTLR_SCAN_DATA_LEN_MAX value.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-05-09 09:28:34 +02:00
Emil Gydesen
5628b29b01 Bluetooth: Audio: broadcast_source_create array of stream pointers
The bt_audio_broadcast_source_create function will now
take an array of stream pointers, instead of an array
of streams. This is to make the API more flexible as
well as more consistent with the unicast API.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-05-09 09:28:14 +02:00
Emil Gydesen
6e60451e09 Bluetooth: Audio: Change array of unicast streams to array of pointers
In bt_audio_unicast_group_create, bt_audio_unicast_group_add_streams
and bt_audio_unicast_group_remove_streams to use an array
of pointers, instead of an array of streams.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-05-09 09:28:14 +02:00
Gerard Marull-Paretas
ade7ccb918 tests: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all tests to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 20:02:14 +02:00
Piotr Pryga
41a05e707d tests: Bluetooth: llcp: Add tests to check instant if no PHY change
There were no unit tests that verify if instant value send in
LL_PHY_UPDATE_IND PDU are correct. The commit adds missing tests.

Besides that there is a small update to all ull_cp_phy_update calls,
to improve readability of the code. Magic number was changed to
HOST_INITIATED macro.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-05-06 11:50:59 +02:00
Morten Priess
112c38e757 tests: bluetooth: Updates for ISOAL unittest
Minor adjustments due to implementation changes.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2022-05-06 11:32:30 +02:00
Piotr Pryga
fecc193630 tests: Bluetooth: df: Enable refactored LLCPs for df conn test
There was missing kconfig option that enables refactored LLCPs.
That caused build error in Direction Finding connection_cte_tx_params.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-05-05 14:41:59 -05:00
Piotr Pryga
ccbe5a56e8 tests: Bluetooth: df: Fix ref to renamed ll_scan_set member
The ll_scan_set::per_sync was renamed to ll_scan_set::periodic.
Direction finding connectionless_cte_rx test didn't build.

The commit fixes the issue.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2022-05-05 14:41:59 -05:00
Herman Berget
29e3188703 Bluetooth: Tests: Mark test scripts as executable.
The mode change was showing up in the git diff after running all bsim
tests.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-05-05 14:40:21 -05:00
Herman Berget
51dde9e87a Bluetooth: Tests: Reduce simulation time for L2CAP test
The test was running for unnecessarily long.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-05-05 14:40:21 -05:00
Herman Berget
e73d530cb4 Bluetooth: Host: Add test for EATT reconfigure callback
Check that the att_mtu_updated callback is called when receiving a
reconfigure request.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-05-04 10:35:31 +03:00
Emil Gydesen
0ceb27553f Tests: Bluetooth: Audio: Update unicast bsim tests with release procedure
Add the release procedure for the unicast audio tests.
This also run the existing tests multiple times to ensure
that the states are properly changed across multiple
attempts.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-04-28 14:18:11 +02:00
Emil Gydesen
84e923cea3 Bluetooth: Audio: Group and cleanup test steps in unicast client bsim test
Move the test steps into functions for more reusability and
readability.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-04-28 14:18:11 +02:00
Thomas Ebert Hansen
20cb60ecd2 Bluetooth: controller: Fix central enc termination
Terminate connection with a MIC failure if an unexpected control PDU
is received during the Encryption Start procedure.

Add a greedy option to pdu_is_expected() to make sure the procedure
processes all unexpected control PDU in all cases.

Add unit test inspired by Bluetooth Qualification test
LL/SEC/CEN/BV-14-C,
Central Receiving unexpected PDU during encryption start

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2022-04-28 12:55:48 +02:00
Thomas Ebert Hansen
70e38b1cbb Bluetooth: controller: Fix central enc reject
Add support for both LL_REJECT_IND and LL_REJECT_EXT_IND when waiting
for the the response to the LL_ENC_REQ and LL_START_ENC_REQ.

Add unit test to test both LL_REJECT_IND and LL_REJECT_EXT_IND as
responses to LL_ENC_REQ.

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2022-04-28 12:55:48 +02:00
Thomas Ebert Hansen
268d00623b Bluetooth: controller: Fix periph enc reject
Chose correct rejection PDU based on features supported on remote peer
when rejecting due to missing LTK.

Update unit test setup with faking that a feature exchange procedure
has run.

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2022-04-28 12:55:48 +02:00
Thomas Ebert Hansen
06feb0202c Bluetooth: controller: Fix periph enc termination
Terminate connection with a MIC failure if an unexpected control PDU
is received during the Encryption Start procedure.

Add unit test inspired by Bluetooth Qualification test
LL/SEC/PER/BI-05-C,
Peripheral Receiving unexpected PDU during encryption start

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2022-04-28 12:55:48 +02:00
Szymon Janc
6ac7bda97d tests: Bluetooth: Add test for invalid LLCP PDU sized
This verifies that invalid size PDUs are detected.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-04-28 12:52:57 +02:00
Erik Brockhoff
26f6941048 Bluetooth: controller: using REJECT_IND when EXT_IND was not negotiated
Unless a feature exchange determines support for REJECT_EXT_IND use
REJECT_IND for collision rejection

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-04-27 10:09:03 +02:00
Erik Brockhoff
06078ee54e Bluetooth: controller: DO TODO, compile out members of struct re. CPR
Compile out misc. members not used when Connection Parameter Request
is not supported.
Implement missing tests re. unsupported features in CU/CPR procedure

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-04-27 10:09:03 +02:00
Erik Brockhoff
0d015fd212 Bluetooth: test: adding helper to verify CTE_RSP notification
This to remove TODO and improve the CTE unit test

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-04-27 10:09:03 +02:00
Mariusz Skamra
5bd1c68dee Bluetooth: tests: Add shell build tests for hearing access service
Add entries for HAS builds to testcase list.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-04-27 10:08:56 +02:00
Alexandru Carbuneanu
59dd898c2b test: bsim: Notification EATT test
Increasing the test coverage of notification on EATT bearers.
- test implementation

Signed-off-by: Alexandru Carbuneanu <alexandru.carbuneanu@nordicsemi.no>
2022-04-27 10:08:42 +02:00
Michał Narajowski
54cd46ac68 tests/bluetooth/tester: Refactor Read UUID callback
ATT_READ_BY_TYPE_RSP returns Attribute Data List so handle it in the
application.

This affects GATT/CL/GAR/BV-03-C.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2022-04-26 17:38:53 +02:00
Erik Brockhoff
d8f0c1adf6 Bluetooth: controller: implement connection termination on invalid pdus
When a running procedure receives a REJECT or UNKNOWN_RSP PDU that is
not an expected part of the procedure flow this leads to termination
of the connection

This affects procedures:
CU/CPR, CTE, PHY, PING, DLE, FEX, VEX, CHMU

Unit tests are updated to cover the updated behaviour.

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-04-26 14:06:16 +02:00
Emil Gydesen
a796927961 Bluetooth: Audio: Make PACS location optional
Make the PACS location characteristic optional, and
also optionally writable.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-04-26 09:00:48 +02:00
Vinayak Kariappa Chettimada
b035a0a2f5 tests: Bluetooth: init: Cover ext. adv without ext. scan filter policy
Update debug project configuration file to cover building of
Bluetooth with Extended Advertising support without Extended
Scan Filter Policy.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2022-04-25 11:44:22 -07:00
Herman Berget
3aef3dae02 Bluetooth: Host: Add test for GATT tx complete callback
Checks that the callback given to bt_gatt_notify_cb is called.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-04-24 19:46:41 +02:00
Herman Berget
23d4788afa Bluetooth: Host: Add more tests for GATT client becoming change-aware
For clients with both a single and multiple ATT channels:
 - Read a characteristic before reading the DB hash and then retrying
 - Read the DB hash and then do the reads
 - Retry the reads without reading the DB hash

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-04-20 16:10:46 +02:00
Herman Berget
2a5d9d10d1 Bluetooth: Host: Update GATT caching test to encrypt the link
EATT channels shall be encrypted. Without encrypting the link, all
requests will be sent on the fixed ATT channel.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-04-20 16:10:46 +02:00
Herman Berget
e5004d9261 Bluetooth: Tests: Wait for sync from other devices only
The sync mechanism using Babblesim backchannels picked up self-sent
messages. Use the device number as data to disambiguate messages from
other devices.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-04-20 16:10:46 +02:00
Asbjørn Sæbø
b0d5db147b Bluetooth: Audio: Media control - pass structs by reference
Changes the media_proxy API to pass structs by reference instead of by
value.

Also pass structs by reference in internal functions in media player
and in media controller test.

Add pointer checks to the public API implementation where
user/application code provides structs by reference.

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
2022-04-20 15:51:01 +02:00
Asbjørn Sæbø
fa5b8a1e38 Bluetooth: Audio: MCC - pass structs by reference
Changes the media control client API to pass structs by reference
instead of by value.

Also change internals of test to pass struct by reference.

Signed-off-by: Asbjørn Sæbø <asbjorn.sabo@nordicsemi.no>
2022-04-20 15:51:01 +02:00
Aleksandr Khromykh
83169f51af tests: Bluetooth: Mesh: test of IV index behavior
Testing of IV update, IV recovery and deferring of
the IV update procedure in case of ongoing segmented
transaction.

Signed-off-by: Aleksandr Khromykh <Aleksandr.Khromykh@nordicsemi.no>
2022-04-19 11:47:57 +02:00
Szymon Czapracki
827890c075 Bluetooth: audio: Add initial Hearing Access Service shell
This adds initial shell support for HAS.

Signed-off-by: Szymon Czapracki <szymon.czapracki@codecoup.pl>
2022-04-15 10:32:54 -07:00
Tristan Honscheid
aa8f740abf ztest API Migration: bluetooth/l2cap
Migrate the unit tests at `bluetooth/l2cap` to use the new ztest API.

Signed-off-by: Tristan Honscheid <honscheid@google.com>
2022-04-14 09:07:23 +02:00
Tristan Honscheid
7e7855d669 ztest API Migration: bluetooth/at
Migrate the unit tests at `bluetooth/at` to use the new ztest API.

Signed-off-by: Tristan Honscheid <honscheid@google.com>
2022-04-14 09:06:57 +02:00
Erik Brockhoff
f056eb516d Bluetooth: controller: Implementing LL param checks for refactored CPR
Now refactored Connection Parameter Request procedure supports
parameter checking, and implements reject_ext_ind on invalid parameters

Updates to TODO description for remaining work

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2022-04-12 09:57:43 +02:00
Lingao Meng
37e561f42e Bluetooth: Host: Add choice select whether BT RX
Change CONFIG_BT_RECV_IS_RX_THREAD into a
choice:CONFIG_BT_RECV_CONTEXT with the following options
(names can be discussed further of course):

    CONFIG_BT_RECV_BLOCKING
    CONFIG_BT_RECV_WORKQ_BT
    CONFIG_BT_RECV_WORKQ_SYS

This way users would be able to choose what to run most of
the BLE stack on, they wouldn't be forced to a single model.

We would default to CONFIG_BT_RECV_BLOCKING so that we wouldn't
need to change the system workqueue stack size by default, instead
asking users to do so if they select the CONFIG_BT_RECV_WORKQ_SYS option

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2022-04-11 10:58:09 +02:00
Mariusz Skamra
e9b40ebc69 Bluetooth: has: Satisfy profile security requirement
This enables Secure Connections pairing (actually disables legacy)
to satisfy security requirements of the Hearing Access Profile.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2022-04-11 10:23:13 +02:00
Yuval Peress
53ef68d459 include: Prefix includes to use a scope
Move include paths and add new target_include_directories to support
backwards compatibility:
* /include -> /include/zephyr
  example: <irq.h> -> <zephyr/irq.h>

Issue #41543

Signed-off-by: Yuval Peress <peress@google.com>
2022-04-08 19:03:32 +02:00