Commit graph

624 commits

Author SHA1 Message Date
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
Carles Cufi 4053470f62 Bluetooth: controller: Add inital support for Controller-based privacy
This initial commit adds the following:

* Handling of privacy HCI commands
* New Link Layer filter module for both whitelist and resolving list
* Advertising RPA generation with timeouts

Follow-up commits will expand the functionality.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-06-20 15:20:09 +03:00
Anas Nashif 2d970a2cbd tests: rename test directory test_bluetooth -> bluetooth
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-17 10:34:24 -04: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
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 b3cfabab63 Bluetooth: Remove CONFIG_BLUETOOTH_GATT_DYNAMIC_DB
Removes CONFIG_BLUETOOTH_GATT_DYNAMIC_DB in preparation to the
introduction of bt_gatt_unregister.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-06-15 21:53:00 +03:00
Vinayak Kariappa Chettimada 51d6bdb2ff Bluetooth: controller: LE Advertising Extensions PDU structs
Add Bluetooth v5.0 LE Advertising Extensions air interface
packet structures.

Jira: ZEP-2073

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-06-14 18:40:40 +03:00
Andrew Boie 15ed8ec7ea tests: use K_THREAD_STACK_DEFINE macros
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-09 18:53:28 -04: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
Vinayak Kariappa Chettimada 5effd68a9d Bluetooth: controller: Fix tests conf file to cover new features
Updated tests conf file with coverage for new feature Kconfig
options in the Controller. This is required to catch compile/
build regression.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-05-12 13:55:39 +03:00
Andrew Boie 68d3678abb tests: use k_thread_create()
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-11 20:24:22 -04:00
Vinayak Chettimada fc6d8d1bc4 Bluetooth: controller: Scan Request Notifications
Implement the framework for LE Scan Request Received Event.
The feature is available under the Controller's advanced
features and will be selected implcitly when Bluetooth v5.0
LE Advertising Extensions feature is implemented.

Jira: ZEP-2073

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-05-05 15:56:04 +03:00
Carles Cufi a1ff1a0933 Bluetooth: Consolidate flow control Kconfig
Since Controller to Host flow control is a feature that affects both
sides equally, move it to the top-level Kconfig file and consolidate its
use in both Controller and Host.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-05-04 18:09:31 +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
Carles Cufi 7ebe7da736 Bluetooth: controller: Controller to Host flow control
The Bluetooth Specification allows for optional Controller to Host flow
control based on the same credit-based mechanism as the Host to
Controller one. This is particularly useful in 2-chip solutions where
the Host and the Controller are connected via a physical link (UART, SPI
or similar) where the Host is sometimes required to ask the Controller
to throttle its data traffic while still making sure that relevant
events get through the line.

This implementation is based on a simple queue of pending events and
data that is populated whenever the Controller detects that the Host is
out of buffers and then emptied whenever the Host notifies the
Controller that is ready to receive data again. Events relevant to the
connections are also queued to preserve the order of arrival.

At this point the Controller ignores the connection handle sent by the
Host and treats all connections equally, and it also queues events even
for connections that have no data pending in the queue. Both this items
can be improved if necessity arises.

Note that Number of Completed Packets will still flow freely from the
Controller to the Host regardless of the pending ACL data packets, which
might lead to inconsistencies in the sequential order of certain
operations that include bi-directional data transfer.

Jira: ZEP-1735

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-05-03 22:23:42 +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 3c454017b4 Merge "Merge bluetooth branch into master" 2017-04-20 16:55:36 +00: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
Vinayak Chettimada 392b5deacb Bluetooth: controller: Channel Selection Algorithm #2
Add Bluetooth 5.0 LE Channel Selection Algorithm #2 feature

Jira: ZEP-2033

Change-id: Ic1155b4399882b89cab33cac78b08b7b39ff6f9d
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-04-20 08:58:09 +03:00
Milosz Wasilewski deea71b3c6 tests: added TC_START to tests
TC_START was missing from some tests. For this reason automated testing
parsing wasn't unified for all tests. This patch fixes the issue and adds
TC_START to tests where it was missing.

Change-Id: I7e27a3fd8eaef9c3d0b0e0aeba9bca5b97eb0c58
Signed-off-by: Milosz Wasilewski <milosz.wasilewski@linaro.org>
2017-04-13 12:08:14 +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 b37f743a13 Bluetooth: test: Add "tiny" controller configuration
Add a configuration that strips the BLE controller down to its simplest
form to catch any issues when commonly used options are not enabled.

Change-Id: Ifbec01d62b7d45fe9139dadaba734eff3b7a72b6
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-04-08 20:11:55 +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 7c22073195 Bluetooth: controller: Make worker and job priority configurable
Add Controller advanced Kconfig options to select IRQ
priorities of the Radio, Ticker's Worker and JOB IRQs.

This will provide an opportunity to have peripheral IRQ's
of higher level than Bluetooth Controller.

Change-id: Iaa128c1cd64a309a77d42d485fdefe68f31e4895
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-04-08 20:11:54 +03:00
Vinayak Chettimada f38d57cba3 Bluetooth: controller: Kconfig option for advanced scheduling
Add Kconfig option to enable advanced scheduling in the
controller.

Enable non-overlapping placement of observer, initiator and
master roles in timespace. Uses window offset in connection
updates and uses connection parameter request in slave role
to negotiate non-overlapping placement with active master
roles to avoid slave roles drifting into active master
roles in the local controller.

This feature maximizes the average data transmission amongst
active concurrent master and slave connections while other
observer, initiator, master or slave roles are active in the
local controller.

Disabling this feature will lead to overlapping role in
timespace leading to skipped events amongst active roles.

Change-id: I16e4e6c3ca99f93987ab86924af0cb9d76bdbc7e
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-04-08 20:11:54 +03:00
Vinayak Chettimada 646726518f Bluetooth: controller: Kconfig for advanced event preparation
Added Kconfig option to enable advanced event preparation
feature.

Enables advanced event preparation offset ahead of radio
tx/rx, taking into account predictive processing time
requirements in preparation to the event, like control
procedure handling and CPU execution speeds. Crystal
oscillator is retained between closely spaced consecutive
radio events to reduce the overall number of crystal
settling current consumptions.

This feature maximizes radio utilization in an average role
event timeslice when they are closely spaced by using a
reduced offset between preparation and radio event.

By disabling this feature, the controller will use a
constant offset between the preparation and radio event. The
controller will toggle crystal oscillator between two
closely spaced radio events leading to higher average
current due to increased number of crystal settling current
consumptions.

Change-id: I19e640f7395ac7938873ef4bfac38acf8d6f7e0e
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-04-08 20:11:54 +03:00
Mariusz Skamra ea8ca7d400 Bluetooth: tester: Fix UART issue on qemu
This fixes an issue introduced by bab3aafa2d,
which changed the default value of UART_PIPE_ON_DEV_NAME to the same
used by BLUETOOTH_UART_ON_DEV_NAME. Due to this, the BTP and HCI were using
the same UART.

Change-Id: Ib59819e49610f28f4c89c0304d024bb1b6aa506a
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2017-03-24 10:16:08 +01: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
Johan Hedberg 5517893543 Bluetooth: Make bt_hci_driver instances link-time constants
Declaring these as const lets the linker generate more optimal code.
Some extra care is needed with hci_ecc.c since it was overwriting the
send callback. Now the choice of send() call is done directly in the
bt_send() function

Change-Id: Iac74f5ee9bee097bbb34c11bd13d1d886700f5cc
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-03-21 17:05:42 -07:00
Vinayak Chettimada 0d75faf02d Bluetooth: Controller: Add advertisement event indication feature
Add a Controller event that indicates everytime
advertisement event has been transmitted on air.

Change-id: I4722488bbfeca987e66983faf5b26467407a89c9
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
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
Anas Nashif 2bc9d69981 build: abstract emulation and replace qemu goal with run
This will replace the current goal of 'make qemu' with 'make run' and
moves Qemu handling into its own file and into the boards instead of
being architecture specific.

We should be able to add new boards that support some other type of
emulation (by adding scripts/Makefile.<emu type>) and allow the board to
define their own options for the use type of emulation.

'make qemu' will still work, however it will be deprecated, starting
with this commit it is recommended to use 'make run'.

Jira: ZEP-359
Change-Id: I1cacd56b4ec09421a58cf5d010e22e9035214df6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-10 20:20:47 +00:00
Kumar Gala 0314a4e287 Bluetooth: remove arduino_101_ble from test_controller_dbg
RAM size has increased on arduino_101_ble which causes it to no longer
be able to build test_controller_dbg.

Change-Id: Iab8ed2857db23d048cfa6b04e2d1fea31efbb13c
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-09 20:56:11 +00: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
Vinayak Chettimada 27353bb655 Bluetooth: Controller: Kconfig connection RSSI measurement
Add Kconfig configuration and conditional compilation of
RSSI measurement during a connection.

Change-id: I5a2f23f76a7cbbd9569d53d31899a472bf39d3ee
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-01-05 08:49:16 +02:00
Vinayak Chettimada 08fcc44b8a Bluetooth: Controller: Kconfig Data Length Update feature
Add Kconfig configuration to conditionally enable Data
Length Update procedure support in the Controller.
This will save CPU time, flash and RAM, if this feature is
not desired.

Change-id: I4515c0c7cf9aeb333a289397ae3c9bac04a08e4e
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-01-05 08:49:16 +02:00
Vinayak Chettimada b37e285c03 Bluetooth: Controller: Kconfig LE Ping feature
Add Kconfig configuration to conditionally enable LE Ping
feature in the Controller.
This will save CPU time, flash and RAM, if this feature is
not desired.

Change-id: I5fbbdbe8f45ac01c9b0d7b11e002a0d1db4d272e
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-01-05 08:49:16 +02:00
Vinayak Chettimada 04794ba1c1 Bluetooth: Controller: add init test for BT 4.0 only controller
Add a test configuration to build a controller that
supports only Bluetooth v4.0 features.

This is copy of prj_controller.conf, but Kconfig defines
will be added in subsequent commits to conditionally
compile out feature not in Bluetooth v4.0 specification.

Also, added nrf52840_pca10056 and arduino_101_ble board
builds be tested.

Change-id: I36891bfc54cc36a8588c9b019de582e3193e8aa3
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-01-05 08:49:16 +02:00
Vinayak Chettimada a591205045 Bluetooth: Controller: Kconfig radio ISR profiling
Add Kconfig configuration and conditional compilation of
radio ISR profiling.

Change-id: Ia80d6bc54810156be99b2e6a25327c30d0714697
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-01-05 08:49:16 +02: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 a9e879e273 logging: move sys_log to subsys/logging
Move logging out of misc/ to its own subsystem. Anything related to
logging and any new logging features or backends could be added here
instead of the generic location in misc/ which is overcrowded with
options that are not related to eachother.

Jira: ZEP-1467
Change-Id: If6a3ea625c3a3562a7a61a0ba5fd7e6ca75518ba
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-19 19:58:39 +00:00
Johan Hedberg 1c9da665c3 Bluetooth: Remove unnecessary runtime kernel object initialization
There are static initializer macros available for most kernel objects
which we should use whenever possible.

Change-Id: I496f4d05d26801eddd21fae53bdd4fcdc3246fe3
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-16 10:27:48 +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
Marcus Shawcroft fe8d044d9a tests: Remove unnecessary CONFIG_TEST_RANDOM_GENERATOR
Remove CONFIG_TEST_RANDOM_GENERATOR from each test and sample where it
is not required.

Change-Id: I949f8e93c2cb1881622a5e48efeb87c43122a170
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-13 22:50:18 +00: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
Johan Hedberg 1e20e8dc04 Bluetooth: Fix left-over usage of TICKS_NONE and TICKS_UNLIMITED
Switch left-over usage of TICKS_NONE and TICKS_UNLIMITED to the new
unified kernel counterparts K_NO_WAIT and K_FOREVER.

Change-Id: I2f2a16360e816f9f8791eb216deb3c70b8cc87df
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-12 19:27:34 +02:00
Johan Hedberg 63a8f3b824 Bluetooth: tests/tester: Convert left-overs to unified kernel APIs
Convert fiber_start to k_thread_spawn and nano_fiber_fifo_put to
k_fifo_put.

Change-Id: If1ec405ec602e28a538f4c9569ede87519346559
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 11:00:45 +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
Mariusz Skamra 0c8ea2037e Bluetooth: tester: Enable privacy for QEMU configuration
Change-Id: I9030f94bb42bfc0aa3e39dac52570eae1d2121a0
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-11-04 22:06:31 +02:00
Mariusz Skamra d1b8d25068 Bluetooth: tester: Increase number of available L2CAP channels
This increases number of available L2CAP channels for the test purposes.
This is needed for TC_COS_CFC_BV_05_C test case.

Change-Id: I5df099fb64632e1a0e557852ca55ee45a9cc89ed
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-11-04 22:06:31 +02:00
Mariusz Skamra 3b27f9857d Bluetooth: tester: Fix configuration file name
This fixes configuration file name in testcase.ini file.

Change-Id: I6496f98694415bfc3a76308aa9ee6dfd008e1691
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-11-04 22:06:31 +02:00
Mariusz Skamra 00f4f2f66c Bluetooth: tester: Set Zephyr-based BLE configuration as default
This updates README as well as makefile to choose Zephyr BLE firmware
configuration as a default one.

Closes: ZEP-1187

Change-Id: I78dec2a4e2b5bfe634a8b7b8897d4f6ab6b37b44
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-11-04 22:06:31 +02:00
Mariusz Skamra 8f2ffb6a45 Bluetooth: tester: Add configuration file for Zephyr BLE firmware
This adds sample configuration file for tester application that
supports controllers with Zephyr-based BLE firmware.

Change-Id: I8b63f93d1395837b8485aba7060b6626be1daab1
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-11-04 22:06:07 +02:00
Mariusz Skamra 79b5e7e6fa Bluetooth: tester: Rename config files
This removes redundant prj_* prefix from configuration file name.

Change-Id: I9867fa345791e68b64f83bb0cd75634cf1cde887
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-11-04 22:06:07 +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 079030718f Bluetooth: Move hci_driver.h to include/drivers/bluetooth
This header file is not intended for applications, rather than for
drivers, so move it to the appropriate place.

Change-Id: I7ff8158418e7e839b538c6cccbb32f3af43c12c6
Signed-off-by: Johan Hedberg <johan.hedberg@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
Johan Hedberg 6c54c92e84 Bluetooth: tests/init: Limit controller+host for 32kB RAM platforms
The combined controller & host build takes up too much RAM for the
16kB arduino_101_ble target, so limit it to the 32kB nRF52 & nRF51
DevKits.

Change-Id: Ib9d04765697b7f5c748633cb6244474d92f96995
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-28 19:27:39 +00: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 6989bf88e1 Bluetooth: Rename bt_driver to bt_hci_driver
The bt_driver API was created when Zephyr only had a Bluetooth host
stack, but no controller-side functionality. The only "driver" that
was needed for the host was the HCI driver, and hence "HCI" was
omitted from the name.

With support both for host and controller Zephyr will be getting more
Bluetooth driver types, in particular radio drivers. To prepare for
this, move all HCI drivers to drivers/bluetooth/hci/ and rename the
bt_driver API bt_hci_driver.

Change-Id: I82829da80aa61f26c2bb2005380f1e88d069ac7d
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-28 08:09:08 +03: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
Luiz Augusto von Dentz ee9f5c1784 Bluetooth: GATT: Pass CCC attribute to changed callback
This way the application can reuse the same callback for multiple CCC
since it can track what CCC is affect by checking the attribute pointer.

Change-Id: I608da643aea07de26b65d67e6db3268d717d0f53
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-10-21 07:47:31 +03:00
Inaky Perez-Gonzalez 61ed9b8853 tests/bluetooth/init/testcase.ini: add missing kernel=micro
This testcase was being ran on Quark D2000 because it failed to
identify itself as micro. There is not enough RAM for that.

Properly tag.

Change-Id: I9fd4235f4436b914b89b10616cbed0cfb3e97b40
Jira: ZEP-1014
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-10-18 13:53:57 +00: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
Johan Hedberg a2ee2b7eca Bluetooth: tests: Clean up platform whitelisting
Clean up left-overs from this getting fixed first in master.

Change-Id: Ief41ecfdeeb51fbc76f2fe045a412ff1643f69c9
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-16 09:03:30 +03:00
Mariusz Skamra 11b9d98bd2 Bluetooth: tester: Add GAP Unpair command handler
This implements GAP Unpair command handler used to remove pairing
information.

Change-Id: Ia2e2400ea06b2b904f89ec3ee88527d1ea8f7f38
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-10-16 09:01:28 +03:00
Mariusz Skamra c1ba7644f7 Bluetooth: tester: Add Identity Resolved event implementation
This event will be used to inform tester about PTS identity address.

Change-Id: I3d25c69c3fc9a8d8a728497d1dc1d57084373e97
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-10-16 09:01:28 +03:00
Mariusz Skamra 09c3d8641d Bluetooth: tester: Rework discovery procedure
This moves discovery logic to the tester application.
BTP Start Discovery command flags have been extended with
"Use observation procedure" bit.
For now, Tester can search for devices in limited/general discoverable
mode or those that are broadcasters by setting corresponding flag bits.

Change-Id: I7142e8fdf40a9081787538e433067335d3ee0564
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-10-16 09:01:28 +03:00
Szymon Janc 8661b7c258 Bluetooth: tests: Add init config for BR/EDR SMP testing
This test build where BR/EDR SMP support is enabled without
LE central or singing support.

Change-Id: I61bc17e989a5752500a7d29557609d9e54b6006d
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-10-16 09:00:57 +03:00
Anas Nashif 6ce68cb6cb Bluetooth: tests: Limit BR/EDR tests to only qemu
No other board has BR/EDR support at the moment, and we're too easily
hitting RAM limits on them.

Change-Id: I81c800f979d34bd58f73a34c1038a9327556adb2
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-15 16:49:04 -04:00
Mariusz Skamra d363e384f3 Bluetooth: Enable privacy for nimble
This enables privacy feature for nimble configuration.

Change-Id: I3ffb1f6c54ac0825c73e3943c5634905b4908f16
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-10-04 09:12:25 +02:00
Luiz Augusto von Dentz e889e2ae87 Bluetooth: Enable CONFIG_BLUETOOTH_DEBUG_AVDTP with prj_20.conf
This ensures ADVTP patches are build tested with debug enabled.

Change-Id: I5c09afea4a9df84b054d2383f0b53ff85fa5dcd5
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-10-04 08:12:14 +03:00
Johan Hedberg 566780ca91 Bluetooth: tests: Fix name of Quark SE C1000 SS devboard
This board was recently renamed, but apparently this reference was
left out.

Change-Id: I9789fa45eab6a9b3118f0f0857ef2207311597f3
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-04 08:12:14 +03:00
Arkadiusz Lichwa 71163ac9dc Bluetooth: init: Add HFP to automated tests
Adds HFP HF stack code to automated tests during build coverage.

Change-Id: Ic7bf5f0077b38bbe0feed167935dee73c989a523
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-10-04 08:12:14 +03:00
Mariusz Skamra c76da25cac Bluetooth: tester: Fix advertising data
This fixes data passed to the BTP Device Found event.

Change-Id: I1ab465b87ce24f3ea10b7217c254aafaee494c91
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-10-04 08:12:14 +03:00
Luiz Augusto von Dentz 85f82d7985 Bluetooth: init: Add CONFIG_BLUETOOTH_A2DP to prj_20.conf
This makes sure A2DP support is build tested on each patch.

Change-Id: I9dba5c20d44d8ac92910e80c1ad97ac8d2207652
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-10-04 08:12:14 +03:00
Luiz Augusto von Dentz 4c44e66a5c Bluetooth: init: Add CONFIG_BLUETOOTH_AVDTP to prj_20.conf
This makes sure AVDTP support is build tested on each patch.

Change-Id: Ia7cf94ca84fa01bd676a99b0df58ac745bbfc8c7
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-10-04 08:12:14 +03:00
Luiz Augusto von Dentz 324b3a2948 Bluetooth: init: Add CONFIG_BLUETOOTH_RFCOMM to prj_20.conf
This makes sure RFCOMM support is build tested on each patch.

Change-Id: I9cd60da1b0ab0db2b41487393fb59fe1b415ea01
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-10-04 08:12:14 +03:00
Anas Nashif 179ce1c891 boards: remove obsolete board basic_minuteia
This board is not being used or tested and does not actually
run on any hardware, remove it in favor of well supported boards
for this CPU.

Jira: ZEP-850
Change-Id: I01c825c7eb44d6c321f2ffb88e8899da528921dc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-22 22:09:34 +00:00
Anas Nashif 572f4a1a14 boards: remove obsolete board basic_cortex_m3
This board is not being used or tested and does not actually
run on any hardware, remove it in favor of well supported boards
for this CPU.

Jira: ZEP-850
Change-Id: Ied681b6059ad74f9d019054292c919a9f938e7d3
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-22 22:09:33 +00:00
Johan Hedberg 5cc5141371 Merge bluetooth branch into master
Main changes:

 - Cleanups & refactoring to the native controller code
 - Support for cross-transport pairing from BR/EDR to LE
 - Fix potential deadlock in TX fiber when disconnecting
 - Initial skeleton for the Hands-Free Profile (HFP)
 - Fix to Resolvable Private Address (RPA) updates
 - Added flow control support to RFCOMM

----------------------------------------------------------------
Carles Cufi (21):
      Bluetooth: HCI: Fix the length of supported commands
      Bluetooth: Controller: Switch to Zephyr's hci.h for cmd handling
      Bluetooth: HCI: Add handle to LTK command complete events
      Bluetooth: HCI: Add handle to conn param update command complete
      Bluetooth: Controller: Switch to Zephyr's hci.h for cmd handling
      Bluetooth: Controller: Switch to Zephyr's hci.h for cmd handling
      Bluetooth: Controller: Switch to Zephyr's hci.h for cmd handling
      Bluetooth: Controller: Switch to Zephyr's hci.h for cmd handling
      Bluetooth: Controller: Unify handling of async events
      Bluetooth: HCI: Fix and extend advertising report events
      Bluetooth: HCI: Add auth payload expiry event
      Bluetooth: Controller: Use hci.h for control event handling
      Bluetooth: HCI: Add read remote version info event
      Bluetooth: Controller: Use hci.h for data-control evt handling
      Bluetooth: Controller: Use hci.h for num complete
      Bluetooth: Controller: Remove HCI event definitions from hci.c
      Bluetooth: Controller: Use hci.h for ACL data
      Bluetooth: Controller: Clean up HCI macros
      Bluetooth: Controller: Implement LE_RAND command
      Bluetooth: Controller: Make HCI endianness-independent
      Bluetooth: Controller: Refactor HCI files

Grzegorz Kolodziejczyk (3):
      Bluetooth: tester: Add support for L2CAP connect command
      Bluetooth: tester: Add support for L2CAP disconnect commands
      Bluetooth: tester: Add support for L2CAP listen command

Itankar, Piyush T (1):
      Bluetooth: Init: Updated filiter options for test_20

Jaganath Kanakkassery (1):
      Bluetooth: RFCOMM: Implement RX flow control

Johan Hedberg (2):
      Bluetooth: GATT: Fix potential bt_conn reference leak
      Bluetooth: Fix giving back pkts semaphore when disconnecting

Luiz Augusto von Dentz (3):
      Bluetooth: ATT: Fix not handling error response properly
      Bluetooth: HCI: Fix updating RPA too early
      Bluetooth: eddystone: Fix byteorder of advertisement

Mariusz Skamra (1):
      Bluetooth: tester: Add support for L2CAP send data command

Sathish Narasimman (1):
      Bluetooth: HFP HF: Initialize Handsfree profile

Sukumar Ghorai (1):
      Bluetooth: Pre-allocated RFCOMM Channels

Szymon Janc (16):
      Bluetooth: SMP: Move smp_create_pdu function up in a file
      Bluetooth: SMP: Add initial code for BR/EDR support
      Bluetooth: SMP: Clear keys on timeout when running over BR/EDR
      Bluetooth: SMP: Support Pairing Request over BR/EDR
      Bluetooth: SMP: Support Pairing Failed over BR/EDR
      Bluetooth: SMP: Distribute local keys over BR/EDR
      Bluetooth: Add support for reading encryption key size for BR/EDR
      Bluetooth: SMP: Fix encryption key size check in BR/EDR pairing req
      Bluetooth: SMP: Support Pairing Response over BR/EDR
      Bluetooth: SMP: Allow to force BR/EDR without SC support
      Bluetooth: SMP: Add support for LTK derivation from LinkKey
      Bluetooth: SMP: Add support for sending Pairing Request over BR/EDR
      Bluetooth: SMP: Add support for Identity Information over BR/EDR
      Bluetooth: SMP: Add support for Signing Information over BR/EDR
      Bluetooth: SMP: Add helper for reporting BR/EDR pairing complete
      Bluetooth: SMP: Factor out BR/EDR encryption check to helper

Vinayak Chettimada (4):
      Bluetooth: ATT: Remove unnecessary call to BT_ASSERT
      Bluetooth: log: Call _SysFatalErrorHandler in BT_ASSERT()
      Bluetooth: log: Include nanokernel.h to use BT_ASSERT()
      Bluetooth: Controller: Use BT_ASSERT instead of custom impl.

 drivers/bluetooth/controller/Makefile             |    2 +-
 drivers/bluetooth/controller/hal/clock.c          |    8 +-
 drivers/bluetooth/controller/hal/debug.h          |   27 +-
 drivers/bluetooth/controller/hal/ecb.c            |    2 +-
 drivers/bluetooth/controller/hal/radio.c          |    2 +-
 drivers/bluetooth/controller/hal/rand.c           |    2 +-
 drivers/bluetooth/controller/hal/rtc.c            |    2 +-
 drivers/bluetooth/controller/hci/hci.c            | 2380 +++++++-----------
 .../controller/{main.c => hci/hci_driver.c}       |   23 +-
 .../controller/hci/{hci.h => hci_internal.h}      |   14 +-
 drivers/bluetooth/controller/ll/ctrl.c            |  332 +--
 drivers/bluetooth/controller/ll/ticker.c          |    3 +-
 include/bluetooth/hci.h                           |   56 +-
 include/bluetooth/hfp_hf.h                        |   61 +
 include/bluetooth/log.h                           |   17 +-
 include/bluetooth/rfcomm.h                        |    8 +
 net/bluetooth/Kconfig                             |   23 +
 net/bluetooth/Makefile                            |    2 +
 net/bluetooth/att.c                               |    4 +-
 net/bluetooth/conn.c                              |   45 +-
 net/bluetooth/gatt.c                              |    7 +-
 net/bluetooth/hci_core.c                          |   18 +-
 net/bluetooth/hci_core.h                          |    4 +-
 net/bluetooth/hfp_hf.c                            |  123 +
 net/bluetooth/hfp_internal.h                      |   43 +
 net/bluetooth/l2cap_br.c                          |   15 +
 net/bluetooth/l2cap_internal.h                    |    1 +
 net/bluetooth/rfcomm.c                            |   49 +-
 net/bluetooth/smp.c                               |  953 ++++++-
 samples/bluetooth/eddystone/src/main.c            |    4 +-
 tests/bluetooth/init/testcase.ini                 |    7 +-
 tests/bluetooth/tester/src/bttester.h             |   71 +
 tests/bluetooth/tester/src/l2cap.c                |  306 +++
 33 files changed, 2785 insertions(+), 1829 deletions(-)
 rename drivers/bluetooth/controller/{main.c => hci/hci_driver.c} (94%)
 rename drivers/bluetooth/controller/hci/{hci.h => hci_internal.h} (68%)
 create mode 100644 include/bluetooth/hfp_hf.h
 create mode 100644 net/bluetooth/hfp_hf.c
 create mode 100644 net/bluetooth/hfp_internal.h

Change-Id: I7bc41fb1c53c0f5128a1e4ab38815d19018b603f
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-09-16 13:28:24 +03: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
Itankar, Piyush T d17a803dc9 Bluetooth: Init: Updated filiter options for test_20
Added filter options to avoid building for the Arduino_101
and Quark_se ARC core as there is not enough RAM to run this
test.

Change-Id: I0c1172714c9827e632648fcedc67555251f25769
Signed-off-by: Itankar, Piyush T <piyush.t.itankar@intel.com>
2016-09-15 14:48:22 +05:30
Mariusz Skamra 044e15743d Bluetooth: tester: Add support for L2CAP send data command
Adds support for handling L2CAP send data command.

Change-Id: I120a9ed56506ce205e32c5efe15c5d967d7726b6
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-09-14 08:45:45 +03:00
Grzegorz Kolodziejczyk a4f526fb6b Bluetooth: tester: Add support for L2CAP listen command
This patch adds support for handling L2CAP listen command.

Change-Id: I2c9c27f925c923a14ddb28b41fbefd612b32d63a
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-09-14 08:45:45 +03:00
Grzegorz Kolodziejczyk c4957ea0e8 Bluetooth: tester: Add support for L2CAP disconnect commands
This patch adds support for handling L2CAP disconnect command.

Change-Id: If6f8f3a7485dc8ae270481ed6af4f0a4d4c69fac
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-09-14 08:45:45 +03:00
Grzegorz Kolodziejczyk 086eac4344 Bluetooth: tester: Add support for L2CAP connect command
This patch adds support for handling L2CAP connect command.

Change-Id: I95d27831f65ed6a3e02e1d6e7583baa6890b588c
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-09-14 08:45:45 +03:00
Grzegorz Kolodziejczyk 81e10314ef Bluetooth: tester: Add L2CAP init method
This adds method which initialize data pool for L2CAP data.

Change-Id: I2b170489aa4b2afc3c1f962591f377e23d147161
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-09-07 09:08:47 +00:00
Mariusz Skamra de124844b3 Bluetooth: btp: Extend BTP specification to cover L2CAP tests
This adds commands to the Bluetooth Testing Protocol for L2CAP.

Change-Id: Ie9ea180c4db62c238ce1450e5714ffd7b0ca2f5f
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-09-07 08:17:26 +03: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
Vinayak Chettimada 8e722ef545 Bluetooth: tests: Add BLE controller init tests
Jira: ZEP-702

Origin: Original
Change-Id: I55fa102069db155e8fd461513abbe898f64d8977
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
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 114985a8a8 Bluetooth: tester: Use SYS_LOG_ERR instead of printk
Change-Id: Ideadc7344dcf7d1cdd550623a02d74c8ad9414f5
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-08-10 14:54:19 +00:00
Szymon Janc ffe8f0ccf4 Bluetooth: tester: Fix extra new lines
Change-Id: Ie3de7d7baeaff386f8683624ee1284834495d6de
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-08-10 14:54:19 +00:00
Genaro Saucedo Tejada 58f88179ef sys_log: replace old debug macros at bluetooth tester
Bluetooth tester is now using new system log macros.

JIRA: ZEP-311

Change-Id: I6398f2de12d5ba1073e40fd45aa8e0177d1e279d
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-08-01 18:39:50 +00:00
Mariusz Skamra 602724a91a Bluetooth: tester: Expose device address
This adds device address to the controller_info data. This address
may be used then by PTS for establishing connection etc.

Change-Id: Ic2319c452d94ac79376659ba37b4c9d812ccf9ae
Signed-off-by: Mariusz Skamra <mariusz.skamra@gmail.com>
2016-07-23 06:16:14 +00:00
Mariusz Skamra c06a13a93d Bluetooth: tester: Set privacy flag in current_settings
If CONFIG_BLUETOOTH_PRIVACY is set in Kconfig, current settings
shall indicate it's usage.

Change-Id: I0645aedf1b774617c9d97cec0070908aef919ca7
Signed-off-by: Mariusz Skamra <mariusz.skamra@gmail.com>
2016-07-23 06:16:09 +00:00
Mariusz Skamra 7fe81b92a6 Bluetooth: tester: Add missing GAP_SETTINGS_* defines
Based on BTP specification following GAP_SETTINGS_* flags were added:
GAP_SETTINGS_CONTROLLER_CONFIG,
GAP_SETTINGS_STATIC_ADDRESS

Change-Id: Ic87d13772c0ef9c9bc8bba331c8bc9f3ffc93f87
Signed-off-by: Mariusz Skamra <mariusz.skamra@gmail.com>
2016-07-23 06:15:48 +00:00
Mariusz Skamra a028e43a97 Bluetooth: tester: Send IUT ready event on tester_init
When tester application has been initialized, send this event
to indicate that Upper Tester can send first BTP command.

Change-Id: Id3f4dd246c4e67982057f9518b4b0036e79a6a01
Signed-off-by: Mariusz Skamra <mariusz.skamra@gmail.com>
2016-07-22 20:03:28 +00:00
Mariusz Skamra 3c15027799 Bluetooth: btp: Add IUT ready event
Before sending any command, the tester shall wait for this event
indicating that IUT is ready to accept first BTP command.
This is needed, because some devices need more time to initialize
their stacks, so that the first BTP command can be lost.

Change-Id: I92d1c6ea8be905734037eb29f7f270a70ab1583e
Signed-off-by: Mariusz Skamra <mariusz.skamra@gmail.com>
2016-07-22 19:19:28 +00: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
Andrew Boie afaba4a98b altera_max10: enable and use 16550 UART
The 16550 will now be the default console device.

Change-Id: I92a6b49984b055e7d5f5c97e5192150be0d5c5c7
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-07-15 19:31:44 +00:00
Mariusz Skamra d98b9bd139 Bluetooth: Get the included service 128bit UUID
This adds reading of included service attribute 128bit UUID.
The limitation of this solution is that if several attr handle-range
pairs will be received, this will read first attribute UUID and then
start discovery from the the succeeding handle.

ZEP-373

Discovery related test results:

 2/76   GATT   TC_GAD_CL_BV_02_C   PASS
 3/76   GATT   TC_GAD_CL_BV_03_C   PASS
 4/76   GATT   TC_GAD_CL_BV_04_C   PASS
 5/76   GATT   TC_GAD_CL_BV_05_C   PASS
 6/76   GATT   TC_GAD_CL_BV_06_C   PASS

Change-Id: I27185b3a3ae96c9c03b0f356492df18ba83b183a
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-07-13 14:18:03 +00:00
Mariusz Skamra 997765def2 Bluetooth: tester: Increase prepare write buffers pool for qemu and nble
Buffers pool has to be increased for all configurations.

Change-Id: Id24caced5043c1672ca5f753d1e86d9a72c728ea
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-07-01 14:57:02 +02:00
Mariusz Skamra 940ee5e6e5 Bluetooth: tester: Increase prepare write buffers pool
TP/GAW/SR/BV-10-C test case requires two long values to perform
nested prepare write operation. Using one ATT Execute Write command
this two values are going to be written simultaneously.

Change-Id: I2950409ed8f1d121dcc706b432cdf071b9af00c0
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-07-01 12:34:06 +02:00
Andrew Boie fe40d1071e REVERTME test: bluetooth: init: exclude Nios II JTAG UART
This driver does not yet support interrupt-driven console.
Revert when ZEP-280 is implemented.

Change-Id: Ib430c39138194ab441c95a1b1856c3661102a625
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-30 18:51: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
Mariusz Skamra c474a03c58 Bluetooth: tester: Fix copying attribute to the server_buf
BT_GATT_INCLUDE_SERVICE user_data shall point to the service declaration
of service to be included. So user_data_len shall be set to 0 to avoid
copying the contents of bt_gatt_attr to the server_buf, and just use
pointer to the actual attribute.

Change-Id: Id770daeb6d64644c51f2bc5d3962dd80363ec8c3
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-06-28 10:57:44 +02: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
Mariusz Skamra acc28a9631 Bluetooth: Fix invalid pointer to local variable
attr pointer is local here, so it may be overwritten anytime, because
this attribute user_data will be used out of scobe of this function.

Change-Id: I85b390299980dac213d8ce1939078fe8b242c887
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-06-27 10:49:09 +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
Andrew Boie b6d9c5ca80 bluetooth: init: disble for CONFIG_UART_ALTERA_JTAG
Interrupt-driving UART not implemented yet for this driver.

Change-Id: Ida60d7e09e9eca2d7e6452a84f6d95529d0af9b6
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-22 16:42:20 +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
Luiz Augusto von Dentz 372a8905d5 Bluetooth: tester: Fix write callback not returning errors properly
There is no need for any prepare write variables as this is now handled
transparently by the stack and so any errors that happens during write
shall be reported in the return.

Change-Id: I3e629016cb7f5f6cd9106ff07c3cbb464e81734f
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-06-16 14:57:16 +03: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
Inaky Perez-Gonzalez fcec9e37c0 testcases: sanity check TCs get more language for real HW
Add more specifications or qualify some to the sanity check test cases
for them to be ran in real hardware:

 - kernel types (micro vs nano)
 - platforms / arches to exclude / include
 - one that is removed (for the PCI sample) as it cannot be ran
   without extra information

Change-Id: Id14dc15eb89358c3656d2814ea41bb6fec051278
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-06-14 23:49:56 +00: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
Johan Hedberg e8620aaada Bluetooth: Take advantage of net_buf_get_timeout()
Use the more explicit net_buf_get_timeout() call where it makes sense
(e.g. where we always want to wait or never want to wait).

Change-Id: Id1eabe0ad2f9fa79f7be39e51fefa5161f9cc550
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-02 10:32:29 +00:00
Luiz Augusto von Dentz f6dd1e4144 Bluetooth: Add support for using SYS_LOG
This add CONFIG_BLUETOOTH_DEBUG_LOG which depends on SYS_LOG since the
later can actually use either CONFIG_PRINTK or CONFIG_STDOUT_CONSOLE.

Change-Id: Ib2974d1331f6c91d119a218ec95e8bf01069377b
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-06-01 05:04:10 +00:00
Andrei Emeltchenko 4f696dd779 Bluetooth/shell: Correct confirm shell commands spelling
Change-Id: I832d8898a0e49b2d7b07a9f81193f52f31d45c7d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-31 11:03:25 +00:00
Szymon Janc 7cd474b3d7 Bluetooth: shell: Fix help message for LE address
LE address can be either public or random.

Change-Id: I5578732bd9929da22ef83f78fbe7ad608847a0d7
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-05-30 13:11:25 +00:00
Szymon Janc 743437bc7b Bluetooth: shell: Add support for setting local ID address
This allows to set custom ID address from shell app.

Change-Id: I293800f116a7e56e183720a9b908ccb0e9622c12
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-05-30 13:11:14 +00:00
Javier B Perez fe5aa9f6ae test: bluetooth: disable test for STM32F103RB not enough RAM
Disabled bluetooth test for STM32F103RB SOC because there is not
enough RAM space for the test.

Change-Id: I9f097d9201ed659c4970b67f42c570331b92bad8
Signed-off-by: Javier B Perez <javier.b.perez.hernandez@intel.com>
2016-05-26 11:14:38 -05:00
Mariusz Skamra edc4f30beb Bluetooth: tester: Add support for indications in tester application
This adds support for indications in tester application.

1/3   GATT   TC_GAN_SR_BV_01_C   PASS
2/3   GATT   TC_GAI_SR_BV_01_C   PASS
3/3   GATT   TC_GAT_SR_BV_01_C   PASS

Closes ZEP-403.

Change-Id: I3da8746641429388d38c2593344105f33fb43ee8
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-05-25 15:19:30 +00:00
Andrei Emeltchenko 61367b415d Bluetooth/shell: Correct attribute write error
Return correct errors for long write.

Change-Id: Idfd54d961db9b2023d05a0dcfa7082d63e9c0261
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-25 16:44:51 +03:00
Mariusz Skamra 13d0832142 Bluetooth: tester: Fix invalid type cast
This fixes invalid cast from struct bt_gatt_attr to bt_gatt_chrc.

Change-Id: Idc2c016e26b5d38d2d4772a7bd79af8357a4da58
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-05-25 13:23:19 +00:00
Szymon Janc 44a306293c Bluetooth: shell: Enable TinyCrypt ECC for nimble
This allows to use LE SC with nimble firmware running on Arduino 101
board.

Change-Id: I3a9a485dc87c367160da98010d0189dfef09d5de
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-05-25 09:52:08 +02:00
Andrei Emeltchenko 1216cf0ac4 Bluetooth/shell: Add test vendor service support
Adding test service makes possible to test Bluetooth PTS test cases
with the shell. Currently long and auth characteristic.

Change-Id: I153efd3f7fa266f93873ef978025faf72c664076
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-24 13:19:25 +00:00
Mariusz Skamra 92884a7540 Bluetooth: nble: Extend BTP with Identity Resolved event
This event indicates resolved Identity Address.

Change-Id: If3a323c4661697a53b015aab805d990703d6f884
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-05-23 13:33:55 +02:00
Grzegorz Kolodziejczyk 58339a6c15 Bluetooth: tester: Correct flushed data length
Returned by flush_value function value should be length of data which
are previously prepared by prepare write requests.

Change-Id: Iacfc63527c68cf20a76a4587acc749bd2d00cffd
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-05-23 09:57:44 +00:00
Luiz Augusto von Dentz 7941630e17 console: shell: Add return to command callback
This enable checking for errors and automatically print help string:

btshell> connect
connect <address: XX:XX:XX:XX:XX:XX> <address type: (public)>

Change-Id: Ie097ecddb72ab15bf6192e310d0bd839bfd251d5
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-05-23 11:00:21 +03:00
Grzegorz Kolodziejczyk f1c5282833 Bluetooth: tester: Fix handling execute write error responses
This patch fixes returning invalid offset, invalid attribute length
error. Error should be set during prepare write and returned in
response to execute write request as error response.

Change-Id: I78c57abc5f6f2fbd4a2c0fbb1ee6532212679a36
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-05-20 11:31:33 +00:00
Luiz Augusto von Dentz 592acc09fd Bluetooth: shell: Add help to commands
This adds help strings to commands describing what parameters they take:

btshell> help init
init [none]
btshell> help connect
connect <address: XX:XX:XX:XX:XX:XX> <address type: (public)>

Change-Id: I0b79cb4f2d424f74b0ddb1de7a6d7120e81e2ae3
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-05-19 08:46:01 +00:00
Mariusz Skamra dc62813b83 Bluetooth: tester: Return Insufficient Authorization error from app
This is related to recent changes in GATT permissions.
Authorization permissions were deleted, so that application
may return BT_ATT_ERR_AUTHORIZATION if configured.

Fixes following Test Cases:
1/9   GATT   TC_GAR_SR_BI_03_C   PASS
2/9   GATT   TC_GAR_SR_BI_09_C   PASS
3/9   GATT   TC_GAR_SR_BI_15_C   PASS
4/9   GATT   TC_GAR_SR_BI_25_C   PASS
5/9   GATT   TC_GAW_SR_BI_04_C   PASS
6/9   GATT   TC_GAW_SR_BI_11_C   PASS
7/9   GATT   TC_GAW_SR_BI_17_C   PASS
8/9   GATT   TC_GAW_SR_BI_22_C   PASS
9/9   GATT   TC_GAW_SR_BI_29_C   PASS

Change-Id: I4c37f6d597192acf34ba50910f92d5f06078201f
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-05-18 10:23:03 +00:00
Johan Hedberg 485d023428 Bluetooth: Remove unnecessary #ifdef for micro/nano main function
By calling the microkernel entry point 'main' there's no need to have
extra hacks to share the same c-file with both nano and micro
configurations.

Change-Id: I6623855a87ef8624b2bddb75b95079521e0eab8b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-05-17 12:30:41 +03:00
Andrei Emeltchenko 3382e44cf2 Bluetooth/shell: Fix variable scope
Change-Id: I546583a22c6c149553bc1f7bf74618d3cc94d9f1
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-16 15:54:22 +03:00
Andrei Emeltchenko 2bca790c2a Bluetooth/shell: Add support for GATT long write
Support long write maximum 100 bytes.

Change-Id: I071fdf68e29a3d4493c1c60215853cfd8f2ae3c3
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-16 14:28:36 +03:00
Anas Nashif f62d86c42b samples: get rid of obsolete usage of ARCH variable
Using ARCH variable to select different configurations for the different
architectures is misleading and conflicts with the variable ARCH being used by
the build system.  The variable is not needed, it is application specific and
an application can be built without the need to specify ARCH on the command
line.

This is yet another item specific to samples and test cases that
wrongfully being used and documented for every application.  We need to use
another variable and just make it clear it is specific to samples and how they
are written.  One possible solution is to have a script that gets the
architecture based on the board being used.  Attachments

Jira: ZEP-238
Change-Id: Ieccbc087a41858fb96fb361c0aaa04705e968a4e
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-12 10:57:28 +00:00
Mariusz Skamra 4108321181 Bluetooth: tester: Add Kconfig for nimble stack
Add config file for Arduino 101 board with the MyNewt nimble stack.

Change-Id: I061b1831457d6780af2ea757da918fb17fdcdaf0
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-05-12 10:50:57 +00:00
Grzegorz Kolodziejczyk 486de7aa84 Bluetooth: tester: Fix setting nonconn advertising type
BTP API allows to set only advertising and scan response data without
declaring advertising type. Advertising type is deduced from current
flags status. Scan response data is static in tester - to set non
connectable mode in current BTP API scan response length must be
considered.

Change-Id: I742cd8ec774c24f317d639835844a4743bb25445
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-05-11 11:34:28 +02:00
Luiz Augusto von Dentz 777033f710 Bluetooth: GATT: Make bt_gatt_write take a struct
This makes bt_gatt_write similar to bt_gatt_read where the parameters are
stored in a struct which can be used to store intermediate values while
the operation is in progress.

Change-Id: I3c62af137b99985690cf88dcc37a977a0be891f5
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-05-10 17:55:06 +00:00
Arkadiusz Lichwa c8c078442f Bluetooth: shell: Add BR/EDR PSM server registration
Sets new command in BT shell app to allow register one BREDR PSM server.
Syntax:
>br-l2cap-register <PSM>

Change-Id: Iec6b1f5639d987b0f41b933ab894069fda5dfdc8
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-05-07 07:07:10 +00:00
Mariusz Skamra 22fa025157 Bluetooth: Minor fix missing format specifier
Sample output:
Include 3f54 found: handle 00000021, start 00000040, end 00000045
Include 477a found: handle 00000041, start 000000a0, end 000000a2

Change-Id: I44ef1c5c956d0ff81c08b9f447df676cac8185b8
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-05-05 17:23:49 +00:00
Andrew Boie 3ea7892410 sanitycheck: allow for more expressive filtering in testcase.ini
The old 'config_whitelist' directive in testcase.ini has been removed.
We use the new expr_parser module to parse a 'filter' directive which
is a boolean expression. This gives a great deal more flexibility
in how tests can be filtered.

To keep the tree bisectable, use of config_whitelist in testcase.ini
converted to the new expression language.

Change-Id: I0617319818c5559c0f0569d2fa73d09b681cac51
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-05-04 22:57:39 +00:00
Grzegorz Kolodziejczyk b4ea3209fa Bluetooth: tester: Add possibility to set scan response data
Patch extends le advertising repot with configurable scan response
data.

Change-Id: Ibcbe71d6158ece3e7f63daf33d188a9b0d525384
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-05-04 13:07:02 +00:00
Szymon Janc 6d5ed390b1 Bluetooth: Simplify advertising API
Instead of requiring application to provide both advertising type
and address type used just require app to provide info if advertising
is connectable or not. Advertising type is set based on provided
SCAN_RSP and local privacy support.

When local privacy is enabled it is no longer possible to advertise
using identity address. If such feature is to be required later on
advertising options can be extended.

This gives BT stack full control over what type of address is used
for advertising and is a preparation for random address rotation
and OOB support.

Change-Id: I90e9a683ef3794f155707343c874f75585439325
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-05-04 11:11:34 +00:00
Luiz Augusto von Dentz 6a4d39d5cd Bluetooth: GATT: Fix error type
Callback errors should contain ATT error code not posix errors.

Change-Id: I698fac086ab8b2dca3487ab99ee974b4318d16f7
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-05-02 14:31:02 +03:00
Luiz Augusto von Dentz b76abc0460 Bluetooth: Fix not being able to set CONF_FILE for init test
Change-Id: I750cb062b88fd265c14ae3304ae33cd345683a0f
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-04-29 11:51:18 +00:00
Grzegorz Kolodziejczyk e0922851a1 Bluetooth: tester: Return pre defined db offset on start server
Some IUTs may have predefined attributes in db which aren't take into
consideration while building via tester database. BTP clients should
know about such attribute handle offset change. After start server
we're sure that none of attributes will be added since zephyr db is
constant.

Change-Id: Ia2c6edaa7a2f3ca4a9c88fe00122c808a529dadb
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-04-29 07:52:11 +00:00
Roger Lendenmann 3278f542eb Bluetooth: gatt: include service api definition proposal
* service include macro definition takes reference to
   first service attribute of the included service

Change-Id: Ib2b1defe2c99aea738da791af74a534d56025eae
Signed-off-by: Roger Lendenmann <roger.lendenmann@intel.com>
2016-04-28 10:35:38 +00:00
Szymon Janc 51b91e1a33 Bluetooth: shell: Update advertising command help
Add missing rpa parameter to help message.

Change-Id: I902e0f1308a8f8a8b603873a8ffcb9b03527f6e1
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-04-25 10:15:16 +02:00
Johan Hedberg e3e91d3280 Bluetooth: Add name member to HCI driver struct
This is more of a convenience to let the driver identify itself in
debug logs and the monitor protocol.

Change-Id: I73351477e98d45d6344c180b8088bde29df6f7d9
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-22 18:49:11 +03:00
Johan Hedberg 4488fc6cab Bluetooth: Move HCI device bus information to the driver
The bus that we notify over the monitor protocol is really driver
specific, so let each driver specify their bus type.

Change-Id: Ic3a086fcc06352dbf051e52cef5bf6b8696349ae
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-22 18:49:11 +03:00
Johan Hedberg 8c3add2b6a Bluetooth: tests: Add automated tests for new monitor code
Add two new test cases to exercise the code in monitor.c.

Change-Id: I66ae70e0d3b61d3b852916333019e1ed2c5c6cf4
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-22 18:49:11 +03:00
Szymon Janc 85d44978a5 Bluetooth: shell: Add support for advertising with RPA
This allows to test local privacy feature.

Change-Id: Ib231f9187e353f79fee9237acef0d1ffe9cb2b7d
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-04-22 11:07:19 +00:00
Grzegorz Kolodziejczyk 0d98a3633e Bluetooth: tester: Add support for seqence gatt database
This patch reorganize tester gatt commands to handle also sequence
builded gatt data base

Change-Id: I5fc89c1c498dd2ecf3999bc93e3caffd14f67cb7
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-04-21 13:32:42 +00:00
Johan Hedberg 3fbe227cdd Bluetooth: tests: Add DEBUG_DRIVER to automated tests
Change-Id: I9fa76816ceb1f6a49861a1145ae85394b6a64c80
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-21 10:41:48 +03:00
Johan Hedberg 560956c54d Bluetooth: Kconfig: Split debug selection into a choice
This prepares for adding other debug types besides the printf-style
logging to the console.

Change-Id: Ic2ed305192491734da991c4f61fdaace03fd60f2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-20 17:46:09 +03:00
Johan Hedberg 483fc4705f Bluetooth: samples: Add sample Kconfig for nimble based controllers
Add config files to be used on Arduino 101 (or any Curie-based) board
with the MyNewt nimble stack running on the nRF51 and exposing HCI
over UART. These configs contain a stripped-down set of features so
that the resulting image fits e.g. on the Arduino 101.

Change-Id: I7300e9ca4205de6f52aa6ca1bfe4e0b011b6dcbe
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-19 13:19:02 +03:00
Mariusz Skamra 3bea520c6c Bluetooth: tester: Update tester application README
This adds the guidelines for the tester application building usage.

Change-Id: Ibcd31b7bed827f8eee99fdf21d3bb1e8edd24d2e
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-04-19 06:58:55 +00:00
Johan Hedberg 01e29cf395 Bluetooth: samples/shell: Make more features optional
For memory-constrained platforms (like the Arduino 101) it's desirable
to be able to build a slimmed-down shell app that doesn't contain any
unnecessary features. This patch makes more of them optional.

Change-Id: Ia7f2cc0930dda6dfed5ce020b56913c6e0bc3d6f
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-18 13:46:21 +00:00
Mariusz Skamra 1cfccfda84 Bluetooth: tester: Start using net_buf to store GATT database
With this patch net_buf based heap will be used to store attribute
user_data and UUID. This is the first step to remove gatt_buf.

Change-Id: I578f26b781e01f5f3464c05f7210dc27cdea8edf
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-04-15 16:51:40 +00:00
Grzegorz Kolodziejczyk 38b202e810 Bluetooth: tester: Update server commands with sequence params
Most iuts data base are intended to have its attribute database builded
in sequence and its constant (except attribute values, parameters,
permissions). Patch allows btp specification to cover also devices
which cannot assign an ID right after issuing add attribute command or
set attribute component (which points to defined attribute ID).

Change-Id: Ie8e5ed223609cca2b6e3fb8444065f33b1408142
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-04-15 15:14:23 +00:00
Szymon Janc cdd5851715 Bluetooth: shell: Add confirming incoming JustWorks pairing
This allows to accept or decline incoming pairing that would
otherwise result in JustWorks pairing.

Change-Id: I759ea067ef298b437e0112b8b7ef3bedf106dc52
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-04-15 04:57:41 +00:00
Szymon Janc 01f80c48ff Bluetooth: shell: Use same config for arm and x86 build
There is no need to have separate configs as init sample is now
used for different build configuration tests.

Change-Id: I917692f8a8e96345afc561dd04bdcf08cdfa5de7
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-04-11 11:54:07 +00:00
Johan Hedberg 30601c09bb Bluetooth: Refactor buffer handling for non-host managed buffers
So far the assumption has been that the host stack manages all
incoming and outgoing buffers. For the incoming buffers (from the
controller) this has required hci_core.c to manage its own pools and
do the host flow control. This setup makes perfect sense for an
architecture where the controller resides remotely on a different CPU
& address space (i.e. the "traditional" HCI transport case).

When the stack runs on a system where the controller resides in the
same address space this setup doesn't work that well. In such a
scenario the incoming buffers are ideally created as low down in the
stack as possible (i.e. below HCI), which means that the current
hci_core.c cannot be responsible for managing their pools.

To allow for both types of architectures this patch introduces a new
BLUETOOTH_HOST_BUFFERS Kconfig option that can be selected to say that
host-side management is desired, or deselected to say that the
controller (residing in the same address space) takes care of managing
the incoming buffers.

So far the incoming buffer types were identified by hci_core.c by
looking at their "free pool" pointers, however as soon as the pools
are allowed to be somewhere else this doesn't work. To solve this we
now require a minimum user data size for all Bluetooth buffers and use
that to store the buffer type.

Change-Id: I14bc32007e3e3f17c654f71f79b520650028d7ce
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-11 11:52:29 +00:00
Grzegorz Kolodziejczyk bae91cf980 Bluetooth: tester: Use bt enable cb to indicate cmd rsp success
This is needed especially for nble. If bluetooth is not enabled we
cannot send another commands to tester.

Change-Id: I17e639301bba6efd127f2c743b8942c1b493f9da
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-04-06 17:25:11 +00:00
Johan Hedberg 5ccb20c591 Bluetooth: Use bt_addr_t inside bt_addr_le_t
In many cases when we want to access the 'val' member of bt_addr_le_t
it's in situations where the type needed is actually bt_addr_t. To
avoid unnecessary typecasts in these places simply embed bt_addr_t
inside bt_addr_le_t.

Change-Id: I7eecf129bee1dcf085abc83ec2f32e1a10b0b5aa
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-05 12:29:14 +03:00
Johan Hedberg 13be3947ab Bluetooth: Add Privacy Feature support
Add initial support for the Privacy Feature, including the ability to
manage a local IRK and to use Resolvable Random Addresses.

Change-Id: I1c70aea67078dd2a5d07f3b797c37746ebe9ab61
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-05 12:29:14 +03:00
Maciek Borzecki 9e8e0e8e82 tests: bluetooth/shell: exclude STM32F103RB from microkernel test
For STM32F103RB targets, the SRAM is overflown by 2-3kB in microkernel
test. Platforms with this SoC can still be built for in the nanokernel test.

Change-Id: I012b93cf8dfec74292f7ab228f4b2fca1a4f3444
Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2016-04-01 13:12:57 +00:00
Maciek Borzecki 3b0a701ac1 bluetooth: shell: declare commands as const
Take advantage of shell_init() accepting const commands array. This
moves ~280 bytes from SRAM to the text section.

Change-Id: Id64ee766e3c6cf7ce4cc623a1e21d3dacf33f050
Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
2016-04-01 13:12:57 +00:00
Johan Hedberg cfe54794f2 Bluetooth: tests/shell: Add some help text
Change-Id: I09cdec8c710120219412eccf69ba25e95679ecfb
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-03-31 08:02:22 +03:00
Andrei Emeltchenko 808b4c6230 Bluetooth/shell: Fix wrong memory access
The extended inquiry response data format include at least two octets:
length and type, so adding NULL termination name shall be 240-2+1
octets.

Fixes accessing wrong memory in the statement below:
...
memcpy(name, &eir[2], sizeof(name) - 1);
...

Change-Id: I71be96aed6af63d0649f4d64271208eeb11e2c6c
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-30 11:07:33 +00:00
Yannis Damigos 9d6e0cebed Bluetooth: tester: Fix typo
Fix typo in tests/bluetooth/tester/testcase.ini

Change-Id: I4a2d93cdf709028bc491aa933d1a5819d62afcff
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2016-03-29 17:32:17 +00:00
Szymon Janc e7daa90d6b Bluetooth: shell: Add support for BR/EDR discovery
This add shell commands to start and stop BR/EDR discovery.

Change-Id: Id7ea2c75a06842afd02708424930b27cfb65a1e9
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-03-25 19:28:33 +00:00
Szymon Janc a4836f4da4 Bluetooth: shell: Make cmd_gatt_mread static
This function is not used outside of main.c.

Change-Id: Ia8cc6c2b2193906dd77d031b73d289c6acd128b2
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-03-24 18:39:04 +00:00
Andrei Emeltchenko f4696286b4 Bluetooth: Fix using uninitialized value
Assign value before using.

Change-Id: I67f0e7195c979bf7547c0f718eeaef5e366b447d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-24 15:10:31 +02:00
Szymon Janc 6f9ce0b417 Bluetooth: Provide more config options to init sample
This allows to excersize different kconfig configurations in
single app. Thanks to this other samples don't have to get
extra extra options enabled just to improve test build coverage.

Change-Id: Ie5d261f3d38c60e227cf963d938b6fac6d0fb3b9
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-03-23 12:50:30 +00:00
Grzegorz Kolodziejczyk 5a3d40beec Bluetooth: tester: Add LE scan type flags and support
Now start discovery GAP function interprets scan type flags (active,
passive) and starts discovery with specific LE scan parameters.

Change-Id: Iecb942e24d68790966afe893d3543433c33192dc
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-03-21 11:17:50 +00:00
Mariusz Skamra 9c23e24da5 Bluetooth: tester: Refactor Set Value command handler
Since user_data can be added with gatt_db_add, Set Value
command handler can be simplified.

Change-Id: I86d3ed411cc897488e9073492ff85e0754b2ab93
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-03-21 11:17:15 +00:00
Daniel Leung fa868a7846 drivers: bluetooth: nble: restructures Bluetooth Kconfig options
This moves both the Bluetooth HCI and NBLE drivers under
"Bluetooth Drivers" category. This also adds a selection for
choosing Bluetooth stacks as the bulk of both HCI and NBLE stacks
cannot be compiled together.

Note that this does not move the source files. That should be
done in a separate change.

Change-Id: I32fa7097ada0fdc52bcc745adb78c7273f4023c6
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-03-19 00:23:11 +00:00
Mariusz Skamra f84bf33aca Bluetooth: tester: Return BTP error if requested unknown attr ID
With this patch BTP error will be returned if attribute with
requested ID don't exist in GATT attribute database.

Change-Id: Ic6125c6359e75a80fb9a51b6a527ee0a98628e6d
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-03-18 15:19:18 +00:00
Szymon Janc bf497e959a Bluetooth: shell: Add support for outgoing BR/EDR connections
This allows to initiate BR/EDR connection with specified address.

Change-Id: I99f0d7dff29384926d3bf739831c7460a7fb5f68
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-03-14 16:03:20 +00:00
Luiz Augusto von Dentz f206d86c10 Bluetooth: GAP: Add service sample
This adds a GAP service sample and make use of it in shell test which had
a copy of this code.

Change-Id: I5f03fb7db5349236e41bc30eb884c134136439e3
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-03-11 11:32:13 +02:00
Andrei Emeltchenko 489b0ff793 Bluetooth/shell: Clear subscription on gatt_unsubscribe()
Clear subscription allowing to test subscribe / unsubscribe in
sequence.

Change-Id: Ife8b994410107f05c23687e3fb23b4a81cad8ce7
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-10 15:40:36 +00:00
Andrei Emeltchenko 1ec4ec237b Bluetooth/shell: Print handle in hex instead of decimal
Change-Id: Id8654b5c58c3d4f3f157725e550091dd112de4a0
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-10 15:40:21 +00:00
Grzegorz Kolodziejczyk 2c121675f5 Bluetooth: tester: Add support for get supported l2cap commands
This adds support for get supported commands of l2cap service.

Change-Id: Ic3e2b6502c05a5784d1fd01af0e47cce11e6d2c9
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-03-09 10:21:46 +00:00
Grzegorz Kolodziejczyk 5d74aecf52 Bluetooth: tester: Add initial support for l2cap service
This patch adds initial declaration of l2cap service in tester
application.

Change-Id: I9bd729bc351b2fe135e7b5b80262b45eaf70b10b
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-03-09 10:21:17 +00:00
Szymon Janc 6116d58b02 Bluetooth: Use bt_auth_cancel for pairing cancel
bt_auth_cancel can be used to cancel any type of pairing.

Change-Id: Ia1a6ba834186ab6d5082d3eb473319c2d70cf4a7
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-03-08 15:38:59 +00:00
Mariusz Skamra 9e5854c16c Bluetooth: tester: Refactor adding attributes to the GATT database
This patch makes adding attributes more clean.
Attribute UUID and user data are now added along with the attribute
in gatt_db_add function. Thanks to that, some static variables have
been deleted, and the code is more readable.

Change-Id: I510bd7a1a9ae0210dd90520212a340ee1a3b2b53
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-03-07 18:21:52 +00:00
Andrew Boie b54355050d REVERTME: bluetooth: tests: disable some tests
bluetooth/shell and bluetooth/tester need to be disabled on
galileo and minnowboard respectively. On these platforms,
the IRQ for the UART console and the H4 are the same IRQ line.
IRQ_CONNECT() is being called on the same IRQ line twice, and
it's only through linker luck that these tests work at all
since one driver will "win" when the mapping is set up at build
time by gen_idt.

gen_idt was supposed to break the build in this situation but
was bugged. The next patch in the series fixes gen_idt.

Change-Id: Ib4a42b57181731121dfad50606c8362a9fd0277d
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-03-03 10:24:25 +00:00
Mariusz Skamra 8a186d4eab Bluetooth: tester: Fix missing le to host order conversion
This fix missing conversion of CEP properties.

Change-Id: Ibdf9fecdb3e21e8fd5e2b7ccacb88ae2abd81776
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-03-03 08:18:39 +00:00
Mariusz Skamra 9055bfe58f Bluetooth: tester: Fix missing bit in GAP supported commands
GAP_CONNECT bit was missing in supported commands.

Change-Id: I9d009c55327ae67bed38c45b7c11fb67665e1cd0
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-03-02 11:38:00 +01:00
Mariusz Skamra c76bd33d61 Bluetooth: tester: Fix supported commands to use uint8_t array
Fixes endianess issues.

Change-Id: I9c308187d34a832cc875c9037235cedc8bee033c
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-03-02 11:38:00 +01:00
Mariusz Skamra 0abe6e85ba Bluetooth: btp: Fix BTP GATT command opcodes
This patch makes opcodes to be in the sequence.
Supported commmands is form now uint8_t array, so this resolves
the problem with endianess as well.

Change-Id: I602a58081948dbbf5e0d83cbb12a118a5990b9f8
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-03-02 11:38:00 +01:00
Mariusz Skamra 084405c2c4 Bluetooth: tester: Remove set_ccc_value helper
CCC user data is already available on the initialization
(struct bt_gatt_ccc_cfg and ccc_cfg_changed callback).

Change-Id: Id06c69b6da33f651bc049983179cd6fe3bc197d6
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-22 10:09:50 +00:00
Mariusz Skamra e561f7c021 Bluetooth: tester: Refactor gatt_buf_add and gatt_buf_reserve functions
This removes a bit of redundant code.
gatt_buf_reserve can call gatt_buf_add with data set to NULL, to
reserve space on gatt_buf.

Change-Id: I533a515bbd022a07ba8e2bfb3cd07e1a9ff8878b
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-22 10:09:34 +00:00
Mariusz Skamra 9d862b2a61 Bluetooth: tester: Fix initialization of static variables
Static variables are already initialized to zero.

Change-Id: I8da4b6d93192f5534fbe55622c4ee890c0297de1
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-22 10:09:16 +00:00
Mariusz Skamra cd272cadfb Bluetooth: tester: Use BT_UUID defines for UUID comparisons
Defined BT_UUID for the header can be used instead of struct member.

Change-Id: I55ca069d04622450e4fbb1e3f7abf6fdef2f8f30
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-22 10:09:05 +00:00
Johan Hedberg bab3b49fdb Bluetooth: Change GATT callback return values to ssize_t
Since the return value of these callbacks is a number of bytes ssize_t
is more appropriate than int.

Change-Id: I3406fb382975d62f51e7a195666d0ae88364fd2c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-20 15:39:33 +00:00
Johan Hedberg dfaafb204f Bluetooth: Use BIT() macro wherever possible
Instead of manually creating bit shifts for individual bits use the
BIT() macro that exists for this purpose.

Change-Id: I599ecc16b3a2cffe8a355e19816c405e51937e91
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-19 10:47:29 +02:00
Mariusz Skamra fc7bc7cffb Bluetooth: tester: Use common write without response command handler
There is no point having separate handlers for signed writes and
write without response commands because both call the same,
bt_gatt_write_without_response function.

Change-Id: Ib033ffb77e2123dd565e8f1119ef668253f810f9
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-18 11:41:11 +01:00
Johan Hedberg a72d967d33 Bluetooth: GATT: Expose ATT error codes to application callbacks
Introduce BT_GATT_ERR macro to make it possible for application
callbacks to return exact ATT error codes.

Change-Id: I971536508e75036fbddc40b3f33e5201e11940bc
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-17 15:05:34 +00:00
Mariusz Skamra 89fbdeef9a Bluetooth: btp: Fix permission bits
This splits Authorization permission to Read with Authorization
and Write with Authorization.

Some attribites may be readable with no authorizarion, but writable
with authorization defined by a higher layer specification or be
implementation specific (eg. Server Characteristic Configuration
Descriptor).

Change-Id: I341a7095c1e8db1dea92cdeebf76c5a2307a49a1
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-17 14:09:25 +00:00
Andrei Emeltchenko 92cd5c9529 drivers/nble: Decrease shell debug
Makes shell output readable by disabling extensive debug from UART
driver.

Change-Id: Ic8df252c8ca4abd6b021db11d266f4db80df4b09
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-16 15:44:32 +00:00
Szymon Janc ea085c4b47 tests: Fix Bluetooth tests and samples platform blacklisting
To exclude platform platform_exclude=foo should be used and not
platform_whitelist=!foo.

Change-Id: I4cddcd3b73e0bd8c42a0726776f8237ebd79a6ae
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-15 15:06:53 +00:00
Szymon Janc 3e00c7ad0e tests: Simplify test_bluetooth configuration
Use common config for tests and use testcase.ini for defining micro
and nano kernel variants.

Change-Id: I47453cd49696dd496cc728cc1eb2eba9cf7f1c6c
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-15 12:57:57 +01:00
Szymon Janc c5d2e76048 Bluetooth: Merge init_h5 into init test
There is no need to have spearate app for H5 testing as init test can
use multiple configuration targets.

Change-Id: I467b5939ae914e7c1ac22fdac24d8b0b6ed3f1cf
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-15 09:40:30 +01:00
Anas Nashif 8afd0c993f samples: move bluetooth shell/init to tests
Combine both nano and micro tests and cleanup whitelisting
for the testcases to include all buildable boards.

Change-Id: I28d41b82fb60d75d4b172d9dd3ac7e71480053b8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-14 19:25:31 +00:00
Johan Hedberg 1589a22650 Bluetooth: samples: Move init and shell to tests
The init, init_h5 and shell are not really samples but fit better in
the test category.

Change-Id: Id1a7ff31ad8767f858705bd952311cf64ff1f3f2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-12 10:46:32 +02:00
Anas Nashif 8290b4c795 move include directory for tests cases to tests/
Make the test case routines reside under tests.

Change-Id: Iea59a68e8b537954250d63923a88df267639e716
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-11 18:08:08 +00:00
Anas Nashif 13b3727e6e tests: move kernel tests to tests/
Move all kernel testcases to tests/ and change Makefiles
accordingly where applicable.

Change-Id: I130cc3919174e93b7130d55fb101bed1d5d7552d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-11 18:06:33 +00:00
Anas Nashif 2e4de760be tests: move bluetooth tests to tests/
Move all bluetooth testcases to tests/ and change Makefiles
accordingly where applicable.

Also fix Makefile to make some variables overridable and reduce
level of whitelisting in testcase.ini.

Change-Id: Ia71ee1fbbb238c45280b1e3c4747ca2f748f5263
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-11 18:00:35 +00:00