Commit graph

566 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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 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 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
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 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
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
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
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 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 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
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
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
Szymon Janc e8e66c85ef bluetooth: tester: Enable unicast server by default
Default config should have all bells and whistles enabled to minimize
number of overlays needed in autopts.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2023-03-06 13:51:55 +01:00
Magdalena Kasenberg 69a6ead783 bluetooth: tester: Add PACS test handling
Add support for testing Published Audio Capabilities Service server
with PTS.

Signed-off-by: Magdalena Kasenberg <magdalena.kasenberg@codecoup.pl>
2023-02-20 11:19:42 +01:00
Krzysztof Kopyściński f31b3f03ad Tests: Bluetooth: Tester: improve stability by Flow Control and UARTE
Some tests may be unstable because of missing data from BTP frames.
Enabling Flow Control fixes the issue, but seems to work reliably
only along with UARTE.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2023-02-20 09:55:09 +01:00
Szymon Czapracki 7941a88121 bluetooth: tester: Add VCP & IAS test handling
This commit introduces Volume Control Profile and
Immediate Alert Service into btp.

VCP includes:
Audio Input Control Service
Volume Control Service
Volume Offset Control Service

Signed-off-by: Szymon Czapracki <szymon.czapracki@codecoup.pl>
2023-01-20 16:12:15 +01:00
Krzysztof Kopyściński bfb3ec5253 tests: bluetooth: tester: allow to add more CCCs
Specification states that: "Only one Client Characteristic Configuration
declaration shall exist in a characteristic definition." This was
wrongly understood as "Ony one CCC can exist in GATT Server". When we
add next characteristic `ccc_added` flag is cleared so next CC can be
added (for this characteristic).

Added array for CCC values so it's no longer shared between CCCs.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2022-12-09 11:18:39 +01:00
Szymon Czapracki f9db7fe065 Bluetooth: tester: Extract services from bttester
This commits extracts mesh, gat, gap, l2cap from
bttester.h into corresponding header files for
better readability.

Signed-off-by: Szymon Czapracki <szymon.czapracki@codecoup.pl>
2022-12-02 13:35:50 +02:00
Théo Battrel e458f5aae6 Bluetooth: Use Zephyr standard log system instead of bluetooth/common/log
The `bluetooth/common/log.h` and `bluetooth/common/log.c` files have been
removed. Files that were using them have been updated to use
`zephyr/logging/log.h` instead.

Those replacement have been done consequently:
- `/BT_DBG/LOG_DBG/`
- `/BT_ERR/LOG_ERR/`
- `/BT_WARN/LOG_WRN/`
- `/BT_INFO/LOG_INF/`
- `/BT_HEXDUMP_DBG/LOG_HEXDUMP_DBG/`
- `/BT_DBG_OBJ_ID/LOG_DBG_OBJ_ID/`

Also, some files were relying on the `common/log.h` include to include
`zephyr/bluetooth/hci.h`, in those cases the include of `hci.h` has
been added.

For files that were including `common/log.h` but not using any logs,
the include has been removed and not replaced.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2022-11-25 17:08:36 +01:00
Aleksander Wasaznik 17fc4b811c Bluetooth: Replace 'bt_addr_le_cmp(x) != 0' with 'bt_addr_le_eq(x)'
These should be equivalent. The '_eq'-form is more readable.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2022-10-19 15:40:18 +03:00
Aleksander Wasaznik ea558187b5 Bluetooth: Replace bt_addr_le_cmp in bool context with !bt_addr_le_eq
These should be equivalent. The new form is more readable.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2022-10-19 15:40:18 +03:00
Aleksander Wasaznik 21e5dcb42a Bluetooth: Replace 'bt_addr_le_cmp(x) == 0' with 'bt_addr_le_eq(x)'
These should be equivalent. The '_eq'-form is more readable.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2022-10-19 15:40:18 +03:00
Krzysztof Kopyściński aa0c52f212 tests: bluetooth: tester: Improve stability of MESH/NODE/TNPT/BV-05-C
IUT is requested to send 2 multi-segmented model messages. In mean time,
third may be sent from Config Model Publication Status may be sent,
which is also segmented. One of the 3 messages will fail to be sent,
but test is passing if it is Status one. Let's increase number of
possible concurrent transmissions to allow all three messages to be
sent.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2022-10-13 09:56:38 +02:00
Anders Storrø 36e34fce41 Bluetooth: Mesh: Add CDB depend on to prov Kconfig
The current implementation of provisioning features is dependent on CDB
to compile, which is reflected poorly in the Kconfig options for mesh.

This commit alters the Kconfig options for provisioning to be dependent
on the CDB option to compile.

Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
2022-09-06 12:35:48 +02:00
Gerard Marull-Paretas 79e6b0e0f6 includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.

The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.

NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-05 16:31:47 +02:00
Michal Narajowski 5c27067dcd Bluetooth: Mesh: Align Config Client API with Health Client API
This PR adds a `*_cli_*` infix to the Config Client API to match
the changes in Health Client. The old API is marked as deprecated.

Signed-off-by: Michal Narajowski <michal.narajowski@codecoup.pl>
2022-09-05 13:56:25 +03:00
Herman Berget 8873b7f05d Bluetooth: Tests: Use chan_opt BT_ATT_CHAN_ANY
The chan_opt field of GATT parameter structs must be set.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-08-19 11:59:52 +02:00
Gerard Marull-Paretas aa1d2cf3d0 tests: bluetooth: initialize devices at compile time
Initialize devices at compile time, allowing to constify device pointer.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Krzysztof Kopyściński f71741cea0 tests: bluetooth: tester: add support for testing Multiple Notifications
Enabled Multiple Notifications and added command for
bt_gatt_notify_multiple().

Increased possible number of connections to execute GATT/SR/GAN/BV-02-C

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2022-08-05 13:01:46 +02:00
Michal Narajowski fab8e29ee2 Bluetooth: Mesh: Add model publish support to Health Client
Mesh Profile Specification errata 11310
Section 4.4.4.1
"This model shall support model publication, as defined in Section
4.2.2 of the Mesh Profile specification and model subscription,
as defined in section 4.2.3 of the Mesh Profile specification."

Signed-off-by: Michal Narajowski <michal.narajowski@codecoup.pl>
2022-08-01 18:04:42 +01:00
Michal Narajowski e98df9f160 tests: bluetooth: tester: Fix Health Fault Test command
The buffer for response was too small.

Signed-off-by: Michal Narajowski <michal.narajowski@codecoup.pl>
2022-08-01 18:04:42 +01:00
Benjamin Björnsson 33b43547e8 tests: bluetooth: bttester: Update test to use DEVICE_DT_GET
Update test to use DEVICE_DT_GET in order to remove usage of
device_get_binding.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-27 18:44:22 +02:00
Pieter De Gendt aba4c4ea3e uart_pipe: move driver from console to serial
The uart_pipe driver is not dependent on any console driver,
however a serial driver is required.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-07-07 09:59:49 +02:00
Krzysztof Chruscinski 041f0e5379 all: logging: Remove log_strdup function
Logging v1 has been removed and log_strdup wrapper function is no
longer needed. Removing the function and its use in the tree.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2022-06-23 13:42:23 +02:00
Herman Berget 63c68dbbbb Bluetooth: Tester: Add support for EATT connection
A new command is added to connect EATT channels.

Affects L2CAP/TIM/BV-03-C, which tests requirements on ATT.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2022-06-17 10:48:05 -05:00
Alperen Sener 12e57d414c tests/bluetooth/tester: Set mesh message cache size to 10
MESH/NODE/RLY/BI-02-C case requires cache size of 10

Signed-off-by: Alperen Sener <alperen.sener@nordicsemi.no>
2022-06-05 14:45:24 +02:00
Gerard Marull-Paretas ade7ccb918 tests: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all tests to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 20:02:14 +02:00
Michał Narajowski 54cd46ac68 tests/bluetooth/tester: Refactor Read UUID callback
ATT_READ_BY_TYPE_RSP returns Attribute Data List so handle it in the
application.

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

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2022-04-26 17:38:53 +02:00
Szymon Janc 218225b17a tests/bluetooth/tester: Disable EATT autoconnect
Don't autoconnect EATT as this was confusing PTS and resulted in
multiple tests failures. When needed PTS will connect EATT bearer.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-04-07 19:06:41 +02:00
Lingao Meng 20ff55e234 Bluetooth: host: Optimize L2CAP resource usage
Making sure struct bt_l2cap_chan has absolutely no members related
to dynamic channels.

That way we ensure that there is no overhead for a build where only
fixed channels are used.

It's not enough that the dynamic channel-related members are put behind
ifdefs - they should be completely moved out from the struct definition.

Furthermore, the public l2cap.h header file already has a struct
that's meant to be used for dynamic channels: struct bt_l2cap_le_chan!

However, currently dynamic channel support is a mess - it's a mix
between these two structs. The bt_l2cap_le_chan struct should really
be an extension of the bt_l2cap_chan struct, i.e. the former should
contain as a member the latter.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2022-04-07 09:37:12 +02:00
Emil Gydesen 9c2cf4ded5 Bluetooth: Host: Add auth_info_cb struct
Add a new callback structure for Bluetooth authentication

This struct is meant to replace the information-only
callbacks in bt_conn_auth_cb. The reason for this is that
due to the nature of bt_conn_auth_cb, it can only be registered
once. To allow mulitple users gain information about pairing
and bond deletions, this new struct is needed.

Samples, tests, etc. are updated to use the new struct.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2022-03-25 15:17:18 -07:00
Szymon Janc 573c0d59e0 tests/bluetooth/tester: Add support for auto connection establishment
autopts was updated to properly require support for Accept Filter List
in Auto Connection Establishment Procedure related tests. This patch
enabled support for it and adds required BTP support.

This was affecting following qualification test cases:
GAP/CONN/ACEP/BV-03-C
GAP/CONN/ACEP/BV-04-C

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-03-24 10:45:49 +01:00
Szymon Janc e932564f3a tests/bluetooth/tester: Enable security validation for GATT subsciption
This was affecting following qualification test cases:
GAP/SEC/SEM/BV-56-C
GAP/SEC/SEM/BV-57-C
GAP/SEC/SEM/BV-58-C
GAP/SEC/SEM/BV-59-C
GAP/SEC/SEM/BV-60-C
GAP/SEC/SEM/BV-61-C

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-03-21 10:14:53 +01:00
Szymon Janc 0b01cf14e1 tests/bluetooth/tester: Add support for rejecting connection parameters
This is required for GAP/CONN/CPUP/BV-05-C qualification test.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-02-25 10:09:09 -08:00
Szymon Janc 3cbec153b2 tests/bluetooth/tester: Add support for multiple GATT subscriptions
This is required by GATT/CL/GAI/BI-01-C qualification test.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-02-25 10:08:45 -08:00
Szymon Janc 382e53c255 tests/bluetooth/tester: Fix possible buffer overflow
Make sure we have enough space for notification data.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-02-25 10:08:45 -08:00
Szymon Janc c631469539 tests/bluetooth/tester: Allocate L2CAP channel only when needed
This fix leaking channels when autorization or key size are tested.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-02-22 10:23:33 +01:00
Szymon Janc 4b40915004 test/bluetooth/tester: Don't clear auth requirements on L2CAP server
We have single server but it can accept multiple connections so
keep same requirements for all connection attempts.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2022-02-22 10:23:33 +01:00
Michał Narajowski da1663ed3b test/bluetooth/tester: Use Health Client Unack API
Unacknowledged API is now separate from Ack.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2021-12-16 10:15:36 +01:00
Krzysztof Kopyściński 0f6dc7a3cd bluetooth: tester: allow to set DisplayYesNo IO capability
This allows us to run SCPK tests with it.

signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-12-15 15:08:37 +01:00
Jordan Yates df327eeb58 net: buf: POOL_FIXED_DEFINE explicit user data
Update the macro prototype to explicitly require the length of the
desired user data. Update all in-tree usage of this macro.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-11-24 16:04:50 +02:00
Johan Lundin 403fbfcc12 Bluetooth: Adds preprocessor to L2CAP tester app
Adds preprocessor ifdefs to reconfigure() in L2CAP tester application
depending on the KConfig option CONFIG_BT_L2CAP_ECRED
Fixes issue #40456

Signed-off-by: Johan Lundin <johan.lundin@nordicsemi.no>
2021-11-22 23:10:47 -05:00
Szymon Janc d268c99266 test/bluetooth/tester: Re-pair on lost bond
If IUT is acting as a central device and peer lost bond we need
to re-pair to restore bond. PTS is not sending any WID for this
so bonding needs to be initiated implicitly by IUT.

This was affecting GAP/SEC/AUT/BV-25-C qualification test case.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-11-19 20:11:34 +01:00
Herman Berget 49c2c37417 tests: bluetooth: tester: Reading multiple variable length
Adds support for reading multiple variable length characteristics.
Previously read_multiple() always set the variable flag to false.

This is used by GATT/CL/GAT/BV-03-C.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
2021-11-13 07:54:27 -05:00
Szymon Janc d80e480f20 tests: bluetooth: tester: Add support for advertising with target RPA
This allows to do directed advertising with peer address set to RPA.
To do this according to specification IUT must first read Central
Address Resolution characteristic to check if peer supports it.

This is affecting GAP/CONN/DCON/BV-05-C qualification test.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-11-09 19:54:30 -05:00
Szymon Janc 03487ec592 tests: bluetooth: tester: Adjust Directed Advertising to latest BTP
This makes implementation in sync with autopts.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-11-09 19:54:30 -05:00
Szymon Janc 5f16b9ce83 tests: bluetooth: tester: Fix not marking chan as unused on disconnect
This fix not being able to re-connect channel after disconnect.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-11-08 11:06:51 -05:00
Szymon Janc 7e0502ebe3 tests: bluetooth: tester: Add support for pairing failed event
This event is sent if pairing failed.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-11-01 21:48:52 -04:00
Szymon Janc d0b02cde2c tests: bluetooth: tester: Fix NULL pointer dereference in error path
bt_conn_unref() requires valid conn pointer but could be called with
NULL in case valid connection was not found in disconnect_eatt_chans().

Fixes #39851

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-10-29 10:12:55 -04:00
Anas Nashif 59648f9001 tests: bluetooth: tester: reference autoPTS in README
Reference autoPTS documentation with more details on how to use this
test.

Fixes #1251

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-10-25 08:02:58 -04:00
Szymon Janc 349f9dfc71 tests: bluetooth: tester: Fix memory corruption in reconfigured_cb
Pass proper length when memsetting struct.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-10-25 12:23:14 +03:00
Jacob Siverskog 046f29a8cb Bluetooth: ATT: Fix typo in defines
Fix typo in ATT first/last attribute defines.

Signed-off-by: Jacob Siverskog <jacob@teenage.engineering>
2021-10-23 20:39:36 -04:00
Ilhan Ates 69abe7de8c Bluetooth: tester: Add directed adv support
GAP/CONN/DCON/BV-01-C test case needs directed advertising
support.

Signed-off-by: Ilhan Ates <ilhan.ates@nordicsemi.no>
2021-10-22 16:38:13 +02:00
Szymon Janc d7b37d8cc8 tests: bluetooth: tester: Increase ATT prepare write buffers count
GATT/SR/GAW/BV-10-C requires more buffers as it tests nested long
writes.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-10-22 16:37:38 +02:00
Szymon Janc 8a780680ad tests: bluetooth: tester: Add support for security_changed callback
This allows to track security levels and check for lost bond of peer
peripherals.

This was affecting GAP/SEC/AUT/BV-21-C qualification test.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-10-22 16:37:23 +02:00
Szymon Janc 17c01328b1 tests: bluetooth: tester: Add support for L2CAP channels options
This allows for better control over IUT behaviour by Upper Tester.

PTS and TS require inconsistent behaviour in terms of how IUT should
return credits. Some tests require return on explicit UT request and
some require that IUT returns credits autonomously.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-10-18 12:44:46 +02:00
Michał Narajowski 5d0f2fbc1d tests: bluetooth: tester: Adjust Segment Retransmit Count
In test cases MESH/NODE/TNPT/BV-04-C and MESH/NODE/TNPT/BI-01-C
the PTS is sending incomplete Seg Ack 3 times and in some cases we run
out of retransmit attempts before PTS sends complete Seg Ack. As a
workaround, increase Segment Retransmit Count to improve stability of
these tests.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2021-10-07 15:45:22 -04:00
Michał Narajowski 4cb935f264 tests: bluetooth: tester: Set Config Client timeout to larger value
In some scenarios when there is a need for multiple re-transmissions of
segmented messages the default value of 2 seconds may be not enough.

In my experience this improves stability of Configuration Client tests
involving multiple PTS instances.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2021-10-06 22:20:22 -04:00