Commit graph

40 commits

Author SHA1 Message Date
Vinayak Kariappa Chettimada 4c123a5162 Bluetooth: controller: Refactor ticker integration into hal
Refactor ticker execution context dependency out into HAL
folder. This decouples ticker from mayfly, enabling porting
towards a more tasklet (if and when kernel gets the support)
style execution contexts type implementation support.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-02-13 13:26:37 +01:00
Luiz Augusto von Dentz 800bfaf9a7 Bluetooth: UUID: Remove macros defining 16 bit values
Application should normally declare a bt_uuid with proper type and then
use bt_uuid_cmp.

Fixes #5162

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2018-02-13 13:33:48 +02:00
Johan Hedberg 8fc4c99496 Bluetooth: Remove redundant AD parsing check
A few lines earlier the code bails out in case len is 0. Checking for
buf->len < 1 is the same as checking for buf->len == 0. Since len is
guaranteed to be > 0 here the check len > buf->len implicitly checks
for buf->len == 0, i.e. the second test can be removed.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-01-31 07:01:10 -08:00
Kumar Gala 26e4da52cf arm: nordic: flash: Use FLASH_DEV_NAME define
We want to move to use a common FLASH_DEV_NAME across the various flash
drivers. So samples, tests, or other code can be a bit more generic.  So
replace CONFIG_SOC_FLASH_NRF5_DEV_NAME with FLASH_DEV_NAME.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-01-25 15:23:00 -06: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
Vinayak Kariappa Chettimada e00282af6e Bluetooth: Fix build failure with -Wshadow CFLAGS
Fixes many instances of errors similar to below:
zephyr/subsys/bluetooth/controller/ll_sw/ctrl.c:5927:22:
    error: declaration of ‘s_link’ shadows a previous
        local [-Werror=shadow]
  static memq_link_t s_link;
                     ^~~~~~
zephyr/subsys/bluetooth/controller/ll_sw/ctrl.c:5905:21:
    note: shadowed declaration is here
  static memq_link_t s_link;
                     ^~~~~~

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-12-20 12:29:52 -05:00
Anas Nashif 429c2a4d9d kconfig: fix help syntax and add spaces
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-12-13 17:43:28 -06:00
Vinayak Kariappa Chettimada b022f72cf4 Bluetooth: shell: Fix compile error due to missing memq.h include
Fixes the following compile error when building
tests/bluetooth/shell application:

In file included from subsys/bluetooth/shell/ticker.c:16:0:
subsys/bluetooth/shell/../controller/util/mayfly.h:21:2:
error: unknown type name 'memq_link_t'
  memq_link_t *_link;
  ^~~~~~~~~~~

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-11-27 13:48:24 -08: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
Vinayak Kariappa Chettimada 6831351799 Bluetooth: shell: Add controller DTM commands
Add controller Direct Test Mode commands to bt shell module.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-09-29 20:56:11 +02:00
Paul Sokolovsky 0592c0ce59 Bluetooth: shell: gatt_read: Reset offset to 0
Unless offset was specified, it should default to 0, whereas
previously, value from the last command was used.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-08-15 21:16:40 +03:00
Carles Cufi d5c13a7530 Bluetooth: controller: Rename Kconfig prefix
Rename the BT_CONTROLLER prefix used in all of the Kconfig variables
related to the Bluetooth controller to BT_CTLR.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-08-14 15:44:56 +03: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
Luiz Augusto von Dentz a864436559 Bluetooth: Shell: Add second vendor service
This adds a second vendor service testing if service changed indications
works with more than one change in a row and as a bonus it implements
echo attribute which notifies any data that is written to it:

> ACL Data TX: Handle 3585 flags 0x00 dlen 9
      ATT: Write Command (0x52) len 4
        Handle: 0x0013
          Data: 0000
< ACL Data RX: Handle 3585 flags 0x02 dlen 9
      ATT: Handle Value Notification (0x1b) len 4
        Handle: 0x0013
          Data: 0000

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-07-11 08:22:22 +03:00
Luiz Augusto von Dentz 17b340cc13 Bluetooth: Shell: Implement support for gatt-metrics off
With introduction of bt_gatt_service_unregister it is now possible to
unregister service at runtime.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-07-11 08:22:22 +03:00
Vinayak Kariappa Chettimada ed85dea358 Bluetooth: shell: Fix compile warnings when CONFIG_DEBUG=y
Fixed uninitialised auto variables, that had caused compile
errors under CONFIG_DEBUG=y.

Jira: Zep-2334

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-06-29 07:43:54 +03:00
Johan Hedberg 4040610244 Bluetooth: shell: Fix incorrect #define
This should have been upper case and not lower case.

Fixes: ZEP-2322

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-06-28 09:52:26 -04:00
Andrzej Puzdrowski 9f964ba8d3 bluetooth: shell: add module for testing NRF5x flash driver
Intention is to test flash driver along with BLE radio.
Added flash shell module with commands for erase, write-check, read and
co-operation with radio stress test.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2017-06-28 12:29:50 +02:00
Luiz Augusto von Dentz a6b37b072b Bluetooth: GATT: Rename bt_gatt_unregister_service
Rename bt_gatt_unregister_service to bt_gatt_service_unregister to be
consistent with other APIs such as bt_gatt_service_register.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-06-20 15:32:16 +03:00
Luiz Augusto von Dentz 272b3a5c99 Bluetooth: Shell: Add gatt-show-db command
gatt-show-db shows the current set of attributes available in the GATT
database:

bt> gatt-show-db
attr 0x0011ce80 handle 0x0001 uuid 2800 perm 0x01
attr 0x0011ce94 handle 0x0002 uuid 2803 perm 0x01
attr 0x0011cea8 handle 0x0003 uuid 2a00 perm 0x01
attr 0x0011cebc handle 0x0004 uuid 2803 perm 0x01
attr 0x0011ced0 handle 0x0005 uuid 2a01 perm 0x01
attr 0x0011cde0 handle 0x0006 uuid 2800 perm 0x01
attr 0x0011cdf4 handle 0x0007 uuid 2803 perm 0x01
attr 0x0011ce08 handle 0x0008 uuid 2a05 perm 0x00
attr 0x0011ce1c handle 0x0009 uuid 2902 perm 0x03
attr 0x0011c9a0 handle 0x000a uuid 2800 perm 0x01
attr 0x0011c9b4 handle 0x000b uuid 2803 perm 0x01

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-06-15 21:53:00 +03:00
Luiz Augusto von Dentz 01eeb5ea0b Bluetooth: Shell: Add gatt-unregister-service command
gatt-unregister-service can be used to remove the test service at
runtime causing service changed to be indicated:

00:1b:dc:07:31:88 (public)> gatt-unregister-service
[bt] [DBG] gatt_indicate: (0x0011e100) conn 0x0011d880 handle 0x0008
[bt] [DBG] bt_att_req_send: (0x0011e100) conn 0x0011d880 req 0x0011db00
[bt] [DBG] att_send_req: (0x0011e100) req 0x0011db00
Unregistering test vendor service

< ACL Data TX: Handle 3585 flags 0x00 dlen 11
      ATT: Handle Value Indication (0x1d) len 6
        Handle: 0x0008
          Data: 0a001000
> ACL Data RX: Handle 3585 flags 0x02 dlen 5
      ATT: Handle Value Confirmation (0x1e) len 0

Jira: ZEP-2225
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-06-15 21:53:00 +03:00
Luiz Augusto von Dentz 79af35991b Bluetooth: GATT: Add bt_gatt_register_service
This adds bt_gatt_register_service using bt_gatt_service which contains
the attribute array that is then added to the database saving a pointer
in each and every attribute declared.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-06-15 21:53:00 +03:00
Vinayak Kariappa Chettimada 8877348aec Bluetooth: shell: Fix compile error with LL cmds included
Fixed compile error due to the missing header file
dependency on bluetooth/hci.h, for bt_addr_le_t, in the
Link Layer header file.

Merge of PR #475 introduced the new dependency that broke
compilation after merge of #474.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-06-14 22:12:40 +02:00
Vinayak Kariappa Chettimada dc11c9c315 Bluetooth: shell: Add Extended Scan command
Add shell scanx command to start Extended Scanning on 1M or
Coded PHY.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-06-14 18:40:40 +03:00
Vinayak Kariappa Chettimada 128a0613cd Bluetooth: shell: Add LE Adv. Ext. advx command
Add Bluetooth Link Layer LE Advertising Extensions commands
for manual testing the feature during development. First one
being advx command to start non-connectable non-scannable
extended advertising.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-06-14 18:40:40 +03:00
Vinayak Kariappa Chettimada 0998cdfba1 Bluetooth: shell: gatt-write-without-response with repeat
Add a repeat param to gatt-write-without-response so that
it covers what gatt-write-without-response-repeated was
doing. gatt-write-without-response was removed in the
commit 26eae70da.

gatt-write-signed too will have repeat param with this
change.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-06-04 09:34:08 +03:00
Vinayak Kariappa Chettimada a3cba8bb90 Bluetooth: shell: Add controller's ticker shell module
Added shell module for the Bluetooth Controller's ticker
interfaces.

For now, info command enumerates active tickers' details.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-06-01 12:32:47 +03:00
Luiz Augusto von Dentz da86ae0cb6 Bluetooth: Shell: Rework gatt-write-signed
This makes gatt-write-signed to reuse cmd_gatt_write_without_rsp since
it is quite similar and that adds the ability to send multiple octecs
instead of just a single byte.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-05-30 16:39:05 +03:00
Luiz Augusto von Dentz a5aa904f90 Bluetooth: Shell: Fix help of gatt-write-signed
gatt-write-signed does not have an offset parameter.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-05-30 16:39:05 +03:00
Luiz Augusto von Dentz 26eae70da2 Bluetooth: Shell: Remove gatt-write-without-response-repeated
This removes gatt-write-without-response-repeated and makes
gatt-write-without-response similar to gatt-write which was the
intention of gatt-write-without-response-repeated.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-05-30 16:39:05 +03:00
Luiz Augusto von Dentz 6107f61d8c Bluetooth: Shell: Fix help of gatt-write-without-response
gatt-write-without-response does not have an offset parameter.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-05-30 16:39:05 +03:00
Luiz Augusto von Dentz 6abccb6d40 Bluetooth: Shell: Split GATT command to its own file
This makes it simpler to organize the GATT command implementation.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-05-30 16:39:05 +03:00
Luiz Augusto von Dentz 54d917f767 Bluetooth: Shell: Add shell subdir if CONFIG_BLUETOOTH_SHELL=y
All the files under shell subdir shall only be build if
CONFIG_BLUETOOTH_SHELL is selected.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-05-30 16:39:05 +03:00
Luiz Augusto von Dentz 7b9013140d Bluetooth: GATT: Fix not queuing writes to CCC
In order to properly queue request there need to be a bt_att_req
storage but none of the calls to gatt_write_ccc were using the params
causing gatt_send to use bt_att_send and not bt_att_req_send.

To fix this now all the callers of gatt_write_ccc do set the params
properly but this means that bt_gatt_unsubscribe has to wait for it
to be completed before the application can reuse the
bt_gatt_subscribe_params.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-05-30 14:34:11 +03:00
Vinayak Kariappa Chettimada fe3aeebcfa Bluetooth: shell: Fix scan on to use active scanning
Both scan on and scan passive performed passive scanning,
fixed scan on command to use active scanning.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-05-29 18:21:36 +03:00
Luiz Augusto von Dentz 737a9dc306 Shell: bt: Use SHELL_REGISTER_WITH_PROMPT
This replaces the use of shell_register_prompt_handler with
SHELL_REGISTER_WITH_PROMPT which doesn't overwrite other modules
prompt.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-05-29 10:42:21 +03:00
Luiz Augusto von Dentz 12d1b2aa32 Shell: bt: Fix build without CONFIG_BLUETOOTH_GATT_CLIENT
If CONFIG_BLUETOOTH_GATT_CLIENT is not defined disable command that
would depend on it.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-05-29 10:42:21 +03:00
Luiz Augusto von Dentz a6f75bebc7 Shell: bt: Add command supported by btshell
This adds existing commands support by btshell test application to bt
module.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-05-29 10:42:21 +03:00
Luiz Augusto von Dentz 1c4561925c Shell: Add initial code for bt shell module
This adds the config option and files of the bt shell module.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-05-29 10:42:21 +03:00