Commit graph

2098 commits

Author SHA1 Message Date
Emil Gydesen 8ab3fbf570 Bluetooth: Audio: Split bt_audio_codec_meta_get to cfg and cap
Split the bt_audio_codec_meta_get functions to cfg and cap
variants. This provides a more explicit API where users
do not need to dereference their cfg/cap structs in order
to use this functions.

Furthermore this will also make the get functions more
similar to the upcoming set functions, where the set functions
will require the use of the cfg and cap structs.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-29 09:46:15 +02:00
Emil Gydesen cc5766bc4b tests: Bluetooth: Fix for btp_bap broadcast create/reconfig
This updates the struct name for the create parameter,
and fixes the call to reconfig.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-28 15:31:30 +02:00
Emil Gydesen 85bb2624bc Bluetooth: Audio: Refactor codec_cfg_get_freq
Refactor the codec_cfg_get_freq function to return the assigned
numbers value, instead of a converted value, but with
support for converting the value.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-28 14:05:18 +02:00
Erik Brockhoff 551b9afe11 Bluetooth: controller: adding unittest for Central CIS Create
Adding unittests for basic Central CIS Create functionality

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2023-09-28 14:05:00 +02:00
Magdalena Kasenberg efb5c0902b bluetooth: tester: Add support for BAP broadcast
Support for BAP/BSRC and BAP/BSNK test cases.

Add partial support for GAP/PADV as periodic advertising is needed
for BAP/BSRC tests and they can share common code.

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
2023-09-28 13:36:46 +02:00
Pavel Vasilyev b7579065f9 tests: bluetooth: tester: Move mesh-1.1 features to a separate conf
This allows to compile mesh tester for 1.0.1 and 1.1 specs sepately.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-09-28 14:19:03 +03:00
Krzysztof Kopyściński a8334210c1 tests: Bluetooth: tester: add support for Proxy Solicitation
Adds BTP commands implemantation needed to pass tests for Proxy
Solicitation.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2023-09-28 14:19:03 +03:00
Michał Narajowski 2ad0eaa9ab tests: Bluetooth: tester: Add Models Metadata Page 128
Add Models Metadata Page 128 support to tester.

Signed-off-by: Michal Narajowski <michal.narajowski@codecoup.pl>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-09-28 14:19:03 +03:00
Krzysztof Kopyściński 26e697bd04 tests: Bluetooth: tester: enable Composition Data Page 1
This allows to tests this page using BTP protocol.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2023-09-28 14:19:03 +03:00
Krzysztof Kopyściński 7b69f8faf0 Tests: Bluetooth: Tester: Add BTP command to enable Private NID
This allows to advertise beacons with Private Node Identity on demand,
like was available for regular Node Identity.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2023-09-28 14:19:03 +03:00
Michal Narajowski 1e5eeb83f4 tests: bluetooth: tester: Add Opcodes Aggregator support
- 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.

Signed-off-by: Michal Narajowski <michal.narajowski@codecoup.pl>
2023-09-28 14:19:03 +03:00
Krzysztof Kopyściński 51ec2462d6 Bluetooth: Tester: Add Blob, DFU and DFD tests support
Adding support for automatic testing BLOB, DFU and DFD models.

Co-authored-by: Agata Ponitka <agata.ponitka@codecoup.pl>
Co-authored-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-09-28 14:19:03 +03:00
Krzysztof Kopyściński 68928e050f Tests: Bluetooth: tester: enable Remote Provisioning
This enables Remote Provisioning in tester application. Adds basic
setup and required structures/functions.

add BTP API for Remote Provisioning Client

This adds BTP commands for RPR Client API.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2023-09-28 14:19:03 +03:00
Michał Narajowski a73727c2fe Bluetooth: tester: Add Transport SAR Configuration models
Add support for testing the new SAR Configuration models in tester
application.

Signed-off-by: Michal Narajowski <michal.narajowski@codecoup.pl>
2023-09-28 14:19:03 +03:00
Michał Narajowski 11bdcb859e tester: Add Large Comp Data models
- Adds Large Comp Data Server and Client
- Defines some dummy metadata for Health Server

Signed-off-by: Michal Narajowski <michal.narajowski@codecoup.pl>
2023-09-28 14:19:03 +03:00
Michał Narajowski 959e55cdc0 Bluetooth: tester: Add ttl param to Model Send CMD
Some test cases require more control over transmission parameters used
when sending access messages.

Signed-off-by: Michal Narajowski <michal.narajowski@codecoup.pl>
2023-09-28 14:19:03 +03:00
Michał Narajowski 0efc66df5e Bluetooth: tester: Use Model Receive testing callback
Send a BTP event to the automation framework that a model message has
been received.

Signed-off-by: Michal Narajowski <michal.narajowski@codecoup.pl>
2023-09-28 14:19:03 +03:00
Piotr Narajowski 8e5898f039 bluetooth: tester: VCP Client tests
Add support for VCP Client tests

Signed-off-by: Piotr Narajowski <piotr.narajowski@codecoup.pl>
2023-09-28 13:16:23 +02:00
Emil Gydesen 4ab658be42 tests: Bluetooth: Add inval testing of bt_bap_broadcast_source_reconfigure
Add invalid parameter and state testing of
bt_bap_broadcast_source_reconfigure

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-28 13:14:49 +02:00
Aleksander Wasaznik 347ce7aa7f bluetooth: samples: Add hci_uart_async
This sample is an alternative implementation of hci_uart. The new sample
differs from the existing sample in that it uses the async UART API
instead of the interrupt driven API.

Included in this commit is a new test for HCI UART flow control. It's
enabled for hci_uart_async. The test can excercise also the existing
hci_uart sample (with some minimal changes to allow compiling in the
mock controller and test suite). The existing hci_uart sample currently
fails the flow control test.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-09-28 14:07:52 +03:00
Aleksandr Khromykh 4cf78b1e6d tests: Bluetooth: tester: fix mesh1d1 EHP pts tests
Mesh1d1 uses EHP wth SHA256 algorithm as the main one.
This mandates to use 32 bytes static oob if static oob
has been chosen.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2023-09-27 15:48:08 +02:00
Vinayak Kariappa Chettimada 3c2b1f952c Bluetooth: Controller: Add BT_CTLR_EVENT_OVERHEAD_RESERVE_MAX Kconfig
Add BT_CTLR_EVENT_OVERHEAD_RESERVE_MAX Kconfig to allow the
omit of EVENT_OVERHEAD_START_US and EVENT_OVERHEAD_END_US in
the time reservation calculations.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-09-27 15:47:45 +02:00
Emil Gydesen a5384bbf1a tests: Bluetooth: BAP: Initial Broadcast reconfigure test
Add a simple initial test for the reconfigure unittest.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-27 15:44:02 +02:00
Piotr Narajowski d20c95e529 bluetooth: tester: MICP BTP event
Enhance AICS BTP events functionality for invalid behavior tests.

Signed-off-by: Piotr Narajowski <piotr.narajowski@codecoup.pl>
2023-09-26 16:54:20 +02:00
Piotr Narajowski 6c4b9c9933 bluetooth: tester: AICS BTP event
Enhance AICS BTP Events Functionality for invalid behavior tests.

Signed-off-by: Piotr Narajowski <piotr.narajowski@codecoup.pl>
2023-09-26 16:54:20 +02:00
Vinayak Kariappa Chettimada 8c9ac505db Bluetooth: Controller: nRF53: Fix sw switch single timer id regression
Fix regression in sw switch single timer id use for nRF53x
series SoC.

Regression introduced in commit cfcbe5d68e ("Bluetooth:
Controller: Remove redudant header file includes").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-09-25 19:47:10 +02:00
Emil Gydesen 63badb0fa7 tests: Bluetooth: Audio: bt_audio_codec_cap_get unit tests
Add unit tests for the bt_audio_codec_cap_get* functions.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-25 09:48:47 +02:00
Emil Gydesen 7d65c55a50 tests: Bluetooth: BAP broadcast source param name fix
The test fixture used an invalid struct for the param
due to a renaming of the struct in another commit.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-21 11:52:39 +02:00
Emil Gydesen 6472054976 tests: Bluetooth: Audio: Codec meta_get unit tests
Add unit tests for the bt_audio_codec_meta_get_* functions.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-20 20:21:24 +01:00
Emil Gydesen c3c83c7049 Bluetooth: ASCS: Modify the ACL disconnect behavior
Instead of calling ase_release for each ASE in the ACL
disconnected callback, we now call the state_transition_work_handler
directly. This is to ensure that when the disconnected callback
returns, the bt_conn object has been properly unref'ed in
a timely manner.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-20 20:20:27 +01:00
Emil Gydesen f93caa3903 Bluetooth: Audio: BT_AUDIO_CODEC_LC3_ID -> BT_HCI_CODING_FORMAT_LC3
Replace the BT_AUDIO_CODEC_LC3_ID macro with the
BT_HCI_CODING_FORMAT_LC3 as there is no reason to
define and use the LC3 ID different than the other
allowed codec IDs.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-20 20:19:50 +01:00
Emil Gydesen ddf4504bce tests: Bluetooth: Add inval test of bt_bap_broadcast_source_start
Add tests to test invalid parameters to bt_bap_broadcast_source_start.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-20 20:17:34 +01:00
Henrik Eriksen 70bdccac7f bluetooth: tester: ccp: Added support for testing Call Control client.
- Discover GTBS.
- Accept call.
- Terminate call.
- Originate call.
- Get call states.

Signed-off-by: Henrik Eriksen <heri@demant.com>
2023-09-20 08:56:15 +02:00
Vinayak Kariappa Chettimada f4e05e3e54 Bluetooth: Controller: Fix ticker to prefer ticker node started
Fix ticker implementation to prefer to keep ticker node
started in case of race condition to start and stop.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-09-19 15:25:21 +01:00
Nirosharn Amarasinghe 467ec2e6b7 tests: bluetooth: controller: Included kconfigs for ISO-AL logging
Included kconfigs to set the ISO-AL logging level and control debug
logging verbosity in ISO-AL unit tests.

Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
2023-09-18 14:35:42 +02:00
Nirosharn Amarasinghe 770f435e68 tests: bluetooth: controller: Updated ISO-AL tests for length of err PDU
Updated unit tests to match changes in ISO-AL that disregard the length
of a received PDU with errors.

Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
2023-09-18 14:35:42 +02:00
Nirosharn Amarasinghe 2260b651b6 tests: bluetooth: controller: ISO-AL selection of TX time stamps
Unit tests for TX time stamp related decisions.

Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
2023-09-18 14:35:42 +02:00
Nirosharn Amarasinghe 05ce650c85 test: bluetooth: controller: Updated ISO-AL tests to cover endianness
Changes:
-- Changed RX tests and one TX test to cover endianness of the framed
   segment header fields
-- Updated RX debug PDU print to include framed segment details

Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
2023-09-18 14:35:42 +02:00
Nirosharn Amarasinghe ec20938627 tests: bluetooth: controller: Test for framed TX in consecutive events
Changes:
-- Included a test to check TX in concesecutive events irrespective of
   the input target event
-- Updated expected output of current tests for change in framed RX
   error handling which waiting for the start of an event

Signed-off-by: Nirosharn Amarasinghe <niag@demant.com>
2023-09-18 14:35:42 +02:00
Vinayak Kariappa Chettimada 5daa864b5e Bluetooth: Controller: Use DIV_ROUND_UP macro in HAL ticker
Use DIV_ROUND_UP macro in HAL ticker.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-09-18 14:25:02 +02:00
Vinayak Kariappa Chettimada 34100cb7ea Bluetooth: Controller: Use defines for femto and pico seconds
Use defines for femto and pico seconds in HAL ticker
calculations.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-09-18 14:25:02 +02:00
Vinayak Kariappa Chettimada 333ff94e6b Bluetooth: Controller: Use HAL_TICKER_US_TO_TICKS_CEIL for ticks_slot
Use HAL_TICKER_US_TO_TICKS_CEIL for ticks_slot calculations.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-09-18 14:25:02 +02:00
Vinayak Kariappa Chettimada 01314b2e43 Bluetooth: Controller: Make openisa and test hal ticker.h consistent
Make openisa and unit test hal ticker.h consistent with
nrf hal ticker.h.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-09-18 14:25:02 +02:00
Donatien Garnier 185a6117c0 Bluetooth: Host: Amend existing L2CAP accept callbacks
This patch amends the existing L2CAP accept callbacks to use the new
accept signature that includes a pointer to the L2CAP server structure.

Signed-off-by: Donatien Garnier <donatien.garnier@blecon.net>
2023-09-14 14:36:34 +02:00
Gerard Marull-Paretas 691facc20f include: always use <> for Zephyr includes
Double quotes "" should only be used for local headers.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-09-14 13:49:58 +02:00
Piotr Narajowski 38c9181642 bluetooth: tester: Service init
VCS and AICS service init will be handled in auto-pts

Signed-off-by: Piotr Narajowski <piotr.narajowski@codecoup.pl>
2023-09-13 17:23:13 +02:00
Piotr Narajowski a2f92bad92 bluetooth: tester: MICS Server tests
Add support for MICS Server tests

Signed-off-by: Piotr Narajowski <piotr.narajowski@codecoup.pl>
2023-09-11 16:57:12 -04:00
Emil Gydesen 830aa5f7da tests: Bluetooth: Add initial BAP Broadcast Source unit tests
Adds initial BAP Broadcast Source unit tests.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-11 11:06:52 +02:00
Piotr Narajowski 925a8b65d5 bluetooth: tester: MICP Client tests
Add support for MICP Client tests.

Signed-off-by: Piotr Narajowski <piotr.narajowski@codecoup.pl>
2023-09-08 14:43:00 +02:00
Magdalena Kasenberg 4d7cef6f33 bluetooth: tester: Reenable PACS characteristics
After recent refactors some PACS characteristics have to be enabled
with CONFIG_ variables.

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
2023-09-06 17:55:26 +02:00
Mariusz Skamra 9a9855f711 tests: Bluetooth: audio: Unit test bt_audio_codec_cfg_get_* helpers
This adds unit tests for bt_audio_codec_cfg_get_* functio helpers.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-09-05 10:06:09 +02:00
Carles Cufi 8c748fd005 kernel: Modify the signature of k_mem_slab_free()
Modify the signature of the k_mem_slab_free() function with a new one,
replacing the old void **mem with void *mem as a parameter.

The following function:
void k_mem_slab_free(struct k_mem_slab *slab, void **mem);

has the wrong signature. mem is only used as a regular pointer, so there
is no need to use a double-pointer. The correct signature should be:
void k_mem_slab_free(struct k_mem_slab *slab, void *mem);

The issue with the current signature, although functional, is that it is
extremely confusing. I myself, a veteran Zephyr developer, was confused
by this parameter when looking at it recently.

All in-tree uses of the function have been adapted.

Fixes #61888.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-09-03 18:20:59 -04:00
Pavel Vasilyev 78d9ebb51d tests: Bluetooth: tester: Change mesh nrf board to nrf52840dk_nrf52840
Mesh tester doesn't fit into nrf52dk_nrf52832.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-09-01 15:09:07 +02:00
Andrei Emeltchenko 60e8d9d859 tests: btp_bap: Fix using wrong index
Fix using cig_id instead of index i

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-09-01 09:55:05 +02:00
Mariusz Skamra 17b9d11a35 tests: Bluetooth: ascs: Fix compilation warning
This fixes implicit declaration of function
‘bt_bap_unicast_server_disable’ compilation warning.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-08-30 17:48:52 +02:00
Mariusz Skamra d11bc6edb4 tests: Bluetooth: ascs: Fix linker warning
This fixes linker warning caused by invalid bonding of linker scripts
provided by multiple "-T" options.

mock-sections.ld contains output sections did you forget -T

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-08-30 17:48:52 +02:00
Fabio Baltieri a16f1cee4a bluetooth: host: fix few mismatched CONTAINER_OF
Fix a bunch of mismatched CONTAINER_OF, few missing
k_work_delayable_from_work conversions but also many
bt_l2cap_le_chan/bt_l2cap_chan and few others.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-30 10:22:37 +02:00
Thomas Ebert Hansen 00c5edd411 Bluetooth: controller: Fix LLCP enc. execution ctx
rp_enc_state_wait_ltk_reply() is executed in thread context, so
it is not allowed to move the encryption state machine forward.

Defer LTK reply handling to next prepare event by introducing a continue
state.

Update the unit test to reflect this, and remove the TODO that actually
said there was an issue in the first place.

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2023-08-30 10:22:15 +02:00
Troels Nilsson 8a2a2bd613 Bluetooth: Controller: Add trpa cache for BT_CTLR_SW_DEFERRED_PRIVACY
Adds a target RPA known unknown cache; it fulfills a similar function
to the existing peer RPA cache, used for scanning of directed
advertisements

Signed-off-by: Troels Nilsson <trnn@demant.com>
2023-08-29 16:13:22 +02:00
Emil Gydesen 6ccd112c56 Bluetooth: Audio: Refactor bt_audio_codec_cfg to flat arrays
Refactor the bt_audio_codec_cfg to use flat arrays to store
metadata and codec specific configurations.

The purpose of this is to make it easier to copy the data
between layers, but also to support non-LTV data for non-LC3
codec configurations.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-08-28 15:56:53 +02:00
Fredrik Danebjer 4c94056f74 Bluetooth: Audio: Make PACS optional notify actually optional
Added Kconfig options to make the various PACS characteristics that are
optionally notifiable selectable as notifiable. Selecting a
characteristic as notifiable will make it so for all pacs instance on
the device.

Signed-off-by: Fredrik Danebjer <frdn@demant.com>
2023-08-28 15:56:26 +02:00
Morten Priess 83fcbfd0be Bluetooth: controller: Fixes for CIS Central error handling
- Fix masking for no coded phy
- Allow ISO_Interval < SDU_Interval for framed mode
- Change BT_HCI_ERR_INSUFFICIENT_RESOURCES to
  BT_HCI_ERR_CONN_LIMIT_EXCEEDED.
- Prevent starting same CIS twice
- Cancel an initiated CIS creation procedure if terminated before
  sending CIS_IND.
- Implement canceling of local CC procedure. Respond to CIS_RSP with
  REJECT, if canceled after CIS_REQ was sent.
- Introduce state CIG_STATE_INITIATING for central, to keep track of
  initiating CIS connection, in transition between CONFIGURABLE and
  ACTIVE.

Fixes EBQ test /HCI/CIS/BC-03-C.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2023-08-23 14:45:24 +02:00
Mariusz Skamra 043c1d8d4e tests: Bluetooth: tester: Add native_posix board to test build targets
This extends the list of build variants with native_posix variant to
build the tester application by CI.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-08-23 14:44:48 +02:00
Mariusz Skamra 7700c27dfc tests: Bluetooth: tester: Move DT overlays to boards directory
This moves the board DT overlays and configurations to /board
directory so that it can be automatically applied in compilation
pipeline.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-08-23 14:44:48 +02:00
Thomas Ebert Hansen 32b1c575fe tests: Bluetooth: Test invalid enc. pause
Add test to verify that
1) A peripheral role cannot initiate an encryption pause
2) A peripheral role rejects a LL_PAUSE_ENC_REQ while a CIS is
   established

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2023-08-22 10:53:47 +02:00
Thomas Ebert Hansen ff861304c3 tests: Bluetooth: Use FFF in ctrl_encrypt
Replace Ztest Mock with FFF.

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2023-08-22 10:53:47 +02:00
Thomas Ebert Hansen 34fc97b2a0 tests: Bluetooth: Mock ISO streams with FFF
Update test_cc_create_periph_rem_host_accept to use mocked
ll_conn_iso_stream_get()

Signed-off-by: Thomas Ebert Hansen <thoh@oticon.com>
2023-08-22 10:53:47 +02:00
Mariusz Skamra 8540682f18 tests: Bluetooth: tester: Fix missing metadata validation on Enable
This fixes missing metadata validation on Enable operation callback.

Fixes: BAP/USR/SPE/BI-04-C
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-08-22 09:59:53 +02:00
Mariusz Skamra 02f399dc1d tests: Bluetooth: ascs: Add prohibited audio context metadata test
This adds for receiving and handling Enable operation with
prohibited audio context value.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-08-22 09:59:53 +02:00
Mariusz Skamra d28f180473 Bluetooth: audio: ascs: Move metadata validation to stack
As the metadata has to be validated anyway, let the initial vaidation of
metadata to be done in ASCS. The application can still reject the
metadata, but the length validation and supported type validation can be
performed by the stack.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-08-22 09:59:53 +02:00
Mariusz Skamra 914dc408fd tests: Bluetooth: ascs: Fix improperly formatted metadata
This fixes improperly formatted metadata. The Stream Context value is 2
bytes in size.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-08-22 09:59:53 +02:00
Mariusz Skamra 293676a433 tests: Bluetooth: tester: Update the testcase.yaml file
This updates the testcase.yaml to include new configurations for
LeAudio, Mesh and native builds.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-08-17 16:49:42 +02:00
Daniel Leung 83adb55931 tests: bluetooth: rename shadow variables
Renames shadow variables found by -Wshdaow.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2023-08-17 13:00:09 +02:00
Mariusz Skamra 6e38356b3c tests: Bluetooth: tester: Do not memset the streams on ACL disconnection
The streams can be deallocated once bt_bap_stream_ops.released callback
is called. Otherwise it may cause memory violation in the stack.

Fixes: ASCS/SR/ACP/BV-31-C
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-08-17 12:50:22 +02:00
Mariusz Skamra 0d49bb3d70 tests: Bluetooth: ascs: Add CIS connection retry test case
This adds test case testing whether ASE in Enabling state will accept
releated CIS Request if previous CIS establishment procedure failed.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-08-16 20:39:15 +02:00
Mariusz Skamra ade1a4495e tests: Bluetooth: ascs: Add CIS link loss test cases
This adds test cases testing correctness of autonomous ASE
state transitions triggered by CIS link loss.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-08-16 20:39:15 +02:00
Mariusz Skamra c7476fd7c9 tests: Bluetooth: ascs: Get chan pointer from test_preamble_state_disabling
This adds a possibility to get the ISO channel pointer from
test_preamble_state_disabling function that can be further used in
tests.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-08-16 20:39:15 +02:00
Mariusz Skamra e85a0bc572 tests: Bluetooth: ascs: Extend mock_bt_iso_disconnected with error param
This extends mock_bt_iso_disconnected function parameters with error
code that can provide the HCI error code that is the reason of CIS
disconnection.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-08-16 20:39:15 +02:00
Magdalena Kasenberg cce76eed24 bluetooth: tester: bap: Add support for BAP/USR tests
Extend Codec capabilities of the server.

At Codec Config operation initiated autonomously by server, all ASEs
with lower IDs than the requested one have to be initated first due
to API limitation.

In some BAP/USR (server role) test cases the PTS sends the MMI 202
to configure the Sink ASE to streaming state, in some others it does not.
For now, let's autonomously send Receiver Start Ready at ASE Enabled.

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
2023-08-16 14:48:11 +02:00
Emil Gydesen 53502cb417 Bluetooth: Audio: Make codec_cap const
There is no reason why the capabilities
should be modified by the stack after registration,
nor any reason why a the unicast client application
needs to modify the reported remote capabilities, so
all have been marked as const.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-08-15 11:14:29 +00:00
Emil Gydesen aa990ae6dc Bluetooth: Audio: Refactor bt_audio_codec_cap to flat arrays
Refactor the bt_audio_codec_cap to use flat arrays to store
metadata and codec specific capabilities.

The purpose of this is to make it easier to copy the data
between layers, but also to support non-LTV data for non-LC3
codec capabilities.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-08-15 11:14:29 +00:00
Emil Gydesen 93ce3e14bc Bluetooth: Audio: Shell: Fix Scan delegator subgroup count
The number of subgroups the scan delegator supports should
match the number of subgroups the broadcast sink supports.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-08-14 13:34:26 +00:00
Emil Gydesen 2390f974af tests: Bluetooth: Update audio mocs for bt_iso_chan_get_tx_sync
bt_iso_chan_get_tx_sync was missing a mock now that it is
being used by bap_stream.c

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-08-14 13:33:57 +00:00
Emil Gydesen d4dc55bfa4 bluetooth: tester: Modify to use bt_bap_stream_get_tx_sync
Modify audio_send_timeout to use bt_bap_stream_get_tx_sync
instead of bt_iso_chan_get_tx_sync to avoid using an internal
function to get the ISO channel from the BAP stream.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-08-14 13:33:57 +00:00
Emil Gydesen 8600356f98 Bluetooth: BAP: Add bt_bap_stream_get_tx_sync
Add bt_bap_stream_get_tx_sync to get the ISO tx info from a BAP
stream.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-08-14 13:33:57 +00:00
Henrik Eriksen 5bd46b91fd bluetooth: tester: Added support for testing CSIS.
- Initialisation of Coordinated Set Identification Service.
- Set and clear member lock.
- Get member RSI.

Signed-off-by: Henrik Eriksen <heri@demant.com>
2023-08-10 08:11:13 +00:00
Magdalena Kasenberg 03370ab22e bluetooth: tester: gap: Add support for extended advertising
Needed for LE Audio tests.

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
2023-07-26 14:33:22 +02:00
Pavel Vasilyev 4d56a318f1 bluetooth: tester: Add commands to add and delete virtual addresses
Virtual address behavior has been changed in this PR:
https://github.com/zephyrproject-rtos/zephyr/pull/57878

Now it is required to register virtual address before using it.

Corresponding PR to auto-pts:
https://github.com/auto-pts/auto-pts/pull/961

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-07-25 15:26:36 +02:00
Magdalena Kasenberg 927168fb5a bluetooth: tester: bap: Add support for AC 7(i) tests
Allow to assing end points to CISes before creating a CIG. Previously
the end points were assinged top-down, so the configuration 7(i) and
other similar were not covered.

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
2023-07-20 16:23:05 +02:00
Mariusz Skamra c09c4181cf Bluetooth: audio: tbs_client: Minor Kconfig refactor
This intoduces dedicated Kconfig option to enable TBS client,
that makes the configuration more intuitive.
While configuring GTBS only, the user does not have to explicitly set
the BT_TBS_CLIENT_MAX_TBS_INSTANCES to 0 to disable the TBS client
functionality.
This adds also `tbs_only_client` test case to test the TBS only build
option.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-07-18 11:06:57 +00:00
Mariusz Skamra 9fa4543994 Bluetooth: audio: ascs: Defer ASE state transition
This adds handling of ASE control point operations in separate thread
so that the notifications of ASE state changes are sent from non-BT
thread. This ensures bt_gatt_notify_cb to be blocking waiting for
available buffers to send the notifications.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-07-18 11:05:03 +00:00
Emil Gydesen 388af8fda4 Bluetooth: BAP: Remove stream->dir field
The BAP stream object should not have a dir field. The
dir field should be stored in the EP only (to avoid having two
fields storing the same value, causing possible issues).

The field was removed, and the places that use it has been updated.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-07-14 16:48:41 +00:00
Aleksandr Khromykh 9b4d080419 Bluetooth: Mesh: add shell statistic commands
Commit adds commands to get and to clear
the frame statistic.

Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
2023-07-07 09:20:33 +02:00
Magdalena Kasenberg a3f1f25de3 bluetooth: tester: Fix build errors
Recently there have been a few name changes in the API that caused
build errors of the tester application when LE Audio overlays applied.

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
2023-07-06 09:47:15 +00:00
Emil Gydesen 5fa793fa9d Bluetooth: Modify stream_ops->stopped to be called on leaving streaming
When a stream leaves the streaming state the `stopped` callback
will now be called, similar to how the `started` callback works.

This ensures that `stopped` is always called and not just when
the CIS disconnects.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-07-05 12:34:01 +00:00
Arkadiusz Kozdra 82d8f09de1 bluetooth: host: track connection type enum
The enum used for connection types gets named bt_conn_type to guard
against accidental usage of generic integers with relation to it.

The added default case in several switch statements avoids warnings
against unhandled enum values.

Signed-off-by: Arkadiusz Kozdra <akozdra@antmicro.com>
2023-07-05 09:15:48 +02:00
Mariusz Skamra 8797e50b64 tests: Bluetooth: ascs: Swap bt_gatt_attr_read mock with real function
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>
2023-07-05 09:14:37 +02:00
Mariusz Skamra 03c04fd8d7 tests: Bluetooth: ascs: Fix build warning
This fixes incompatible pointer type warning.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-07-04 09:32:00 +02:00
Emil Gydesen 49a70aa1bb Bluetooth: TMAP: Add TMAP shell module
Add simple TMAP shell module that supports the TMAP
discovery.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-06-30 16:10:51 +02:00
Emil Gydesen 69f7fd9cb2 Bluetooth: Audio: Rename bt_codec to bt_audio_codec_{cap, conf, data}
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>
2023-06-30 12:39:50 +02:00
Mariusz Skamra 17223f136f Bluetooth: audio: Fix metadata length checks
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>
2023-06-29 21:06:58 +02:00
Mariusz Skamra db5767e50f Bluetooth: audio: Accept empty CCID list in audio metadata
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>
2023-06-29 21:06:58 +02:00
Mariusz Skamra 91ad386cb5 tests: Bluetooth: ascs: Add ISO Data PDU recv tests
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>
2023-06-29 21:06:31 +02:00
Lang Xie db8881dd97 tests: bluetooth: tester: Reduce nrf53 BT_BUF_ACL_RX_SIZE
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>
2023-06-28 06:49:07 +00:00
Emil Gydesen adabb00914 Bluetooth: Audio: Shell: Update audio.conf to more sane values
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>
2023-06-27 12:15:54 +00:00
Krzysztof Kopyściński 7d7874c75b Tests: Bluetooth: tester: add BTP command for connecting Proxy Client
This allows to execute MESH/CL/MPXS tests.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2023-06-26 16:16:01 +02:00
Magdalena Kasenberg 76dc5d37cb bluetooth: tester: vcp: Remove unused include
Fixes build error:
mesh/keys.h:40:2: error: #error "Crypto library has not been chosen"

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
2023-06-26 16:15:14 +02:00
Magdalena Kasenberg c8a650fa89 bluetooth: tester: has: Update name of bt_has_register_param
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>
2023-06-26 16:15:14 +02:00
Magdalena Kasenberg 69a93f3835 bluetooth: tester: LE Audio: Fix sending ISO data
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>
2023-06-26 16:15:14 +02:00
Théo Battrel 0f079a1ab8 Bluetooth: Unit: Fix unit tests that rely on settings
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>
2023-06-17 07:58:07 -04:00
Henrik Eriksen 070122f55b bluetooth: tester: Added support for testing Hearing Access Service (HAS).
- Initialisation of Hearing Access Service.
- Adding/removing presets.
- Changing preset properties.
- Changing preset name.

Signed-off-by: Henrik Eriksen <heri@demant.com>
2023-06-17 07:47:21 -04:00
Aleksandr Khromykh 29895d8275 Bluetooth: Mesh: refactor mesh to use both tinycrypt and psa based crypto
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>
2023-06-17 07:46:03 -04:00
Pavel Vasilyev de61b25b83 tests: bluetooth: mesh_shell: Print correct command for provisioning
Provisioning commands were moved under `mesh prov` subcommand.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-06-13 07:05:21 -04:00
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 b0d6437653 Bluetooth: Audio: Shell: Increase number of streams for unicast client
Increase CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT to match
CONFIG_BT_ISO_MAX_CHAN.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-06-10 05:16:59 -04:00
Carles Cufi bcd0e8c175 tests: bluetooth: tester: Fix ATT max attr size assert
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>
2023-06-08 09:34:10 -04:00
Vinayak Kariappa Chettimada 5f38c4ba71 Bluetooth: Controller: Fix Tx ISO SDUs dropped due to strict SN check
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>
2023-06-08 06:47:25 -04:00
Vinayak Kariappa Chettimada 54aa6f1075 Bluetooth: Controller: Fix ISOAL sink create role for ISO Receiver
Fix ISOAL sink create role for ISO Receiver.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2023-06-08 12:25:31 +02: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
Nirosharn Amarasinghe 97935bb0dc tests: Bluetooth: controller: updated ISO-AL tests for lost SDUs
-- 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>
2023-06-06 13:34:45 +02:00
Nirosharn Amarasinghe f0434254fb tests: bluetooth: controller: Release SDU as missing RX unf. padding
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>
2023-06-06 13:34:45 +02:00
Aleksander Wasaznik 75bb62ad24 Bluetooth: Host: Test: bt_addr_from_str
Some basic tests for `bt_addr_from_str`. This proves a bug.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2023-06-05 08:31:06 -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 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
Magdalena Kasenberg 567c39250e bluetooth: tester: Add support for streaming
Unlocks BAP/UCL/STR tests.

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
2023-05-25 16:26:25 +02:00
Anas Nashif 7fd5cf8b97 tests: ctrl_isoal: cleanup test metadata
Remove definition of testcases in yaml file, those are now detected from
binary.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-05-25 04:44:11 -04:00
Anas Nashif be5dc33896 tests: bluetooth: ascs: cleanup test metadata
Remove definition of testcases in yaml file, those are now detected from
binary.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-05-25 04:44:11 -04:00
Gerard Marull-Paretas dacb3dbfeb iterable_sections: move to specific header
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>
2023-05-22 10:42:30 +02:00
Mariusz Skamra 626e47514e tests: Bluetooth: ascs: Factor out call count verification function
Reduce code duplicates by using common function to verify mock function
call count.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-05-22 10:16:02 +02:00
Mariusz Skamra a61dd0c950 tests: Bluetooth: ascs: Add test for stream pair release on ACL disc
This adds test case to verify if ACL disconnects, the associated
stream pair is released.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-05-22 10:16:02 +02:00
Mariusz Skamra 6c6a66711c tests: Bluetooth: ascs: Add test for ASE release on ACL disconnection
This adds test case to verify if ACL disconnects, the associated ASE
is released.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2023-05-22 10:16:02 +02:00
Mariusz Skamra df5317a6f0 tests: Bluetooth: ascs: Change bap_stream asserts to expectations
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>
2023-05-22 10:16:02 +02:00
Fredrik Danebjer f3fdb1f96f Bluetooth: Audio: Make VCS optional notify characteristics optional
This change makes VCS Volume Flag characteristic Notify property
optional and selectable through Kconfig.

Signed-off-by: Fredrik Danebjer <frdn@demant.com>
2023-05-17 19:26:54 +02:00
Szymon Janc 5dbc069e3d bluetooth: tester: Bump supported GATT Prepare Writes to 12
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>
2023-05-16 18:19:50 +02:00
Maciej Perkowski 75b062a6d6 tests: samples: Resolve duplicates in names.
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>
2023-05-16 06:21:25 -04:00
Emil Gydesen 89bcb874db tests: Bluetooth: Add missing ASCS mocks
Add mocks for k_sem_take, k_sem_give and bt_gatt_get_mtu

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-12 15:29:17 +02:00
Erik Brockhoff ccb449ba55 Bluetooth: test: removing nrf51dk_nrf51422 from init test target list
Due to increase in image size the target nrf51dk_nrf51422 no longer
supports this test.

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2023-05-12 12:53:16 +02:00
Erik Brockhoff 998512f59b Bluetooth: controller: use RX node piggy-back for NTF when possible
When possible re-use the already allocated RX node for notifications.
Store (retain) RX node and Link element on RX if NTF could occur.
Pass link element to LLCP (ull_cp_rx()) together with RX node.
New RX node type RETAIN introduced to signal retention

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

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

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

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

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2023-05-12 12:53:16 +02:00
Mariusz Skamra 12d8a0d178 Bluetooth: id: Keep RPA as bt_addr_t
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>
2023-05-12 10:55:50 +03:00
Erik Brockhoff 105621bdce Bluetooth: controller: Only generate ntf on host initiated feature exch
Only generate notification when feature exchange was initiated by host

Signed-off-by: Erik Brockhoff <erbr@oticon.com>
2023-05-12 08:43:46 +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 2678ab55b6 Bluetooth: Audio: Shell: Enable CSIP Set Member debug log
Enable the CSIP Set Member debug log.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-05-10 10:14:56 +02:00
Gerard Marull-Paretas 93b63df762 samples, tests: convert string-based twister lists to YAML lists
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>
2023-05-10 09:52:37 +02:00
Pavel Vasilyev da7e555a99 tests: bluetooth: mesh: Check bt_mesh_rpl_reset with unit test
Check RPL when rescheduling happens during the reset operation
started by bt_mesh_rpl_reset.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-05-09 13:03:38 +02:00
Aleksander Wasaznik bb1ede6a9b Bluetooth: Use bt_addr_eq
Refactor. Using `bt_addr_eq` instead of `bt_addr_cmp`.

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

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

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

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

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

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

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

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

This PR ensures that the correct sizes are used.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

The existent API function "bt_set_oob_data_flag" was removed.

Two new API functions were added:

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

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

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

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

There is no other changes in this commit beyond that.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Also adds the _bap_ infix to the bt_unicast_client functions.

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

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

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

This also adds the _bap_ infix for bt_unicast_server.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Co-authored-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2023-03-06 13:52:15 +01:00