Commit graph

35 commits

Author SHA1 Message Date
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
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
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
Joakim Andersson ba504fbffa Bluetooth: tests: Add privacy configuration for test basic_conn_encrypt
Add privacy configuration when using the split controller for the test
basic_conn_encrypt. The handling with or without controller based
privacy affects the RPA handling in the host due to different
connection complete events being used. This affects the overall pairing
procedure as the addresses are inputs to the pairing functions.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-02-05 14:33:21 +02:00
Ulf Magnusson 9446554969 bt_sim: basic_conn_encrypted_split.sh: Use lowercase for internal vars
This makes it possible to tell at a glance which variables are internal
to the script and which ones are parameters to it, which is very
helpful.

This convention is pretty common. See e.g. Google's shell style guide at
https://google.github.io/styleguide/shell.xml#Naming_Conventions, and
https://github.com/icy/bash-coding-style#naming-and-styles. It's older
than those though.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-12-10 14:34:46 -08:00
Ulf Magnusson d779de1f54 bt_sim: basic_conn_encrypted.sh: Use lowercase for internal vars
This makes it possible to tell at a glance which variables are internal
to the script and which ones are parameters to it, which is very
helpful.

This convention is pretty common. See e.g. Google's shell style guide at
https://google.github.io/styleguide/shell.xml#Naming_Conventions, and
https://github.com/icy/bash-coding-style#naming-and-styles. It's older
than those though.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-12-10 14:34:46 -08:00
Ulf Magnusson ed4f3cd354 bsim_bt: basic_conn_split.sh: Use lowercase for internal vars
This makes it possible to tell at a glance which variables are internal
to the script and which ones are parameters to it, which is very
helpful.

This convention is pretty common. See e.g. Google's shell style guide at
https://google.github.io/styleguide/shell.xml#Naming_Conventions, and
https://github.com/icy/bash-coding-style#naming-and-styles. It's older
than those though.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-12-10 14:34:46 -08:00
Ulf Magnusson c69a501df6 bsim_bt: basic_conn.sh: Use lowercase for internal vars
This makes it possible to tell at a glance which variables are internal
to the script and which ones are parameters to it, which is very
helpful.

This convention is pretty common. See e.g. Google's shell style guide at
https://google.github.io/styleguide/shell.xml#Naming_Conventions, and
https://github.com/icy/bash-coding-style#naming-and-styles. It's older
than those though.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-12-10 14:34:46 -08:00
Joakim Andersson f49bb10ca5 Bluetooth: Samples: Switch to synchronous bt_init before main loop
Switch to using the synchronous bt_init call before starting the main
loop in the peripheral samples. This is to avoid sending notifications
before bluetooth has been properly initialized.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-12-09 16:11:19 +01:00
Peter Bigot 6e5db350b2 coccinelle: standardize k_sleep calls with integer timeouts
Re-run with updated script to convert integer literal delay arguments to
k_sleep to use the standard timeout macros.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-09 08:38:10 -04: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
Joakim Andersson c1a754f665 Bluetooth: Host: Print error codes in hex
Error codes are listed in header files and in the core spec as hex
values. Always print them in hex in debug for easier error code
checking.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-08-05 12:18:17 +02:00
Vinayak Kariappa Chettimada f4eb03c538 Bluetooth: controller: Rename BT_LL_SW to BT_LL_SW_LEGACY
Rename the controller Kconfig option BT_LL_SW to
BT_LL_SW_LEGACY in preparation towards switch to new Link
Layer implementation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-07-22 14:23:42 +02:00
Joakim Andersson 029a66a195 Bluetooth: services: Move Heart rate service
This commit moves the BLE GATT heart rate service from
samples/bluetooth/gatt to subsys/bluetooth/services and adds a Kconfig
entry to enable and configure the service.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-07-11 13:21:14 +03:00
Emanuele Di Santo 30d65809fc Bluetooth: services: battery service enhancements
This commit moves the BLE GATT Battery service
from /samples/bluetooth/gatt to /subsys/bluetooth/services and
adds a Kconfig entry to enable and configure the service;
when enabled, it will register itself automatically.

Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-07-11 13:21:14 +03: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
Anas Nashif 5d001f3e41 cleanup: include/: move misc/byteorder.h to sys/byteorder.h
move misc/byteorder.h to sys/byteorder.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
Vinayak Kariappa Chettimada 40241d81be Bluetooth: controller: Enable additional ULL/LLL CI tests
Add/Enable additional conf files for ULL/LLL CI testing.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2019-05-06 14:41:58 +02:00
Anas Nashif 3ae52624ff license: cleanup: add SPDX Apache-2.0 license identifier
Update the files which contain no license information with the
'Apache-2.0' SPDX license identifier.  Many source files in the tree are
missing licensing information, which makes it harder for compliance
tools to determine the correct license.

By default all files without license information are under the default
license of Zephyr, which is Apache version 2.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-04-07 08:45:22 -04:00
Patrik Flykt 24d71431e9 all: Add 'U' suffix when using unsigned variables
Add a 'U' suffix to values when computing and comparing against
unsigned variables.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-28 17:15:58 -05:00
Wolfgang Puffitsch 3f4a64cd4e tests: bsim_bt: Extend connection test case.
Change connection parameters and channel map after connection is
established. Test encrypted connection also with split stack. Tighten
pass/fail criteria.

Signed-off-by: Wolfgang Puffitsch <wopu@oticon.com>
2019-02-15 14:12:27 -05:00
Wolfgang Puffitsch 4464029fb1 tests: bsim_bt: Make peripheral role part of test case.
Make peripheral role part of test case to build it with
split/non-split stack.

Signed-off-by: Wolfgang Puffitsch <wopu@oticon.com>
2019-02-15 14:12:27 -05:00
Wolfgang Puffitsch 5a49a0aa1f tests: bsim_bt: Replace ad_parse function with bt_data_parse.
Use shared function, aligning with code in central_hr sample.

Signed-off-by: Wolfgang Puffitsch <wopu@oticon.com>
2019-02-15 14:12:27 -05:00
Alberto Escolar Piedras 815f6fad75 tests: bsim_bt: Rename test script for consistency
Minor change:
Rename the file names of the test scripts for consistency with
other BLE code
The simulation identification string is also changed (although
there is no actual functional need)

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-01-30 13:24:30 -05:00
Alberto Escolar Piedras 8c8d099632 tests: bsim_bt: Add BLE connection test with split controller arch
To also cover the new split controller architecture (with a common ULL
and vendor dependent LLL).
Add a connection testcase (without encryption so far) for the nrf52_bsim
configured with the split controller architecture.
This is just the exact same as the Basic_con test but building the test
with CONFIG_BT_LL_SW_SPLIT=y.
Privacy and data lenght extensions are also so far disabled as the
new controller does not yet support them.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-01-30 13:24:30 -05:00
Alberto Escolar Piedras a40f07a3f3 tests: Prolong BT encrypted connection test
Prolong by 1 second the BT encrypted connection test, to ensure
there is enough time for the link itself to be encrypted.
Before this change the key was exchanged, but the 1st notification
(pass condition) was received before the link itself was encrypted.
With this change we wait for 1 notification more (1 second more),
and during that extra second the link is actually encrypted.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-01-18 18:28:32 -05:00
Anas Nashif 5060ca6a30 cmake: increase minimal required version to 3.13.1
Move to latest cmake version with many bug fixes and enhancements.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-01-03 11:51:29 -05:00
Alberto Escolar Piedras a822bc2241 tests: Add new bsim based encrypted BLE link test
Test which depends on the nrf52_bsim board.
It is based on the basic connection bsim test,
with the same pass/fail critaria.
The only difference being that the link will be encrypted
therefore exercising that part of the BLE stack.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-11-13 11:14:19 -05:00
Alberto Escolar Piedras d21a36d981 tests bsim_bt: Add script to execute the basic connection test
A script which will execute:
* the peripheral sample
* the bsim_test_app (the actual self-testing application)
* the BabbleSim phy

This script will return
* 0 if the test passes
* something else otherwise

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-11-13 11:14:19 -05:00
Alberto Escolar Piedras 3983ccf583 tests: Add new BabbleSim based BT test
Test which depends on the nrf52_bsim board.
It is based on the central_hr sample application.
The testcase is considered passed, if during the first 5 seconds
after boot, it manages to find and connect to a
peripheral and a notification is received from it.
Otherwise, the testcase fails.
Note that the executable return code will reflect the status of the
test:
0: Testcase passed
1: Testcase was stopped while in progress
2: Testcase failed
anything else: A failure not from the testcase itself

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-11-13 11:14:19 -05:00