Commit graph

624 commits

Author SHA1 Message Date
Vinayak Kariappa Chettimada e0613b9638 tests: Bluetooth: bsim: Added tests for adv set terminate event
Added bsim testing for Advertising Set Terminated event.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-07-23 11:39:47 +02:00
Dag Bjarvin 12fdddb80d Bluetooth: controller: Add terminate event for external advertising
Add terminate event for duration timeout, max number of events and
connection.

Signed-off-by: Dag Bjarvin <Dag.Bjarvin@nordicsemi.no>
2020-07-23 11:39:47 +02:00
Emil Gydesen 5b59c002f6 Bluetooth: Gatt: Automatic discover of CCC when subscribing
Added a feature that allows an application to request
automatic discovery of the CCCD handle when subscriping
to a characteristic. In order to preserver RAM, the application
is expected to provide the discovery parameters, and it's up
to the application whether or not it wants to reuse the
discovery parameters or use one for each characteristic.

Signed-off-by: Emil Gydesen <emil_gydesen@bose.com>
2020-07-20 12:46:18 +02:00
Vinayak Kariappa Chettimada 36707cdb58 tests: Bluetooth: bsim: Disable test with long AD data
Disable test with long AD data being set, as 251 byte
Advertising PDU is not yet supported.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-07-16 14:43:46 +02:00
Joakim Andersson a52c442fc7 Bluetooth: test: Print disconnect reason in hex value
Print the disconnect reason in hex value since the defines are in hex.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-07-06 11:15:39 +02:00
Joakim Andersson 4be66bd33d Bluetooth: Fix host RX thread deadlock
Fix host RX thread being deadlocked. The deadlock occurs because the
RX thread is stuck waiting in conn_tx_alloc with K_FOREVER but if the
connection is disconnected only the RX thread can unblock it in the
handling of the disconnect event.

This commit fixes this deadlock by splitting the processing of the
disconnected event into two parts.
The part needed to unblock the RX is to release resources held by
unack'ed TX packets and mark the connection state as not connected
anymore.
The RX thread waiting for free_tx fifo and the TX thread waiting for
the bt_dev.le.pkts semaphore will both check the connected state after
having acquired them and will abort if disconnected.
The rest of the processing will be handled at normal RX thread
priority like normal.

Move the bt_recv_prio handling to the Bluetooth host when the host
has defined its own RX thread (CONFIG_BT_RECV_IS_RX_THREAD=n).
If the HCI driver has the RX thread (CONFIG_BT_RECV_IS_RX_THREAD=y),
then the responsibility to call bt_recv and bt_recv_prio correctly
falls to the HCI driver.
The helper function bt_hci_evt_is_prio() is replaced with
bt_hci_evt_get_flags() so that the HCI driver can do this correctly.
This decision to replace was made so that existing HCI drivers
maintained out-of-tree will fail at compile time with the new system.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>

Bluetooth: host: Move bt_recv_prio to host when RX thread is defined

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-07-06 11:15:39 +02: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
Andries Kruithof ed85577a22 Bluetooth: controller: Increase timeout for babblesim
The timeout for testing advertisement extensions in babblesim
was set to 30 seconds. Depending on the hardware used for
testing this may be too low. Increased to 120 seconds

Signed-off-by: Andries Kruithof <Andries.Kruithof@nordicsemi.no>
2020-06-29 09:27:09 +02:00
Vinayak Kariappa Chettimada 372a2e2fd3 tests: Bluetooth: bsim_test: Include advx testing in CI
Update compile.sh and added test_script, so that
bsim_test_advx bsim_test application is built and run in
CI.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 353bb6d5cf tests: Bluetooth: make ctrl_advx a BabbleSim test
Convert the ctrl_advx application into a Babblesim test.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 0a18b7e2cb tests: Bluetooth: advx: disable periodic SYNC_IND packets
Added function call to test disable of the started periodic
SYNC_IND packets.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada b92abf8e6a tests: Bluetooth: advx: Use 2M PHY auxiliary PDUs.
Use 2M PHY auxiliary PDUs in test.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada 1bd7f26cb0 tests: Bluetooth: advx: Update data while periodic advertising
Update Aux PDU AD Data while periodic advertising.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada f0174527f9 tests: Bluetooth: advx: Added code to test periodic advertising
Added code to invoke starting of periodic advertising.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02:00
Vinayak Kariappa Chettimada dd0c46c371 tests: Bluetooth: advx: test application for adv. ext. development
Added a new advx test application to aid test driven
development.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-06-12 15:50:34 +02: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
Peter Bigot 8949680482 tests: bluetooth: ctrl_sw_privacy_unit: remove legacy timeout API
This test doesn't depend on the legacy API.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-03 17:47:58 +02: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
Anas Nashif ad82b38b8f tests: ztest: prefix tests with test_
Tests should always start with test_, otherwise detection of subtests
will not work through sanitycheck.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-05-13 18:16:07 +02:00
Carles Cufi b67a31e411 Bluetooth: controller: Remove legacy LL
Remove the legacy Link Layer implementation.

Closes #24187.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-08 15:07:00 +02:00
Joakim Andersson 194079d5bd Bluetooth: shell: Enable extended advertising support in the shell
Enable extended advertising commands in the shell and enable the
runtime check of feature support in the controller.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-07 20:12:29 +02:00
Joakim Andersson 21a42f3b67 Bluetooth: shell: Add phy handling to the shell
Add phy update callback and command to the shell.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-07 20:12:29 +02:00
Joakim Andersson 322f70243e Bluetooth: shell: Add data length handling in the shell
Add data length callback and command to the shell.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-07 20:12:29 +02:00
Carles Cufi 9b04a99243 timeouts: Port BBC micro:bit to the new timeout API
Port the BBC micro:bit display driver to the new timeout API exposed by
the kernel.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-05-07 11:01:55 +02:00
Luiz Augusto von Dentz f3116842f1 Bluetooth: EDTT: Use bt_buf_tx_get to allocate buffers
Instead of using its own buffer pool use one already available by
HCI_RAW which are accessible with bt_buf_tx_get.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-05-07 10:31:36 +03: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
Kumar Gala 59d3cc213e tests: Convert DT_ALItAS_* to new DT_ALIAS() macro
Convert DT_ALIAS_* defines to use DT_ALIAS() plus other macros from
include/devicetree.h.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-04 09:11:38 -05:00
Luiz Augusto von Dentz 70271435dd Bluetooth: shell: Enable BT_EATT
This enables BT_EATT for shell samples so it can be build test by CI and
gives user the ability of test it using shell commands.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-05-02 15:59:14 +03:00
Joakim Andersson 45e6921517 Bluetooth: test: Fix redefinition of BT_BUF_ACL_SIZE
Fix BT_BUF_ACL_SIZE in hci_test_app after declaration was moved to
hci_raw.h

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-02 13:08:59 +03:00
Joakim Andersson 68ce16cf86 Bluetooth: tests: Update EDTT configuration for easier debugging
Update EDTT default configuration to make it easier to debug. The
use of maximum log level to restrict default output caused some
confusion. Instead remove debug options to reduce the default log
output. Enabling debug logs is now similar to other samples and tests.

Remove options commented out, no need to keep them.
Move comment to the matching CONFIG.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-30 13:33:16 +02:00
Joakim Andersson e1479a406f Bluetooth: test: Convert EDTT test to using k_timeout_t struct
Convert the EDTT test to use k_timeout_t struct.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-30 13:46:48 +03:00
Carles Cufi 205cf1595e boards: nrf52810_pca10040: Rename to nrf52dk_nrf52810
The board target for emulation of nRF52810 on nRF5DK, so far
known as nrf52810_pca10040, is renamed to nrf52dk_nrf52810.
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
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
Johan Hedberg 71eb56a34c net: buf: Move LEGACY_TIMEOUT_API selection to specific subsystems
The net_buf subsystem is now fully compatible with the new timeout
API, so move the selection of the legacy API to those specific
subsystems that use net_buf and still need converting.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2020-04-03 23:17:53 +03:00
Joakim Andersson 3baccee472 Bluetooth: tests: Add additional build configurations
Add additional build configurations to the shell to catch build errors
when enabling extended advertising.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-03 21:13:14 +03:00
Johan Hedberg 31ad7b455b Bluetooth: tests: Fix timeout passed to k_sleep()
Use the appropriate K_SECONDS() macro to pass a timeout to k_sleep().

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2020-04-01 20:03:15 +03: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
Ioannis Glaropoulos f3807f19dc boards: arm: nrf51_pca10028: rename board to nrf51dk_nrf51422
We rename the nRF51 Dev Kit board target (nrf51_pca10028)
to nrf51dk_nrf51422. We update all associated references
in the supportive documentation and all nRF51-related
cofigurations and overlay files in the samples and tests
in the tree.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2020-03-24 11:45:27 +01:00
Trond Einar Snekvik 824c2ebc58 Bluetooth: Mesh: Slab based segmentation handling
Allocates segmented message buffers as slabs in a common pool for RX and
TX. This reduces memory requirements for both TX and RX, as TX messages
can be stored without the network and advertising buffer overhead, and
RX can use only the slabs it needs, instead of allocating a full size
segmented message. This approach also removes the need for decrypting
the segments for each retransmission, reducing overall processing load.

Slab based segmentation for tx also introduces queuing of segmented
messages, which allows the application layer to send multiple messages
to the same destination without violating Bluetooth Mesh specification
v1.0.1, section 3.6.4.1. This mechanism is provided through a flag that
blocks segmented messages to a destination which a message is already
being sent to until the previous message finishes.

This changes the SDU size configuration to a symmetrical
RX_SEG_MAX/TX_SEG_MAX pair of configurations, plus a new segment pool
side configuration. It also removes the binding between the TX_SEG_MAX
config and the advertising buffers, reducing the minimum advertising
buffer count from 6 to 3.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-03-19 15:54:26 +02: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
Joakim Andersson 5c1963b1c5 Bluetooth: tests: shell: Add missing dependency in mesh.conf
Add missing dependency in mesh.conf.
Handles this warning: Warning: BT_MESH_SHELL was assigned the value 'y'
but got the value 'n'. Check these unsatisfied dependencies:
BT_MESH_HEALTH_CLI (=n)

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-02-27 13:45:18 +02:00
Joakim Andersson 98827e9f6d Bluetooth: tests: shell: Remove config not supported on native_posix
Remove CONFIG_CONSOLE_HANDLER from project configuration. When building
for native_posix this produces the following warning:

warning: CONSOLE_HANDLER was assigned the value 'y' but gotthe value 'n'
Check these unsatisfied dependencies: SERIAL_SUPPORT_INTERRUPT (=n)

The shell works without this option since this is handled by the shell
itself instead.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-02-27 13:45:18 +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