Commit graph

396 commits

Author SHA1 Message Date
Emil Gydesen f79b39c104 Bluetooth: shell: Remove accidentally added debug config
Remove two debug config values from the BT shell that
was accidentally merged.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-08-26 13:42:22 -04:00
Emil Gydesen c47dae8c6d Bluetooth: ISO: Update connected ISO API
Update the connected ISO API to be more
similar to the broadcast ISO API as well
as the HCI spec.

This updated API allows for more flexibility
and will better support scenarios such as true
wireless setup, as ISO channels and connections
are more independent now.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-08-24 07:29:11 -04:00
Johann Fischer 72be0ed332 tests: bluetooth: shell: update shell over CDC ACM UART configuration
Add usb.overlay which contains chosen node and cdc-acm-uart node.
Update USB configuration and test case.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-23 18:53:47 -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
Johann Fischer 3240e0cc51 tests: remove USB configuration option
Remove USB configuration option, replace it where necessary
with USB_DEVICE_STACK.

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-03 19:00:12 -04:00
Kumar Gala 57690f566e tests: bluetooth: shell: Limit build only tests to native_posix
Some recent updates to the bluetooth shell test cause build failures
in CI for platforms that don't have a uart that supports interrupts
(ie ip_k66f or xmc45_relax_kit).

As these tests are build-only a single platform is sufficient to get
coverage and utilize platform_allow to limit to just one board target
intead of integration_platforms.  As this will limit to the single
platform for both PR based CI and nightly CI (integration_platforms
only is utilized for PR based CI, so we'd need other filtering for
the nightly CI and there isn't any value in building these tests
on more than the single platform so platform_allow makes the most
sense).

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-07-23 11:29:30 -05:00
Kumar Gala d00b37c8dd tests: bluetooth: shell: Filter tests on dts "storage_partition"
Some of the shell tests need a devicetree "fixed-partition" and
"storage_partition" for the settings partition support.  Not all
boards support this, so filter the tests on the devicetree having
this.

Fixes #37115

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-07-21 13:11:03 -05:00
Emil Gydesen 1c04a7505e Bluetooth: shell: Add bluetooth tag to shell tests
Add missing bluetooth tag for recently added tests in
the testcase.yaml file.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-20 18:04:03 -04:00
Emil Gydesen 57b5c32e82 Bluetooth: shell: Add bt audio compile tests for the bt shell
Add a couple of compile tests for the bt shell for
BT audio, including checking that the services can be
compiled individually without error.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-07-19 20:08:30 -04:00
Emil Gydesen 2c67bafb7b Bluetooth: Audio: Microphone Input Control Service and Client
This commit implements the microphone input  control service
(MICS) and client, The implementation supports and uses the
Audio Input Control Service (AICS) secondary service.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-06-07 12:04:28 +02:00
Casper Bonde afe469eac7 Bluetooth: ISO: Speed up BT ISO data processing
For the native posix build the sleep calls used in tasks will stall
the zephyr instance which sets an upper limit on the data processing
interval to once every 20-30 millisecond.
This change reduces the duration of the sleep calls and increases the
TICKS_PER_SECOND to allow for shorter sleeps. This is needed to
support the data rates needed for LE Audio streaming. The rate is
tuned to support up to bidirectional 5ms ISO-intervals.
This change also increases the ISO buffer count from 1 to 5 to
allow for some buffering in the controller, which is needed for
gapless playback and/or use of burst number larger than 1.

Signed-off-by: Casper Bonde <casper_bonde@bose.com>
2021-05-27 13:16:40 +02:00
Emil Gydesen 82a32f5ca5 Bluetooth: Audio: Volume Control Service and client
This commit implements the volume control service (VCS) and
client, The implementation supports and uses the
Audio Input Control Service (AICS) and
Volume Offset Control Service (VOCS) secondary services.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-05-07 15:02:41 +02:00
Joakim Andersson 6483e12a8a Bluetooth: Refactor bluetooth buffer configuration for simplification
Refactor and simplify the bluetooth buffer configurations to improve the
easy of configurations and eliminate invalid ones.
By moving configurations out of host and controller specific
configurations and into a common one it becomes easier to configure
the host and controller separately as the same configurations can be
used as would be for a combined build.

All HCI configurations are now given exluding the matching HCI header,
which eases the configuration as the application don't have to know the
different header sizes.
The BT_RX_BUF_LEN is split into ACL and Event, as well as the suprising
use of Command size.
BT_L2CAP_RX_MTU is removed as the stack does not support reassembling of
HCI ACL data to larger L2CAP PDUs. The application will have to set
ACL RX size and account for the L2CAP PDU header itself.
BT_EATT_RX_MTU was removed as it is only used for setting a different
default value for another option which leads to the stuck kconfig symbol
problem.

The configurations can be updated according to the table below:

** New configuration         | ** Old configuration
All configurations
BT_BUF_ACL_RX_SIZE           | BT_L2CAP_RX_MTU + 4
BT_BUF_ACL_RX_SIZE           | BT_RX_BUF_LEN - 4
BT_BUF_EVT_RX_SIZE           | BT_RX_BUF_LEN - 2
BT_BUF_CMD_TX_SIZE           | BT_RX_BUF_LEN - 3
BT_BUF_CMD_TX_COUNT          | BT_HCI_CMD_COUNT
BT_BUF_EVT_RX_COUNT          | BT_RX_BUF_COUNT
BT_BUF_ACL_RX_COUNT          | BT_RX_BUF_COUNT
BT_BUF_ACL_RX_COUNT          | BT_ACL_RX_COUNT
BT_BUF_EVT_DISCARDABLE_SIZE  | BT_DISCARDABLE_BUF_SIZE - 2
BT_BUF_EVT_DISCARDABLE_COUNT | BT_DISCARDABLE_BUF_COUNT
Controller-build
BT_BUF_ACL_TX_SIZE           | BT_CTLR_TX_BUFFERS_SIZE
BT_BUF_ACL_TX_COUNT          | BT_CTLR_TX_BUFFER
HCI-bridge
BT_BUF_ACL_TX_SIZE           | BT_HCI_ACL_DATA_SIZE
BT_BUF_ACL_TX_COUNT          | 6

Fixed invalid configurations setting either BT_L2CAP_RX_MTU or
BT_CTLR_DATA_LENGTH_MAX larger than BT_RX_BUF_LEN could lead to buffer
overruns.

Fix advertising report max data length calculation.
This always used the BT_DISCARDABLE_BUF_SIZE macro but this feature
can be turned off and advertising reports will be allocated from the RX
buffer in that case. Also controller-build does not have this buffer
(in hci_raw.c). Also the wrong HCI header was used in the calculation,
HCI event header should have been used instead of HCI ACL header.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-05-06 14:56:18 +02:00
Emil Gydesen 2016509756 Bluetooth: Audio: Audio Input Control Service and client
This commit implements the secondary service
Audio Input Control Service (AICS) server and client.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-04-12 11:47:00 -04:00
Emil Gydesen ed2162c700 Bluetooth: Audio: Volume Offset Control Service and Client
This commit implements the secondary service
Volume Offset Control Service (VOCS) server and client.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-03-22 13:05:56 -04:00
Emil Gydesen a264efbcbc Bluetooth: host: Initial support for BIS
Added initial support for BIS (broadcast ISO stream), which
adds support for creating BISes as both broadcaster and receiver,
as well as managing and creating BIGs.

Extends PA sync to handle BIGInfo adveritising reports.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-03-09 08:06:02 -05:00
Joakim Andersson f8956cfbc7 Bluetooth: L2CAP: Enable L2CAP dynamic channels without Enhanced CBFC
Allow application to enable L2CAP dynamic channels without support
for Enhanced Credit Based Flow Control (CBFC).

Since these are separate features in the qualification it should
be possible to qualify L2CAP connection oriented channels without
also having to qualify L2CAP enhanced credit based flow control.

The L2CAP/LE/REJ/BI-02-C conformance test will fail when enhanced CBFC
has not been selected in the ICS.

The lower tester expects that since the Enhanced CBFC is not supported,
the command L2CAP_CREDIT_BASED_CONNECTION_REQ should be met with an
L2CAP_COMMAND_REJECT_RSP and not an L2CAP_CREDIT_BASED_CONNECTION_RSP.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-11-09 11:25:10 +01:00
Emil Obalski 3527b7dca1 tests: shell: Correct overlay extension
When added bluetooth over USB shell overlay, the
file was by mistake added with wrong extension.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
2020-09-22 16:04:56 -05:00
Peter Bigot a28f570855 tests: bluetooth: shell: add usb shell test configuration
Verify builds and execution when a CDC-ACM UART is used for the shell.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-09-16 13:32:22 -05:00
Luiz Augusto von Dentz 67041a85d2 Bluetooth: shell: Add CONFIG_BT_AUDIO
This enables use of iso module with shell application.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-09-04 21:03:13 +02:00
Emil Gydesen 8d7b5ebd7a Bluetooth: Remove _gatt_ infix for Heart Rate Service (HRS)
The _gatt_ infix was determined to be unnecessary as
GATT is implied by it being a Bluetooth service.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2020-09-04 15:38:44 +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
Joakim Andersson 5880f3d74f Bluetooth: UUID: Use BT_UUID_16_ENCODE to set UUIDs in adv data
Use BT_UUID_16_ENCODE to set UUIDs in advertising data.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-08-25 16:09:22 +03:00
Emil Gydesen aea6afe3fa Bluetooth: host: Perodic advertisement synchronization
Added support for syncing to periodic advetisements.
The API and usage is heavily inspired by the extended advertisement
and connection APIs.

Signed-off-by: Emil Gydesen <emil_gydesen@bose.com>
2020-08-11 14:17:19 +02:00
Emil Gydesen 8cf01ab590 Bluetooth: host: Add periodic advertising API
Added API to set periodic adv parameters, periodic adv data
and to enable/disable periodic advertisement.

Signed-off-by: Emil Gydesen <emil_gydesen@bose.com>
2020-08-11 14:17:19 +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
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
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
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
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
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
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
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
Luiz Augusto von Dentz 6a66879050 Bluetooth: shell: Advertise when registering HRS service
This makes simulate command advertise with proper UUID so the likes of
central_hr can connect to it when simulating:

hrs simulate on
Registering HRS Service
Connected: 00:aa:01:01:00:24 (public)
Start HRS simulation

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-02-06 08:43:09 +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
Johan Hedberg 4e135d76a3 Bluetooth: shell: Add printing of remote version information
Add printing of the remote version information whenever the new
CONFIG_BT_REMOTE_VERSION option is enabled.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-12-23 14:47:31 +02:00
Anas Nashif 70758c4374 tests: fix test identifiers
The seasonal overhaul of test identifiers aligning the terms being used
and creating a structure. This is hopefully the last time we do this,
plan is to document the identifiers and enforce syntax.

The end-goal is to be able to generate a testsuite description from the
existing tests and sync it frequently with the testsuite in Testrail.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-12-09 15:53:44 -05:00
Kamil Piszczek 92d9e30527 tests: migrating to NVS backend with settings
Bluetooth tests now use the NVS backend for Settings.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-10-11 14:55:24 +02:00
Carles Cufi f8da57a93e tests: bluetooth: shell: Revert back to default logging settings
Disable the CONFIG_TEST_LOGGING_DEFAULTS Kconfig option which forces
immedate logging, since that is not compatible with Bluetooth and its
tests.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2019-10-01 19:11:16 +02:00
Joakim Andersson 513244afe2 Bluetooth: Shell: Add whitelist commands to shell
Add shell commands to add and remove devices from the shell.
Add commands and options to use whitelist for advertising, scanning,
and creating connections.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2019-08-09 16:26:10 +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
Nicolas Pitre 6609c12516 tests: enable native_posix_64 testing
Whenever conditions are applied to native_posix, they should apply to
native_posix_64 too.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-16 10:41:11 -07:00
Anas Nashif ba31f4fc35 tests: bluetooth: shell: remove whitelisting on arduino_101
Not a primary bluetooth testing platform.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-07-12 05:54:16 -07: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
Johan Hedberg 0d9dab300e Bluetooth: Introduce separate pool for discardable events
Introduce a separate buffer pool for events which the HCI driver
considers discardable. Examples of such events could be e.g.
Advertising Reports. The benefit of having such a pool means that the
if there is a heavy inflow of such events it will not cause the
allocation for other critical events to block and may even eliminate
deadlocks in some cases.

Also update all mesh samples not to specify explicit RX buffer counts
anymore. Instead, create appropriate defaults in Kconfig so that we
only need to override this in the app for cases like the bbc:microbit
with limited memory.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2019-07-01 16:36:15 +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
Luiz Augusto von Dentz bd007141fd Bluetooth: GATT: Rename BT_GATT_DB to BT_GATT_DYNAMIC_DB
This should be clearer about the intent of the option.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-05-02 08:29:23 +03:00
Luiz Augusto von Dentz 2c4e5d5f16 Bluetooth: GATT: Disable dynamic database by default
This makes BT_GATT_DB default to n which reduces the ram required for
many samples.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-05-02 08:29:23 +03: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
Andrew Boie 7b1ee5cf13 tests: CONFIG_TEST_USERSPACE now off by default
Unlike CONFIG_HW_STACK_PROTECTION, which greatly helps
expose stack overflows in test code, activating
userspace without putting threads in user mode is of
very limited value.

Now CONFIG_TEST_USERSPACE is off by default. Any test
which puts threads in user mode will need to set
CONFIG_TEST_USERSPACE.

This should greatly increase sanitycheck build times
as there is non-trivial build time overhead to
enabling this feature. This also allows some tests
which failed the build on RAM-constrained platforms
to compile properly.

tests/drivers/build_all is a special case; it doesn't
put threads in user mode, but we want to ensure all
the syscall handlers compile properly.

Fixes: #15103 (and probably others)

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-06 14:30:42 -04:00
Cinly Ooi 8cce685bbc tests: bluetooth: Improve test case names
Improvement in test case name is needed to make it easier
to navigate from test case name to the actual test
folder.

This is useful as some tools that consume tests directory
will only output test case name without directory names

Signed-off-by: Cinly Ooi <cinly.ooi@intel.com>
2019-04-05 08:25:33 -04:00
Krzysztof Chruscinski 3605e48c44 shell: Modify subcommands to use SHELL_STATIC_SUBCMD_SET_CREATE
It is planned to deprecate SHELL_CREATE_STATIC_SUBCMD_SET macro
which is replaced by SHELL_STATIC_SUBCMD_SET_CREATE.

Additionally, removed irrelevant comments about alphabetical
ordering which is no longer needed.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-02-20 07:31:35 -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
Jakub Rzeszutko b928b71756 shell: rename shell_help_print function
Function printing help has been renamed to shell_help.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-12-05 15:15:44 +01:00
Jakub Rzeszutko 3064ca4f2f shell: creating new module for help functionality
1. Created new shell module: shell_help.
2. Simplified command handlers with new shell print macros.
3. Removed help functions from command handlers.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-12-05 15:15:44 +01:00
Jakub Rzeszutko 5451ff2848 shell: remove "options" concept
Removing help "options" from shell API.

Currently SHELL_OPT macro is not used by users. What is more
commit: a89690d10f ignores possible options created in
command handler by the user. As a result they are not printed
in help message.

Second, currntly implemented "options" in command handlers options are
implemented without SHELL_OPT macro.

And last but not least this change will allow to implement
help handler in a way that user will not need to think about calling
functions printing help in a command handler.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-12-05 15:15:44 +01:00
Jakub Rzeszutko b7a5874830 tests: shell: migrate tests to the new shell
Testing:
1. Shell built-in commands.
2. Wildcards module.
3. Static commands creation and execution.
4. Dynamic commands creation and execution.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-11-22 11:32:29 +01:00
Luiz Augusto von Dentz b7c6ea4971 Bluetooth: shell: Remove macros to print messages
Make use of shell_print and shell_error now that they are available.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2018-11-13 20:42:01 +02:00
Reto Schneider 7eabab2f5d samples, tests: Use semi-accurate project names
When using an IDE (e.g. Eclipse, Qt Creator), the project name gets
displayed. This greatly simplifies the navigation between projects when
having many of them open at the same time. Naming every project "NONE"
defeats this functionality.

This patch tries to use sensible project names while not duplicating
too much of what is already represented in the path. This is done by
using the name of the directory the relevant CMakeLists.txt file is
stored in. To ensure unique project names in the samples (and again, in
the tests folder) folder, small manual adjustments have been done.

Signed-off-by: Reto Schneider <code@reto-schneider.ch>
2018-10-27 21:31:25 -04:00
Johan Hedberg 343c53e841 Bluetooth: Switch from SYS_LOG to logger-based logging
Initial conversion to use syslog instead of logger.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-10-19 14:50:22 +02:00
Jakub Rzeszutko 147122e77f shell: examples unification
Updating examples according to new return value of function
shell_cmd_precheck.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-10-19 13:35:56 +02:00
Jakub Rzeszutko f6197c4f3c shell: create instances automatically basing on enabled backend
If user will enable shell than for each backend shell instance
will be created automatically.

Update all shell examples according to the new initialization
procedure.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-10-11 12:08:04 +02:00
Jakub Rzeszutko b0571746e2 shell: parsing output LF character
Some terminals literally interprets shell output data. Hence to print
a message in new line shell needs to send `\r\n` each time. To minimize
flash usage user can now send `\n` as a line delimiter and shell will
automatically add missing CR character.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-10-10 10:45:28 +02:00
Carles Cufi 94f8e75b24 tests: Bluetooth: shell: Whitelist nrf52840_pca10056
In order to fully cover the platform that supports most of the optional
features in the specification, whitelist the nRF52840 DK.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-10-03 11:03:21 -05:00
Luiz Augusto von Dentz 76714c1480 Bluetooth: Shell: Make error message for unknown parameter consistent
Also simplify it by having the 'unknown parameter:' as part of the
message format.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2018-10-03 09:49:58 +02:00
Luiz Augusto von Dentz 4058f724bc Bluetooth: samples: shell: Don't use printk
Make use of shell_fprintf whenever possible.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2018-10-03 09:49:58 +02:00
Jakub Rzeszutko c471614cb6 subsys: shell: fix accept either CR or LF as as line delimiter
1. Shell will accept CR or LF as line delimiter.
2. Macro SHELL_DEFINE simplified - it no longer requires
   new line character.
3. Fixes: #10207.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-10-02 11:55:47 -07:00
Jakub Rzeszutko 0eea1ef212 subsys: shell: add int ret_val to command handlers
1. Command handler can return command exectution status as int.
2. Existing command handlers rework.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
2018-10-02 14:44:25 +02:00
Luiz Augusto von Dentz 592dd2e964 Bluetooth: shell: Port commands to the news shell
Fixes #8873

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2018-10-01 11:10:46 +02:00
Krzysztof Chruscinski 527256501f shell: Rename shell to legacy_shell
New shell implementation is on the way. For now old one and all
references are kept to be gradually replaced by new shell.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-09-19 09:30:29 -04:00
Sebastian Bøe 55ee53ce91 cmake: Prepend 'cmake_minimum_required()' into 'app' build scripts
Prepend the text 'cmake_minimum_required(VERSION 3.8.2)' into the
application and test build scripts.

Modern versions of CMake will spam users with a deprecation warning
when the toplevel CMakeLists.txt does not specify a CMake
version. This is documented in bug #8355.

To resolve this we include a cmake_minimum_required() line into the
toplevel build scripts. Additionally, cmake_minimum_required is
invoked from within boilerplate.cmake. The highest version will be
enforced.

This patch allows us to afterwards change CMake policy CMP000 from OLD
to NEW which in turn finally rids us of the verbose warning.

The extra boilerplate is considered more acceptable than the verbosity
of the CMP0000 policy.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-08-15 04:06:50 -07:00
Johan Hedberg 7ec40e81d0 Bluetooth: shell: Add multiple identity support
Add shell support for creating and showing identities.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-08-13 19:53:22 +03:00
Szymon Janc 504584a998 Bluetooth: att: Add option to disable GATT writable name
This allow to set name at runtime while leaving GAP name characteristic
read only.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2018-08-03 10:41:01 +02:00
Johan Hedberg b049ac1216 Bluetooth: shell: Add command for setting fixed passkey
Add a shell command to utilize the newly added bt_passkey_set() API.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-08-01 16:13:21 +03:00
Johan Hedberg d26e482dab Bluetooth: Mesh: Use more reasonable advertising buffer counts
The number of buffres influences e.g. the maximum SDU size, which in
turn influences call stack consumption. Use lower values where a high
number of buffers isn't necessary, and use the default (6) where it's
sufficient.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-07-25 18:16:45 +03:00
Luiz Augusto von Dentz e9e5115116 Bluetooth: shell: Add name command
name command can be used to read or write the GAP Device Name which is
used by the advertise command.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2018-07-23 14:45:58 +03:00
Vinayak Kariappa Chettimada fdedc49a61 Bluetooth: tests: exclude btshell/mesh_shell on NRF52810_PCA10040
Exclude building the btshell and mesh_shell application for
NRF52810_PCA10040 boards due to limited RAM and Flash
availability on the nRF52810 SoC.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-06-27 16:09:58 +02:00
Johan Hedberg 8d1f67c605 Bluetooth: Remove references to non-existing Kconfig symbols
Remove non-existent Kconfig symbol references. An additional (but
related) change is the removal of all persistent storage symbols from
the Arduino 101 Bluetooth shell app, since BT_STORAGE no longer
exists.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-05-23 16:57:59 -04:00
Johan Hedberg a29554360a Bluetooth: shell: Add settings support
Enable settings and increase the system workqueue size to deal with
the stack usage. This also makes it possible to test unpairing support
with the shell's 'clear' command.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-05-04 17:26:05 -04:00
Paul Sokolovsky 6b7435b85d tests: bluetooth: shell: Set min_flash to 145K
With recent master, this sample started to overflow ROM area of
arduino_101, which has 144K of it:

Memory region         Used Size  Region Size  %age Used
             ROM:      149420 B       144 KB    101.33%
             RAM:       26228 B        52 KB     49.26%
        IDT_LIST:         564 B         2 KB     27.54%
        MMU_LIST:          0 GB         1 KB      0.00%

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-03-16 13:44:06 -07:00
Alberto Escolar Piedras 6ef85ed6fc test: shell: native_posix also supports shell
The native_posix port also supports shell apps thru its
stdin redirection.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-02-02 07:48:46 -08:00
Vinayak Kariappa Chettimada 5f4a7ea119 Bluetooth: shell: Support a non-connectable build
Add conditional compilation and move code to support
building a non-connectable Bluetooth shell application.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-01-25 10:51:54 +02:00
Anas Nashif 829598be2b tests: add CONFIG_TEST for marking tests
Mark tests with CONFIG_TEST to allow for test specific setup and
configuration.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-01-08 10:03:57 -05:00
Anas Nashif d4784555d0 tests: remove build_only option
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-28 20:24:29 -05:00
Anas Nashif 23f81eeb42 tests/samples: fixed yaml syntax
Use a map directory, avoid the list which makes parsing a bit
cumbersome.

Fixes #5109

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-11 14:47:08 -05:00
Johan Hedberg 9a5fd64a31 Bluetooth: tests/shell: Move mesh into its own configuration
Trying to always include mesh support resulted in the app not fitting
on some boards (e.g. nrf51_pca10028). Put the mesh-specific
configuration in a separate configuration file instead.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-20 15:00:29 +02:00
Johan Hedberg a18a22524f Bluetooth: Mesh: shell: Add mod-pub command
Add a command for getting and setting the model publication. We also
have to adjust the app's configuration, since both the Model
Publication Set and Status messages are segmented messages, meaning we
need two TX and RX segment contexts.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-16 15:35:10 +02:00
Johan Hedberg 2a1e16c2a3 Bluetooth: Mesh: Add skeleton for Configuration Client Model
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-14 16:48:49 +02:00
Johan Hedberg e2e74f705b Bluetooth: Mesh: shell: Add basic skeleton
Add a basic shell skeleton for Mesh, containing basic command for
initialization, provisioning and reset.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-14 11:03:58 +02:00
Johan Hedberg af512e5498 Bluetooth: tests/shell: Rename Arduino 101 conf file for cmake
The conf file name must be of the form prj_<board>.conf for it to be
automatically chosen for a given board.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-13 15:10:20 +02:00
Johan Hedberg a30d876a6c Bluetooth: tests: Remove explicit setting of QEMU_EXTRA_FLAGS
The needed options to QEMU_EXTRA_FLAGS now get set from a single
central place, so applications don't need to do it anymore.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-11-12 15:05:49 +02:00
Sebastian Bøe 0829ddfe9a kbuild: Removed KBuild
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Sebastian Bøe 12f8f76165 Introduce cmake-based rewrite of KBuild
Introducing CMake is an important step in a larger effort to make
Zephyr easy to use for application developers working on different
platforms with different development environment needs.

Simplified, this change retains Kconfig as-is, and replaces all
Makefiles with CMakeLists.txt. The DSL-like Make language that KBuild
offers is replaced by a set of CMake extentions. These extentions have
either provided simple one-to-one translations of KBuild features or
introduced new concepts that replace KBuild concepts.

This is a breaking change for existing test infrastructure and build
scripts that are maintained out-of-tree. But for FW itself, no porting
should be necessary.

For users that just want to continue their work with minimal
disruption the following should suffice:

Install CMake 3.8.2+

Port any out-of-tree Makefiles to CMake.

Learn the absolute minimum about the new command line interface:

$ cd samples/hello_world
$ mkdir build && cd build
$ cmake -DBOARD=nrf52_pca10040 ..

$ cd build
$ make

PR: zephyrproject-rtos#4692
docs: http://docs.zephyrproject.org/getting_started/getting_started.html

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Anas Nashif 0356590df5 tests: samples: fix yaml syntax
Fix indentation and syntax and make it pass yamllint tool.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-15 08:15:00 -04:00
Anas Nashif c6a8014e1c subsys: fs: consolidate elm FAT kconfig options
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-03 08:43:50 -04:00
Luiz Augusto von Dentz 26cd8cefd1 Bluetooth: shell: Enable CONFIG_BT_SHELL for arduino_101
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-08-25 15:32:38 -04:00
Johan Hedberg 2975ca0754 Bluetooth: Kconfig: Rename CONFIG_BLUETOOTH_* to CONFIG_BT_*
The API name space for Bluetooth is bt_* and BT_* so it makes sense to
align the Kconfig name space with this. The additional benefit is that
this also makes the names shorter. It is also in line with what Linux
uses for Bluetooth Kconfig entries.

Some Bluetooth-related Networking Kconfig defines are renamed as well
in order to be consistent, such as NET_L2_BLUETOOTH.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-08-09 11:14:19 +03:00
Inaky Perez-Gonzalez 3d498dd10c build: workaround build bug in tests
When an app uses a construct such as:

obj-y = main.o ../../../../samples/bluetooth/gatt/hrs.o

in its makefile, it causes said object module to be built in the
source tree, not in the object tree.

When building massively parallel, this usually resuls on the files
getting corrupted, leading to bugs such as:

https://jira.zephyrproject.org/browse/ZEP-2316
https://jira.zephyrproject.org/browse/ZEP-2317

src/../../../../samples/bluetooth/gatt/.gap.o.cmd:3: warning: NUL character seen; rest of line ignored
src/../../../../samples/bluetooth/gatt/.gap.o.cmd:4: warning: NUL character seen; rest of line ignored
src/../../../../samples/bluetooth/gatt/.gap.o.cmd:5: *** missing separator.  Stop.

as multiple build are trying to touch the same file in the source tree
and of course, race and causes a build bug.

We have known about this issue for a long time, but it requires
modifications in the build system that there is no time to tackle.

A suggested workaround is to include the source files into a local .c
file, so this is what this patch does, to remove the random noise.

Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2017-07-27 14:09:40 -04:00
Johan Hedberg 7a79101fd5 Bluetooth: tests: Remove unused prj_nimble.conf files
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-07-03 08:22:58 -04:00
Anas Nashif d1e562c924 tests: replace filters in testcase files
Where possible, replace the use of filter with newly added keywords.
This will speed things up and in some cases add more coverage due to bad
filters.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-28 09:51:40 -05:00
Anas Nashif 6ff291a174 tests: do not exclude quark_d2000_crb
quark_d2000_crb does not build net/bluetooth tests by default now.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-27 17:44:23 -04:00
Anas Nashif 470c5f3189 tests: remove testcase.ini files
We now use yaml files.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-21 20:56:53 -04:00
Anas Nashif cc24f4b03c tests: samples: convert testcase files to yaml
This will prepare test cases and samples with metadata and information
that will be consumed by the sanitycheck script which will be changed to
parse YAML files instead of ini.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-21 20:56:53 -04:00
Luiz Augusto von Dentz d837a6ec4b Bluetooth: GATT: Add GAP service by default
GAP is mandatory service and now that the db can only be build
dynamically there is no reason to keep the applications registering it.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-06-15 21:53:00 +03:00
Luiz Augusto von Dentz e1a062e28b Bluetooth: shell: Use CONFIG_BLUETOOTH_SHELL
Remove existing commands supported by CONFIG_BLUETOOTH_SHELL and make
sure all .conf select it.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-05-29 10:42:21 +03:00
Johan Hedberg 9516d63836 Bluetooth: Remove support for NBLE
NBLE has been deprecated for a few releases now and can be removed.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-05-25 09:03:16 -07:00
Vinayak Kariappa Chettimada a7afc75c8a Bluetooth: shell: Add GATT write cmd throughput measurement
Add shell command to test GATT write cmd throughput between
two test shell peers.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-05-16 15:30:51 +03:00
Luiz Augusto von Dentz 4f019eab26 Bluetooth: shell: Remove forward declaration
It is possible to remove the forward declaration of l2cap_alloc_buf as
the recv pointer can be compared directly with chan pointer avoiding
using l2cap_ops directly.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-05-14 17:54:46 +03:00
Vinayak Kariappa Chettimada 9fd04ea272 Bluetooth: shell: Add L2CAP throughput measurement
Added l2cap-metrics command to shell application which will
collect the rx-ed L2CAP CoC throughput.

Usage (local shell):
> l2cap-register <chan>
> l2cap-metrics on

  From peer shell:
  > l2cap-connect <chan>
  > l2cap-send 10

> l2cap-metrics
l2cap rate: 119225 bps.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-05-14 11:19:27 +03:00
Luiz Augusto von Dentz ad4bb37b17 Bluetooth: shell: Fix deadlock when receiving L2CAP packet
The TX and RX pool needs to be split otherwise the TX code path may
consume all buffers causing the RX thread to deadlock which will
possible deadlock the TX thread as well in case it needs more credits.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-05-04 08:36:12 +03:00
Luiz Augusto von Dentz a03e068b03 Bluetooth: shell: Don't attempt to reuse channel
If the channel is already in use don't attempt to connect it a second
time.

Change-Id: I87bdaeadbe866b59c1a7975002699d9ef7a90c61
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-04-29 11:39:13 -04:00
Kumar Gala eaaa175b92 tests: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.

Jira: ZEP-2051

Change-Id: I6c676bc6c5e850a8725785554cd535e32067f33e
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 09:53:49 -05:00
Kumar Gala 789081673f Introduce new sized integer typedefs
This is a start to move away from the C99 {u}int{8,16,32,64}_t types to
Zephyr defined u{8,16,32,64}_t and s{8,16,32,64}_t.  This allows Zephyr
to define the sized types in a consistent manor across all the
architectures we support and not conflict with what various compilers
and libc might do with regards to the C99 types.

We introduce <zephyr/types.h> as part of this and have it include
<stdint.h> for now until we transition all the code away from the C99
types.

We go with u{8,16,32,64}_t and s{8,16,32,64}_t as there are some
existing variables defined u8 & u16 as well as to be consistent with
Zephyr naming conventions.

Jira: ZEP-2051

Change-Id: I451fed0623b029d65866622e478225dfab2c0ca8
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-20 16:07:08 +00:00
Johan Hedberg ba7b6b1ced Bluetooth: tests/shell: Limit BR/EDR configuration to Qemu for now
The BR/EDR configuration doesn't fit e.g. the Arduino 101 anymore.
Limit it to Qemu for the time being, which is anyway the primary
target where the functionality is being tested.

Change-Id: I9a34c82157d56079e43acabe29eeadd6d99e03fe
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-04-09 19:05:34 +03:00
Carles Cufi 27e83660ff Bluetooth: controller: Implement scan duplicate filter
Implement the controller's ability to drop duplicate advertising reports
when instructed by the Host.

Jira: ZEP-1246

Change-Id: I2d1b7abf1ed950dde705e5df30a858c595f3834c
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-04-08 20:11:54 +03:00
Vinayak Chettimada 2037ec803d Bluetooth: shell: Add connection update command
Added conn-update command to btshell module to test
bt_conn_le_param_update Bluetooth API.

Change-id: I205df9ffc12a0ab062de5a779ab96bc91cbd9259
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-03-21 17:05:43 -07:00
Vinayak Chettimada 30a46529b2 Bluetooth: shell: Reorder commands in logical order of use
Reordered the commands in btshell to represent the logical
order of use. Moved advertise and scan before connect
command.

Change-id: Id64509e39848109a6df7ddb1306b6bd221b65c40
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-03-21 17:05:42 -07:00
Johan Hedberg e085ff49b9 Bluetooth: shell: Add command to start continuous passive scanning
Change-Id: I0d9c2f47014464a27ff24ac79a16ee956bbcf62c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-03-21 17:05:42 -07:00
Johan Hedberg 1ce1c3484e Bluetooth: shell: Fix missing initialization of param.own_addr
Add proper logging for errors in the same go.

Change-Id: I8bd4fa8d5b143e51024496bfba0056525ad35964
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-03-21 17:05:42 -07:00
Kaustav Dey Biswas c25df73c5a Bluetooth: SDP: Server: Refactor data element structure header
Separate out data element structure header into type and size fields

Change-Id: I869ee1ea82db1f6d669bb905055135b7d63f3fa2
Signed-off-by: Kaustav Dey Biswas <kaustav.d.biswas@intel.com>
2017-03-07 12:21:29 +01:00
Szymon Janc dc2ce98088 Bluetooth: shell: Fix GATT long write support
Parameters and data must be permament for time of the operation.

Change-Id: Idd4eee948e62c2c80648116a339558042059f801
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2017-03-07 12:21:29 +01:00
Szymon Janc 10ce50dc30 Bluetooth: shell: Simplify indication in gatt-subscribe
Instead of passing exact value allow to use 'ind' for enabling
indications instead of notifications.

Change-Id: I24306a321ed90b4bcb6300846218ff7214b39bc4
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2017-03-07 12:21:29 +01:00
Szymon Janc 667e3af3dd Bluetooth: shell: Don't echo LE CoC data
Don't echo data from received callback as this can cause
deadlock. Just dump incoming data instead.

Change-Id: Iedbbafd0406ad46ba2c9d26fd8a70fff59de8143
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2017-03-07 12:21:29 +01:00
Szymon Janc 691397023b Bluetooth: shell: Fix typo
Change-Id: I2c1a6e7cb61f65ce2292f128e73dc2d80372f773
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2017-03-07 12:21:29 +01:00
Szymon Janc af7d0c64a8 Bluetooth: shell: Fix accessing invalid memory
argc needs to be check before accessing argv.

Change-Id: I9cb70906a388b96df4e192dd4f31eafdab25127f
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2017-03-07 12:21:29 +01:00
Arkadiusz Lichwa 9fff70dbe5 Bluetooth: shell: Add support to retrieve A2SRC record
Adds to BT shell app functionality to trigger to be found on remote
A2SRC UUID. Implements user callback to read resolved response data
and uses existing SDP client API to read attributes values.

> HCI Event: Number of Completed Packets (0x13) plen 5
        Num handles: 1
        Handle: 77
        Count: 1
> ACL Data RX: Handle 77 flags 0x02 dlen 48
      Channel: 64 len 44 [PSM 1 mode 0] {chan 0}
      SDP: Service Search Attribute Response (0x07) tid 2 len 39
        Attribute bytes: 36
        Continuation state: 0
        Combined attribute bytes: 89
          Attribute list: [len 84] {position 0}
            Attribute: Service Record Handle (0x0000) [len 2]
              0x00010005
            Attribute: Service Class ID List (0x0001) [len 2]
              UUID (3) with 2 bytes [0 extra bits] len 3
                Audio Source (0x110a)
            Attribute: Protocol Descriptor List (0x0004) [len 2]
              Sequence (6) with 6 bytes [8 extra bits] len 8
                UUID (3) with 2 bytes [0 extra bits] len 3
                  L2CAP (0x0100)
                Unsigned Integer (1) with 2 bytes [0 extra bits] len 3
                  0x0019
              Sequence (6) with 6 bytes [8 extra bits] len 8
                UUID (3) with 2 bytes [0 extra bits] len 3
                  AVDTP (0x0019)
                Unsigned Integer (1) with 2 bytes [0 extra bits] len 3
                  0x0102
            Attribute: Browse Group List (0x0005) [len 2]
              UUID (3) with 2 bytes [0 extra bits] len 3
                Public Browse Root (0x1002)
            Attribute: Bluetooth Profile Descriptor List (0x0009) [len 2]
              Sequence (6) with 6 bytes [8 extra bits] len 8
                UUID (3) with 2 bytes [0 extra bits] len 3
                  Advanced Audio Distribution (0x110d)
                Unsigned Integer (1) with 2 bytes [0 extra bits] len 3
                  0x0102
            Attribute: Unknown (0x0100) [len 2]
              Advanced Audio [len 15]
            Attribute: Unknown (0x0311) [len 2]
              0x0001
< ACL Data TX: Handle 77 flags 0x00 dlen 12
      L2CAP: Disconnection Request (0x06) ident 10 len 4
        Destination CID: 65

Change-Id: I8938d9eebda31f3d252ff49adc1a96abfcbc5751
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2017-02-05 22:39:25 +02:00
Arkadiusz Lichwa 658ea8cc4b Bluetooth: shell: Use SupportedFeature attribute API
BT shell app tries to retrieve supported features exposed by remote
HFPAG enabled SDP record.

Jira: ZEP-1112

Change-Id: Ic8e5e8bd7cdea822fcaea317e884233e3bf0b4f9
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2017-02-05 22:39:25 +02:00
Arkadiusz Lichwa 4f8641990c Bluetooth: shell: Add getting ProfileDescriptorList attribute
Makes use ProfileDescriptorList atribute API to get remote Hands-Free
profile version.

Jira: ZEP-1112

Change-Id: I3752691057e15c3a9a681dd3277ac160096792e9
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2017-02-05 22:39:25 +02:00
Arkadiusz Lichwa 7577a4ff7c Bluetooth: shell: Add SDP client support
Adds pool memory for storing SDP client query results and introduces
command allowing add HFPAG UUID to be resolved when connection to peer
is already set. When resolved data arrives, UUID callback handler
tries to identify RFCOMM protocol specific information, in this case
remote HFPAG Server Channel Number, stored in Protocol's Descriptor List
attribute data.

> HCI Event: Number of Completed Packets (0x13) plen
        Num handles: 1
        Handle: 77
        Count: 1
> ACL Data RX: Handle 77 flags 0x02 dlen 55
      Channel: 64 len 51 [PSM 1 mode 0] {chan 0}
      SDP: Service Search Attribute Response (0x07) tid 2 len 46
        Attribute bytes: 43
        Continuation state: 0
        Combined attribute bytes: 96
          Attribute list: [len 91] {position 0}
            Attribute: Service Record Handle (0x0000) [len 2]
              0x00010003
            Attribute: Service Class ID List (0x0001) [len 2]
              UUID (3) with 2 bytes [0 extra bits] len 3
                Handsfree Audio Gateway (0x111f)
              UUID (3) with 2 bytes [0 extra bits] len 3
                Generic Audio (0x1203)
            Attribute: Protocol Descriptor List (0x0004) [len 2]
              Sequence (6) with 3 bytes [8 extra bits] len 5
                UUID (3) with 2 bytes [0 extra bits] len 3
                  L2CAP (0x0100)
              Sequence (6) with 5 bytes [8 extra bits] len 7
                UUID (3) with 2 bytes [0 extra bits] len 3
                  RFCOMM (0x0003)
                Unsigned Integer (1) with 1 byte [0 extra bits] len 2
                  0x03
            Attribute: Browse Group List (0x0005) [len 2]
              UUID (3) with 2 bytes [0 extra bits] len 3
                Public Browse Root (0x1002)
            Attribute: Bluetooth Profile Descriptor List (0x0009) [len 2]
              Sequence (6) with 6 bytes [8 extra bits] len 8
                UUID (3) with 2 bytes [0 extra bits] len 3
                  Handsfree (0x111e)
                Unsigned Integer (1) with 2 bytes [0 extra bits] len 3
                  0x0106
            Attribute: Unknown (0x0100) [len 2]
              Handsfree Gateway [len 18]
            Attribute: Unknown (0x0301) [len 2]
              0x01
            Attribute: Unknown (0x0311) [len 2]
              0x0027
< ACL Data TX: Handle 77 flags 0x00 dlen 12
      L2CAP: Disconnection Request (0x06) ident 5 len 4
        Destination CID: 64
        Source CID: 64
> HCI Event: Number of Completed Packets (0x13) plen 5
        Num handles: 1
        Handle: 77
        Count: 1
> ACL Data RX: Handle 77 flags 0x02 dlen 12
      L2CAP: Disconnection Response (0x07) ident 5 len 4
        Destination CID: 64
        Source CID: 64

Jira: ZEP-1112

Change-Id: Ibda606fabe367ca3d0353f77c7093da8c4f175c8
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2017-02-05 22:39:25 +02:00
Johan Hedberg eb07178236 Bluetooth: samples: Use Kconfig DEVICE_NAME variable when possible
Instead of using a hard-coded string, make the sample use the Kconfig
variable for the device name.

Change-Id: Ib09f594e1cba221f9064318572bd90d38bd2733a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-01-28 08:43:41 +02:00
Johan Hedberg 4153b6ca1f Bluetooth: Kconfig: Make device name variable generic
Change BREDR_NAME to DEVICE_NAME so it can also be used as the LE
device name.

Change-Id: I9ef55d9dff098372d47d9d5754ad7a7163a65bc0
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-01-28 08:43:41 +02:00
David B. Kinder ac74d8b652 license: Replace Apache boilerplate with SPDX tag
Replace the existing Apache 2.0 boilerplate header with an SPDX tag
throughout the zephyr code tree. This patch was generated via a
script run over the master branch.

Also updated doc/porting/application.rst that had a dependency on
line numbers in a literal include.

Manually updated subsys/logging/sys_log.c that had a malformed
header in the original file.  Also cleanup several cases that already
had a SPDX tag and we either got a duplicate or missed updating.

Jira: ZEP-1457

Change-Id: I6131a1d4ee0e58f5b938300c2d2fc77d2e69572c
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-19 03:50:58 +00:00
Johan Hedberg 767c92e176 Bluetooth: Consolidate most outgoing ACL TX buffers into a single pool
Having TX buffers split into numerous pools has the downside of
increased memory consumption. This patch takes the initial step to
consolidate these pools into a single one, saving about 248 bytes of
RAM for a basic configuration.

Change-Id: I449ba18b44a9a6af68e9a2c44f19a9286eb88b14
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-01-17 08:44:21 +02:00
Jithu Joseph 89f4bf7c7e subsys: disk: Refactor disk_access stuff into a directory
Disk IO functions are used by both FS and USB Mass Storage.
This patch refactors those from FS directory to a separate one.
In addition existing, config options were modified to make
stuff meaningful.

Jira: ZEP-1276

Change-Id: Ia2a2e18f3dbbbdb964c3dc0427d8138ad86134cd
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
2017-01-08 20:58:05 +00:00
Johan Hedberg 63f71adc5f Bluetooth: Take advantage of new net_buf_add_mem() API
This helps simplify code that was previously combining net_buf_add()
with memcpy().

Change-Id: If44cf9cd651aba5e544e36567869f147468663eb
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-01-05 08:49:16 +02:00
Anas Nashif 66cfcc26bc tests: introduce Makefile.test
To customise test builds and support test related features such as time
stamps and a boot banner, introduce a Makefile variant that is dedicated
to testing.

Initially we introduce a new config overlay that is used for all tests, in
this case we enable BOOT_BANNER and BUILD_TIMESTAMP. This will print the
current version and the date, useful when reporting bugs and also an
indicator that the system has booted before the test has started.

For example:

[QEMU] CPU: qemu32
***** BOOTING ZEPHYR OS v1.6.99 - BUILD: Dec 21 2016 19:57:13 *****
tc_start() - Test Nanokernel CPU and thread routines
Initializing nanokernel objects
...
..

Change-Id: I224318cdeb55a301964ea366dbc577e2e3a09175
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-03 17:48:44 +00:00
Anas Nashif 7297f5db88 shell: move shell to its own subsystem
This moves the shell component into its own subsys and groups all
related files and options into a single place.

Additionally, one Kconfig option will now be required to enable the
shell:

 CONFIG_CONSOLE_SHELL=y

The header files was also moved to include/shell/shell.h and can be now
referenced with

 #include <shell/shell.h>

instead of

 #include <misc/shell.h>

Updated documentation as well.

Change-Id: Iffbba4acfa05408055e9fd28dffa213451351f94
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-25 19:35:11 +00:00
Szymon Janc ad8eee2788 Bluetooth: shell: Fix br-discovery help message
Timeout should be passed as decimal.

Change-Id: I9f772b918e33eded8e0328e655e83cca74166595
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-12-24 08:42:15 +02:00
Szymon Janc 17ea315e20 Bluetooth: shell: Add option to specify BR/EDR discovery length
This allows to specify length of discovery from command line.

Change-Id: I3ad80e74b5cdc263e549ce309b75c1f5c117b653
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-12-24 08:42:15 +02:00
Anas Nashif fe958df4dd libc: rework libc selection and reduce Kconfigs
Moved all libc Kconfigs to where the code is and remove the default
Kconfig for selecting the minimal libc. Minimal libc is now the default
if nothing else is configured in.

Removed the options for extended libc, this obviously was restricting
features in the minimal libc without a good reason, most of the
functions are available directly when using newlib, so there is no
reason why we need to restrict those in minimal libc.

Jira: ZEP-1440
Change-Id: If0a3adf4314e2ebdf0e139dee3eb4f47ce07aa89
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-15 22:31:28 +00:00
Johan Hedberg 71c7c01819 net: buf: Remove the need for net_buf_pool_init()
In order to keep the initialization process light-weight, remove
net_buf_pool_init() and instead perform the initialization of the pool
and buffers in a "lazy" manner. This means storing more information
in the pool, and removing any 'const' members from net_buf. Since
there are no more const members in net_buf the buffer array can be
declared with __noinit, which further reduces initialization overhead.

Change-Id: Ia126af101c2727c130651b697dcba99d159a1c76
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-15 09:58:02 +02:00
Johan Hedberg c3e08c8fea net: buf: Redesigned pool & buffer allocation API
Until now it has been necessary to separately define a k_fifo and
an array of buffers when creating net_buf pools. This has been a bit
of an inconvenience as well as blurred the line of what exactly
constitutes the "pool".

This patch removes the NET_BUF_POOL() macro and replaces it with a
NET_BUF_POOL_DEFINE() macro that internally expands into the buffer
array and new net_buf_pool struct with a given name:

	NET_BUF_POOL_DEFINE(pool_name, ...);

Having a dedicated context struct for the pool has the added benefit
that we can start moving there net_buf members that have the same
value for all buffers from the same pool. The first such member that
gets moved is the destroy callback, thus shrinking net_buf by four
bytes. Another potential candidate is the user_data_size, however
right not that's left out since it would just leave 2 bytes of padding
in net_buf (i.e. not influence its size). Another common value is
buf->size, however that one is also used by net_buf_simple and can
therefore not be moved.

This patch also splits getting buffers from a FIFO and allocating a
new buffer from a pool into two separate APIs: net_buf_get and
net_buf_alloc, thus simplifying the APIs and their usage. There is no
separate 'reserve_head' parameter anymore when allocating, rather the
user is expected to call net_buf_reserve() afterwards if something
else than 0 headroom is desired.

Change-Id: Id91b1e5c2be2deb1274dde47f5edebfe29af383a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-13 21:41:53 +00:00
Jaganath Kanakkassery 77753193d9 Bluetooth: shell: Add support for RFCOMM Disconnect
This is used to disconnect a dlc.

Syntax:
>br-rfcomm-disconnect

Change-Id: I8f345d9fbb1f1f84bfb1f697322d9a87ff531797
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-12-09 06:53:14 +00:00
Johan Hedberg a4b6b2417d Bluetooth: Switch from printf to printk functions
There's now snprintk available that's more light-weight on the stack
than snprintf.

Change-Id: I6b3e4409703ca92fe6b8f4146ff47c490ab826cb
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-09 08:18:24 +02:00
Szymon Janc cb67b35c5a Bluetooth: tests: Fix Makefiles comments
Those tests are now build with unified kernel.

Change-Id: Idbc42bb77060cea0130d62cccdf2e40aeee89128
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-18 07:47:50 +02:00
Szymon Janc 2b16287286 Bluetooth: Use proper timeout defines for net_buf_get_timeout
Use defines from k_fifo intead of legacy API.

Change-Id: Ib8cf0d88240ef145da550b8cf83d2580e7140521
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-11 06:00:28 +00:00
Szymon Janc 051f97bd7a Bluetooth: samples: Fix use of deprecated sleep API
Use new sleep API or remove sleeps where not needed.

Change-Id: I88c0973e57eb4970b68b3f4fa428683191b1a7f0
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-11 07:59:15 +02:00
Szymon Janc 47eaaf9f96 Bluetooth: Use unified k_fifo API for FIFOs
Change-Id: I6ddc24575e4bf3c3040945a2bdb62f153b15cdb3
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-11-11 07:59:15 +02:00
Jaganath Kanakkassery f2b1ffbedb Bluetooth: shell: Add support for RFCOMM Connect
This can be used to initiate an outgoing connection
Syntax:
>br-rfcomm-connect <channel>

Change-Id: I7ac7aeb61e7ae7e3f55c7cd7e815bdb604b27fb3
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-11-11 07:59:15 +02:00
Johan Hedberg c583a9f43b Bluetooth: Kconfig: Restructure for a more logical hierarchy
Restructure the Bluetooth options more logically.

- Both host and controller are now behind the same high level
  CONFIG_BLUETOOTH.

- Selecting controller support disables other HCI driver selection, so
  the controller isn't in the same list as HCI drivers any more.

- Under the top-level there's a "Custom stack" option, which when
  enabled opens up the option of choosing CONFIG_NBLE.

There are various other cleanups and simplifications in this patch as
well, since splitting these up would have been fairly tricky while
making sure all test cases still build.

Change-Id: I5bb715cb9d20201cb8b72fbd149c8a09a4b2d7d2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 07:59:15 +02:00
Johan Hedberg 77dcd7151d Bluetooth: tests/shell: Add Arduino 101-specific configuration
Add an Arduino 101-specific configuration that enables flash-based
storage support as well as the file system shell.

Change-Id: Ic10ea958dd2446df4942a8dfd3cce1e3368852b2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-09 09:15:46 +00:00
Johan Hedberg 7e1234b44b Bluetooth: tests/shell: Implement "clear" command
Implement a new "clear" command to exercise the bt_storage API. The
command can either take an address parameter to clear storage for a
specific device, or, if called with the parameter "all", to clear the
entire storage.

Jira: ZEP-181

Change-Id: I1ebd17033f2062951abeeb7d7c448a34a3672577
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-09 08:57:52 +02:00
Johan Hedberg ac844cf687 Bluetooth: Remove misleading NBLE mentions from sample README files
The README files provided with the samples contain references to NBLE,
which is not a publicly supported solution for Bluetooth. Simply
remove these files. If the need arises to provide application-specific
information in the future we can add back per-application README
files.

Jira: ZEP-1183

Change-Id: I81b3ea5491d50fb16062ccd5a421ddc8fcb7ea42
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-04 22:05:05 +02:00
Anas Nashif d622b09bc0 samples: tests: remove obsolete KERNEL_TYPE and kernel variables
Remove those from Makefiles and testcase.ini, we now support unified kernel
only and sanitycheck script now knows how to deal with this.

Change-Id: I853ebcadfa7b56a4de5737d95f2ba096babb2e13
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-04 15:47:25 -04:00
Yael Avramovich d5db35204a console: shell: Support multiple modules
Ability to use Zephyr shell by multiple modules simultaneously, each
module for its own usage.

Old shell implementation enabled the user to call only one module
commands, not all of the modules simultaneously.

Change-Id: I0ef8fa2fd190b7490c44fe91d1016363258302c9
Signed-off-by: Yael Avramovich <yael.avramovich@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-02 00:23:18 +00:00
Luiz Augusto von Dentz 2538811fa9 Bluetooth: shell: Add support for setting security level to l2cap_register
This adds support for setting the minimun required security level to
l2cap_register command:

l2cap-register <psm> [sec_level]

Note that entering the security level is optional and the default is
BT_SECURITY_LOW(1).

Change-Id: Ib6dea92919357f41fe2f4de3050b9a10a7f553d6
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-11-01 21:40:39 +02:00
Johan Hedberg 900fbc20ba boards: x86: Don't default to 'y' with NRF51_PM and WAIT_NOP
These options were only needed for a MyNewt-based nRF51 firmware on
these boards (the MyNewt BLE stack is called Nimble, hence the
prj_nimble.conf sample config files). With a Zephyr-based nRF51
firmware these options are no-longer needed, so it's not appropriate
to have them default to enabled. Instead, if they are needed, require
the app-specific configuration to enable them.

Change-Id: Iefbee4d97590af4e11bcedea05fe61f32a147b83
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-01 19:37:26 +00:00
Anas Nashif 6043c30aa4 tests: samples: exclude quark_d2000_crb from large applications/tests
Change-Id: I108639966d5bb66fb08d745155d692b82c304de1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-31 16:10:45 -04:00
Szymon Janc fb5424392b Bluetooth: Use unified kernel build for tests and samples
This makes all Bluetooth samples and tests being build with unified
kernel. main() is now executed from init thread and specifying task
for it in mdef file is no longer needed. By default main stack is
1024 bytes and this should be enough for BT samples.

Change-Id: I6674eea2c028b78ada5190acef72937186738af2
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-10-28 08:30:57 +02:00
Johan Hedberg 19138eb2f4 Bluetooth: samples: Remove redundant CONFIG_ARC_INIT=n
CONFIG_ARC_INIT defaults to 'n' now days so there's no reason to try
to explicitly disable it in the sample config files.

Change-Id: I88df06ba23bdac697f0767384f7b88e3bd9fced9
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-28 08:09:08 +03:00
Anas Nashif 465de4a1a0 Bluetooth: tests optimize testcase.ini for shell and init
Change-Id: Ia3f09e33684075394bf5d3e91ade53aaf4443a17
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-28 08:09:08 +03:00
Kaustav Dey Biswas 0ecbbc8a7b Bluetooth: SDP: Shorten Service Class macro name
This change shortens the Service Class macro name from
BT_SDP_*_SVCLASS_ID to BT_SDP_*_SVCLASS

Change-Id: I1150baae24428c6b76f005d11003291016e0a03e
Signed-off-by: Kaustav Dey Biswas <kaustav.d.biswas@intel.com>
2016-10-21 07:47:31 +03:00
Kaustav Dey Biswas 148b0a2d35 Bluetooth: shell: Add sample SDP service registration
This change adds SPP as a sample SDP service during RFCOMM
server registration. The SPP channel is now used as the
fixed channel for RFCOMM register command.

Change-Id: I3b5ad3995725adca55db1497d4a35099f6311f3b
Signed-off-by: Kaustav Dey Biswas <kaustav.d.biswas@intel.com>
2016-10-21 07:47:31 +03:00
Genaro Saucedo Tejada 24b2bf40a4 filter: Exclude failing bluetooth test at debug build
Some of tests/bluetooth test are failing link step only when debug
is enabled, these filters prevent those tests from being executed
under such configuration.

Jira: ZEP-1063

Change-Id: I87fa73710d78346b1b2ce587e9055b0732d9cb49
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-10-18 11:04:21 +00:00
Anas Nashif 5363d14a9e boards: rename Quark SE Devboard to Quark SE C1000
This board now has an official name and will be available soon:

http://www.intel.com/content/www/us/en/embedded/products/quark/mcu/se-soc/overview.html

Jira: ZEP-758
Change-Id: Ia16d33722308cf81471321c3063bdc75055a4d50
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-16 03:10:31 +00:00
Jaganath Kanakkassery 2a3a95b24d Bluetooth: shell: Use bt_rfcomm_create_pdu() in RFCOMM send
Remove BT_RFCOMM_SEND_RESERVE usage since it will be removed
eventually.

Change-Id: Iada20cf0692ae12996e7ed820601bb77fe47d438
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 08:17:26 +03:00
Jaganath Kanakkassery eb443ddffc Bluetooth: shell: Add support for RFCOMM send data
Sets new command in BT shell app to send data to peer
Syntax:
>br-rfcomm-send <number of packets>

Change-Id: Ic795d007a03f657afb833719ae0e800ca0ac6e0b
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 08:17:26 +03:00
Luiz Augusto von Dentz 50997f2ccd Bluetooth: GATT: Add queuing support
This adds queueing support for requests that requires a response making
it simpler to use the API. The storage is keep in the parameters of the
request so it is up to the application to define how many can be queued
but in case the application don't want a request to block waiting for
a buffer it can use BLUETOOTH_ATT_REQ_COUNT to control the available
buffers which is recommended in case the requests will be sent from the
RX fiber.

Change-Id: I407c3982a7ecdc4a9eff7172d9d0addd46949783
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-09-07 08:17:26 +03:00
Szymon Janc 1c81bdffc4 Bluetooth: tests/shell: Remove not needed RFCOMM option from config
prj.conf is for single mode LE controllers.

Change-Id: I138a560f4e33f6663135bbcbb4d8aeb5955342a1
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-09-07 08:17:26 +03:00
Szymon Janc ada1b0a594 Bluetooth: tests/shell: Add dedicated BR/EDR config
BR/EDR support in chip is mandatory if BR/EDR is enabled so add
separate config for it. This is to avoid problems when using
single mode LE controller.

Change-Id: I9d9692b89883dd1980803d66818fb6e3a368afb0
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-09-07 08:17:26 +03:00
Jaganath Kanakkassery d19752b955 Bluetooth: shell: Add support for RFCOMM test
Sets new command in BT shell app to allow register one RFCOMM server.
Syntax:
>br-rfcomm-register <Channel>

It also accept the connection from remote and provides dlc object

Change-Id: I99f672ee68785338f3bf22948d4f33b3e1aecd2e
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 08:17:26 +03:00
Szymon Janc 0b67e04922 Bluetooth: tests/shell: Set same name on BR/EDR and LE
This sets BR/EDR name with same value used over LE.

Change-Id: I29407b0b44907b520b0f39afe868fc612c5e47d4
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-09-07 08:17:26 +03:00
Andrew Boie 2a8aee133a tests: bluetooth: fix incorrect printk() usage
Change-Id: I9493fddf9d7d1120ae54a58673835c64d2042188
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-28 07:47:28 -04:00
Szymon Janc d2549115ca Bluetooth: Rename connectable_addr member in struct bt_le_oob
Depending on advertising options this can be non-connectable address.
NFC pairing application document also allows broadcaster/observer
roles.

Change-Id: I9b104ac8fb9752a083a7a31fc20598c66f23f608
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-07-22 13:09:30 +02:00
Johan Hedberg 1668624a2f Bluetooth: tests/shell: Remove unnecessary redefinition of AD types
Change-Id: I411618b1cc8ecdf67f84d6debb43bde314eaed10
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-07-22 09:18:02 +00:00
Szymon Janc c8cb32c462 Bluetooth: shell: Add support for getting OOB data
This allows to query LE and BR/EDR OOB data.

Change-Id: I8bc281a9549092c1c4b40c346580abb5fd51d02d
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-07-20 20:20:44 +02:00
Johan Hedberg 211ae314e8 Bluetooth: Pass net_buf_simple to scan callback
This lets the callback take advantage of the powerful net_buf API for
parsing the advertising data content.

Change-Id: Id65e6e83efd60c0f36c47bc5446a2e8ec2833d7c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-07-20 16:19:01 +00:00
Luiz Augusto von Dentz c51bcbb9d9 Bluetooth: GATT: Add write struct parameter to its callback
This makes bt_gatt_write consistent with the rest of the API where the
parameters are passed back to its callback.

Change-Id: Ie94208aa661d3620d0cbc5be4a4fb5b3c3ef061c
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-07-20 13:40:55 +00:00
Luiz Augusto von Dentz d84dcb9626 Bluetooth: shell: Loopback L2CAP data
This can be used to test if receiving and sending simultaneously is
working properly with tools such as BlueZ's l2test.

Change-Id: Ic6bcd00a4e1448bebd3ae74bcc58986872332bbe
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-07-20 05:34:50 +00:00
Kumar Gala 7dcbbc39e7 build: move from srctree to ZEPHYR_BASE for app include paths
$srctree for the application might not be set to be $ZEPHYR_BASE, use
$ZEPHYR_BASE instead to be more explicit in the build.

Change-Id: Iefa5ff59f246b584949329044f7a6531adc6ed62
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2016-06-30 14:36:39 +00:00
Luiz Augusto von Dentz e9083dfcd7 Bluetooth: GATT: Add flags to attribute write callback
This adds flags parameter to write callback which can be used to indicate
that data only need to be prepared with use of BT_GATT_WRITE_FLAG_PREPARE
fixing qualification tests that needs to check authorization or other
errors that cannot be verified with just the permissions.

Change-Id: I3d662b2027718ffb52a280e3bbc9750be14f89ae
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-06-28 17:36:08 +03:00
Andrei Emeltchenko 437c0e18e3 Bluetooth/shell: Add HRS simulation to btshell
Add HRS simulation to shell allowing to switch on / off HRS simulation
helping testing GATT notifications.

Change-Id: Idf99b74ac73d45d2f0d3279d50431be4027fef8a
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-06-27 18:43:44 +00:00
Arkadiusz Lichwa 5192c44e72 Bluetooth: shell: Suplement BR/EDR L2CAP channel handlers
Adds to BR/EDR L2CAP client channel object required handlers and allocate
room for channel data traffic to make it operational when fully
setup and to be interactive with internal stack.

Change-Id: Id1e90d7ea318ed8a875383995e4d175e124939eb
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-06-23 19:58:57 +00:00
Arkadiusz Lichwa 83fd0cf62e Blutooth: shell: Fix printout BR/EDR PSM server registration
Fixes wrong server instance used during printing details on registration
PSM server.

Change-Id: I269d20bf4d12f24ce143a04c1c23ed8711b9cdba
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-06-17 11:56:56 +02:00
Johan Hedberg 8ea57bd5d3 Bluetooth: Shorten limited discovery parameter name
The parameter is already inside a struct that's specific to BR/EDR
discovery, so there's no need to repeat "discovery" in its name.

Change-Id: Idb95788bfc9d62ecd52adecc35104e212724cb78
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-16 11:28:59 +03:00
Johan Hedberg 1a756d6f8d Bluetooth: Fix validity check for Inquiry parameters
Since we only have a single user we can enforce length > 0x01. We
should also ensure that the results count is 1-255.

Change-Id: Id5d91acae06c6c6fc66dd59c0e367682a98dc08c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-16 10:58:50 +03:00
Arkadiusz Lichwa b2647d84b3 Bluetooth: L2CAP: Refactor l2cap core types
Refactors L2CAP core data structures and modifies functions that uses them.
Now we can have separate L2CAP feature channel objects for LE and BR/EDR
transport. This's also a ground for make L2CAP CoC API to be common
for both transports.

Change-Id: Ic1197b0e3c4f505764b23fb9c7eb27123a44a675
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-06-13 11:49:07 +00:00
Johan Hedberg ebd5011adf Bluetooth: Update Intel copyright for files modified in 2016
Change-Id: I10a7cab9a7f911b9f64e17bf24ddce82c2f08c40
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-10 12:10:53 +03:00
Szymon Janc 6248407c00 Bluetooth: shell: Fix data_pool declaration
Buffers pass to BT stack need to have minimum BT_BUF_USER_DATA_MIN
of reserved user space data.

Change-Id: Iaeb85faa20b1c5281bfd0331336295ad7cfdd68e
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-06-06 19:09:59 +02:00
Luiz Augusto von Dentz f54c5b744d Bluetooth: GATT: Remove obsolete flush callback
It is no longer necessary to implement flush callback for long
descriptors since the stack can queue prepare writes this callback
will never be called which makes BT_GATT_LONG_DESCRIPTOR obsolete
as well.

Change-Id: Idca31ba8e4404d2acba760c420394d5adee0a508
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-06-06 12:29:02 +00:00
Luiz Augusto von Dentz 56419a135b drivers/nble: Add buffer pool for prepare writes
This is similar to previous patch which makes the API much more simple
when handling long writes.

Change-Id: Ibd3856863a43927195e23936872a160d5ff94648
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-06-06 12:28:35 +00:00
Luiz Augusto von Dentz d7e0294227 Bluetooth: ATT: Add incoming buffer pool
This adds a buffer for incoming prepare writes which can be
tunned using BLUETOOTH_ATT_PREPARE_COUNT, these buffers are then used in
execute write to commit the data thus making flush callback obsolete:

[bt] [DBG] bt_att_recv: (0x001159c0)Received ATT code 0x16 len 50
[bt] [DBG] att_prepare_write_req: (0x001159c0)handle 0x0022 offset 0
[bt] [DBG] prep_write_cb: (0x001159c0)handle 0x0022 offset 0
[bt] [DBG] bt_att_recv: (0x001159c0)Received ATT code 0x16 len 34
[bt] [DBG] att_prepare_write_req: (0x001159c0)handle 0x0022 offset 45
[bt] [DBG] prep_write_cb: (0x001159c0)handle 0x0022 offset 45
[bt] [DBG] bt_att_recv: (0x001159c0)Received ATT code 0x18 len 2
[bt] [DBG] att_exec_write_req: (0x001159c0)flags 0x01
[bt] [DBG] write_cb: (0x001159c0)handle 0x0022 offset 0
[bt] [DBG] write_cb: (0x001159c0)handle 0x0022 offset 45

Change-Id: Iae071d7b4b5b042285952da57e3f7a853cf58afb
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-06-06 12:28:11 +00:00
Szymon Janc 61c2353fc0 Bluetooth: shell: Fix missing new lines
This makes shell logs cleaner.

Change-Id: I5ecc751e3062b9cb581471c5399dd01decc9fa57
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-06-06 04:45:30 +00:00