Commit graph

923 commits

Author SHA1 Message Date
Andrei Emeltchenko 44a3cca2e2 usb: Remove default Vendor and Product ID
Vendor ID and Product ID should be assigned on build time by
respective process.

For sanity check we assign some random values which are only used for
build tests and should not be used for real products.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2017-10-19 09:30:58 -04:00
Johan Hedberg ee107baad9 samples: mesh_demo: Use second button to change target address
It's been observed that that the relay toggling functionality is not
very useful, and that it's better left enabled always. Change the
purpose of the second button to instead modify the target address that
messages sent through the first button get directed to. By default the
destination is the group address, i.e. all nodes receive the message.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-10-18 16:08:22 -04:00
Anas Nashif 0356590df5 tests: samples: fix yaml syntax
Fix indentation and syntax and make it pass yamllint tool.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-15 08:15:00 -04:00
Anas Nashif 18a33edd39 usb: fix local includes and add usb namespace
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-10-03 14:50:14 -04:00
Johan Hedberg d712a4e1a3 Bluetooth: Mesh: Remove local network interface Kconfig option
From section 3.4.5.3 in the Mesh Profile Specification 1.0:

    "A node shall implement a Local Network Interface."

Removing the Kconfig option also helps clean up quite a lot of code.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-09-27 16:33:06 +03:00
Luiz Augusto von Dentz 9b5d3f174f Bluetooth: ipsp: Add dedicated conf file for CONFIG_NET_L2_BT_ZEP1656
CONFIG_NET_L2_BT_ZEP1656 shall only be used with hosts that are known to
not comply with RFC 7668.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-09-22 07:27:34 +03:00
Luiz Augusto von Dentz a4e176b6a3 Bluetooth: ipsp: Add note about the Linux 4.12 kernel release
Since 4.12 Linux kernel has fixes required to comply to RFC 7668.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-09-22 07:27:34 +03:00
Luiz Augusto von Dentz b81ab53f89 Bluetooth: ipsp: Add CONFIG_NET_APP_BT_NODE=y to prj_dbg.conf
CONFIG_NET_APP_BT_NODE is required in order for the Bluetooth L2 driver
to register IPSS service.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-09-22 07:27:34 +03:00
Andrei Emeltchenko 4efaefba5c usb: Allow to select configuration for composite devices
Composite multifunction USB devices should be able to know about
configuration change, implement it through existing callback.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2017-09-21 09:00:23 -04:00
Luiz Augusto von Dentz 154f32d9ca Bluetooth: ipsp: Remov ipss.c
This file is no longer needed as IPSS service is already enabled with
CONFIG_NET_L2_BT.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-09-18 10:21:11 -04:00
Carles Cufi 43fa93f682 samples: bluetooth: hci: Fix TX memory leak
Whenever a buffer is sent to the driver via bt_raw using bt_send() the
buffer might not be consumed if an error is returned. In that case
unreference the buffer to avoid leaking the already allocated net_buf.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-09-13 14:17:32 +02:00
Sebastian Bøe 76537ad1dd samples: Add bbc_microbit to hci_uart's whitelist
bbc_microbit has been observed to regress on this sample and is
therefore a good candidate for CI.

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-09-07 07:04:22 -05:00
Carles Cufi 80e0f7939e Bluetooth: controller: Add DTM HCI commands
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-09-04 06:08:09 -04:00
Vinayak Kariappa Chettimada 6a39ed084f Bluetooth: controller: Add Minimum Number of Used Channels Proc
Add implementation to support Bluetooth 5.0 Minimum Number
of Used Channels Procedure.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-08-21 08:41:56 -04:00
Ricardo Salveti 4ff2c33451 Bluetooth: samples/hci_spi: increase BT_RX_BUF_COUNT to 10
Default BT_RX_BUF_COUNT value is not enough when transfering a large
amount of data (e.g. heavy network traffic over BT 6LoWPAN). Increase
BT_RX_BUF_COUNT from default value 3 to 10.

Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2017-08-17 08:20:18 +03:00
Paul Sokolovsky 7ef28df980 Bluetooth: samples: ipsp: Fix crash on TCP connection closure
Be sure to check for NULL pkt in receive callback, which means TCP
EOF. The fix ported from echo_server sample.

Jira: ZEP-2423

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-08-16 23:40:11 +03:00
Marti Bolivar cf9a5e352f doc: 96Boards Carbon: add Bluetooth setup docs
Add cross-referenced information on the 96b_carbon and
96b_carbon_nrf51 pages which disambiguates between the two "boards".
Also describe how to flash 96b_carbon_nrf51 with
samples/bluetooth/hci_spi and 96b_carbon with samples/bluetooth/ipsp
to support a Bluetooth HCI stack on 96Boards Carbon (the physical
board).

While we're here, make the documentation page for 96b_carbon match the
format in doc/templates/board.tmpl.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-08-15 22:58:02 +03:00
Marti Bolivar 7394401baf Bluetooth: ipsp: use sys_log
Various of the printk messages in this sample app don't have
newlines. Let's fix the output by moving to SYS_LOG_xxx() macros
instead, which don't need them anyway.  This also makes it easier to
tell errors apart from other messages, etc.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-08-15 22:58:02 +03:00
Ricardo Salveti 8dbb388000 samples: Bluetooth: add HCI SPI raw handler sample
Add a sample application that allows a Zephyr-based Bluetooth
controller to interface with an HCI driver via SPI. This sample
implements the same BT SPI protocol already as Zephyr's HCI SPI
driver.

Currently, the sample only supports the legacy SPI API.

Provide a single configuration file, avoiding board-specific
files. Some board-specific configuration information must be provided
via other means:

- CONFIG_BT_CONTROLLER_TO_HOST_SPI_DEV_NAME
- CONFIG_BT_CONTROLLER_TO_HOST_SPI_IRQ_DEV_NAME
- CONFIG_BT_CONTROLLER_TO_HOST_SPI_IRQ_PIN

Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-08-15 22:58:02 +03:00
Carles Cufi d5c13a7530 Bluetooth: controller: Rename Kconfig prefix
Rename the BT_CONTROLLER prefix used in all of the Kconfig variables
related to the Bluetooth controller to BT_CTLR.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-08-14 15:44:56 +03:00
Johan Hedberg 2975ca0754 Bluetooth: Kconfig: Rename CONFIG_BLUETOOTH_* to CONFIG_BT_*
The API name space for Bluetooth is bt_* and BT_* so it makes sense to
align the Kconfig name space with this. The additional benefit is that
this also makes the names shorter. It is also in line with what Linux
uses for Bluetooth Kconfig entries.

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

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-08-09 11:14:19 +03:00
Johan Hedberg 51252bdea4 Bluetooth: samples/mesh_demo: Fix tune generation with sharp notes
The parsing of strings with sharp notes (e.g. "100C#") was incorrectly
implemented. Now it should be correct. Additional benefit is that this
should fix Coverity CID 173632.

Jira: ZEP-2467

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-08-08 13:10:29 +03:00
Johan Hedberg bf8e504588 Bluetooth: Mesh: Fix duplicate const declarations
Remvoe duplicate const declarations which may cause compiler warnings.

Jira: ZEP-2442

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-08-07 19:18:02 +03:00
Luiz Augusto von Dentz e57b7ec4ba Bluetooth: ipsp: Use CONFIG_NET_APP_BLUETOOTH_NODE
Make use of CONFIG_NET_APP_BLUETOOTH_NODE to enable advertising and
registering the necessary services.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-08-04 18:18:40 +03:00
Johan Hedberg 0be8414e2f Bluetooth: samples/mesh: Increase GATT TX buffer count
Count of 4 seems to cause deadlocks with some Android phones due to
other GATT activity in addition to Mesh related data.

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

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

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

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

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

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

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

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

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

Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2017-07-27 14:09:40 -04:00
Johan Hedberg ee3b715d1d Bluetooth: samples/mesh: Update generic nRF51 16k configuration
Update the configuration with the latest fine-tuning that was already
present in microbit.conf.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-07-27 13:51:34 -04:00
Johan Hedberg 28ce610a06 Bluetooth: samples/mesh: Disable unnecessary debug logs
There's no need for debug logs by default in the mesh sample, and it
just contributes excessively to the ROM footprint.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-07-27 13:51:34 -04:00
Anas Nashif 977537107e samples: mesh: build sample where they fit
Not easily done using RAM/ROM filters, configurations need to be adapted
to make this fit on more devices. Limit the target platforms now while
we figure out configurations.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-27 07:47:53 -04:00
Anas Nashif 9f642c4291 samples: mesh: build only on BLE platforms
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-07-26 07:23:14 -04:00
Paul Sokolovsky 4732452a42 samples: bluetooth: ipsp: Bump max number of contexts
This sample includes builtin UDP and TCP echo servers, max
MAX_CONTEXTS=3 as set previously, they just didn't work.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2017-07-22 10:33:29 +03:00
Johan Hedberg 0ec2630882 Bluetooth: Mesh: Add initial implementation
Add an initial implementation for the Bluetooth Mesh Profile
Specification. The main code resides in subsys/bluetooth/host/mesh and
the public API can be found in include/bluetooth/mesh.h. There are a
couple of samples provided as well under samples/bluetooth and
tests/bluetooth.

The implementation covers all layers of the Bluetooth Mesh stack and
most optional features as well. The following is a list of some of
these features and the c-files where the implementation can be found:

 - GATT & Advertising bearers (proxy.c & adv.c)
 - Network Layer (net.c)
 - Lower and Upper Transport Layers (transport.c)
 - Access Layer (access.c)
 - Foundation Models, Server role (health.c & cfg.c)
 - Both PB-ADV and PB-GATT based provisioning (prov.c)
 - Low Power Node support (lpn.c)
 - Relay support (net.c)
 - GATT Proxy (proxy.c)

Notable features that are *not* part of the implementation:

 - Friend support (initial bits are in place in friend.c)
 - Provisioner support (low-value for typical Zephyr devices)
 - GATT Client (low-value for typical Zephyr devices)

Jira: ZEP-2360

Change-Id: Ic773113dbfd84878ff8cee7fe2bb948f0ace19ed
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-07-20 09:30:44 +03:00
Luiz Augusto von Dentz ca9c8a2627 Bluetooth: ipsp: Remove requirements section
All supported driver are HCI based so there is no need have it state on
the README.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-07-17 17:45:46 +02:00
Luiz Augusto von Dentz 94409a14ae Bluetooth: ipsp: Disable debug options
This disable debug options in order for the image to fit in boards
such as arduino_101 and quark_se_c1000_devboard.

For convenience this adds another configuration file with as it was
available previously which can be build using:

make CONF_FILE=prj_dbg.conf

JIRA: ZEP-2378
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-07-12 17:37:45 +03:00
Geoff Gustafson 1405627c37 net: context: Use K_NO_WAIT instead of 0 for timeout
Signed-off-by: Geoff Gustafson <geoff@linux.intel.com>
2017-07-10 10:59:28 +03:00
Kumar Gala 5920acef8a samples: mark samples that require usb_device support
Add depends_on usb_device for those samples that need it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-07-07 09:01:01 -05:00
Jukka Rissanen 3604c391e6 net: udp: Remove NET_UDP_HDR() macro and direct access to net_buf
Remove NET_UDP_HDR() macro as we cannot safely access UDP header
via it if the network packet header spans over multiple net_buf
fragments.

Fixed also the UDP unit tests so that they pass correctly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-07-07 15:24:00 +03:00
Carles Cufi c170855825 Bluetooth: hci_uart: Set the UART TX size correctly
Since the controller comes with a transmit buffer size that mirrors the
maximum size of a transmit packet, use that to size the buffers that are
used in the hci_uart application to receive packets from the Host over
the UART.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-07-05 16:59:31 +02:00
Johan Hedberg 30beef9419 Bluetooth: GATT Introduce BT_GATT_CCC_MAX helper define
The worst-case maximum number of CCC entries we need is actually
MAX_CONN + MAX_PAIRED. Provide a helper define for it and use it
whenever appropriate.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-07-04 17:30:40 +03:00
Vinayak Kariappa Chettimada 6cc00f0ee3 Bluetooth: samples: scan_adv: Select BROADCASTER and OBSERVER
Explicitly select CONFIG_BLUETOOTH_BROADCASTER and
CONFIG_BLUETOOTH_OBSERVER in the scan_adv sample.

If the Controller is included without connections support
then only broadcaster support is compiled in by default,
hence add broadcaster and observer role support explicitly
in the prj.conf file.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2017-06-30 13:42:33 +03:00
Johann Fischer 08df5961b3 arch: intel_quark: use DW device driver when USB is selected
This patch allows more generic USB configuration in the samples
and removes platform dependent driver configuration.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2017-06-28 15:14:15 -04:00
Anas Nashif 6ff291a174 tests: do not exclude quark_d2000_crb
quark_d2000_crb does not build net/bluetooth tests by default now.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-27 17:44:23 -04:00
Anas Nashif 3c50f7aa12 tests: samples: remove duplicate filtering
We have many testcases doing filtering both on the architecture level
and the platform level, which is redundant. Also many testcases are
running the same test twice on the same SoC for no good reason, cleanup
the tests and cleanup the filtering.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-27 17:44:23 -04:00
Anas Nashif 3afb47887f samples: hci_uart: optimize testcase definition
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-22 09:22:48 -04:00
Carles Cufi 634d3b46a9 Bluetooth: Set hci_uart RAM config to fit privacy
With the introduction of privacy, the system workqueue is now being
linked into the image, growing the RAM footprint considerably.

In order for the sample to fit in QFAA and QFAB variants of the nRF51
(16KB of RAM) we reduce the workqueue stack size to 512 since the RPA
update mechanism doesn't use more than 340 bytes and we stick to 16
connections maximum.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-06-22 14:40:23 +03:00
Anas Nashif 470c5f3189 tests: remove testcase.ini files
We now use yaml files.

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

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-21 20:56:53 -04:00
Anas Nashif 397d29db42 linker: move all linker headers to include/linker
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-06-18 09:24:04 -05: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
David B. Kinder 342bdda760 doc: spelling fixes in samples/ and boards/
regular spelling check on .rst files

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-06-12 18:28:08 -04:00
Andrew Boie e87eacacfa samples: use K_THREAD_STACK_DEFINE macros
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-06-09 18:53:28 -04:00
Sharron LIU 3970cd4a87 samples: fixed typo in README.rst
Per ISSM team feedbacks:
“demostrating” >> “demonstrating”
“demonstates” >> ”demonstrates”

Signed-off-by: Sharron LIU <sharron.liu@intel.com>
2017-06-07 22:53:54 -04:00
Luiz Augusto von Dentz f8c4a34663 Bluetooth: ipsp: Enable CONFIG_BLUETOOTH_SHELL
This enabled testing CONFIG_BLUETOOTH_SHELL with configuration other
than btshell and enables ipsp sample to use bt shell module which
allows to disconnect, print metrics, etc.

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
Carles Cufi 6c9e563c92 Bluetooth: Move common code to common/
Since more and more code is going to be reused by both the Host and the
Controller, this commit introduces a common/ folder that will contain
everything that is not tied to one of the two components but shared by
them.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-05-12 12:56:14 +03:00
Andrew Boie 39962dc92c samples: use k_thread_create()
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-05-11 20:24:22 -04:00
Johan Hedberg 18593e74e1 Bluetooth: samples: Fix passkey display
Passkeys are always 6 digits in length and should therefore be
zero-padded if necessary.

Jira: ZEP-2113

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-05-05 11:25:57 +03:00
Carles Cufi 689bd232f8 Bluetooth: Reshuffle Kconfig options
In order to achieve proper sharing of configuration options, everything
that is common to both the Host and the Controller should now be placed
in the top-level Kconfig file, and Controller-only options are in the
controller/ Kconfig one.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-05-04 11:27:04 +03:00
Carles Cufi 7a0588ac9f samples: bluetooth: Set DT baud rate for nRF5x boards
Since most of nRF5x-based boards can be used either as a standalone
development kit or as a BLE controller to connect to an external host,
add DT overlays so that the baud rate is correctly set to 1Mbit/s
whenever building the hci_uart sample application.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-05-03 08:43:17 -05:00
Kumar Gala e547533435 samples: 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: I08c682bfc0b80dfa88de859e90a011bcd2db2762
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 09:53:53 -05:00
Jukka Rissanen da6eba463d Bluetooth: ipsp: Fix compile error in sample app
Some incompatible changes were introduced when net and bluetooth
branches were changed at the same time.

Change-Id: Ifa03f85d26a63ade0fcc029377d54850c0e92451
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-04-21 15:44:20 +03:00
Tomasz Bursztyka e5896906f6 net: Rename all *_BUF() macros to *_HDR()
Most of these macros are not exactly exposing a buffer, but a specific
header pointer (ipv6, ivp4, ethernet and so on), so it relevant to
rename them accordingly.

Change-Id: I66e32f7c3f2bc75994befb28d823e24299a53f5c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:51 +03:00
Tomasz Bursztyka db11fcd174 net/net_pkt: Fully separate struct net_pkt from struct net_buf
- net_pkt becomes a stand-alone structure with network packet meta
  information.
- network packet data is still managed through net_buf, mostly named
  'frag'.
- net_pkt memory management is done through k_mem_slab
- function got introduced or relevantly renamed to target eithe net_pkt
  or net_buf fragments.
- net_buf's sent_list ends up in net_pkt now, and thus helps to save
  memory when TCP is enabled.

Change-Id: Ibd5c17df4f75891dec79db723a4c9fc704eb843d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:50 +03:00
Tomasz Bursztyka bf964cdd4c net: Renaming net nbuf API to net pkt API
There have been long lasting confusion between net_buf and net_nbuf.
While the first is actually a buffer, the second one is not. It's a
network buffer descriptor. More precisely it provides meta data about a
network packet, and holds the chain of buffer fragments made of net_buf.

Thus renaming net_nbuf to net_pkt and all names around it as well
(function, Kconfig option, ..).

Though net_pkt if the new name, it still inherit its logic from net_buf.
'
This patch is the first of a serie that will separate completely net_pkt
from net_buf.

Change-Id: Iecb32d2a0d8f4647692e5328e54b5c35454194cd
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-04-21 14:19:50 +03: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
Luiz Augusto von Dentz 617842edde Bluetooth: ipsp: Add TX pools for TCP
TCP requires buffers to be acked thus it retain a reference, but L2
driver actually consumes the buffer so it needs a context pool to store
to original ones.

Change-Id: Ie9083ab361d3674c33080f9e7e6c7248aaf7abc3
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-04-20 08:58:09 +03:00
Sathish Narasimman 1f5a809178 Bluetooth: HFP HF: Add support for RING indication cb
This patch adds support for incoming RING indication callback to
notify application.

> ACL Data RX: Handle 256 flags 0x02 dlen 16   [hci0] 167174.600312
      Channel: 65 len 12 [PSM 3 mode 0] {chan 1}
      RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
         Address: 0x0b cr 1 dlci 0x02
         Control: 0xef poll/final 0
         Length: 8
         FCS: 0x9a
        0d 0a 52 49 4e 47 0d 0a 9a                       ..RING...

Change-Id: I0469590a77d619f2a842df647d84f4d56dbd4883
Signed-off-by: Sathish Narasimman <sathish.narasimman@intel.com>
2017-04-08 20:11:54 +03:00
David B. Kinder 2bfff175ab doc: add labels to bluetooth sample docs
Docs need a label at the top so we can use :ref:`labelname`
to create a link to that doc from other docs.

Change-Id: Ide66f75ca8fac0d5f65fbfc50dc9d130cf45b392
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-04-04 19:51:27 +00:00
Tomasz Bursztyka 0f18ce44f9 net: Rename Kconfig.samples and its main option for future changes
s/SAMPLES/APP for name shortening. Applying the change where relevant.

Not only IP addresse will be available as samples settings there but
also IEEE 802.15.4 channel, pan_id, and more for instance.

Change-Id: I05dd24989bd0c804d9588092d67044a3e063bc88
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2017-03-31 11:24:26 +02:00
Luiz Augusto von Dentz 4fb0724a55 Bluetooth: ipsp: Fix checking for NULL pointer
This may cause static analyser error such as the following:

  Null-checking "tmp" suggests that it may be null, but it has already
  been dereferenced on all paths leading to the check.
             if (tmp) {

Change-Id: Id04f8d052d8128003d5b91f7a8303940529ef261
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-03-21 17:05:42 -07:00
Jukka Rissanen d32503f57e net: nbuf: Split one global DATA pool to RX and TX DATA pools
If we receive lot of packets, it might happen that we exhaust
all the DATA buffers in the system. This would prevent from
us sending anything to the network.
Change this by splitting the DATA buffer pool into RX and TX
parts. This way RX flooding cannot consume all DATA buffers
that needs to be sent.

Change-Id: I8e8934c6d5fdd47b579ffa6268721b5eb3d64b6d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-03-09 20:33:43 +02:00
Johan Hedberg 9cf9a2f1f2 Bluetooth: samples: Add combined observer & broadcaster app
Add a sample application demonstrating doing continuous scanning and
sending out advertising packets periodically.

Change-Id: I0ce88afd73bed4928ba65472051c0f83ff27a632
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-03-07 12:21:29 +01:00
Maureen Helm 93a6565dc5 Bluetooth: samples: Add hexiwear_k64 and frdm_k64f to tests
The introduction of device tree broke bluetooth sample builds for the
hexiwear_k64 and frdm_k64f boards. Add these boards to the peripheral_hr
test so this doesn't happen again.

Jira: ZEP-1745

Change-Id: I3e61a83db09cbb5834bd510bff851611e43844a8
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2017-03-07 12:21:29 +01:00
Andrei Emeltchenko e9b41f764b hci_usb: Add project configuration for tinyTile board.
Makes configuration for tinyTile board.

Change-Id: I823e299dad905387de85fd6d74159c7540bc7edd
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2017-03-07 11:19:11 +00:00
Andrei Emeltchenko 8ea70851db hci_usb: Fix incorrect length log
Fixes following warning:
...
warning: format '%u' expects argument of type 'unsigned int', but
argument 6 has type 'int32_t * {aka int *}' [-Wformat=]
...

Change-Id: I3ac523b7c8daf08b0c8e7b43aad270306fe5d744
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2017-03-07 11:18:39 +00:00
Anas Nashif 31f01f8ed6 Merge "Merge net branch into master" 2017-02-08 12:03:09 +00:00
Jukka Rissanen bd3908b2a9 net: nbuf: Add timeout to net_buf getters
This commit changes the net_buf getter functions in nbuf.h
by adding a timeout parameter. These function prototypes
are changed to accept a timeout parameter.
	net_nbuf_get_rx()
	net_nbuf_get_tx()
	net_nbuf_get_data()
	net_nbuf_get_reserve_rx()
	net_nbuf_get_reserve_tx()
	net_nbuf_get_reserve_data()
	net_nbuf_copy()
	net_nbuf_copy_all()
	net_nbuf_push()
	net_nbuf_append()
	net_nbuf_write()
	net_nbuf_insert()

Following convinience functions have not been changed
	net_nbuf_append_u8
	net_nbuf_append_be16
	net_nbuf_append_be32
	net_nbuf_insert_u8
	net_nbuf_insert_be16
	net_nbuf_insert_be32
	net_nbuf_write_u8
	net_nbuf_write_be16
	net_nbuf_write_be32
so they call the base function using K_FOREVER. Use the
base function if you want to have a timeout when net_buf
is allocated.

Change-Id: I20bb602ffb73069e5a02668fce60575141586c0f
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2017-02-08 10:12:35 +02:00
Johan Hedberg 46ed7974b3 Bluetooth: samples: Add missing README.rst files
Add missing README.rst files to the last two samples.

Jira: ZEP-1540

Change-Id: I8dfa6489c6c65872594d4416870e2a41e701595d
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-02-07 10:52:08 +02:00
Johan Hedberg 50678b03cb Bluetooth: Reuse HCI command buffers for the command response
Reduce the pressure on the common RX buffer pool by reusing HCI
command buffers also for the Command Status or Command Complete
response to them. This also implies removing the existing Kconfig
variable for the command buffer sizes since the size is also dependent
on maximum Command Complete event sizes. Instead, reuse the RX buffer
size also for HCI Command buffers.

Change-Id: I006b287d64a0c9ca40de741aa9a424a49a927385
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-02-05 22:39:25 +02:00
Johan Hedberg 743379c21f Bluetooth: Kconfig: Merge headroom reserve variables into a single one
A subsequent patch will start reusing HCI command buffers for
receiving the response, so the distinction of received vs sent data
headroom would just make the code unnecessarily complex. Instead, just
merge these two variable into a single one.

Change-Id: I31d846331939f1a2270df7ed0c75112825e16493
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2017-02-05 22:39:25 +02:00
Luiz Augusto von Dentz e89aebc4d5 net: samples: Add CONFIG_NET_L2_BLUETOOTH_ZEP1656
This enables these samples to interoperate with Linux 6LoWPAN over
Bluetooth implementation while that is being fixed, in the long term
we might remove it from the samples once Linux is fixed.

Jira: ZEP-1656

Change-Id: I8ca9fe5a27f43cebc75b6fe5a436a5e8fcee26d5
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-02-03 15:59:20 +02:00
Michael Scott ca6a686495 net: correct in*_addr parameter of net_addr_pton()
Currently, the function accepts a struct sockaddr * but the code
immediately type casts this to either in_addr or in6_addr.  This is
incorrect behavior as the first field in a sockaddr is sa_family_t
and not address data.

So without special knowledge, a developer will use a sockaddr structure
as the parameter and then wonder why the address information isn't being
set correctly.

Let's change this parameter to void * which makes this function similar
to inet_pton().

Jira: ZEP-1616

Change-Id: I1fc9368da999d90feb07c03fac55dcc749d4eba6
Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-02-03 15:59:13 +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
Anas Nashif 11e3d97c99 doc: update bluetooth samples with pointers
Change-Id: I37b653d59f2297619fb92112a418cd2c1ff80cd4
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-26 20:02:35 +00:00
Anas Nashif 3b8925099e Bluetooth: Move Bluetooth docs to rst
Change-Id: I36009f5acd4016ec47edb6dac29e81e58b1ba24f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-24 17:58:59 +00: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
Lee Jones 65cd08d925 Bluetooth: samples/beacon: Print message at start of sample
This is very handy for debug purposes.  It provides us with a reassurance
that at least something is happening, even if initialisation does not
complete (hangs forever).

Change-Id: I6ac1bfec84f8a6694f82d14fdc5d2a27aa1fc634
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-01-18 12:24:28 +00:00
Luiz Augusto von Dentz d627509185 Bluetooth: IPSP: Reuse buffer fragments instead of copying
The original buffer fragments can be used to send back a reply directly
since Bluetooth doesn't add anything to then.

Change-Id: Ifeac0e6c3abbd527c79912abc5f5b833b0b52171
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-01-17 15:37:03 +02:00
Johan Hedberg 6ddf827d88 Bluetooth: hci_uart: Remove redundant idle & ISR stack size values
The idle stack already defaults to 256. The ISR stack size of 640 was
intended to make the app fit on 16k nRF51 variants and is now the
default, i.e. it doesn't need to be explicitly set anymore.

Change-Id: I8db3c080e1f84c65b27f931fa48c75bd90a2d3cd
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
Anas Nashif f6e039062a kernel: remove dependency on CONFIG_NANO_TIMERS/TIMEOUTS
Remove legacy option and use SYS_CLOCK_EXISTS where appropriate.

Change-Id: I3d524ea2776e638683f0196c0cc342359d5d810f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-08 18:09:52 +00:00
Anas Nashif eaa06ac40a net: do not skip sanitycheck on samples
Change-Id: I781a908ad998211b34d5f05f53fbf3471e6b9f1b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2017-01-06 22:08:14 +00:00
Carles Cufi c2a2841212 bluetooth: hci_uart: Allocate 65 bytes for L2CAP packets
With LE Secure Connections the longest packet we require is 65 bytes
long: 64 bytes of Public Key data + 1 byte SMP opcode.
Extend the size of the L2CAP pool blocks so that they can fit such
packets and therefore one can use 70-byte
CONFIG_BLUETOOTH_CONTROLLER_TX_BUFFER_SIZE to achieve LE Secure
Connections pairing without HCI fragmentation.

Change-id: I2f11b4277ec5a24ceba79bccc7d84c64065b6e84
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2017-01-05 11:05:49 +00:00
Sathish Narasimman 55190c90a1 Bluetooth: samples: handsfree application indicator callback
Displays the present value of the indicators in the Handsfree
application.

Change-Id: I666ff2b15e70de8c1a26b902077d79c5c1a9d5fe
Signed-off-by: Sathish Narasimman <sathish.narasimman@intel.com>
2017-01-05 12:35:21 +05:30
Carles Cufi 4b7cdd499f bluetooth: Tune stack sizes after measuring with hci_uart
The following readings were obtained after running the peripheral and
central_hr apps in qemu combined with the controller (hci_uart) on nRF51
and nRF52:

Main Stack 380
Idle Stack: 68
ISR stack: 532
Controller RX Stack: 388
HCI TX Stack: 516

The numbers set in this change provide a safety margin from the ones
measured empirically.

Change-id: Ice7ad7f081502e0ea1accf856a7937c0bf0783b2
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-01-05 08:49:16 +02:00
Luiz Augusto von Dentz aaf6bbf33c Bluetooth: ipsp: Port sample to native stack
This port ipsp sample to use the native stack so it can be used once
again.

Change-Id: I7975b017b0aa5bd81a1701692ec81527e39d4701
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2017-01-05 08:49:16 +02:00
Carles Cufi aa150d6f56 Bluetooth: hci_uart: Disable HCI ECC commands temporarily
HCI ECC commands are causing freezes in the controller build. Until
further investigation is done disable them to avoid issues when running
the controller standalone.

Change-id: Ifab0fa362348b72e88adaa5250c914770e4a70ba
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-01-05 08:49:16 +02:00
Carles Cufi 80f000ab43 Bluetooth: Rename SEND_STACK to TX_STACK_SIZE
For consistency with RX_STACK_SIZE and the rest of stack sizes, rename
to use the normal naming scheme.

Change-id: Ib8d484482466fa8d629e6329e07b927abdd6f598
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@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 ef2dd99efb samples: fix path to sanitycheck script
Change-Id: Ic8fae0617faa6495a30bee09b5457a080924172c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-24 17:49:53 +00: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
Luiz Augusto von Dentz 9791274303 Bluetooth: samples: Add extern "C" { } block to GATT header files
Adds extern "C" { } blocks to header files so that they can be
safely used by C++ applications.

Change-Id: I767a04635b38d8ef7a02e8c7da3a5c99b0bc7709
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-12-16 11:23:33 +02: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 954baea90b random: Restructure RANDOM Kconfig
Restructure the RANDOM Kconfig to match the structure used in other
drivers with a single top level menu.  Move the true random number
generators to appear first in the menu, with pseudo generators at the
bottom.  Do not present pseudo generators if a true random generator
is presented.

This change implies that tests, samples and applications that require
the random driver interface must now select CONFIG_RANDOM_GENERATOR.

In order for tests and samples to build (and run) on platforms that
have no random driver it remains necessary to select
the CONFIG_TEST_RANDOM_GENERATOR.

Note that CONFIG_TEST_RANDOM_GENERATOR retains its original purpose of
enabling a random driver that delivers non random numbers for the
purpose of testing only.

Change-Id: I2e28e44b4adf800e64a885aefe36a52da8aa455a
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-13 22:50:18 +00: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
Anas Nashif 70f9244db7 Merge "Merge net branch into master" 2016-12-05 15:56:26 +00:00
Szymon Janc d1187302e0 Bluetooth: Make bt_send stack requirements a Kconfig option
This allows to fine tune TX stacks size depending on selected HCI
driver. If needed it can be used to tune for monitor too or other
logging mechanism used.

Change-Id: Ib501921da0b786e151083760d85ec58fe3c08b60
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-12-03 17:09:38 +00:00
Szymon Janc 151e37b856 Bluetooth: samples/hci_uart: Use proper stack declaration
Use BT_STACK_NOINIT for tx stack declaration. This makes sure stack
it properly alligned and account for k_thread overhead.

Change-Id: I704958fcc3ce02aba913f6eaee13ae50d2a81591
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-12-03 17:09:38 +00:00
Carles Cufi b1d02621fc Bluetooth: hci_uart: Fix init order in hci_uart bootup
bt_enable_raw() needs to be called before spawning the tx thread,
otherwise there might be an HCI command processed from the UART
before the HCI driver has been opened and therefore initialized.

Change-Id: I050158bd48bebaf8fa2cf6b11efb54b531f70079
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-12-03 17:09:38 +00:00
Vinayak Chettimada 73a2100bd8 Bluetooth: hci_uart: reduce configured stack sizes
From stack_analyze function, used isr stack is 368 bytes
with the controller build, main stack is 288 bytes and idle
stack is 56 bytes. Hence, configuring sizes of 512, 512,
and 256 bytes for isr, main and idle stacks respectively.

Increased max connections from 16 to 20 utilizing the RAM
free from the reduced stack sizes.

Change-id: I67d073fd1893cafc53d36e89035a6fd931488a46
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-12-03 17:09:38 +00:00
Carles Cufi 3b1baa88ef Bluetooth: Controller: Implement ECC commands
Implement the 2 HCI commands that provide ECC public key
and shared secret generation:

- LE Read Local P-256 Public Key
- LE Generate DHKey

Jira: ZEP-1246

Change-Id: I79388bfdb9f2e28b9377b4bb6ee2caca25f33f3e
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-12-03 17:09:38 +00:00
Jukka Rissanen 6b43821f20 net: Remove legacy Contiki based uIP stack
This commit removes the legacy Contiki based uIP stack.
The new native IP stack must be used after this commit.

The commit also removes following things:
- legacy cc2520 driver
- legacy ethernet drivers
- legacy IP stack samples

and changes these things:
- disabled tests that only work for legacy IP stack
- select new IP stack by default
- enable random number generator by default as it is needed
  by the new IP stack

Change-Id: I1229f9960a4c6654e9ccc6dac14a7efb9394e45d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-12-02 12:41:17 +02:00
Johan Hedberg 2469bd6f87 Bluetooth: Use convenience macros for timeout durations
Using the K_* macros makes it easier to read what exactly the various
timeouts are.

Change-Id: Ia405d3760b8e600af7e33a7221ef6ec717708973
Signed-off-by: Johan Hedberg <johan.hedberg@intel.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 35376eed13 Bluetooth: samples/hci_ecc: Switch to using k_thread_spawn()
Switch from fiber_start() to k_thread_spawn(). Also switch to
k_yield() from fiber_yield() in the same go.

Change-Id: I2dc480310f981112063651b61b0ceedf38601bee
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 10:57:23 +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 619d7bafd9 Bluetooth: samples: Fix using nano_delayed_work in eddystone
This fixes warnings related to the use of nano_delayed_work.

Change-Id: Ie20fb47fc6d5c486ff885ad583354eb715d12c1b
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
Johan Hedberg 3062516a1a Bluetooth: Controller: Improve default RX/TX buffer counts
Currently the ideal buffer counts for a controller-only build are 6 RX
buffers and 7 TX buffers: ATT_MTU of 158 bytes can be sent in one
connection interval of 6 tx/rx -es wherein connection interval is
7.5ms

Change-Id: I64b4620c5e8e7db8d7ed72fa1db82e266e121f27
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 07:59:15 +02:00
Johan Hedberg a3c057a5e9 Bluetooth: samples/hci_uart: Remove redundant semicolon
Remove redundant semicolon from the end of a while loop.

Change-Id: I02cef7879efe0d6eeae59595e14fb1d9b00a6d52
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 07:59:15 +02:00
Johan Hedberg a8506f7814 Bluetooth: samples/hci_uart: Declare assert handler only when needed
If support for the controller assert handler isn't enabled the
function shouldn't exist.

Change-Id: I72076eb1001980f102a0404c91d22e41582ced25
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 07:59:15 +02:00
Johan Hedberg a69996210f Bluetooth: samples/hci_uart: Remove dependency on controller
Don't use a controller define if controller support is not enabled.

Change-Id: I837b3b66f010dfbdf2d9099acd85fa29fce954b7
Signed-off-by: Johan Hedberg <johan.hedberg@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
Carles Cufi f7d313b154 Bluetooth: Controller: Add ASSERT info dump on HCI builds
When building Zephyr in the controller-only configuration,
assertions that happen in the Link Layer code are not visible
to the Host which is running on another HCI and connected via
UART or USB to it. This patch allows the Controller code
to output the assertion line number when in such a configuration,
allowing the Host to view the event to help debugging.

The event format used is temporary and will be replaced by a
standardized Vendor Specific specification to come at a later
time.

Change-Id: I013ca6783a3fdedc47b171132919dd4798c66285
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-11-11 07:59:15 +02:00
Johan Hedberg 3fc4fd53f6 Bluetooth: samples/hci_uart: Add micro:bit configuration
The BBC micro:bit doesn't have UART HW flow control, so it needs to be
disabled to build for the board. The baudrate is also lowered to
115200 since 1Mbps is likely to be unreliable without flow control.

Change-Id: I1725a2a1e46cfbc0f57b4f5c4ee57ff52d9670e9
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-11 07:59:15 +02:00
Sathish Narasimman 46972b1822 Bluetooth: Sample: handsfree sample application
Samble bluetooth application for handsfree profile

Change-Id: I280a313afef4c842896c6470a473127e03dacd88
Signed-off-by: Sathish Narasimman <sathish.narasimman@intel.com>
2016-11-09 08:57:52 +02:00
Johan Hedberg 87e18b4fbb Bluetooth: samples: Use consistent naming for HCI apps
The convention for Zephyr sample names is to use _ instead of - for
delimiting words.

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

Jira: ZEP-1183

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

Change-Id: I853ebcadfa7b56a4de5737d95f2ba096babb2e13
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-04 15:47:25 -04:00
Johan Hedberg 142b75fddb Bluetooth: samples/hci-uart: Fix minor style issues
Fix minor style issues with excessive whitespace for alignment and
lack of 'static' for the tx_fiber_stack.

Change-Id: I0c761e94e6a6789a3772b08b0774cd1a5e73c2ef
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-01 21:40:39 +02:00
Johan Hedberg 1b804f9d74 Bluetooth: samples/hci-uart: Fix up configuration files
Right now the hci-uart samples doesn't really work anywhere else than
nRF5x, so make that the default configuration. Also rename the old
prj.conf to generic.conf to give a generic starting point for creating
configurations for other targets.

Change-Id: I1c940339b457d0e77c8ddad4b2474fc7e5b12a51
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-01 21:40:39 +02:00
Carles Cufi 20952b75e3 Bluetooth: uart: Fix UART TX stall condition
In 3 of our UART driver implementations the ISR is exclusively
used and enabled for the RX path. The existing logic was
susceptible to a stall situation where a polled out transmission
would be interrupted by a reception and then the ISR code
would loop forever due to the TX event being signalled (although
the interrupt itself was disabled) causing the ISR to keep
looping for an RX interrupt.

Change-Id: Ic379e58b1c974aca3cee37d2d81f12c3726fb160
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-11-01 21:40:39 +02:00
Johan Hedberg a3a74de6ba Bluetooth: samples/hci-uart: Remove unneeded hci_driver.h include
There's no need for this app to use the HCI driver API directly.

Change-Id: Ie5acfbfb09fc3f86c3f29f22fbf7da7db1ff2127
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-11-01 21:40:39 +02: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 506ad96c6f Bluetooth: samples/hci-uart: Add arduino_101_ble to tests
It's important that this configuration stays within the limits of the
Arduino 101 nRF51 (which has only 16kB of RAM, unlike most others that
have 32kB).

Change-Id: I359061f8a41f1373f254c49bff00f551f915bd70
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-28 20:15:12 +00:00
Johan Hedberg 3564b6f01a Bluetooth: samples: Limit tests to just qemu platforms
For the current purposes it's enough to build these tests only for the
ARM and x86 qemu targets. This also avoids false-positive failures on
platforms that don't have enough memory.

Change-Id: Icbbfc0603feba6bb1ec8a3054f8cdf0800f49ca1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-28 20:15:01 +00:00
Carles Cufi 17f7a3cf74 Bluetooth: hci-uart: Match controller buffers in UART RX
Since net_buf_get() for the avail_acl_tx FIFO is called in
interrupt context (ISR) it cannot wait, and it will fail
immediately returning NULL if it fails to acquire a buffer.
During LE Secure Connections pairing, when there is a fair
amount of packets coming from the host, the FIFO was running
out of buffers causing the packet to be dropped instead of
forwarding it to the controller.
The number allocated now matches the amount of TX buffers
in the controller, so that normal HCI flow control (from
the Host to the Controller) will kick-in preventing any
buffers from being dropped.

Change-Id: Ifad4fbac84ae938eb0e68b73a80a02ba79b6ff6e
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-10-28 20:42:37 +02: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 326901397f Bluetooth: samples/hci-uart: Make sure we yield in tx_fiber
Whenever the writer of a FIFO is an ISR and the reader a fiber it's
important to make sure that we give the chance for other fibers to run
in case the FIFO keeps getting new data from the ISR without ever
running empty.

Change-Id: I6b40461713d4acfdc6fcec13ff90c9697ff01935
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-28 08:09:08 +03: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
Carles Cufi a78e8addad Bluetooth: hci-uart: Add a sample configuration file for nRF5x
Add a config file for boards using the Nordic Semiconductor nRF5x
ICs with reasonable defaults in terms of UART configuration and
controller settings.

Change-Id: Iaa5904c96c0f40a2749b7dda0398dd35fa809f24
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-10-28 08:09:08 +03:00
Szymon Janc 9292a83424 Bluetooth: hci-uart: Don't include nanokernel.h
Include zephyr.h instead which properly includes nano or unified kernel
headers.

Change-Id: I41c848092d022e2b0737ae6b2b53084eaf9bc6a7
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-10-28 08:09:08 +03:00
Anas Nashif d6e2de744b Bluetooth: cleanup testcase.ini and adapt to current platforms
Change-Id: If5df39337aee31c0e72dad8c1a38c69e6c1b0a72
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-28 08:09:08 +03:00
Carles Cufi 3a670fce6d Bluetooth: hci-uart: Use a fiber to offload TX from ISR
Due to the fact that ISRs run at priority 1, the LE_Rand
command was not being rescheduled after CPU sleep to be
able to fill its buffers. By performing all TX (to controller)
work on a fiber, the RNG ISR is able to run and the command
can be executed synchronously in the fiber context.

Change-Id: I3b658e1cab3f80ae655cc88566639a122a361a08
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-10-28 08:09:08 +03:00
Johan Hedberg 9d04ff3365 Bluetooth: samples/README: Document hci-usb and hci-uart
Add short descriptions for what the hci-usb and hci-uart applications.

Change-Id: Ie06cfa1678243e97b49e5594a00086cbf3c343be
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-28 08:09:08 +03:00
Anas Nashif 56629db9fa samples: ipsp: whitelist platforms
Change-Id: Ibc221d3e72481418f7bb0946a107aa0a8676cffb
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-22 16:55:53 -04:00
Carles Cufi c74675c27a Bluetooth: HCI UART app to run Zephyr as a BLE Controller
Add a new sample application in sample/bluetooth/hci-uart
that acts as a bridge between a UART and the BLE Controller.
It receives commands and ACL data in H4 format over the UART
and passes them on to the BLE Controller to be processed.
It also conversely forwards all events and incoming ACL data
generated by the BLE Controller to the UART.
The application uses the hci_raw interface to pipe the data
to and from the BLE Controller and UART.

Change-Id: Iff7696166a82fe363b2ad4e1abea40103899f927
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
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
Luiz Augusto von Dentz e6cb507a42 Bluetooth: IPSS: Remove ipss_listen
This removes ipss_listen since it does depend on the old network stack it
cause build problems with yaip and anyway its code is only used by ipsp
sample while the net samples does not use ipss_listen at all.

Change-Id: I23987670548741bde8800115d473a3bab242153b
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-10-16 09:01:28 +03:00
Johan Hedberg ba3ab4d2bc Bluetooth: samples: Rename btusb to hci-usb
This prepares the way for more controller-side HCI implementations
which can be named hci-<transport>.

Change-Id: I6f82db4b7b7096a122f32def9fe9025a7b811244
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-16 09:00:57 +03:00
Johan Hedberg 5338ad23b8 Bluetooth: samples/btusb: Rename main c-file
Use main.c as in most other samples.

Change-Id: I82a593d2842e0653279046be181e2770a367ab45
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-10-16 09:00:57 +03:00
Luiz Augusto von Dentz c4fb8f8820 Bluetooth: eddystone: Add missing characteristics
This adds last 2 missing characteristics:

(Advanced) Factory reset - a3c8750b-8ed3-4bdf-8a39-a01bebede295
(Advanced) Remain Connectable - a3c8750c-8ed3-4bdf-8a39-a01bebede295

Change-Id: I749b4be65469080a24957805d40395563a74a972
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-10-04 08:12:14 +03: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
Luiz Augusto von Dentz 88d5175ac4 Bluetooth: eddystone: Fix byteorder of advertisement
This fixes the UUID 128 bits to use the right byte order so it can be
decoded properly:

< HCI Command: LE Set Advertising Data (0x08|0x0008) plen 32
        Length: 21
        Flags: 0x06
          LE General Discoverable Mode
          BR/EDR Not Supported
        128-bit Service UUIDs (complete): 1 entry
          Eddystone Configuration Service (a3c87500-8ed3-4bdf-8a39-a01bebede295)

Change-Id: Ia4aacaf3557d74a248f63cbffb2adb73b076d38c
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-09-16 10:53:51 +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
Luiz Augusto von Dentz bafbe76dc3 Bluetooth: HoG: Require authentication for connections
HID over GATT Profile Specification states:

  'The HID Device shall use LE Security Mode 1 and either Security Level
   2 or 3.'

Change-Id: I2cfc1d9df76b4e8a8b2be7e87d18a7a5f3a19ea8
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-09-07 08:17:26 +03:00
Luiz Augusto von Dentz f509d68cf1 Bluetooth: Add sample implementing HIDS
This adds a sample that implements HID Service peripheral, the current
descriptor map is for a generic mouse so when connecting to a Linux box
it will create a input device like in the following output:

input: Test HoG mouse as /devices/virtual/misc/uhid/0005:1D6B:0246.0035/input/input98
hid-generic 0005:1D6B:0246.0035: input,hidraw2: BLUETOOTH HID v5.29 Mouse [Test HoG mouse] on XX:XX:XX:XX:XX:XX

Change-Id: Iccf07926ecc7363f4f47e1aa9df506a722e7e2d3
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-09-07 08:17:26 +03:00
Luiz Augusto von Dentz 30665185f8 Bluetooth: Add service sample for HoG
This adds a HoG service sample which can be shared with application
samples.

Change-Id: I6893ff409b254d0a616b2ba558fd629ce9edf1d4
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-09-07 08:17:26 +03:00
Andrei Emeltchenko 9dc90369d5 Bluetooth/samples: Fix missing argument in printf for btusb
Change-Id: I130362a9a3a7f58036b09821bf897295dcca7fdf
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-09-07 08:17:26 +03:00
Andrei Emeltchenko 210596e246 Bluetooth: Include btusb sample to sanity check
Change-Id: I05aeb54124b7dbf36aa730e04a105683eb8c4eaa
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-09-07 08:17:26 +03:00
Andrei Emeltchenko e8abb72a6a Bluetooth: Export USB HCI controller using RAW HCI channel
The application exports Bluetooth controller over USB as USB HCI
dongle using RAW HCI channel introduced in the previous patch.

When connected to Linux is should be handled by btusb driver.

usb-devices output:

T:  Bus=05 Lev=03 Prnt=121 Port=00 Cnt=01 Dev#= 22 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=8086 ProdID=ff02 Rev=01.00
S:  Manufacturer=Intel
S:  Product=BTUSB12
S:  SerialNumber=00.01
C:  #Ifs= 2 Cfg#= 1 Atr=c0 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
I:  If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb

Change-Id: I8bc362876353b6c97eb7051f4cdff3d8a9f55abd
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-09-07 08:17:26 +03:00
Luiz Augusto von Dentz e2b5be9087 Bluetooth: eddystone: Add timeout to deactivate configuration mode
This adds a timeout to switch from configuration mode to beacon mode
following the recommended behavior from the spec:

  The connectable timeout should be at the very least 30 seconds to let
  enough time to user to start a configuration application.

Change-Id: I8f262c447ed1622e377fd7a05dde78c7b6b0560d
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-09-07 08:17:26 +03: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 be9f89da50 Bluetooth: Add eddystone sample
This adds a sample which implement Eddystone Configuration Service
following the spefication bellow:

https://github.com/google/eddystone/tree/master/configuration-service

Change-Id: Ia3e74d068de03ae20191534e61b2752dd2d70211
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-07-19 11:22:38 +00:00
Johan Hedberg 8ff97da3fd Bluetooth: samples: Add summary of available sample apps
Add short description of each sample app to the README.

Change-Id: I830e48aad226b5bf08985fbb6c218e3b5fe72b15
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-07-16 10:08:00 +03:00
Javier B Perez 22c68169fd samples: testcases.ini change tags separated with commas
Tags should be separated with spaces no with comma.

Change-Id: I5381200bcd0caf59f3601ec849d698966c734a28
Signed-off-by: Javier B Perez <javier.b.perez.hernandez@intel.com>
2016-07-08 18:20:08 +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
Szymon Janc 2fb8ef6606 Bluetooth: samples: Unify config for QEMU and Arduino101 targets
Setting CONFIG_ARC_INIT=n in prj.conf make it possible to use same
config for both QEMU and Arduino 101 targets.

Change-Id: Ie4f549d5721f2b87077fba8787f5b1e2a8f07680
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-06-15 12:17:06 +00:00
Luiz Augusto von Dentz 8ebb68dbdb Bluetooth: IPSP: Add README
This removes the section explaining how to test the IPSP from the general
README moving it ipsp specific README which can be expanded to include
other specific details related to 6LoWPAN, etc.

Change-Id: I80210cacb6b0042b3b0dc570dbdf7d38f92b3031
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-06-14 15:59:50 +03: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
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
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
Grzegorz Kolodziejczyk d1cad8ecce Bluetooth: Fix long writes handling
This patch fixes long writes handling. Attribute length error and
invalid offset error for prepare write should be sent in a response
to execute write request.

Change-Id: I9b4cbe0df198df9d685dbd2b328009290ebdc567
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-05-30 11:12:23 +00:00
Luiz Augusto von Dentz 9fed4ce48a Bluetooth: Add missing flags to beacon sample
The flag BT_LE_AD_NO_BREDR shall be set which makes BT_DATA_FLAGS
mandatory.

Change-Id: Id933a4d73bc9fdcdc53c197041bb488d45ba149a
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-05-30 09:24:04 +00:00
Andrei Emeltchenko 094a2cd8f0 Bluetooth/peripheral_csc: Add configuration for nble
Change-Id: I102f4a178f22d93b5b673944f34138e7579e5901
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-05-25 16:44:51 +03:00
Mariusz Skamra 999c69f23d Bluetooth: Make ES Trigger Setting Descriptor non-writable
This removes optional write permission to the ES Trigger Setting
Descriptor. These setting can be set by application.

Change-Id: Ic62ebd909c10601955e67b38303b8c852971203e
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-05-20 11:06:26 +00:00
Johan Hedberg b78b8a946a Bluetooth: samples: Add Nimble config for peripheral_hr
Change-Id: Ie311b85710fc24dbde8c7dbb7c9afb966b57cc15
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-05-17 15:07:03 +03: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
Luiz Augusto von Dentz ffd0d3e36a Bluetooth: Omit implicit permission flags
This is no longer needed since commit:
7834061d12

Change-Id: If6436204b886d31be20c27e4f3d74a5c5a979e8c
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-05-11 15:17:59 +00:00
Szymon Janc c7982b65d2 Bluetooth: Use tinycrypt for ecc in LE SC only sample
This makes sure LE SC are always enabled regardles of controller used.

Change-Id: I015213eb95f97793d1a1962a1cb392c652489568
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-05-10 16:50:06 +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
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
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
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
Andrei Emeltchenko 0fd771acfc samples/nble: Remove default driver debug for samples
CONFIG_BLUETOOTH_DEBUG_DRIVER provides too low level information to be
useful for samples. Remove it from default settings.

Change-Id: I9d99f9953d4e6b839eeb51ed393e4aed1eeeb01b
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-04 14:33:50 +00:00
Maciek Borzecki f95e15a228 samples: bluetooth: ipsp: exclude STM32F103RB from the test
Exclude STM32F103RB based platforms from the test. The SRAM is overflown
by 14kB.

Change-Id: I37c2905ed2706a89d9a199bc49518937659ac997
Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2016-04-01 13:12:58 +00:00
Johan Hedberg a27641b1c5 Bluetooth: samples/README: Fix sanitycheck references
Change-Id: I6e54a80de1f9a95f7b22ee2213e764ed93c495b2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-03-31 07:57:23 +03:00
Luiz Augusto von Dentz 7a585ee137 Bluetooth: CTS: Add service sample
This adds a CTS service sample which can be shared with application
samples.

Change-Id: I38889f71f6ce8fc7b784d0d04af6c97408e2d662
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-03-22 17:26:49 +00:00
Luiz Augusto von Dentz 6d461204bf Bluetooth: BAS: Add service sample
This adds a BAS service sample which can be shared with application
samples.

Change-Id: I1f484dadf63b41632992454a40edd91077bb78fa
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-03-22 17:26:29 +00:00
Luiz Augusto von Dentz 265fc8703a Bluetooth: DIS: Add service sample
This adds a DIS service sample which can be shared with application
samples.

Change-Id: I66f7a725139c8fa381275c3bda5e7c79fa3f09c8
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-03-22 17:26:15 +00:00
Luiz Augusto von Dentz 97e1938db9 Bluetooth: HRS: Add service sample
This adds a HRS service sample which can be shared with application
samples.

Change-Id: I1d2022ee7a6dfa46e2cae2d7c9d7924140d4fe37
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-03-22 16:43:10 +00:00
Luiz Augusto von Dentz 47bb494610 Bluetooth: Make application samples to use GAP Service sample
This reduces the amount of duplicated code across sample applications.

Change-Id: I20cf2e9f948f1420f234a58beb7f72ad74696cf8
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-03-22 16:43:02 +00:00
Andrei Emeltchenko 59659ce4da drivers/nble: Re-enable advertising on disconnect
Move re-enabling logic to the NBLE stack.

Change-Id: I1b895aa952a241dc41e2fc9faa2794a8c2c2d2db
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-21 09:21:24 +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
Luiz Augusto von Dentz 19387677da Bluetooth: peripheral_esp: Add support for using NBLE driver
This adds support for building and testing peripheral_esp using NBLE
driver.

Change-Id: I962238d526101f8f423491d3023079684ec7d59f
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-03-16 13:27:29 +00:00
Luiz Augusto von Dentz 4aae7ec31f Bluetooth: Fix header documentation of GATT service samples
Change-Id: I8dc2643aa755811549cc54fef0be0ec589e2dab9
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-03-14 11:04:22 +02: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
Luiz Augusto von Dentz ae04454d01 Bluetooth: IPSS: Only register extra services if necessary
If CONFIG_BLUETOOTH_GATT_DYNAMIC_DB is defined it shall be possible for
the application to register any extra service it needs.

Change-Id: I7186f3faf45e9295e0c8b32dce030099a142c500
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-03-11 11:31:53 +02:00
Luiz Augusto von Dentz 1d523c3faf Bluetooth: IPSS: Move sample service to gatt
This moves IPSS sample code to samples/bluetooth/gatt which shall become
the default place for GATT related samples that can be reused.

Change-Id: I04089f6e43bfcc30ee1c7cc766620f19e3dad08e
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-03-11 11:29:13 +02:00
Andrei Emeltchenko 7e84a00068 Bluetooth/sample: Fix exit after first indication sent
Change-Id: Ia958fa1c1013660e7281dc91e77ea742c753e104
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-03-10 15:41:00 +00:00
Luiz Augusto von Dentz a3135478ff Bluetooth: IPSP: Add missing primary service
Accourding to the spec the IP Support Service shall be instantiated as
a «Primary Service».

Change-Id: Ief0a2729c2752a33c8e7d4d9fae017c22e969e61
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-03-09 17:46:47 +00:00
Luiz Augusto von Dentz 018709de1c Bluetooth: Add indication support for peripheral sample
This adds indication support for one characterist of the vendor service
so it can be used to test bt_gatt_indicate API.

Change-Id: Ief058c93caf3e30972eca920c050451f6120543b
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-03-08 11:46:45 +00:00
Luiz Augusto von Dentz 2f8a5967a8 net: Kconfig: Auto select mandatory features for Bluetooth
This makes sure NETWORKING_WITH_6LOWPAN and 6LOWPAN_COMPRESSION_IPHC are
selected properly and update IPSP sample to only include the minimal
config options so it can test if this is working properly.

Change-Id: I2565cbd4f79d91eaba348d43933aa893c6dc6ace
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-25 10:36:33 +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
Luiz Augusto von Dentz 86b845c44f Bluetooth: IPSP: Correct filename and description
Change-Id: I95e0304d0cc28d27f773ce2333e7ac851b724df1
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-17 18:38:05 +00: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
Luiz Augusto von Dentz 6ee34adff4 Bluetooth: IPSP: Add sample header
This make it possible to include IPSP services in other samples.

Change-Id: If6eaecd8bab85a382b2da623b06603f6c98aef59
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-16 14:39:03 +00:00
Mariusz Skamra fef38c1e6d Bluetooth: Add Cycling Speed and Cadence sample application
This adds sample application that implements Cycling Speed
and Cadence profile.

Change-Id: I0fd94582887ca3f5fdc363f35e5a3304c5f64cd9
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-16 11:24:39 +00:00
Mariusz Skamra 7e389af158 Bluetooth: Add Environmental Sensing Profile sample app
This adds peripheral sample that implements Environmental
Sensing Profile.

Change-Id: I34ad003b6157a5f87fce32b1c00d8eba66f205fe
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-16 11:23:50 +00:00
Johan Hedberg 29263a0760 Bluetooth: samples/beacon: Advertize http://www.zephyrproject.org
Update the advertising data to advertise the Zephyr project web site.
Also provide references to the Eddystone specification.

Change-Id: Id9cfdf4d9be95bccab4152031479ab45f5b8a035
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-15 16:35:02 +00:00
Mariusz Skamra 475c550ca3 Bluetooth: Remove HR Control Point Characteristic from HR svc decl.
This removes HR Control Point from Heart Rate Service Declaration.
This characterisitc is mandatory if the Energy Expended feature is
supported, otherwise excluded. Since we don't simulate Energy Expended
we shouldn't have this characterisitc in our service declaration.

Change-Id: Ibdfdb2dd48f28bd01763ee0a038faed08e30f84c
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-15 15:29:49 +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
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
Szymon Janc 3ed1a37a41 Bluetooth: SMP: Use TinyCrypt for AES CMAC
TinyCrypt provides implementation of AES CMAC so there is not need
for internal implementation in SMP code.

Change-Id: I15fe0daf8fca8c44b002636983b46502419c57a5
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-11 20:44:28 +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
Andrei Emeltchenko b436fa16b5 drivers/nble: Enable UART debug only if BLUETOOTH_DEBUG_DRIVER enabled
This allows to decrease number debug messages using config option.

Change-Id: I987d25c6d4b18503d6beb7feab97e9207100323d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-11 15:34:53 +02:00
Szymon Janc 4318fc0e5b Bluetooth: Kconfig: Add TinyCrypt ECC config option
This enables use of ECC from TinyCrypt. Since ECC is heavy this option
is separated from general use of TinyCrypt in SMP code.

Change-Id: Ia550e4a5f89240c8e15d2b5acccc21993b44b471
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-11 10:56:40 +00:00
Johan Hedberg 31b9a82f65 Bluetooth: samples/peripheral_hr: Add "Zephyr" to device name
Change-Id: I6ff63676db9d74932a4eef648bf5284b9229d4f2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-10 19:13:01 -05:00
Szymon Janc c762215b79 Bluetooth: Remove CONFIG_TEST_RANDOM_GENERATOR from sample apps
This option is not needed as none of sample uses sys_rand32_get.

Change-Id: I00620a2fa7ea926d09e4e8f86cbf8ca7080478b3
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-10 19:13:01 -05:00
Luiz Augusto von Dentz 36522ee71b Bluetooth: peripheral: Make heart rate simulation more predictable
sys_rand32_get appears to get stuck with same number for a while so
instead just increment the heart rate by 1 until 160 and then return it
back to 90.

Change-Id: I2aea870c68539271a1bb6190a958a7e2d1914dc3
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-10 19:13:01 -05:00
Johan Hedberg 362579cc74 Bluetooth: samples/peripheral_hr: Pass explicit connection to bt_gatt_notify
Change-Id: Ie854ddc3a20ae38df0501ffaa4026dd37c7ae7d8
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-10 19:13:01 -05:00
Johan Hedberg f23f8c3e96 Bluetooth: samples/peripheral_hr: Add adv-restart hack for nble
Force restarting advertising until nble is able to handle this by
itself.

Change-Id: Ife811eb69a63b98b3b0380b80e403d5d9dc10f22
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-10 19:13:01 -05:00
Szymon Janc eccec2a5ac Bluetooth: Kconfig: Add option for enabling TinyCrypt
Add a single option for enabling use of TinyCrypt library for
crypto. This option selects all required TinyCrypt options
depending on BT features enabled. Thanks to this applications
only need to select single option instead of set of required
TinyCrypt features.

Change-Id: I2862e9ad3e204635f2ed3199433982bcfb7112f6
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-10 19:13:00 -05:00
Szymon Janc 47ecb52064 Bluetooth: Add support for TinyCrypt based bt_rand
This allows to use pseudo random numbers generator provided by
tinycrypt instead of constant using of HCI LE Rand command.

HCI LE Rand commands are used only to initialize and re-seed PRNG.

Using tinycrypt for NRPA increase size of sample shell application
from 86852 to 89700 bytes.

Change-Id: I06e7392d087908caf37cd3ae648ea0bd5cc4ce61
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-10 19:13:00 -05:00
Luiz Augusto von Dentz 7ab263ea6a Bluetooth: peripheral: Fix using CCC handle with bt_gatt_notify
The handle shall be the characteristic value handle not the CCC.

Change-Id: I677ca12fdd59023f2498f712b060197a59baee64
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-10 19:13:00 -05:00
Johan Hedberg 2b7a5229f2 Bluetooth: samples: Add dedicated Heartrate peripheral sample app
This can be used to focus on demonstrating a simple heartrate service.

Change-Id: Ib59c653ebe356784592c8468767b45c5240ec67a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-10 19:12:55 -05:00
Szymon Janc 843268d78d Bluetooth: GATT: Refactor read API
Add read parameters to read callabck

Merge bt_gatt_read_multiple functionality into bt_gatt_read.
This makes it easier for application to handle all types of reads
as same sematics is kept for them.

Instead of destroy callback, call read_func with NULL data to
indicated that read has completed. This makes it clear when
read is completed and parameters used for it are no longer needed.
Thanks to this application doesn't need to abuse user data destroy
callback for detecting if read has completed. Since destroy callback
is no longer needed it is removed.

Also note that bt_gatt_read doesn't take any user data parameter
and that destroy callback was acctually called with read parameters.

If application would require to pass user data along with parameters
it may use CONTAINER_OF macro along with bt_gatt_read_params.

Change-Id: I8d6ea136b1e61c1dae73cca868b53c48c45a5492
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-10 18:52:29 -05:00
Luiz Augusto von Dentz eb3b2b5f83 Bluetooth: peripheral: Register services after init
With NBLE driver it is not possible to register services before
bt_enable completes.

Change-Id: I71194150b807e183b0016accb600ae9538ba9b01
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-10 18:52:29 -05:00
Szymon Janc 51ac70d42b Bluetooth: GATT: Refactor subscription API
This removes destroy callback for userdata as bt_gatt_subscribe
doesn't take any user data parameters and that destroy callback
was acctually called with subscribe parameters.

We assume subscription is active if bt_gatt_subscribe returned 0
(ie write command was sent). This is due to remote might be sending
notifications before reply to write.

Also note that bt_gatt_subscribe doesn't take any user data parameters
and that destroy callback was acctually called with subscribe
parameters.

If application would require to pass user data along with parameters
it may use CONTAINER_OF macro along with bt_gatt_subscribe_params.

Change-Id: I58ac9cd481ffa08ccc2d7a0464ca75f61fb280c5
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-10 18:52:29 -05:00
Daniel Leung f42664554e sanitycheck: enable build tests for Arduino Due
This enables sanitycheck to build for Arduino Due.

Note that there is no on-board bluetooth so bluetooth tests
are skipped.

Change-Id: I4f564e68ec65f01b7b33a32f6d0d7749290c0e5b
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-10 01:35:33 +00:00
Szymon Janc 6645d3f485 Bluetooth: GATT: Remove destroy callback from bt_gatt_discover_params
Instead of destroy callback, call discovery_func with NULL attribute to
indicated that discovery has completed. This makes it clear when
discovery is completed and parameters used for it are no longer used.
Thanks to this application doesn't need to abuse user data destroy
callback for detecting if discovery has completed.

Also note that bt_gatt_discover doesn't take any user data parameter
and that destroy callback was acctually called with discovery
parameters.

If application would require to pass user data along with parameters
it may use CONTAINER_OF macro along with bt_gatt_discover_params.

Change-Id: Iec4eb9795975ef2555502e13a682e13ff37742e0
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:32 -05:00
Szymon Janc d3a05596f8 Bluetooth: samples/tester: Fix invalid use of struct bt_uuid
struct bt_uuid is a 'tentative' UUID type and shouldn't be used for
UUID storage. Since tester application doens't know type of UUID
on compile time we need to have a common extra type that would
allow to store both 16 and 128 UUIDs.

Change-Id: Ia2775a457a732cf03ba7e4a59e6d654fcd1ab05d
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:32 -05:00
Johan Hedberg 479d25d035 Bluetooth: Rename BT_LE_ADV_ADDR_PUBLIC to BT_LE_ADV_ADDR_IDENTITY
In anticipation of supporting a local static random address in the
future it makes more sense to call BT_LE_ADV_ADDR_PUBLIC
BT_LE_ADV_ADDR_IDENTITY.

Change-Id: I4826f1dfb50b54e13a35cbe7ee74e28641c81ad1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:31 -05:00
Andrei Emeltchenko 8baedd3a6b Bluetooth: tester: Update configuration for NBLE
Enable CONFIG_CONSOLE_HANDLER and disable CONFIG_UART_CONSOLE since
tester reuses that UART.

Change-Id: Ia440d75f66d01f29d10b5d6a68fc052fd8b57fa7
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:31 -05:00
Andrei Emeltchenko e539c3b99c Bluetooth: nble: Remove enabling debug by default
Enabling BLUETOOTH_DEBUG enables also serial console conflicting with
tester reusing the same UART.

Change-Id: I8058a019e61146ff05cc44ab543cf6ec9ff418ef
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:31 -05:00
Johan Hedberg bd0065b3bd Bluetooth: samples: Use sizeof() to evaluate fixed name length
This way we avoid bugs coming from wrongly (human) counted length.

Change-Id: I95eb87a78fc12d4c5e083ce1c65d8b690ad8db78
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:31 -05:00
Johan Hedberg 7d8303bbbf Bluetooth: Introduce BT_DATA_BYTES convenience macro
This way we don't need a special BT_BYTES macro and avoid bugs coming
from wrongly counted number of bytes (which is now evaluated at
build-time).

Change-Id: Ic6319234a816fe2fab6229b3bb980d0e3503e241
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:31 -05:00
Szymon Janc 47f0279502 Bluetooth: samples/shell: Fix printk modifier
Use %d for printing signed integer.

Change-Id: I6fbf387969e97561430ea0d2d422842c599f1457
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:28 -05:00
Johan Hedberg d5e23e86d2 Bluetooth: UUID: Introduce new API
Introduce new UUID API with bt_uuid, bt_uuid_16 and bt_uuid_32
structs. The specific size structs are derived from the common bt_uuid
struct to make it possible to use CONTAINER_OF().

Change-Id: I9cb03c73406acb7768d410fdf29eae75d252163c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:28 -05:00
Andrei Emeltchenko 81b4ffbf93 Bluetooth: bttester: Trivial style correction
Change-Id: I39e2c414ec1e972112bda0ba3ca1d1626c32bb18
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:28 -05:00
Luiz Augusto von Dentz 5506ec6f09 Bluetooth: Shell: Fix l2cap-send
bt_l2cap_chan_send does actually return the number of bytes sent.

Change-Id: I862a8519c752c6b26250a21be02a927a9326617c
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:28 -05:00
Luiz Augusto von Dentz bcea32a2ca Bluetooth: shell: Don't call bt_enable blocking
Now that nble driver is supported bt_enable cannot be called blocking
since it is not supported, futhermore the call to bt_gatt_register
should be done after bt_enable is complete.

Change-Id: I404f8cd8b8339dba0fd26d24edeb718eba4bf225
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:27 -05:00
Andrei Emeltchenko 26e152f734 Bluetooth: doc: Add notes for building with NBLE enabled
Change-Id: I77f4c25bacd4f6233152d44d36f3057f4ac108e7
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:27 -05:00
Andrei Emeltchenko 4124327525 Bluetooth: nble: Correct platform name for Arduino 101
This enables this test case for arduino_101 platform.

Change-Id: I2a94fb90f4c57022ddf1ec11ab06bb5e59de9b6e
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:27 -05:00
Andrei Emeltchenko af6d20461b Bluetooth: tests: Remove extra board definition for NBLE
Board already defined in platform_whitelist

Change-Id: I2fed4b3c0663fd15d43ee697837a89439f7bd07a
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:27 -05:00
Szymon Janc 92e84bbfb8 Bluetooth: samples/shell: Fix use of NULL net buffer
Don't use NULL pointer if aquiring net buffer failed.

Change-Id: I11a22b832d1da9559b90abe0cb83eed56d14722f
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:27 -05:00
Mariusz Skamra 71472f8aca Bluetooth: tester: Convert advertising data
This adds conversion of advertising data (adv_data) to be used by
bt_le_adv_start function.

Change-Id: I403ff7ebed89dbf763d258b5dcdabfbb2cb68260
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:27 -05:00
Andrei Emeltchenko 1636eca4cb Bluetooth: shell: Add NBLE shell test to sanitycheck
Test can be verified with

$ sanitycheck -s bluetooth/shell/test_nble -v
arduino_101  bluetooth/shell/test_nble  PASSED

Change-Id: Icfc5892524041d169973bd6eb7d23b6ecffb98fc
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:27 -05:00
Andrei Emeltchenko d5d9e081c6 Bluetooth: shell: Add Nordic BLE configuration
Allow to build shell for NBLE.

Change-Id: Icbd019ee1947f2dcf3bc358685024f22c6a5de34
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:27 -05:00
Andrei Emeltchenko 355146d2aa Bluetooth: shell: Fix usage of BREDR functions
Fix compiler errors when CONFIG_BLUETOOTH_BREDR is not enabled.

Change-Id: I003985a9769120b3314eaf1b9563a3bf9712e32a
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:27 -05:00
Andrei Emeltchenko e4777eca2c Bluetooth: shell: Make buf_data local
Move buf_data to the place it is used reducing errors when dynamic
channels are disabled.

Change-Id: I82f640ffa8046e1c9b5805658e69cb722856d445
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:27 -05:00
Andrei Emeltchenko 06d9e61dd6 Bluetooth: shell: Fix dynamic channel usage
Fix wrong dynamic channel usage in shell

Change-Id: Ieb6505b4c5ce1d380af4ac0b5ef788b16a2eeb4d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:27 -05:00
Luiz Augusto von Dentz 59a4e2eaea Bluetooth: tester: Add support for testing with nble driver
Change-Id: I4c996d30da30d8f3b88d7ba9efe974872f902e0a
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:27 -05:00
Luiz Augusto von Dentz dab10c414b drivers/nble: Add UUID support
This reuses the existing code since that is not driver specific, with
this samples such as tester can be build using nble driver.

Change-Id: I6d9f3edf8deb2e84fce233ef02d1cd0ad6f52526
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:27 -05:00
Andrei Emeltchenko 6c988ba401 Bluetooth: beacon: Correct arduino target
Putting right target allows to build for arduino_101.

Change-Id: Ib11244c7f024c72f0ab0b15549be57c576bdef3c
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:27 -05:00
Andrei Emeltchenko a166d5fd6d Bluetooth: nble: Include right platform
Currently it is not possible to build for Arduino since wrong platform
was specified.

Change-Id: I85ff6f5adb003db9a0905d6afa04bb5dfbd55d53
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:27 -05:00
Luiz Augusto von Dentz 9e74b5171f Bluetooth: beacon: Add support for testing with nble driver
In addition to having a different CONF_FILE bt_enable needs to be given
a callback since nble driver cannot block while initializing.

Change-Id: I8bd2c79d0620e93dbecfef25c49c5529ff1ee954
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:27 -05:00
Johan Hedberg 4218572c13 Bluetooth: samples/peripheral: Set right board for nble testcase
Change-Id: Ie0b1dceeb94a760dc9990a5c573616522169ea76
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:26 -05:00
Peter Mitsis 0f213d57e4 samples: Ensure stacks are properly aligned
Applies '__stack' tag where necessary to ensure that stacks are
properly aligned.

All stacks must be properly aligned via the '__stack' macro tag.

Change-Id: Icfb04e246bd97b2185bb05e63647c7ab01993e36
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:25:23 -05:00
Johan Hedberg ded463351d Bluetooth: samples/peripheral: Add missing TEST_RANDOM_GENERATOR
Change-Id: I8e52ed05dbf52e48d1d98baaf854be26a60f0410
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:20 -05:00
Luiz Augusto von Dentz 9905c6fb12 Bluetooth: Remove nble sample
nble sample is a copy of peripheral sample which now has support for
testing nble driver so a dedicated application just for that is no
longer needed.

Change-Id: Ia8ea2262fc2472a54c81b90eb86d9c0d4b12f42d
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:20 -05:00
Luiz Augusto von Dentz 29921c9e83 Bluetooth: Add support for testing nble driver with samples
This adds a test case that passes prj_nble.conf as CONF_FILE so that
the same code tested using HCI Bluetooth driver is also tested using
NBLE driver.

Change-Id: Ia4ad59d74b82c02007c55ea4fa8f53833d7a7fe5
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:20 -05:00
Luiz Augusto von Dentz dc2c434ff7 drivers/nble: Add BLUETOOTH_MAX_PAIRED
This makes it easier to port samples which may use
CONFIG_BLUETOOTH_MAX_PAIRED.

Change-Id: I3e37df7cae63a4ac2219ce26408ae4d4f987645d
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:20 -05:00
Luiz Augusto von Dentz d65dcc5e4b Bluetooth: GATT: Replace handle with attribute object in bt_gatt_notify
This make more sense since the handles are normally self allocated by
the stack.

Change-Id: I198dd9c3ef6259cff8a0e528514918ec18990dea
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:20 -05:00
Luiz Augusto von Dentz 05da1e9b01 Bluetooth: Rename prj_x86.conf to prj.conf
There is no need to keep arch specific prj.conf for these samples are
they are always the same.

Change-Id: I0f93b5a47458f9800a6654cc45914b911b42b3e3
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:20 -05:00
Mariusz Skamra 6ccccc75a8 Bluetooth: btp: Make Configure Notify/Indicate cmds return status
These commmands don't have to return ATT error code, because
status BTP status is sufficient.

Change-Id: I5405bfbc0ad6fbac46eb3dab1ee63d3e18bf38fc
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:20 -05:00
Mariusz Skamra cd69293bf6 Bluetooth: tester: Add Configure notifications/indications cmds
This patch adds implementation of handlers for Configure Notifications
and Configure Notifications BTP commands.

Change-Id: I92c40836c09e145ea405226f321dd752ac16fc9f
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:20 -05:00
Mariusz Skamra 0198c192ea Bluetooth: tester: Add notifications/indications struct defines
This patch adds noifications and indications commands and event
related structure defines to the tester application.

Change-Id: I532ab6471d2e7671213bfa526e7261308dd4b2f6
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:20 -05:00
Mariusz Skamra 7abc58cb1d Bluetooth: btp: Rename Configure Notifications cmd parameter
Enable seems to be more appropriate than Toggle.

Change-Id: I69ef509c47ddd7b76bc16684af60821328a7c647
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:20 -05:00
Mariusz Skamra 87a51595fc Bluetooth: tester: Add BTTESTER_DBG macro for logging
This adds BTTESTER_DBG logging macro.

Change-Id: I5a884ccb8ed50d1c663b4cc87b77e9680f9b9492
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:20 -05:00
Arkadiusz Lichwa b713d8462f Bluetooth: samples/shell: Fix printing bluetooth address for BR/EDR
Adjust printing bluetooth address in auth_cancel() user callback.

Change-Id: Ic39eeac36394d73eaee27c04bcad17e32704bbe7
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:25:20 -05:00
Luiz Augusto von Dentz 6517da9dc9 Bluetooth: tester: Fix using attribute _next
_next member, as the name suggest, is internal and shall not be used by
application directly instead application must use bt_gatt_attr_next.

Change-Id: I7c137eae555475d024098cd14a54d965cb397eae
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:20 -05:00
Andrei Emeltchenko d2d857bac0 Bluetooth: samples/nble: Add debug output
Let us know that bt_enable() is successful.

Change-Id: I70581d950a9a922e809804bacfbfa039b2fec2fe
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:20 -05:00
Luiz Augusto von Dentz 6e8ab42997 Bluetooth: Make peripheral sample use CONFIG_BLUETOOTH_GATT_DYNAMIC_DB
This makes sure the code behind CONFIG_BLUETOOTH_GATT_DYNAMIC_DB builds
properly and sanity_check is able to detect problems whenever there is
a change affecting it.

Change-Id: If46d1d9723f9daa494611e5a1799afd943e6519c
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:20 -05:00
Luiz Augusto von Dentz c44ef91e56 Bluetooth: GATT: Add support for static DB
This enable applications to build with a single table representing the
database where attributes don't have to store a pointer to the next
attribute thus reducing its size.

Change-Id: I4c84e2d50f9088a2f9879068890f0646e586e007
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:20 -05:00
Andrei Emeltchenko 0190ba7abd Bluetooth: samples/nble: Disable ARC core
Disabling ARC core allows to flash only lakemont and decrease unneeded
debug output.

Change-Id: Ifb913274302d7c69f1fb9c2e1747742d7a810627
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:19 -05:00
Andrei Emeltchenko bdbd02bd26 Bluetooth: samples/nble: Only test on quark_se
Test Nordic BLE on platforms which has support for it, at least we
need a UART configured to be connected to the chip.

Change-Id: I040fbb33436ae6bf973b521d52bf7b971993559a
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:19 -05:00
Johan Hedberg bc073cdb59 Bluetooth: Add bt_conn prefix for auth APIs
All of the authentication APIs deal with bt_conn objects. For
consistency it makes therefore sense to use the proper bt_conn name
space with them.

Change-Id: I47912d542373df511524cc6ad2532d6c9a76ca68
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:19 -05:00
Mariusz Skamra 3f58f09864 Bluetooth: tester: Increase gatt_buf buffer size
This is needed for GATT Server tests to implement larger attribute
databases.

Change-Id: Id160ac81b3e393697bdacd3e19033e9ff7c10fde
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:19 -05:00
Johan Hedberg 432c2db4d8 Bluetooth: Add err/reason parameters to connected/disconnected calls
This is essential so that the application can be notified of
connection failures and also be able to know the reason for the
disconnection.

Change-Id: I30108958963f6aeac690612bb26738dc4c67ca80
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:19 -05:00
Johan Hedberg 3c47e9515c Bluetooth: Update advertising API
Update the advertising API according to what has recently been
discussed and agreed upon.

Naming-wise the most important change is the removal of "EIR" which
was confusing since this is mainly used with LE at the moment. The
Core Specification Supplement consistently uses the generic terms data
and data type to describe what we're dealing with here, so the new
names are bt_data and BT_DATA.

Another change is to detach the actual data from the struct by
converting it from an array to a pointer. This is not only essential
for supporting BR/EDR (which has a different length) but to also
minimize memory usage.

Another change is to require the caller of bt_le_adv_start() to
provide the array lengths of the ad and sd paramters. This way we
don't have to have the empty (8-byte) element at the end of each
array.

Lastly, the bt_le_adv_start() logic is slightly modified so that it
will always clear the respective data if necessary. Previously the
user might have been left with a previous callers data if it passed
NULL to the API.

Change-Id: I318026ceb1b52bb688edf4dcfed82613bd15c3e1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:19 -05:00
Arkadiusz Lichwa 7e9b66ae93 Bluetooth: samples/shell: Fix printing bluetooth address for BR/EDR
Uses proper bluetooth address during printing to standard output
when monitors connected, disconnected and security changed states
based on established connection transport type.

Change-Id: I87b54ee619c329ffa645bfbb5e453cf673b93181
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:25:19 -05:00
Andrei Emeltchenko bd087e2bc9 Bluetooth: Change default board to Arduino 101
Change default board for nble app to arduino_101

Change-Id: I5f8cd57c9834e38125d9e17cd4c3a96427db702a
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:18 -05:00
Szymon Janc b0ce61bedf Bluetooth: samples/shell: Fix BR/EDR legacy pairing in sec mode 3
If device is operating in security mode 3 PIN request callback
is called before connected.

Change-Id: Ie36363ae7af2398276f9cc4d07126344588b9ae6
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:18 -05:00
Johan Hedberg c9431e17a9 samples/bluetooth: Add sample app for nble implementation
This is almost exactly the same as the peripheral app, except that it
uses CONFIG_NBLE.

Change-Id: Ia6854bce2a0babd03a3ce3251a173ce7ddbfe374
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:18 -05:00
Grzegorz Kolodziejczyk fa3b78bd07 Bluetooth: tester: Use default address types
Unified bluetooth address types will simplify tester code.

Change-Id: I6d973ff05a8a8dcabb12c9543cd4d747db3e6680
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:25:18 -05:00
Mariusz Skamra a91c44417b Bluetooth: tester: Add support for adding CEP descriptors
This patch handles adding of Characteristic Extended Properties
descriptors to tester's GATT database.

Change-Id: Ie1f1c5c5176983250c5fbc97dd44cbe19622b06c
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:18 -05:00
Mariusz Skamra 0fa3b620c5 Bluetooth: tester: Support for adding CCC descriptors
Intentionally only one CCC descriptor will be added to the database.
It's because this meets the conditions to pass PTS tests.

Change-Id: Ic29608e5a9fb4cee0c576d149e5dd26498b365ed
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:18 -05:00
Peter Mitsis cd6db374de nano_fifo: Simplify nano_xxx_fifo_get() API family
Changes the nanokernel FIFO API so that the timeout parameter must be
specified when invoking nano_isr_fifo_get(), nano_fiber_fifo_get(),
nano_task_fifo_get() and nano_fifo_get().

This obsoletes the following APIs:
	nano_fiber_fifo_get_wait()
	nano_fiber_fifo_get_wait_timeout()
	nano_task_fifo_get_wait()
	nano_task_fifo_get_wait_timeout()
	nano_fifo_get_wait()
	nano_fifo_get_wait_timeout()

Change-Id: Icbd2909292f1ced0bad8a70a075478536a141ef2
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:25:14 -05:00
Anas Nashif 10bb38c186 Use SoC instead of platform.
Change terminology and use SoC instead of platform. An SoC provides
features and default configurations available with an SoC. A board
implements the SoC and adds more features and IP block specific to the
board to extend the SoC functionality such as sensors and debugging
features.

Change-Id: I15e8d78a6d4ecd5cfb3bc25ced9ba77e5ea1122f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:11 -05:00
Anas Nashif dcf046c72d rename basic_atom with minnowboard
Use a real board name that can run this kernel instead of a generic
name. Basic functionality exits on this board with Zephyr.

Setup of the board is mostly similar to what we have in galileo (EFI
based)

Change-Id: Ic8554f26dcac0dbbbb6d35d863482f6207dc63c5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:11 -05:00
Anas Nashif c740608ce5 Use BOARD instead of PLATFORM_CONFIG
Change-Id: I14db0087cd705df0db8a911071bc3949b5c79314
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:11 -05:00
Szymon Janc dcd8e188da Bluetooth: Fix bt_gatt_discover_func_t callback definition
bt_gatt_discover function doesn't take user data and therefore
bt_gatt_discover_func_t is not providing any user data. It was
always providing discovery parameterts used so just match that
in function definition.

Change-Id: I90086285d02e2ef50be1d5d25299bb1c6819fdd7
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:10 -05:00
Szymon Janc 6edc0edd8a Bluetooth: Add LE SC Only mode sample
This adds peripheral sample application that is configured
in LE SC Only Mode. It tries to set security level to FIPS right
after connection is created. Two paired devices are supported.

Change-Id: I78f3e3eeaf552c52f982035168e967016858a00b
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:10 -05:00
Johan Hedberg 005b9904a4 Bluetooth: Don't pass length of PIN code to bt_auth_pincode_entry
We can calculate the length with strlen() and there should be no need
to consider anything else except nul-terminated C strings.

Change-Id: I02ec4b1dddbb1bd457f035926c86b27f4c2ab050
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:10 -05:00
Arkadiusz Lichwa 8d9e7861b4 Bluetooth: BR/EDR: Apply PIN code functionality in bt shell
Typical usage:
>auth all
[Connected]
[Request to enter PIN code]
>auth-pincode 1234

Change-Id: I2bb203185c1a048ddb967c9b0ade69e9ffefcacc
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:25:10 -05:00
Johan Hedberg b68c47f671 Bluetooth: samples: Use shorter form for connectable event tests
Instead of a switch statement use an if statement which is  more
compact and readable.

Change-Id: Ie2cd703eef582b129d81331b4bbcee5e0eba2479
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:10 -05:00
Szymon Janc 83eb4ba541 Bluetooth: Use passive scan in central samples
Those applications don't require active scan to be performed.

Change-Id: I7c4b52ab8aaa700ab4fea4e2b19a66d182f799b6
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:10 -05:00
Mariusz Skamra 10866023d1 Bluetooth: BTP: Add missing Type parameter in Find Included command
Included Services Found can be of type either Primary or Secondary.
Tester shall know the type of service discovered.

Change-Id: Ia78e0c76236bb0ce295a91c6617aa9eafdfcf60b
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:09 -05:00
Mariusz Skamra 80ac70b45a Bluetooth: BTP: Add missing Notification/Indication event parameter
This patch adds missing Type parameter in the Notification/Indication
Received event. This parameter specifies if the IUT received Notification
or Indication.

Change-Id: Ia9f4fbf6ede99c72d6c7bddb87f1aeb3b8b97600
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:09 -05:00
Mariusz Skamra 0eeb521b87 Bluetooth: BTP: Add commands to configure notifications and indications
This patch adds extends BTP with commands to register for characteristic
value indications and notifications. These commands require CCC handle
parameter taken from PTS in the MMI.

Change-Id: Ie97c85c47590c0e29c5d8cb65cefe5f022f79f47
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:09 -05:00
Szymon Janc 31be0927d5 Bluetooth: Skip non connectable advertising in central_hr sample
There is no point in trying to connect non connectable device.

Change-Id: I1e3d8486db7cd7ca80f226ec3f4c36ab43f14a1a
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:09 -05:00
Szymon Janc 26ba17d534 Bluetooth: Add simple central application
This application only connects and disconnects to found devices.

Change-Id: Ic4d5cde52da37a369aa0583ec774c4dd116c6c6e
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:09 -05:00
Szymon Janc 594ee4cce4 Bluetooth: Rename central sample to central_hr
This application implements Heart Rate client.

Change-Id: I0b8b7923c89721c9fe66f72b76ab818dc41930b4
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:09 -05:00
Luiz Augusto von Dentz cd0c4eaeda Bluetooth: Fix central sample
This makes sure discovery UUID is a static variable so that it remain
valid once the scope changes.

Change-Id: Iaca9ab5d71f51e526dcd8439795e962bb359f9b2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:09 -05:00
Andrei Emeltchenko 9a232371ef Bluetooth: Add init_h5 sample app
The main purpose of sample app is testing H5 driver and catching
checkpatch build issues with H5 enabled.

Change-Id: Ia02cdcb38fc8f836de0e5f87b1afe428f7021673
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:09 -05:00
Szymon Janc a1034a205f Bluetooth: Add DIS peripheral sample application
This adds very simple peripheral application that supports
Device Information Service only and doesn't support pairing.

Change-Id: Iaec1317a8894db11388408d3f65af8a38d1618c3
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:09 -05:00
Mariusz Skamra b90d2c6dbd Bluetooth: GATT: Pass bt_conn to the discovery function callback
This patch replaces bt_gatt_attr_func_t with bt_gatt_discover_func_t
to be used as a type of discovery callback. The reason is
bt_gatt_attr_func_t don't return bt_conn which could be used
later on to issue other commands and to application to know
from which connection this results come.

Change-Id: I1f26c72ad5c8a0b97485a337c7005d34281586d7
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:08 -05:00
Mariusz Skamra 5ac044431e Bluetooth: tester: Handle Read Multiple Characteristic Values command
This patch adds Read Multiple Characteristic Values command handler
to the tester. It allows to test if GATT Client can read multiple
values from a GATT Server.

Change-Id: I994ffac73eb8e6c0a7696dc41304efd9f01c35a4
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:08 -05:00
Mariusz Skamra c3ee5fbcdd Bluetooth: tester: Handle Write Long Characteristic/Descriptor command
This patch adds Long Write Characteristic Value/Descriptor command handler
to the tester. It allows to test if GATT Client writes long values properly.

Change-Id: I788707b0a043ecad6be32d9e1f8d536765ebf41a
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:08 -05:00
Mariusz Skamra 2f1e4e92e9 Bluetooth: tester: Handle Write Characteristic Value/Descriptor command
This patch adds Write Characteristic Value/Descriptor command handler
to the tester. It allows to test if GATT Client performs write
operation properly.

Change-Id: I3afe167c7ca2789df7d288bbc06ffc8479240da8
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:08 -05:00
Mariusz Skamra b1c8d269ec Bluetooth: tester: Handle Read Long Characteristic/Descriptor command
This patch adds Read Long Characteristic Value/Descriptor command handler
to the tester. It allows to test if GATT Client can read long value from
a GATT Server.

Change-Id: I1c2060f7ecd45ca18ed5f9e0747121236b283631
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:08 -05:00
Mariusz Skamra 4e04f912f1 Bluetooth: tester: Handle Read Characteristic Value/Descriptor command
This patch adds Read Characteristic Value/Descriptor command handler
to the tester. It allows to test if GATT Client can perform read
attribute value from a GATT Server.

Change-Id: If95b8d2d3a5a62048bb6371ae80b2834c20d88e1
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:08 -05:00
Mariusz Skamra 0e774613a4 Bluetooth: tester: Handle Signed Write Without Response command
This patch adds Signed Write Without Response command handler to the tester.
It allows to test if GATT Client can perform signed write operation without
acknowledgement form Server.

Change-Id: I14757e6a52abf87bed68103b2e6fbff200fb6bb8
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:08 -05:00
Mariusz Skamra 51de714eef Bluetooth: tester: Handle Write Without Response command
This patch adds Write Without Response command handler to the tester.
It allows to test if GATT Client can perform write operation without
acknowledgement form Server.

Change-Id: I3663e2e01c0fabfd75e4bedab0955700e3003522
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:08 -05:00
Mariusz Skamra 66cc8faf7a Bluetooth: tester: Handle Discover All Characteristic Descriptors command
This patch adds Discover All Characteristic Descriptors command handler
to the tester. It allows to test if GATT Client can perform discovery of
characteristic descriptors within specified range.

Change-Id: Ieb04b47168249d8d76eab840b4f54b8b6b450792
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:07 -05:00
Mariusz Skamra 2d1b3b5a62 Bluetooth: tester: Handle Discover Characteristics by UUID command
This patch adds Discover Characteristics by UUID command handler
to the tester. It allows to test if GATT Client can perform discovery
of characteristics based on known UUID.

Change-Id: Iab78ea7e5bc85e1fadc46b7e8f5b28ee4b9db16d
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:07 -05:00
Mariusz Skamra b01cc79923 Bluetooth: tester: Handle Discover All Characteristics command
This patch adds Discover All Characteristics command handler to the tester.
It allows to test if GATT Client can perform discovery of all
characteristics contained within specified range.

Change-Id: Ib70abaf1365fe4a73757507148723e66881b01de
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:07 -05:00
Mariusz Skamra 469ea4ee10 Bluetooth: tester: Handle Find Included Services command
This patch adds Find Included Services command handler to the tester.
It allows to test if GATT Client can perform relationship discovery.

Change-Id: I76c12fcd5e79d906b4e29b926a82a2022e505c40
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:07 -05:00
Mariusz Skamra ee178fe665 Bluetooth: tester: Handle Discover primary services by UUID command
This patch adds Discover Primary Services by UUID command handler
to the tester. It allows to test if GATT Client can perform discovery
of primary services based on known service UUID.

Change-Id: If5788c6f23481c7b4af85834bf8b113a97a4b66d
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:07 -05:00
Mariusz Skamra a693d9f29c Bluetooth: tester: Set missing bits in GATT supported commands
This patch fixes missing bits set in GATT supported commands.

Change-Id: I0c8035dc126a680147978947438f28df3b734d7a
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:07 -05:00
Grzegorz Kolodziejczyk c8dbc71552 Bluetooth: tester: Add passkey entry command implementation
This adds implementation of passkey entry command in tester
application.

Change-Id: I0624ee9f899102284490a82f5bb0a68bb342640a
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:25:07 -05:00
Grzegorz Kolodziejczyk cc795e9204 Bluetooth: tester: Add pair command implementation
This adds implementation of pair command in tester application.

Change-Id: I55545bdf99e2828c17ec716069e925940f15d019
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:25:07 -05:00
Grzegorz Kolodziejczyk b6c0a04a55 Bluetooth: tester: Add set io cap command implementation
This adds implementation of setting io capabilities command in tester
application.

Change-Id: I21ae68633fb74d78db6e5622e1ee518ef0eed632
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:25:07 -05:00
Grzegorz Kolodziejczyk 434a4f6d85 Bluetooth: tester: Implement SM command stubs for tester
This patch adds stubs for SM commands defined in GAP.

Change-Id: I5aef256ade5a100eb0a582c5d9bd5eb8d01611f2
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:25:07 -05:00
Grzegorz Kolodziejczyk 2c14807046 Bluetooth: tester: Separate helper for converting to btp addr type
This patch separates helper for converting address type to btp
specific.

Change-Id: Ied723e01f5548b10e063a6771f8824c0c35b4682
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:25:07 -05:00
Grzegorz Kolodziejczyk c0c7358196 Bluetooth: tester: Replace tester_rsp_full wrapper with tester send
This patch removes redundant tester_rsp_full public function with
wrapped tester_send function.

Change-Id: Iba517ed194e02045ca952b00b952c7608592fbbd
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:25:07 -05:00
Mariusz Skamra d82d735079 Bluetooth: tester: Fix blocking ATT requests
BTP Client received success response from the tester application too early,
so that next command was blocked due to pending ATT Request

Change-Id: I598c0e9e90984cac07f8b4ea265b0d6d69d3d18d
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:07 -05:00
Luiz Augusto von Dentz 4a20bc14a7 Bluetooth: Make use of BT_UUID_DECLARE_16 for services
This makes it simpler to add the services directly into GATT services
table.

Change-Id: I090c7f9396329cf524947dd6647230c663a55f60
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:07 -05:00
Anas Nashif f6f81868f8 build: Remove PROJECTINCLUDE from application makefiles
PROJECTINCLUDE is not required in app makefiles.

Change-Id: I3751b7c51c453dfe47d207bb11d171138668c4e7
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:04 -05:00
Johan Hedberg 5355aa8a76 Bluetooth: samples/shell: Add support for custom prompt callback
Change-Id: Ib5d305b4e98d5bcf7c14172494f452c35149a8de
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:03 -05:00
Johan Hedberg 610186b48a Bluetooth: Fix HCI driver Kconfig references in samples
Now that the H:4 driver is the default it doesn't have to be
explicitly enabled anymore. The only exception is the "no default
driver" option that's needed by the test_bluetooth unit test.

Change-Id: Ie582d51202714e314b76ffa9659c7a232a18fc1a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:03 -05:00
Johan Hedberg 76d3602e46 Bluetooth: samples/shell: Update advertising command to new API
Change-Id: I2cb1065547dc3d39f5b9c645a576f768aa9d903f
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:02 -05:00
Johan Hedberg de6e78e1f6 Bluetooth: samples/beacon: Use NRPA for advertising
Change-Id: I9c9c8ab5b18bdd0e035944718405cfec9a164c13
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:02 -05:00
Johan Hedberg d4a9bdebc9 Bluetooth: samples/shell: Clean up advertise command handler
Change-Id: I11ed196b69d340eab9d8e0e1dc1d2d959cc1043b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:02 -05:00