Commit graph

566 commits

Author SHA1 Message Date
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
Szymon Janc ab6c090d74 tests: bluetooth: tester: Add support for L2CAP channel reconfiguration
This allows UT to reconfigure MTU of a channel and get notfied when
channel configuration changed.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-10-04 11:05:03 +02:00
Szymon Janc 6cfc6fa8e1 tests: bluetooth: tester: Add support for L2CAP Credits command
This allows IUT to return credits on specified L2CAP channel when
requested by Upper Tester.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-09-30 08:28:34 -04:00
Agata Ponitka bd8b9ee830 Bluetooth: Tester: Add the OOB Authentication method
Adding support for automatic testing OOB Authentication method.

Signed-off-by: Agata Ponitka <agata.ponitka@codecoup.pl>
2021-09-28 11:44:33 +02:00
Szymon Janc 24007fb2ad tests: bluetooth: tester: Fix build with EATT disabled
For ECFC L2CAP test we user overlay with disabled EATT and
bt_eatt_disconnect_one() is available only with EATT enabled.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2021-09-15 16:58:06 +02:00
Krzysztof Kopyściński fa2f83bf8b Bluetooth: host: add testing API (disconnect one EATT channel)
To test fallback to remaining bearers PTS might request IUT to
disconnect one of the connected EATT channels, while the others remain
intact. Test function must be added, because we cannot create L2CAP
server on EATT PSM and manage this server as normal and have EATT
enabled at same time.

This is affecting GATT/SR/GAW/BV-14-C

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-09-09 10:30:31 +02:00
Krzysztof Kopyściński 7a687b8a5d Tests: bluetooth: tester: accomodate L2CAP connect commant to BTP change
BTP change extended L2CAP_CONNECT command by ECFC flag, which determines
which connection procedure is used (non-enhanced or ecred). Now, only
this flag determines the procedure used, not number of requested
channels.

This was affecting L2CAP/ECFC/BV-25-C

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-09-09 10:28:10 +02:00
Krzysztof Kopyściński bd068e475d Tests: bluetooth: tester: find connection for get_attr_val_rp
To check security of connection  in read_value() we need to actually
pass connection not NULL.

This is affecting GATT/SR/GAR/BI-11-C

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-09-06 09:23:06 -04:00
Trond Einar Snekvik 2435419416 tests: bluetooth: mesh: Remove dead code
Removes all the dead ternary expressions in the mesh bluetooth tester.

Fixes #37983.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2021-08-31 11:03:06 -04:00
Michał Narajowski a614fc02ad Bluetooth: tester: Configure L2CAP Connection Response
Some test cases require the IUT to respond with a certain error. To get
the stack to return this error to PTS the application needs to be
configured specifically for this test case.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2021-08-30 14:40:59 +02:00
Krzysztof Kopyściński c94e53c9f5 Tests: bluetooth: tester: increase CONFIG_BT_ATT_PREPARE_COUNT
This is required for GATT/SR/GAW/BV-14-C

signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-08-21 21:34:08 -04:00
Torsten Rasmussen 1cccc8a8fe cmake: increase minimal required version to 3.20.0
Move to CMake 3.20.0.

At the Toolchain WG it was decided to move to CMake 3.20.0.

The main reason for increasing CMake version is better toolchain
support.

Better toolchain support is added in the following CMake versions:
- armclang, CMake 3.15
- Intel oneAPI, CMake 3.20
- IAR, CMake 3.15 and 3.20

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-08-20 09:47:34 +02:00
Krzysztof Kopyściński 00bfac00ae Bluetooth: gatt: Add option to read multiple without variable length
Currently, with EATT enabled, when bt_gatt_read is called with multiple
handles first it'll try to use gatt_read_mult_vl, and if it fails
gatt_read_mult will be used to try again. Add option to skip
the gatt_read_mult_vl and use gatt_read_mult right away. This is needed
by tests that expect BT_ATT_OP_READ_MULT_REQ but support variable
lenght, thus don't return BT_ATT_ERR_NOT_SUPPORTED.

Removed fallback from read multiple vl to read multiple on
BT_ATT_ERR_NOT_SUPPORTED error.

This was affecting:
GATT/CL/GAR/BV-05-C, GATT/CL/GAR/BI-18-C, GATT/CL/GAR/BI-19-C,
GATT/CL/GAR/BI-20-C, GATT/CL/GAR/BI-21-C, GATT/CL/GAR/BI-22-C

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-08-12 11:07:08 -04:00
Lingao Meng ce40fa434f tester: bluetooth: gatt: fix null pointer case CASE failed
GATT/SR/GAD/BV-03-C will read attr value, but we parse NULL
from `attr->read` which point to `attr_read` function.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-08-05 17:34:57 +02:00
Lingao Meng 36a385386a Tester: Bluetooth: Mesh: Rename function avoiding conflict
Since `write` or `read` belong with system standard API, so rename
this to avoiding conflict.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-08-03 10:21:16 -04:00
Lingao Meng 3911ce8d40 Bluetooth: Mesh: Mark as internal function
Marks funcs:`show_faults` as internal, avoiding conflict.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-08-03 10:21:16 -04:00
Krzysztof Kopyściński c8a196c65b Tests: Bluetooth: Tester: enable EATT by default
Since Zephyr supports EATT, which is reflected in ICS GATT_2_3
(Enhanced ATT bearer Attribute Protocol Supported (L2CAP fixed EATT PSM
supported) and GATT_2_3a (Enhanced ATT bearer supported over LE)
in GATT tests preamble 4.2.1.4 (Setup EATT Bearer over LE) is used
instead of 4.2.1.2 (Setup ATT Bearer over LE). Let's enable
EATT by default, allowing to run almost all GATT tests without
additional overlay.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-08-03 13:56:41 +02:00
Michał Narajowski 0bca465cab Bluetooth: tester: Add Bond Lost API
In GAP/SEC/AUT/BV-22-C the IUT needs to inform the Upper Tester about a
lost bond.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2021-07-23 14:43:01 +03:00
Agata Ponitka 0f61c0c65f Bluetooth: tester: Add Key Refresh Procedures tests support
Add support for automatic testing of KRP.

Signed-off-by: Agata Ponitka <agata.ponitka@codecoup.pl>
2021-07-22 22:41:32 +03:00
Agata Ponitka 1dbfc40705 Bluetooth: tester: Add provisioner support
Add provisioning procedure for automatic testing.

Signed-off-by: Agata Ponitka <agata.ponitka@codecoup.pl>
2021-07-22 22:41:32 +03:00
Agata Ponitka 41024b60eb Bluetooth: tester: Add Mesh Health Client Model tests support
Add support for automatic testing of Mesh Health Client Models.

Signed-off-by: Agata Ponitka <agata.ponitka@codecoup.pl>
2021-07-22 22:41:32 +03:00
Agata Ponitka b89003df86 Bluetooth: tester: Add Mesh Configuration Client tests support
Add support for automatic testing of Mesh Configuration Client Models.

Signed-off-by: Agata Ponitka <agata.ponitka@codecoup.pl>
2021-07-22 22:41:32 +03:00
Ingar Kulbrandstad 3ec6411c7f Bluetooth: Mesh: Align capitalization for BT mesh
Align the capitalization of the term "Bluetooth Mesh" to Bluetooth mesh"
in the documentation. This is done to to match the new updated naming
convention done in Bluetooth SIG. In the upcoming spec versions, it its
used "Bluetooth mesh" with the lower case convention.

Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
2021-07-13 11:23:54 -04:00
Lingao Meng 1447e796bc Tester: Add support ble auto-tester on native posix
The purpose of this PR is to automatically test the
host in the native environment.

It is used to simulate /dev/tty*, can replace by /dev/pts/*.
Also, device log will be output to stdio by default.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-06-28 20:14:32 -04:00
Krzysztof Kopyściński 79a3a0f40b bttester: add key-size and authorization based l2cap conn reject
In tests that expect returning error in response for l2cap
connection request we use predefined PSMs. This commit adds
check for required keysize (which will always return error,
as connection is not secure and key size will always be 0)
instead of setting security level 4 (which would return
insufficient authentication, not insufficient key size).
It also adds suport for PSM used in insufficient authorization
tests - choosing this PSM will set flag that triggers error
on channel accept.

This affects tests L2CAP/LE/CFC/BV-[10-15]-C

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-05-19 12:18:08 +03:00
Joakim Andersson b8c5eda2d2 Bluetooth: tester: Update tester to reserve bytes for an L2CAP SDU
Update the tester application to correctly reserve the number of bytes
needed for an L2CAP SDU.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-05-06 14:56:18 +02:00
Krzysztof Kopyściński ae935a7a37 Bluetooth/tester: fix coverity issue in l2cap
i is of uint type, so it'll never be negative. Thus, while loop
condition i >= 0 will always be true.
This patch also fixes issue with marking unused l2cap channels
as free by freeing only these that were marked as in_use by
get_free_channel(), and not all of them.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-05-05 16:03:22 +02:00
Joakim Andersson de60823d9a Bluetooth: tester: fix bt_le_oob_set_legacy_tk excluded when supported
Fix bt_le_oob_set_legacy_tk excluded when Legacy OOB pairing is
supported. We still support legacy OOB when
CONFIG_BT_SMP_OOB_LEGACY_PAIR_ONLY is not defined.
It is only when we disable Legacy pairing that it is not included.

Check that the OOB data type is in fact Legacy OOB before calling
bt_le_oob_set_legacy_tk.

Log an error if the OOB type was not handled by the callback.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-05-03 10:00:44 +02:00
Michał Narajowski 00681f0241 Bluetooth: tester: Implement Provisioning Node Added event
This information is useful to the automation framework when implementing
tests where the IUT is the provisioner and the test uses two PTS
instances.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2021-04-28 11:13:45 -04:00
Krzysztof Kopyściński 97f992c470 Bluetooth/tester: connect L2CAP using Enhanced Credit Flow Control
This change adds field to L2CAP connect command allowing to choose
ECFC in L2CAP connect() function and adds required logic to perform
such connection.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-04-16 15:32:48 -04:00
Emil Gydesen 42da370df5 Bluetooth: Use ATT FIRST/LAST attribute handle defines where applicable
Change to use the BT_ATT_FIRST_ATTTRIBUTE_HANDLE and
BT_ATT_LAST_ATTTRIBUTE_HANDLE instead of the literal values where
applicable.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-04-08 16:35:57 +02:00
Joakim Andersson 122320f5bd Bluetooth: tester: Revert "Fix an error response in tester"
This reverts commit 24784b1452.

The change appears to have been submitted twice in different PRs.
The correct change is: 76789883e2

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-04-07 13:54:42 +03:00
Krzysztof Kopyściński 806ca8f78d bluetooth/tester: give data buffer for each L2CAP channel
L2CAP channels are allocating buffers from common data_pool. For that
pool buffer count was hard-coded as 1. This count should be set to value
CHANNELS, allowing each channel to allocate buffer for incoming
data. Without this change, execution would stuck at l2cap_chan_le_recv()
as we give net_buf_alloc() in alloc_buf_cb() no timeout.

Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-04-06 15:30:47 +02:00
Jun Huang 24784b1452 Bluetooth: tester: Fix an error response in tester
In the function conn_param_update, it should send the opcode
GAP_CONN_PARAM_UPDATE, instead, it send GAP_PASSKEY_ENTRY.

Signed-off-by: Jun Huang <huangjun6@xiaomi.com>
2021-03-26 15:31:29 -04:00
Krzysztof Kopyściński 714239ba13 Bluetooth: tester: fix build with BT_SMP_SC_ONLY
bt_le_oob_set_legacy_tk is not defined with this
setting and this code is reachable only for legacy pairing

signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
2021-03-26 15:29:31 -04:00
Ryan Chu 5c0544aa9d Bluetooth: tester: Reserve BT buffer for different HCI transports
With this change, L2CAP/LE/CFC/BV-06-C can be supported when using
BT_RPMSG and the others HCI transports.

Depending on CONFIG_BT_HCI_RESERVE, the HCI transport requires extra
headroom in a BT buffer.

Signed-off-by: Ryan Chu <ryan.chu@nordicsemi.no>
2021-03-26 08:26:21 -04:00
Andrzej Głąbek 031aeb2bd9 tests: bluetooth: tester: Remove assignment to CONFIG_LOG_MINIMAL
The LOG_MINIMAL option is no longer user-configurable, as now it has
no prompt. LOG_MODE_MINIMAL should be modified instead.
But in this case, the assignment is redundant, as this option is not
enabled by default. Remove it then, to align the configuration file
for nrf5340dk_nrf5340_cpuapp with the one for nrf52840dk_nrf52840.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-03-18 06:17:45 -04:00
Ayturk Duzen 99f53662dc Bluetooth: tests: Add nrf5340 support to tester
Add missing boards nrf5340dk_nrf5340_cpuapp.conf and
nrf5340dk_nrf5340_cpuapp.overlay files

Signed-off-by: Ayturk Duzen <ayturk.duzen@nordicsemi.no>
2021-03-04 13:00:04 +01:00
Michał Narajowski b386853367 Bluetooth: tester: Implement Friend and LPN callbacks
Use these callbacks to send BTP events. They are useful for test
automation in auto-pts.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2021-01-15 11:14:24 -05:00
Michał Narajowski d4247b3503 Bluetooth: tester: Set LPN Poll timeout to smaller value
Smaller poll timeout means shorter test time.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2021-01-15 11:14:24 -05:00
Michał Narajowski 71577b2d98 Bluetooth: tester: Use Linux Foundation Company ID
PTS now does not accept 0xffff as a company ID so set it to Linux
Foundation ID.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2021-01-15 11:14:24 -05:00
Pavel Vasilyev 561a8e4f0e Bluetooth: Mesh: Break up mesh settings
The mesh settings.c module is a giant piece of code responsible for
storing the mesh stack configuration. Such approach makes it difficult
to control the data to be stored, breaks the stack modules'
encapsulation by forcing them to reveal the internal kitchen, which
leads to unpleasant issues such as #19799.

This commit moves the responsibility of storing the configuration
to corresponding modules while keeping control of the moment of storing
the configuration and of starting the stack after the settingss loading
is completed.

This doesn't introduce any abstraction between the mesh settings.c and
other modules as it will add more complexity and overhead than necessary
for the actual task.

Fixes #19850

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2021-01-14 16:38:50 +02:00
Michał Narajowski ead46e029f Bluetooth: tester: Fix net send command
After change 7e302979f3 some
MESH/NODE/NET/ tests would fail because we tried to send a message to a
non-unicast address using the device key. This patch fixes that by
defining and adding an app key for vendor model which is then used to
send network packets for these test cases.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2020-12-16 12:17:03 -05:00
Jun Huang 76789883e2 Bluetooth: tester: Fix an error response in tester
In the function conn_param_update, it should send the opcode
GAP_CONN_PARAM_UPDATE, instead, it send GAP_PASSKEY_ENTRY.

Signed-off-by: Jun Huang <huangjun6@xiaomi.com>
2020-12-03 12:16:04 +02:00
Jordan Yates ffab099eb9 Bluetooth: add destroy callback to indication
Adds a `destroy` callback to the `struct bt_gatt_indicate_params` which
is used to signify to the application that the indication operation has
completed and the struct instance can be freed/destroyed.

This is required as the number of indication value callbacks that will
be triggered is not known by the caller when the `conn` parameter is
`NULL`.

Tracking when this callback should be run is mananged by a private
reference counter inside the struct.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-11-10 11:21:46 +01:00
Jordan Yates 170f17e0e7 Bluetooth: indication callback signature update
Update the signature of the `bt_gatt_indicate_func_t` callback type by
replacing the attr pointer with a pointer to the
`bt_gatt_indicate_params` struct that was used to start the indication.

This allows the callback to free the `bt_gatt_indicate_params` instance
if it was allocated from storage, while still allowing the
`bt_gatt_attr` value to be accessed through `params->attr`.

Allocating the `bt_gatt_indicate_params` instance from storage is
desirable as multiple indications can be queued, however each instance
must be valid until the callback is run.

Implements API update from #29357

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-11-10 11:21:46 +01:00
Trond Einar Snekvik ad2fd44d7a Bluetooth: Mesh: Encapsulate feature config
Moves mesh feature configuration to a separate module, deprecating the
bt_mesh_cfg_srv structure. The initial values for the features should
now be enabled through KConfig, where new config entries have been added
for each feature.

This removes the upward dependency on the config server from the core
stack, and makes the config server a pure frontend for the configuration
states, as all spec mandated behavior around the feature states is now
encapsulated.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-11-09 11:23:34 +02:00
Ryan Chu 385000e8d9 Bluetooth: tester: Set the required minimim security level of LE COC
With this change, these two tests can be supported:
- L2CAP/LE/CFC/BV-11-C
- L2CAP/LE/CFC/BV-14-C

Signed-off-by: Ryan Chu <ryan.chu@nordicsemi.no>
2020-10-29 20:34:21 +02:00
Ryan Chu 70a27af090 Bluetooth: tester: Clear adv_buf after sending GAP_EV_DEVICE_FOUND
Avoid sending duplicate GAP_EV_DEVICE_FOUND because adv_buf->len was
not cleared.

With this change, the following tests become more stable in a noisy
environment:
- GAP/BROB/OBSV/BV-01-C
- GAP/BROB/OBSV/BV-02-C
- GAP/BROB/OBSV/BV-05-C
- GAP/BROB/OBSV/BV-06-C
- GAP/DISC/RPA/BV-01-C

Co-authored-by: Konstantinos Sotiropoulos
                konstantinos.sotiropoulos@nordicsemi.no

Signed-off-by: Ryan Chu <ryan.chu@nordicsemi.no>
2020-10-29 20:34:21 +02:00
Ryan Chu efc8459340 Bluetooth: tester: Support SM tests related to OOB
Support the folowing new tests related to OOB pairing:
- SM/MAS/OOB/BI-01-C
- SM/MAS/OOB/BV-01-C
- SM/MAS/OOB/BV-03-C
- SM/MAS/OOB/BV-09-C
- SM/MAS/SCOB/BI-01-C
- SM/MAS/SCOB/BI-04-C
- SM/MAS/SCOB/BV-01-C
- SM/MAS/SCOB/BV-04-C
- SM/SLA/OOB/BI-02-C
- SM/SLA/OOB/BV-02-C
- SM/SLA/OOB/BV-04-C
- SM/SLA/OOB/BV-10-C
- SM/SLA/SCOB/BI-02-C
- SM/SLA/SCOB/BI-03-C
- SM/SLA/SCOB/BV-02-C
- SM/SLA/SCOB/BV-03-C

Co-authored-by: Konstantinos Sotiropoulos
                konstantinos.sotiropoulos@nordicsemi.no
Co-authored-by: Aytürk Düzen ayturk.duzen@nordicsemi.no

Signed-off-by: Ryan Chu <ryan.chu@nordicsemi.no>
2020-10-29 20:34:21 +02:00
Xavier Chapron 824f423e54 misc: Replace assert include and calls by sys/__assert.h equivalent
Replace all calls to the assert macro that comes from libc by calls to
__ASSERT_NO_MSG(). This is usefull as the former might be different
depending on the libc used and the later can be customized to reduce
flash footprint.

Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
2020-10-02 11:42:40 +02:00
Carles Cufi 2fd929355a Bluetooth: tester: Fixes for GCC 10.x
Fix the structures so that they are compliant with the stricter checks
of GCC 10.x, and at the same time correct a bug that was present in the
handling of the GAP Start Advertising BTP command.

Fixes #28375.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-09-18 13:32:08 +02:00
Luiz Augusto von Dentz 5c4bde55d0 Bluetooth: GATT: Rework bt_gatt_attr_func_t
Make it actually give the original pointer to the attribute and its
resolved handle so static attributes don't need an extra lookup.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-09-05 11:06:21 +02:00
Anas Nashif dca317c730 sanitycheck: inclusive language
change whitelist -> allow.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-08-27 07:04:07 -04:00
Michał Narajowski 7c06f3c38e mesh: Adjust config values to pass Transport test cases
These values were derived experimentally by running PTS test cases.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
2020-07-02 16:30:01 +03:00
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Marc Herbert debade9121 tests: make find_package(Zephyr...) REQUIRED
... because it is (required).

This makes a difference when building with CMake and forgetting
ZEPHYR_BASE or not registering Zephyr in the CMake package registry.

In this particular case, REQUIRED turns this harmless looking log
statement:

-- Could NOT find Zephyr (missing: Zephyr_DIR)
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- ...
-- ...
-- ...
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:8 (target_sources):
  Cannot specify sources for target "app" which is not built by
  this project.

... into this louder, clearer, faster and (last but not least) final
error:

CMake Error at CMakeLists.txt:5 (find_package):
  Could not find a package configuration file provided by "Zephyr" with
  any of the following names:

    ZephyrConfig.cmake
    zephyr-config.cmake

  Add the installation prefix of "Zephyr" to CMAKE_PREFIX_PATH or set
  "Zephyr_DIR" to a directory containing one of the above files.  If
  "Zephyr" provides a separate development package or SDK, be sure it
  has been installed.

-- Configuring incomplete, errors occurred!

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2020-05-29 10:47:25 +02:00
Mariusz Skamra f51557d0f2 tester: Adjust to recent changes in BTP API
This patch adjusts L2CAP CoC related command and responses to the
recent BTP API changes.
BTP has been extended with Enhanced CoC support, thus few L2CAP
CoC related commands have been changed.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2020-05-05 11:05:54 +03:00
Carles Cufi 6656214af2 boards: nrf52_pca10040: Rename to nrf52dk_nrf52832
The board name for the nRF52 DK, so far known as nrf52_pca10040, is
renamed to nrf52dk_nrf52832.  Its documentation and all references
to its name in the tree are updated accordingly. Overlay and
configuration files specific to this board are also renamed, to
match the new board name.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-04-06 13:09:07 +02:00
Joakim Andersson f2d7b77e96 Bluetooth: host: Deprecate BT_LE_ADV defines in hci.h in favour of gap.h
Deprecate BT_LE_ADV defines in hci.h that are expected to be used by the
application in the scan received callback to identify the advertising
PDU type. These defines are mixing HCI input parameters and advertising
PDU types. Internally it is acceptable to mix these, but at the API we
should to mix in them.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-03-30 00:38:23 +03:00
Joakim Andersson 405ce842ab Bluetooth: host: Add new argument and return code to bt_create_conn_le
Deprecate bt_create_conn_le and rename it to in order to add return
code, new arguments and to follow the established naming convention.

Add API for the application to control the scan parameters of the
initiator role. This allows the application more scheduling control
of the initiator in multi-role scenarios. Also provides options to
configure the initiator for LE Coded PHY for long range support.
We deprecate the old way of creating connection to make the name more
consistent with the rest of the API.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-03-30 00:38:23 +03:00
Torsten Rasmussen 407b49b35c cmake: use find_package to locate Zephyr
Using find_package to locate Zephyr.

Old behavior was to use $ENV{ZEPHYR_BASE} for inclusion of boiler plate
code.

Whenever an automatic run of CMake happend by the build system / IDE
then it was required that ZEPHYR_BASE was defined.
Using ZEPHYR_BASE only to locate the Zephyr package allows CMake to
cache the base variable and thus allowing subsequent invocation even
if ZEPHYR_BASE is not set in the environment.

It also removes the risk of strange build results if a user switchs
between different Zephyr based project folders and forgetting to reset
ZEPHYR_BASE before running ninja / make.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-03-27 16:23:46 +01:00
Andrzej Głąbek 4253eae005 boards: nrf52840_pca10056: Rename board to nrf52840dk_nrf52840
The nRF52840 DK board target, so far known as nrf52840_pca10056,
is renamed to nrf52840dk_nrf52840.
Its documentation and all references to its name in the tree are
updated accordingly. Overlay and configuration files specific to
this board are also renamed, to match the new board name.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-03-27 09:14:08 +01:00
Carles Cufi 02b630d494 Bluetooth: tester: Fix GATT service registration
The service registration logic was using the wrong variable to check for
a pending service to be registered, which led to the same service being
registered twice in some cases. Fix the logic so that a pending service
is only registered once.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-27 21:21:46 +02:00
Carles Cufi e9a416f3cd Bluetooth: tester: Add missing log_strdup
Since we enable CONFIG_ASSERT in the tester app, the logging subsystem
will assert if it detects a missing log_strdup. Add the two missing ones
that I could find to properly log transient strings.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-25 22:29:29 +02:00
Carles Cufi 2b0e9a3d6e Bluetooth: tester: Implement the GAP_SET_MITM command
Implement the BTP command to set MITM, although on Zephyr this is not
configurable at runtime. Instead print a warning instructing to use the
CONFIG_BT_SMP_ENFORCE_MITM Kconfig option instead.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-23 21:46:22 +02:00
Carles Cufi 3c69dff9a3 Bluetooth: tester: Implement the GAP_PASSKEY_CONFIRM command
Implement the BTP GAP command and event for passkey confirmation.
This also allows us to set the passkey_confirm auth callback which
enables the keyboard/display IO capabilities.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-23 21:46:22 +02:00
Carles Cufi c3f5677672 Bluetooth: tester: Implement the GAP_SET_BONDABLE command
Implement the BTP GAP command to set bondable on or off.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-23 21:46:22 +02:00
Carles Cufi 4a59e8da59 Bluetooth: tester: Disable forcing of MITM
Since some tests require MITM to be off, disable the option that forces
the MITM flag at all times.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-23 21:46:22 +02:00
Carles Cufi 6f8dd90a83 Bluetooth: tester: Ensure the app is bondable by default
Ensure the bondable Kconfig option is set unconditionally.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-23 21:46:22 +02:00
Carles Cufi 2b48a8f37b Bluetooth: tester: Fix packet field name
Correct the name of the boolean include in the set bondable
command so it reflects the spec.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-23 21:46:22 +02:00
Carles Cufi 5cbc3e0c6c Bluetooth: tester: Tweak nRF52840 config
Disable stack measurements by default, since they pollute the log
output.
Ensure that the logging thread has enough stack.
Ensure that the UART that connects to the BTP client is
interrupt-driven.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-23 21:46:22 +02:00
Carles Cufi 613e5f541f Bluetooth: tester: Update GATT cmds/evts to the latest BTP spec
Fill in all the missing GATT commands and events in the latest BTP
specification.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-22 19:15:04 +02:00
Carles Cufi 2be22c0473 Bluetooth: tester: Update GAP cmds/evts to the latest BTP spec
Fill in all the missing commands and events in the latest BTP
specification.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-21 18:17:59 +02:00
Carles Cufi cee1954ac3 Bluetooth: tester: Add abundant logging in GAP
Log all error conditions in GAP for easier debugging.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-21 13:42:07 +02:00
Carles Cufi 7f5ae21a6d Bluetooth: tester: Add logging in core handlers
Add warnings when something goes unhandled.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-21 13:42:07 +02:00
Carles Cufi b01cd4c7bb Bluetooth: tests: tester: Add an init log message
Add a log message to let people running the test know that the tester
booted up correctly.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-20 21:37:33 +02:00
Carles Cufi 5af621282e tests: bluetooth: tester: Add a config for the 52840 DK
Add a configuration file for the nRF52840 DK so that it uses RTT for
debugging and enables more protection measures.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-20 21:37:33 +02:00
Carles Cufi 6de5c4b7b3 tests: bluetooth: tester: Clean up configuration
- Use the built-in mechanism for configuration overlays
  (having a boards/ folder with <board>.conf fragments)
- Clean up variables that were giving warnings

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-02-20 21:37:33 +02:00
Ulf Magnusson cf89ba33ea global: Fix up leading/trailing blank lines in files
To make the updated test in
https://github.com/zephyrproject-rtos/ci-tools/pull/121 clean, though it
only checks modified files.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-01-27 17:41:55 -06:00
Peter Bigot 6a964663b1 treewide: use full path to console/uart_pipe.h header
The build infrastructure should not be adding the drivers subdirectory
to the include path.  Fix the legacy uses that depended on that
addition.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-01-26 17:52:12 +01:00
Ulf Magnusson 2f2a04d167 tests: bluetooth: kconfig: Do not assign promptless BT_MESH_PROV
Assignments have no effect on promptless symbols. Flagged by
https://github.com/zephyrproject-rtos/zephyr/pull/20742.

BT_MESH_PROV is already selected by BT_MESH_PB_ADV and BT_MESH_PB_GATT,
which these configuration files enable.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-01-14 16:49:25 -05:00
Johan Hedberg 0e91493ab4 Bluetooth: L2CAP: Make channel ops const
Make the channel ops struct const since there really isn't anything
there that needs to change at runtime. The only exception is the L2CAP
shell which was playing with the recv callback, however that can be
fixed by introducing a simple bool variable.

With tests/bluetooth/shell this reduces RAM consumption by 112 bytes
while adding only 16 bytes to flash consumption.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-12-19 11:28:24 +02:00
Joakim Andersson b30b480c7c Bluetooth: UUID: Expose bt_uuid_to_str to application
Expose the bt_uuid_to_str function as an API to the application.
This aligns this function with the bt_addr_to_str function call. This
allows the application to use this function without having to enable
the BT_DEBUG option.

Move the in-place bt_uuid_str to internal logging, this is mainly done
due to the limitation in the log_strdup that shouldn't be exposed to the
application.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-12-09 17:15:05 +02:00
Jacob Siverskog 7096fa512f Bluetooth: GATT: Remove all subscriptions for connection when unpairing
Make sure all subscriptions are removed when a connection is unpaired.

Fixes #21131

Signed-off-by: Jacob Siverskog <jacob@teenage.engineering>
2019-12-04 19:14:28 +01:00
Johan Hedberg 39291fbbbe Bluetooth: Remove usage of BT_BUF_USER_DATA_MIN
This define is not of use anymore since there's a global net_buf user
data Kconfig variable and its definition already guarantees a
sufficient minimum for Bluetooth.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-11-28 13:35:11 +02:00
Maksim Masalski e9d7565d66 tests: remove duplicate names for the bluetooth tests
According to the comment in #20008 I found out that some test cases
for different tests have same names.
To get rid of it, I decided to change test cases names.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2019-10-24 06:29:17 -04:00
Johan Hedberg 5537181e1a Bluetooth: Fix missing includes for hci.h
With the changes in PR #19836 applications now need to explicitly
include hci.h to use defines from it. Fix two sample/tests apps which
were missing this.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-10-17 19:05:33 +03:00
Mariusz Skamra 9828b0fae8 Bluetooth: tester: Adapt to BTP Get Attribute Value API change
Adapt the gatt_get_attribute_value_cmd to recent changes in API.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2019-09-25 17:36:05 +02:00
Luiz Augusto von Dentz 03b9ce487c Bluetooth: GATT: Add support to setting permission on CCCD
This adds support to set different permissions to CCCD so security can
be checked when enabling notification which conforms to:

BLUETOOTH CORE SPECIFICATION Version 5.1 | Vol 3, Part G page 2360:

  '3.3.3.3 Client Characteristic Configuration

   Authentication and authorization may be required by the server to
   write the configuration descriptor.'

In addition to that also ensure that notification are not re-enabled
until the proper security level is reached to conform to the following
statement:

  '10.3.1.1 Handling of GATT indications and notifications

   A client “requests” a server to send indications and notifications
   by appropriately configuring the server via a Client Characteristic
   Configuration Descriptor. Since the configuration is persistent
   across a disconnection and reconnection, security requirements must
   be checked against the configuration upon a reconnection before
   sending indications or notifications. When a server reconnects to a
   client to send an indication or notification for which security is
   required, the server shall initiate or request encryption with the
   client prior to sending an indication or notification. If the client
   does not have an LTK indicating that the client has lost the bond,
   enabling encryption will fail.'

Fixes #17983

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-09-19 21:12:39 +03:00
Joakim Andersson 3e9888105e Bluetooth: Host: Rename API function to initiate bluetooth security.
Rename bt_conn_security to bt_conn_set_security, this makes the API
naming more consistent.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-08-27 15:13:25 +02:00
Joakim Andersson 1c48757d94 Bluetooth: Host: Rename security level enum
Rename security level enum, using level and number instead of low,
medium, high and fips.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-08-27 15:13:25 +02:00
Luiz Augusto von Dentz 5f3595e47c Bluetooth: GATT: Fix using variable size storage for CCC
This removes the necessity of registering the storage for CCC and make
it part of the declaration itself.

Fixes #18547

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-08-22 15:14:39 +03:00
Mariusz Skamra 5a7a520ea1 Bluetooth: GATT: Add BTP Discover All Primary Services command handler
This will handle BTP Discover All Primary Services command.

Related TC: GATT/CL/GAD/BV-01-C
Fixes: #17861
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2019-08-07 18:07:45 +02:00
Anas Nashif ffaba63b10 boards: remove arduino 101 and related boards
This board and SoC was discontinued some time ago and is currently not
maintained in the zephyr tree.
Remove all associated configurations and variants from the tree.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-07-29 21:30:25 -07:00
Mariusz Skamra 8b27af58eb Bluetooth: tester: Change RPA timeout
This changes RPA timeout so that the address is changed every 60
seconds. This change is needed to speed up privacy related test cases.
Currently, the new RPA was initiated on request that was a bit hackish
and could be done via BT_RPA_TIMEOUT Kconfig option.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2019-07-19 16:28:13 +03:00
Mariusz Skamra 1074efd3cd Bluetooth: tester: Update to recent conn param related changes in BTP
This updates tester application to recent changes in BTP related
to Connection Parameters Update.
Connected event has been extended with connection parameters.
Connection Parameters Update command and event have beend added to
initiate and track current connection parameters.
Needed to automate qualification test GAP/CONN/CPUP/BV-06-C

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2019-07-19 11:24:11 +02:00
Mariusz Skamra d4f1a5aba6 Bluetooth: tester: Enable GAP writable device name
This enables support for GAP writable device name in tester application
for testing purposes.

Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2019-07-18 14:36:30 +02:00
Mariusz Skamra 35dcab988e Bluetooth: tester: Enable Mesh Friend support
Enable Mesh Friend support in tester application.

Fixes: #17600
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
2019-07-18 14:35:40 +02:00
Anas Nashif a2fd7d70ec cleanup: include/: move misc/util.h to sys/util.h
move misc/util.h to sys/util.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 9ab2a56751 cleanup: include/: move misc/printk.h to sys/printk.h
move misc/printk.h to sys/printk.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00