Commit graph

662 commits

Author SHA1 Message Date
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
Johan Hedberg 1a32d5ed55 Bluetooth: Add support for specifying connection parameters
Applications may want fine-grained control of connection parameters.
The two APIs to provide this through are bt_le_set_auto_conn() as well
as bt_conn_create_le().

Change-Id: If5cddbbf017b868d768d18d2a09daf4af8aa00d8
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:02 -05:00
Johan Hedberg 4956d5630e Bluetooth: samples/shell: Add "select" command
Add command for choosing the default connection.

Change-Id: Id100320f31cb0e99ab48b162b466f52f6273018a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:01 -05:00
Johan Hedberg 2f76a721fd Bluetooth: samples/shell: Support disconnecting non-default device
Change-Id: If9d0c601e02b9bbf4b48bf6f2e06b45d2ab5bce2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:01 -05:00
Johan Hedberg 160489a595 Bluetooth: samples/shell: Add "auto-conn" command
Change-Id: Id81b760efa74eb6cd802289f200231bd020fbe94
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:01 -05:00
Johan Hedberg dd353487c4 Bluetooth: Create active scanning helper macro
All current user just want basic active scanning so a corresponding
macro makes more sense than something based on duplicate filtering.

Change-Id: I97787be24b89fad66f2a952c5d53ab76f4e062fb
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:01 -05:00
Mariusz Skamra 59719970cc Bluetooth: tester: Increase BTP_MTU size
Current MTU size was not sufficient to test GATT Client, where lower
tester requires to send data of length 512 +opcode +BT address.
This exceeds current BTP_MTU size.

Change-Id: I090c47975ecfe9a657d6ff1158b5dc764c8a78a1
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:25:00 -05:00
Johan Hedberg 38b5be06a7 Bluetooth: samples/central: Use consistent scan type
Both places in the central app that enable scanning should do
duplicate filtering.

Change-Id: If7086667c78878355dc246aa3d0b5ebcbdd0ac7b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:00 -05:00
Johan Hedberg f5a238b665 Bluetooth: Add ability to specify dedicated LE advertising parameters
We'll need to have a much more flexible LE advertising API. This is a
first step in that direction. A convenience BT_LE_ADV() macro is
provided to ease converting application code.

Change-Id: I74854487bbdfb4b1cf1bee0b6351d1750a56ff86
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:00 -05:00
Johan Hedberg f1d4b686b6 Bluetooth: Rename bt_bredr_* prefix to bt_br_*
bt_br_* is equally understandable and the same length as the
corresponding bt_le_* prefix on the LE side.

Change-Id: I1820f9b9fab6363b696072f6b70d57c0bc780078
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:00 -05:00
Johan Hedberg 5619d1114b Bluetooth: Rename LE scan & advertising APIs for consistency
To have a clear split between LE & BR/EDR rename these APIs with the
appropriate prefixes.

Change-Id: I983df2b5880947d96f0ad289d12f3383f44894be
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:00 -05:00
Luiz Augusto von Dentz 962462629e Bluetooth: Fix scan data of IPSP Application
The data length was incorrect which caused the name to be truncated.

Change-Id: Ieaca7745fff89f0f5689b6d15bfc0386f59add47
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:00 -05:00
Luiz Augusto von Dentz c3fde0020d Bluetooth: Make IPSP Application use blocking version of bt_enable
For test purpose pass NULL to bt_enable so it blocks until init
sequence is complete.

Change-Id: I875ff9a59bb3d1d2e799db6fc967da3aee3ac77a
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:00 -05:00
Luiz Augusto von Dentz 21fc28e8f8 Bluetooth: Add IPSP application to sanitycheck
Change-Id: Ib64f9e4d3f1d6a7f6d1cd1e18f88303b70e0dd91
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:00 -05:00
Arkadiusz Lichwa 66f9b8dc22 Bluetooth: BR/EDR: Add SCAN functionality to shell app
Enables in bt shell commands to verify available SCAN API.

Change-Id: Ie5a50ee6ecb875b56260bec7c5bbaa0482bd69e0
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:25:00 -05:00
Arkadiusz Lichwa a8d187d5aa Bluetooth: BR/EDR: Enable BLUETOOTH_BREDR option in shell app
Enables CONFIG_BLUETOOTH_BREDR option by default for bt shell app.

Change-Id: I94bca76f4c55ccccb61a3c868cbc6922f553f1f0
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:25:00 -05:00
Szymon Janc 216938ca2b Bluetooth: Print leading zeros for passkey in shell app
Passkey should be entered with leading zeros so print them to avoid
user confusion. Due to printk limitation (no support for padding or
precision operators for decimal numbers) snprintf is used for
convertion.

Change-Id: I6e01f577c935147ec91038b6dce115fcd893ac99
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:59 -05:00
Luiz Augusto von Dentz ddc617efad Bluetooth: Update README with instructions for IPSP application
For testing IPSP application against a Linux host it currently need some
extra steps since 6LowPAN is not enabled by default.

Change-Id: Id491e31ef9ad6eebca7497705e874c01a5493589
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:59 -05:00
Luiz Augusto von Dentz 6be8a35d05 Bluetooth: Add IPSP sample application
This application uses Bluetooth IP driver to listen to UPD port and
echo back the data received.

Change-Id: Id8e58f5f8bf58ff5947441cbcb3131c0da27081c
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:59 -05:00
Grzegorz Kolodziejczyk ce4a34181f Bluetooth: Add SM related struct defs to bttester
This patch adds structure definitions for SM related commands and
events. Structs are mapped with btp specification and will be used
within commands and events implementation.

Change-Id: I82231cdab62d170b86c548acc14ffdcbd888473a
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:24:59 -05:00
Szymon Janc 607f7c12cd Bluetooth: Disable SMP debugs in shell app
Those are debug feature and were enabled by mistake.

Change-Id: Id49078fd4b910578af35dbe8660d148a691a4f13
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:58 -05:00
Sergio Rodriguez 2e2ad8166e qemu: Creation of QEMU specific platforms
Setting up new platforms to handle emulation, and make them the only
ones able to run on QEMU from the Makefile "qemu" target to avoid
confusion with other platforms. We have now platform qemu_x86 and
platform qemu_cortex_m3, also modification to the sanity checks to have
qemu support only on those platforms

Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
Change-Id: I9291918a1d58fea4f37750ada78234628f9a5d98
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:56 -05:00
Thomas Heeley f85566a0b6 misc: add shell support.
Move btshell.h out of samples into include/misc and rename to shell.h

Move btshell.c into driver/console and rename to console_handler_shell.c
as an shell implementation based on new config
CONFIG_CONSOLE_HANDLER_SHELL.

Add shell_register_app_cmd_handler for an to app to optionally call so
that it can receive cmdlines not handled by the cmds registered with
shell_init

Change-Id: I5c1585e62ff7a0ee923c6c92833cc762cf912bad
Signed-off-by: Thomas Heeley <thomas.heeley@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:55 -05:00
Szymon Janc c0baad2262 Rename simple UART driver to pipe UART
Original name was too generic and confusing. This patch renames
driver to pipe UART and moves it to console drivers folder. Kconfig
destription is also improved.

Change-Id: I716fdbf7d636bbdc03b0fce27a59fd866f473246
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:52 -05:00
Szymon Janc 341f81bd81 Bluetooth: SMP: Refactor keys handling
This refactor the way stored keys are handled to avoid overwriting
existing keys with new keys in case of pairing failed. Main goal is
to delay update of keys (including type and encryption size) until
link is succesfully encrypted with new key (legacy STK or LE SC LTK).

To fix this properly, TK is used to store STK or LE SC LTK and updates
of keys properties are done only on successfull encryption. This makes
code less error prone since update is done only in one place in code.
Also quering SMP code for current key makes sure that correct keys is
used in case of re-pairing.

Change-Id: I6b9e3d8229de522143e0d1fbfe0bd8223dad2a56
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:52 -05:00
Mariusz Skamra 105f052992 Bluetooth: tester: Handle Exchange MTU command
This patch adds Exchange MTU command handler to the tester.
It allows to test if GATT Client can initiate MTU Exchange Procedure.

Change-Id: I2e50cec27fb7b944f57a4a6487138adbf126bad4
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:51 -05:00
Grzegorz Kolodziejczyk 49eab1402c Bluetooth: Extend BTP Specification to cover SM routines
This adds protocol specification for SM.

Change-Id: I9c6ef377d0e4ad261e466dfed3a35713cf79de12
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:24:51 -05:00
Luiz Augusto von Dentz 7d2d2838fb Bluetooth: L2CAP: Implement segmentation for incoming packets
If the SDU length is bigger than the amount data received in the first
packet it means it will be segmented in 2 or more packet until the SDU
is completed.

Since the MTU required by the upper layer could be much bigger than the
ACL buffer the code now request a buffer to reassemble the SDU.

Change-Id: I286d16e185f59a8128c4357dddebdc13145dfe31
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:51 -05:00
Luiz Augusto von Dentz 8f48f02cae Bluetooth: Add l2cap-send command to btshell
l2cap-send can be used to send data when connecting to an L2CAP channel:

btshell> l2cap-send 3
bt: bt_l2cap_chan_send (0x00114b0c): chan 0x00112824 buf 0x00112b00 len 23
bt: l2cap_chan_create_seg (0x00114b0c): chan 0x00112824 seg 0x001124f8 len 23
bt: l2cap_chan_le_send (0x00114b0c): chan 0x00112824 cid 0x0040 len 23 credits 7
bt: l2cap_chan_le_send (0x00114b0c): chan 0x00112824 cid 0x0040 len 2 credits 6
bt: bt_l2cap_chan_send (0x00114b0c): chan 0x00112824 buf 0x00112b00 len 23
bt: l2cap_chan_create_seg (0x00114b0c): chan 0x00112824 seg 0x001124f8 len 23
bt: l2cap_chan_le_send (0x00114b0c): chan 0x00112824 cid 0x0040 len 23 credits 5
bt: l2cap_chan_le_send (0x00114b0c): chan 0x00112824 cid 0x0040 len 2 credits 4
bt: bt_l2cap_chan_send (0x00114b0c): chan 0x00112824 buf 0x00112b00 len 23
bt: l2cap_chan_create_seg (0x00114b0c): chan 0x00112824 seg 0x001124f8 len 23
bt: l2cap_chan_le_send (0x00114b0c): chan 0x00112824 cid 0x0040 len 23 credits 3
bt: l2cap_chan_le_send (0x00114b0c): chan 0x00112824 cid 0x0040 len 2 credits 2

Change-Id: Ibc970d1ffd8c407c66b35e9f3bf49ccf826f7472
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:51 -05:00
Mariusz Skamra e54d74f696 Bluetooth: tester: Lookup for service handle while adding characteristic
Add characterictic command requires to provide service ID to which this
characteristic shall be added. With this patch initialization will
succeed only if service with given ID exists.

Change-Id: Ie6223f293b4cac06f211556d29896b2e1ccd96ac
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:51 -05:00
Grzegorz Kolodziejczyk 559f7a07f3 Bluetooth: Add handling connect command for tester
This patch adds support for handling connect command in tester
application.

Change-Id: Ia35bcb33caf59b8df4a3cdc01c12d58fdeeecfe9
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:24:51 -05:00
Mariusz Skamra 50a13c5fc1 Bluetooth: tester: Handle Set Encryption Key Size command
This patch adds a command to the tester application that sets the
required encryption key size to access characteristic value or
descriptor.

> ACL Data RX: Handle 64 flags 0x02 dlen 8    [hci0] 16139.016504
      ATT: Write Request (0x12) len 3
        Handle: 0x0004
          Data: be
< ACL Data TX: Handle 64 flags 0x00 dlen 9    [hci0] 16139.024052
      ATT: Error Response (0x01) len 4
        Write Request (0x12)
        Handle: 0x0004
        Error: Insufficient Encryption Key Size (0x0c)

Change-Id: Ida8b0fdaffe2b1a941a0b87c8a11395a8b63ccd0
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:51 -05:00
Szymon Janc 16e7c44fb2 Bluetooth: Add support for passkey confirmation in btshell
This allows to display passkey and confirm if it matches remote
device.

Change-Id: I22f706b6441210ef426702ec290a05112e06a4e2
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:51 -05:00
Grzegorz Kolodziejczyk d475229b4d Bluetooth: Refactor disconnect command
This patch adds missing connection unref in disconnect command. Also
lightly status setting was refactored.

Change-Id: Ic2502d8df15e45c4aea25632642af3d8a4fb23cc
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:24:50 -05:00
Grzegorz Kolodziejczyk b11d431d98 Bluetooth: Add missing packed attribute to cmd/ev structs
This patch adds missing packed attribute to structures.

Change-Id: I9bcc8a677ae296e41eebb530584977660df52ebf
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:24:50 -05:00
Mariusz Skamra 5b58da915e Bluetooth: Extend BTP specification to cover GATT Client tests
This patch extends Bluetooth Testing Protocol with commands used
while testing IUT as GATT client.

Commands are mapped to the procedures from Core Specification to make
use of Read Supported Commands command. Based on the response to this
command tester can determine which PTS test cases should be enabled.
If the IUT don't support eg. Reliable Writes, this command won't be
set in Read Supported Commands response, so that test cases that
test this functionality won't be executed.

Change-Id: I204a295698d4b69f73d0556b172770c4fd018009
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:50 -05:00
Mariusz Skamra 05426296ee Bluetooth: tester: Fix invalid type of buffer length
Buffer size is 512, so uint16 type shall be used to store it's length.

Change-Id: I5abaf7d783032ff41819f7b838d4016932dece20
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:50 -05:00
Mariusz Skamra f47b828be7 Bluetooth: tester: Factor out helper for converting uuid to bt_uuid
This patch separates helper for converting uuid received from btp
command to bt_uuid.

Change-Id: If7f5423a839379763928ba5e87678697b1721d83
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:50 -05:00
Mariusz Skamra 8dc991855e Bluetooth: tester: Response with error while writting with invalid offset
IUT shall response with Invalid Offset ATT error code, if it exceeds
value length.

Change-Id: I5c7148c96324482f198332d475742bfb44274957
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:49 -05:00
Ruslan Mstoi 36b02569e3 Bluetooth: Remove wrong information about the LSB of opcode
The least significant bit of opcode is not used to distinguish between
command/response or events.

Change-Id: Icaa1b6d87968e095a7f231d43e74257f5acca379
Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
2016-02-05 20:24:49 -05:00
Mariusz Skamra 93adf39864 Bluetooth: tester: Remove not needed status variable
Change-Id: I3f91f5f5bd40912fee2095af340303203807cc11
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:49 -05:00
Johan Hedberg fd4d439d72 Bluetooth: samples/shell: Remove dependency on CONFIG_EXPERIMENTAL
There's no reason to depend on this config option, in fact it looks
like it doesn't even exist.

Change-Id: I3e072466700ca7115dfde5af09b08f98707062bb
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:47 -05:00
Arkadiusz Lichwa cb29e6135d Bluetooth: Kconfig: Change topmost option
Refactors existing menu by putting as topmost selectable option
general bluetooth subsystem support instead so far Low Energy (LE).
Implication of the change is introduction of new BLUETOOTH_LE config
flag. The flag needs to be propagated to all existing bluetooth
related apps to make them buildable.

Change-Id: I608c1baad038e0ee4cccf44a3e597e16ae1f7f54
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:24:47 -05:00
Mariusz Skamra 7dc3d35da6 Bluetooth: gatt: Unsubscribe notification from callback directly
With this patch application can unsubscribe notifications
from Subscribe value callback directly, if BT_GATT_ITER_STOP
is returned.

Change-Id: I7873594f5dbe6e8c5bef11bf397a74cdc870a464
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:47 -05:00
Mariusz Skamra d42a70288b Bluetooth: gatt: Refactor read of attributes as a gatt client
This patch refactor reading of attribute values as a client.
Current MTU size is taken into account to determine if read
procedure has been completed or not.
For now, read procedure will be continued until whole is read,
or stopped by client.
Core Specification says that "The Read Blob Request is repeated
until the Read Blob Response’s Part Attribute Value parameter is
shorter than (ATT_MTU – 1)." (Vol 3, Part G 4.8.3)
Because application didn't know the current MTU value,
there was no way to determine if data received is complete.

Change-Id: I9d0e3f8638b58c3a4e39060333aedc133b775e3d
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:46 -05:00
Luiz Augusto von Dentz 8061ed1277 Bluetooth: Add l2cap-disconnect command to btshell
l2cap-disconnect can be used to disconnect or cancel a connection to
a server:

btshell> l2cap-disconnect
bt: bt_l2cap_chan_disconnect (0x0011260c): chan 0x0011065c scid 0x0040 dcid 0x0040
btshell> bt: bt_l2cap_recv (0x00114e00): Packet for CID 5 len 8
bt: l2cap_chan_recv (0x00114e00): chan 0x00111534 len 8
bt: l2cap_recv (0x00114e00): LE signaling code 0x07 ident 2 len 4
bt: le_disconn_rsp (0x00114e00): dcid 0x0040 scid 0x0040
bt: l2cap_chan_del (0x00114e00): conn 0x001111c0 chan 0x0011065c cid 0x0040
Channel 0011065c disconnected

Change-Id: If249748f98f9b006e4eb2f8722a6f698b372d959
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:46 -05:00
Luiz Augusto von Dentz 2902d5c3c3 Bluetooth: Add l2cap-connect command to btshell
l2cap-connect can be used to connect to a server:

btshell> l2cap-connect 0080
bt: bt_l2cap_chan_connect (0x0011260c): conn 0x001111c0 chan 0x0011065c psm 0x0080
bt: l2cap_le_connect (0x0011260c): conn 0x001111c0 chan 0x0011065c psm 0x0080
bt: l2cap_chan_add (0x0011260c): conn 0x001111c0 chan 0x0011065c cid 0x0040
btshell> bt: bt_l2cap_recv (0x00114e00): Packet for CID 5 len 14
bt: l2cap_chan_recv (0x00114e00): chan 0x00111534 len 14
bt: l2cap_recv (0x00114e00): LE signaling code 0x15 ident 1 len 10
bt: le_conn_rsp (0x00114e00): dcid 0x0040 mtu 672 mps 230 credits 10 result 0x0000
Channel 0011065c connected

Change-Id: I8440615225e74d603c0f6bc3db4cf4bd46831841
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:46 -05:00
Mariusz Skamra 5fc0533414 Bluetooth: tester: Handle add descriptor command
This command will be used to add a descriptor to attributes database.

 >> send 2 4 0 02000302cccc
Received: hdr:  header(svc_id='\x02', op='\x04', ctrl_index='\x00',
							data_len=2)
Received data (hex): 04 00
Received data (ascii): ('\x04\x00',)

> ACL Data RX: Handle 64 flags 0x02 dlen 9
      ATT: Find Information Request (0x04) len 4
        Handle range: 0x0004-0x0004
< ACL Data TX: Handle 64 flags 0x00 dlen 10
      ATT: Find Information Response (0x05) len 5
        Format: UUID-16 (0x01)
        Handle: 0x0004
        UUID: Unknown (0xcccc)

Change-Id: I64b77ce735e2dff10ae15290fb174b7f99876014
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:46 -05:00
Mariusz Skamra f83809991c Bluetooth: tester: Handle add included service command
This command is used by the tester to include service.
Service that is going to be included has to be already present
in the gatt database.

> ACL Data RX: Handle 64 flags 0x02 dlen 11
      ATT: Read By Type Request (0x08) len 6
        Handle range: 0x0001-0xffff
        Attribute type: Include (0x2802)
< ACL Data TX: Handle 64 flags 0x00 dlen 14
      ATT: Read By Type Response (0x09) len 9
        Attribute data length: 8
        Attribute data list: 1 entry
        Handle: 0x0007
        Value: 01000500aaaa

Change-Id: I12e1790be946c3cf10105c66a852da1cb23cf4bd
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:46 -05:00
Mariusz Skamra 6f047a7040 Bluetooth: Refactor adding attributes to the gatt database
This patch changes the way the attributes are added to the database.
From now, attributes will be registered one by one in gatt_db_add function.
This change is needed, because the handle of the attribute is assigned
in bt_gatt_register, and the tester application has to respond to the
command with valid attribute handles.
Moreover, Set Value command rely on the attribute handle, based on which
it looks for an attribute with handle spacified by tester to set it's
value.

Change-Id: I1f251f9bd5579bde2a52ebe3f1997da49c1b1721
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:46 -05:00
Mariusz Skamra 723405d685 Bluetooth: Add command to set the required Encryption Key Size
This will be needed to pass tests that require Insufficient Encryption
Key Size error response.

Change-Id: Ie358686d3a9843527e0c3dbd3918daed4e4d2f4c
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:46 -05:00
Grzegorz Kolodziejczyk 2e77f815f0 Bluetooth: Correct Device Disconnect Event opcode
The same opcode was used to Device Connected event.

Change-Id: I51640ed81822311817e82e43998c476795a28d49
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:24:46 -05:00
Grzegorz Kolodziejczyk 7c49f209b1 Bluetooth: Add possible values of addr type for GAP conn/disconn
This patch adds valid address types parameter for connect, disconnect
commands.

Change-Id: Ia54d503795c1ff04549f9813e197a1de923ef0bb
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:24:46 -05:00
Johan Hedberg 1f6841c9c1 Bluetooth: Convert driver header info to hidden Kconfig options
We know the needed values at build-time, so there's no point in having
a runtime mechanism of accessing them in the code. Having the values
as defines makes it e.g. possible to use them as input for defining
the size of buffer pools.

Change-Id: Ib7556644719bfb631e638fa5bf29f3d1747a5072
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:45 -05:00
Szymon Janc 542bb9cc34 Bluetooth: Fix disconnect command in shell application
Disconnect command is special since it is also used for cancelling
outgoing connection. Due to this is might be called with default_conn
set to NULL. To avoid conditional unref always pick extra reference
from default_conn for local use.

Change-Id: I59ad583becbf39a71366069d0307aa44f2c64174
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:44 -05:00
Luiz Augusto von Dentz 5bd4324ae2 Bluetooth: L2CAP: Unref buffer after calling recv callback
This simplify the handling quite a bit while the application can still
prevent the buffer to be freed by referencing it if necessary.

Change-Id: I5ed0e96e8d9e349b79ba31ba9568af61181e1065
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:41 -05:00
Luiz Augusto von Dentz b861797736 Bluetooth: Fix not unreferencing buffer
Buffer received over L2CAP dynamic channels needs to be unref by the
application once they are done with it.

Change-Id: If210be1c538cf0b550dd03094d007b6851cdfbf4
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:40 -05:00
Johan Hedberg 4b433d4fa6 Bluetooth: Differentiate send/recv of needed driver headroom
The space that the HCI driver needs to reserve for its own use is not
necessarily symmetrical. E.g. even with the current H4 driver we only
need to reserve space for sending data but not for receiving it.
Keeping track of these values independently enables more efficient use
of the buffers.

Change-Id: I64917b545c5cd77356ed038d09afe76422334661
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg 5f4daa1551 Bluetooth: Merge send_acl/cmd back to a single callback
Now that we have the buffer type enum as part of the HCI driver API we
can take advantage of it to pass the buffer type information and not
have to have two separate callbacks.

Change-Id: Ib2ee5b1540e532c9b27903e97660a276c1293fbc
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg 7ff1cbd976 Bluetooth: Split HCI driver ACL/CMD send callback
This is a necessary step in preparation for removing the buffer type
information from the buffers.

Change-Id: I29d8fae32aa660416a1c12e87840499c711e659f
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg 70f80ad968 Bluetooth: samples/peripheral: Remove dependency on internal define
Change-Id: I514d9beb69c27e563d7daeaa880ba55b49a6f159
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Szymon Janc 51af39ff16 Bluetooth: Allow sanity to build tester on x86
This allows to build sanity for both ARM and x86 archs.
Only supported platforms are enabled.

Change-Id: I499dbdee7b9df265affb2bba98b5bb100339fe18
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:39 -05:00
Szymon Janc 162b5e8091 Bluetooth: Default to ARM build for tester application
Tester application requires 3 UARTs and currently no x86 based
platform supports it. For convenience default to arch that allows
to run, not only build tester.

Change-Id: I086e72a580f56d94181a6d6eada7693ddd24dec1
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg 48fde83fe5 Bluetooth: samples/test_bluetooth: Convert to net_buf API
Convert the code to use the net_buf API instead of the soon to be
removed bt_buf API.

Change-Id: I98a0720483d3f364b77fe6dc030c9169aa4ade67
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg e41285999c Bluetooth: samples/shell: Convert to net_buf API
Convert the code to use the net_buf API instead of the soon to be
removed bt_buf API.

Change-Id: I4eb6cea592cce99dcc9e4c1b1219ebbf89eddd04
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Luiz Augusto von Dentz d57e54fddc Bluetooth: Make it possible to build tester for x86
Currently it is only possible to build the tester for arm.

Change-Id: I7fd530ca09bfa41072420da774fba3b48a5d5a90
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:38 -05:00
Luiz Augusto von Dentz 929d4f4c86 Bluetooth: GATT: Make BT_GATT_CHARACTERISTIC declare its value
This makes BT_GATT_CHARACTERISTIC declare a local bt_gatt_chrc so the
applications don't need to declare themselves.

Change-Id: Icf3fad7dffea5667c6f13aa022a5722900da51e8
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:38 -05:00
Luiz Augusto von Dentz 1617f5580b Bluetooth: GATT: Remove value_handle from bt_gatt_chrc
The spec says it should always be the very first descriptor after the
characteristic:

  "BLUETOOTH SPECIFICATION Version 4.2 [Vol 3, Part G] page 534:
   3.3.2 Characteristic Value Declaration
   The Characteristic Value declaration contains the value of the
   characteristic. It is the first Attribute after the characteristic
   declaration. All characteristic definitions shall have a
   Characteristic Value declaration."

Change-Id: I6c38dea9cc4c1a05997edbd348e2759680472725
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:38 -05:00
Luiz Augusto von Dentz 148ce3013c Bluetooth: GATT: Remove unused field of _bt_gatt_ccc
value_handle is not used for anything.

Change-Id: I3885d221b162eb3bd44956af64280baf61dc001b
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:38 -05:00
Luiz Augusto von Dentz 1284e608ac Bluetooth: GATT: Remove handles from macros
bt_gatt_register will assign a handle if not initialized and removing
the handle makes it simpler to change the attributes since it is no
longer possible to have conflicting handles.

Change-Id: I787f7325cc990c360056b1aefd07bb7d7876b445
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:38 -05:00
Luiz Augusto von Dentz 1c8ab98114 Bluetooth: GATT: Make attribute database into a list
This allow calling bt_gatt_register multiple times so different tasks
can add their own services separately.

Change-Id: I8143ddedfa1079087d608013d1a97b552a3007dc
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:38 -05:00
Johan Hedberg 49885879f2 Bluetooth: Rename bt_conn_get/put to bt_conn_ref/unref
We want to make the naming convention ref/unref rather than get/put.
So far the only reference counted objects are the buffers and the
connections. For the buffers the new generic buffer API will also use
ref/unref.

Change-Id: I9fe8b8a6a50a8baf06ba231e8f6717a5a47dd292
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:38 -05:00
Mariusz Skamra 13e0178c55 Bluetooth: Add support for writting characterisitc value
This adds write and flush attribute callbacks to be used for writting
attribute values.
With this patch lower tester can test if IUT can properly handle
write request to the characteristic values.

> ACL Data RX: Handle 64 flags 0x02 dlen 7  [hci0] 1151923.440823
      ATT: Read Request (0x0a) len 2
        Handle: 0x0003
< ACL Data TX: Handle 64 flags 0x00 dlen 7  [hci0] 1151923.456050
      ATT: Read Response (0x0b) len 2
        Value: bbbb
> ACL Data RX: Handle 64 flags 0x02 dlen 9  [hci0] 1151928.435525
      ATT: Write Request (0x12) len 4
        Handle: 0x0003
          Data: ffff
< ACL Data TX: Handle 64 flags 0x00 dlen 5  [hci0] 1151928.456865
      ATT: Write Response (0x13) len 0
> ACL Data RX: Handle 64 flags 0x02 dlen 7  [hci0] 1151929.380796
      ATT: Read Request (0x0a) len 2
        Handle: 0x0003
< ACL Data TX: Handle 64 flags 0x00 dlen 7  [hci0] 1151929.394636
      ATT: Read Response (0x0b) len 2
        Value: ffff

Change-Id: Iea1d39e1a52496692141411251fd4ac2f9ae0b97
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:38 -05:00
Mariusz Skamra 1fa60d7a5e Bluetooth: Fix set value command handler
If the attribute value is going to be changed by the upper tester,
(eg. to issue notification) for simplicity it can be stored in the
place of old one.

Change-Id: I03a6ebbda5d75e6ffa9c2fd6b3c0eab495623a11
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:38 -05:00
Luiz Augusto von Dentz 118dc75cea Bluetooth: GATT: Add connection to bt_gatt_notify
This allow sending direct notification to a specific peer without
using CCC which is allowed by the spec:

  BLUETOOTH SPECIFICATION Version 4.2 [Vol 3, Part F page 507
  3.4.7.1 Handle Value Notification

  A server can send a notification of an attribute’s value at any time.

Change-Id: Ieff29216cb9ba197c0da92d7b22b26e63101cfa8
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:37 -05:00
Mariusz Skamra d523f0bd66 Bluetooth: tester: Handle set discoverable command
Set discoverable command is used to set the discoverable flags
in advertisement data.

Change-Id: If46a5e05379c5f589afb1658a7b275a82c52e4e1
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:37 -05:00
Luiz Augusto von Dentz d55e4ca91c Bluetooth: Add CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL
This adds an option to enable L2CAP dynamic channel support, fixed
channels are not affected by it.

Change-Id: If36bece46b7b94142ea1ac976b878d1b5ae6a578
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:37 -05:00
Luiz Augusto von Dentz 4a41da9b38 Bluetooth: Add l2cap-register command to btshell
l2cap-register can be used to register a server:

btshell> l2cap-register 0x0080
bt: bt_l2cap_server_register (0x0011110c): PSM 0x0080

Change-Id: I2c2d9a4cba70b0cddaf352830659d206b609ee63
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:37 -05:00
Anas Nashif 36579879c2 use zephyr.h instead of microkernel/nanokernel.h
Cleanup header inclusion and only include zephyr.h in samples
and applications.

Change-Id: If7460f4c6305a1c1cfcfdcf6a9bb7423f410c5c6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:35 -05:00
Mariusz Skamra ceef6099dd Bluetooth: shell: Improve device found event callback
With this patch device name obtained from advertising packets
will be printed out.

[DEVICE]: D0:03:4B:DA:10:46 (public), AD evt type 0,
			RSSI -83 AppleLETester
[DEVICE]: D0:03:4B:DA:10:46 (public), AD evt type 4,
			RSSI -82
[DEVICE]: 00:A0:50:00:00:08 (public), AD evt type 0,
			RSSI -80 BLE Keyboard

Change-Id: Ic5116bce958d5b4479d481c40b2658ab56ecb819
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:30 -05:00
Mariusz Skamra df7f3a193f Bluetooth: shell: Improve attribute discovery callback
This patch makes attributes discovery more easier from the point
of shell application user.
UUIDs of discovered attribute declarations are now printed.
For services handle range is shown.

btshell> gatt-discover-primary 1800
btshell> Service 1800 found: start handle 00000001, end_handle 0000000b

Characteristic properties are parsed to string and printed
with characteristic value handle.

Characteristic f000ffc1-0451-4000-b000-000000000000 found: handle 0000006a,
				value_handle 0000006b
Properties: [write][write w/w rsp][notify]

Change-Id: I6823fa562206ccf336dc301ee71bc4a02cecc14f
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:30 -05:00
Szymon Janc f795f37426 Bluetooth: Remove outdated comment from tester
Advertising type is already configured based on current settings.

Change-Id: I4b47237c9ea7c48eab05786f01b38ebe3250141a
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:30 -05:00
Mariusz Skamra 15612e6bf9 Bluetooth: Add authentication callbacks to the peripheral app
To allow the remote central to pair and encrypt the link.
IO capabilities are set to DisplayOnly.

Change-Id: I46459539f1b882952d29ee5eb8d17766715de4b8
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:30 -05:00
Mariusz Skamra 9a794915b7 Bluetooth: Fix invalid characteristic handle in peripheral app db
We had two attributes stored with the same handle.

Change-Id: Ib24912578b958d428d6b3da3c2f73994691622bb
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:30 -05:00
Mariusz Skamra cc1208fb5f Bluetooth: Fix invalid value length type
BTP protocol specifies value length to be 2 octets value,
so uint16_t has to be used to store this length.

Change-Id: I2a911910475db305a0ff1f9ab70866d24aa47158
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:30 -05:00
Javier B Perez Hernandez f7fffae8aa Change BSD-3 licenses to Apache 2
Change all the Intel and Wind River code license from BSD-3 to Apache 2.

Change-Id: Id8be2c1c161a06ea8a0b9f38e17660e11dbb384b
Signed-off-by: Javier B Perez Hernandez <javier.b.perez.hernandez@linux.intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:29 -05:00
Szymon Janc ca9d755073 Bluetooth: Enable stack analysis in tester application
This allows for compile test if analysis code builds.

Change-Id: I500d727a06ef065fc65465140062ec47d31e79fa
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:25 -05:00
Mariusz Skamra 01bec178dc Bluetooth: Handle read supported gatt server commands
This will be used to poll Zephyr to send it's supported commmands.

Change-Id: I12cb93a238cd14589123d88e9d9ba4d580dd6d71
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:25 -05:00
Mariusz Skamra b75915e366 Bluetooth: Add read characteristic value callback
This is used to respond to the read request of characteristic
value.

Change-Id: Ia0518fae0d70e712621578a7938009345dbfaab4
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:25 -05:00
Mariusz Skamra 865a087e76 Bluetooth: Handle Set Characteristic/descriptor value
This adds support to handle set attribute value.

Change-Id: I2631cc8744210cfd76add1be3d30e5a0f54b3a7e
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:25 -05:00
Mariusz Skamra cc3949fec4 Bluetooth: Handle Add Characteristic command
This adds support for adding characteristic declaration and characteristic
value to the tester defined database of GATT attributes.

Change-Id: I108fc5a9bc5c7491fc354c71457d452baaedd868
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:25 -05:00
Mariusz Skamra 9624fe8732 Bluetooth: Add support for GATT Server to tester application
This adds support for tester application to cover GATT Server
automated tests. BTP ptotocol commands are used do drive stack to
build attributes database specified by the external tester.

Two commands: to add a service and to start the GATT server are
implemented.

Change-Id: I236c3e4d8636e97926514b2099779cb4334e95cd
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:25 -05:00
Mariusz Skamra 7bb885198d Bluetooth: Extend BTP Specification to cover GATT Server
This adds protocol specification for GATT Server.

Change-Id: I2f6083b15c483fb1348f6c108fd54f890d45b83d
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:25 -05:00
Mariusz Skamra 5438f7b96b Bluetooth: tester: Handle Set Connectable command
This patch is needed to be able to test zephyr against tests
which require Zephyr to be non-connectable.

This adds handler for the opcode 0x06 - Set Connectable command.
Based on connectable flag in current settings, the corresponding
advertising type is set after issuing Start Advertising command.
If connectable, Connectable undirected advertising type is set,
if non-connectable Non connectable undirected advertising type
is set.

Change-Id: I77865b67c4b717548095ac5e398a873d1b739d6a
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:24 -05:00
Mariusz Skamra 926e65fe3b Bluetooth: tester: Handle disconnect command
This feature is needed to pass some tests which require termination
of ACL link.

Change-Id: Idab03c569172ea6deb3bc5cf6744e5e73bd5de3e
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:24 -05:00
Mariusz Skamra 8505cc9b37 Bluetooth: tester: Fix Start/Stop Advertising responses
According to new tester API in case of success Current_settings
shall be returned.

Change-Id: I1caf05180bff4756b8e7271098611d23200af8ee
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:24 -05:00
Mariusz Skamra fa48de9e9a Bluetooth: Add connect/disconnect commands to BTP spec
These commands are necessary to pass some of the GAP tests.

Change-Id: Ia599e7dc3dd06aa5ac4130e0d878fcddad7b37dd
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:24 -05:00
Mariusz Skamra 85c6194670 Bluetooth: shell: Replace xtoi with strtoul from libc
Change-Id: Ibb6356f5d2dc041b5637abfdfcf5e3dc1a00ea77
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:24 -05:00
Szymon Janc 9ecbd34f89 Bluetooth: Add support for disabling GATT client support
Binary size reduction of sample peripheral app:
45940 -> 45772

Change-Id: Ia8c463c9642a2928c2cb2ec48d9e9c4eeef20fe7
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:24 -05:00
Szymon Janc 9c2ad108b8 Bluetooth: Add option for disabling SMP support
This allows to not compile SMP support for devices that don't
require pairing. It is required to support SMP channel and reply
with error for any command received even if pairing is not supported.
To handle this cleanly a null smp implementation is used that case.

Change-Id: I656a52dac882839db904eee65f25a4e29ea2d8c2
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:24 -05:00
Szymon Janc 4c901ac75d Bluetooth: Add option for disabling data signing support
This allows to not compile data signing support if it is not
required. Reduces image size of peripheral sample app from
45772 to 44436 bytes.

Change-Id: I2cd3515973d1a70f478cbd68426ec84fd1645d19
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:24 -05:00
Szymon Janc 8ff443b1c9 Bluetooth: Add initial Kconfig split options
This allows to specify which roles are supported. Broadcaster and
Observer roles are always supported.

Image size reduction for samples apps:
beacon     43148 -> 15196
central    46892 -> 46356
peripheral 47532 -> 45940

Change-Id: If260c13d63651b9b54df5bafc2c412b01dcb1eb0
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:24 -05:00
Luiz Augusto von Dentz 7d16329af6 Bluetooth: Fix not setting subscription value
bt_gatt_subscribe requires setting proper value in the parameters ever
since indication support was introduced.

Change-Id: Ib78dac717874e51e21bc9f8ad10279ba9fe68097
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:24 -05:00
Luiz Augusto von Dentz f4700f6ceb Bluetooth: Add gatt-discover-secondary command to btshell
This adds gatt-discover-secondary which works as follow:

btshell> gatt-discover-secondary <uuid> [start_handle] [end_handle]
bt: att_find_type (0x00110d18): uuid 0x180f start_handle 0x0001 end_handle 0xffff
Discover pending
btshell> bt: bt_att_recv (0x001134a8): Received ATT code 0x01 len 5
bt: att_error_rsp (0x001134a8): request 0x06 handle 0x0001 error 0x0a
bt: att_find_type_rsp (0x001134a8): err 0x0a
Discover destroy

In addition to this gatt-discover is now renamed to gatt-discover-privary
to avoid any confusion with other discover types.

Change-Id: Iee1fdf3e72269b134e222b4a2c6b4329858e71b0
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:24 -05:00
Luiz Augusto von Dentz 331a3d8016 Bluetooth: Add gatt-discover-include command to btshell
This adds gatt-discover-include which works as follow:

btshell> gatt-discover-include [uuid] [start_handle] [end_handle]
bt: att_read_type (0x00110d18): start_handle 0x0001 end_handle 0xffff
Discover pending
btshell> bt: bt_att_recv (0x001134a8): Received ATT code 0x01 len 5
bt: att_error_rsp (0x001134a8): request 0x08 handle 0x0001 error 0x0a
bt: att_read_type_rsp (0x001134a8): err 0x0a
Discover destroy

Change-Id: Id96ffbde7828c8266ab96022861983a9c68c976a
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:24 -05:00
Luiz Augusto von Dentz 7a441e7424 Bluetooth: GATT: Refactor discover API
Add discover type to bt_gatt_discover_params to the API is reduced to
just bt_gatt_discover, this should simplify adding support for
discovering secondary and included services.

Change-Id: Iadeed86fed115afee1340b2c09821d7fafdda0f4
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:24 -05:00
Mariusz Skamra a07ae2531b Bluetooth: shell: Use atoi from internal libc
Since atoi is available in libc this implementation can be removed.

Change-Id: I3cbb230916f382e27d59b503618b6291c8f0b691
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:23 -05:00
Mariusz Skamra b1c31ced58 Bluetooth: tester: Fix supported_settings to be sent in le order
All the data shall be sent in little-endian byte order.

Change-Id: I6d4ab0760f92e202ddcb348d30f0d1f208f84f1d
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:23 -05:00
Szymon Janc 46137ba7f5 Bluetooth: SMP: Use tinycrypt if available
If tinycrypt is compiled in use it for encryption instead of HCI LE
Encrypt command.

Change-Id: I9cf70540f14ed449bfda52c4a0901462b9a60fe9
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:23 -05:00
Mariusz Skamra 34bd454fae Bluetooth: tester: Keep track current settings
Some tester commands require to response with current settings.
This patch is needed to properly track the changes in these settings.

Change-Id: Ib9c919e804decbe26ba6ab2a23f1c30d812f98ab
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:23 -05:00
Johan Hedberg fd0bd160e6 Bluetooth: Add missing copyright statement to btp_spec.txt
Change-Id: I21f567fa56ee6cd5038838938161ac9cb00e9841
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:16:17 -05:00
Luiz Augusto von Dentz d1ca4eb92d Bluetooth: Add subscription type to gatt-subscribe in btshell
This enables passing the value to be used when writing to CCC so it can
be configure for indications in adition to notifications.

Change-Id: Ied89faed422e5c5ec60618d512dbd3f250f50b46
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:16:16 -05:00
Luiz Augusto von Dentz 1b4fb0d8a6 Bluetooth: GATT: Add value support to bt_gatt_subscribe
This enables bt_gatt_subscribe to subscribe using indication value in
addition to notification.

Change-Id: I25f3b057e36b023a79fb66b11b70716ecc299ba9
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:16:16 -05:00
Mariusz Skamra 3bb2df0d24 Bluetooth: tester: Add missing GAP_SETTINGS_DISCOVERABLE define
Change-Id: I56cad6462a50783a9518b3bc7a3c6b082f323f8e
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:16:16 -05:00
Andrei Emeltchenko 41d047f0fa Bluetooth: Fix bug in the shell app
Fixes bug accessing wrong memory.

Change-Id: I13b4bebe807fe3c2694311e72d9d49d3b688bceb
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:16:16 -05:00
Szymon Janc deb72b0b34 Bluetooth: Add initial Bluetooth Tester Protocol specification
This documents describes protocol used by external tester to drive
IUT. Currently initial version includes only Core and GAP services.

Change-Id: I2fcb366076313880116be2ead8916bb56a4b5910
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:16:16 -05:00
Szymon Janc bece111ec9 Bluetooth: Refactor tester application
This big patch refactors tester application and put it in par with
updated tester protocol.

Change-Id: Ib016fdd0aac58a32bcdc67774843cf65d619947d
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:16:16 -05:00
Grzegorz Kolodziejczyk 1d322531cd Bluetooth: Add GAP Appearance characteristic to GATT db
This is a mandatory characteristic for GAP servie. It must be included
in GATT db.

Change-Id: I27c0c6d56f5303c3c5d1606d7656c51823f74989
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:16:15 -05:00
Szymon Janc 18b98614a4 Bluetooth: Make signed_value static in periperal sample
This variable is not used outside of c file.

Change-Id: I89b34fb6dd2cdd9dd111b6e33829f170d0ba00ae
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:40 -05:00
Grzegorz Kolodziejczyk f535c0674e Bluetooth: Add possiblity to set advertising mode
This patch adds possibility of setting advertise mode.
If no advertising mode is set, use default value (discoverable).

Change-Id: I86456ca52ad54a2fd4e4c6443a79087ddeb99ec6
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:15:40 -05:00
Grzegorz Kolodziejczyk 03706d4644 Bluetooth: Add advertising type argument set possibility
Bluetooth shell now supports advertising type set while starting
advertise.

Change-Id: I1e672b4c9315368dcef38398834acc5541c1843b
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:15:40 -05:00
Szymon Janc cfa51f89f1 Bluetooth: Strip command extra spaces in shell app
This makes shell a bit more convenient to use.

Change-Id: I50490eb3cf9434723737a71fb382316876ba6291
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:40 -05:00
Szymon Janc e28d358d09 Bluetooth: Add explicit help command
This commands print list of all available commands.
On unknown command only short info about 'help' command is
printed.

Change-Id: I780f4fd8da7292192260a0e0af8815fe4e385ae2
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:40 -05:00
Szymon Janc ea80649a83 Bluetooth: Refactor command parameters handling in shell app
Reduce usage of static variables making code easier to follow.
Also improve robustness in case of too many parameters provided.

Change-Id: I6a3f0162a4fb301479ed36c54ceca2967bb7e389
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:40 -05:00
Szymon Janc 022f1897e0 Bluetooth: Don't print help in shell app for empty input line
If empty input was provided simply reprint prompt instead of printing
uage information. This makes it similar to linux shell.

Change-Id: Ie4d9e1e7cb011ddf14f490188335ddc44289ffcf
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:40 -05:00
Andrei Emeltchenko eba54d6610 Bluetooth: Refactor btshell app
Use more robust approach when registering shell callbacks. Instead of
allocating maximum number of callbacks use exact memory which is
needed.

Change-Id: I96db75375e8d24df328adc0622c7817a3328f860
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:15:39 -05:00
Szymon Janc 9764e3dc84 Bluetooth: Implement security_changed callback in shell app
This callback is called when security level of connection changed.

Change-Id: Ifec130163fffe291cd012c99247017bd31173660
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:38 -05:00
Grzegorz Kolodziejczyk 76bf6f60aa Bluetooth: Use generic read string handler for db descriptors
There is no need to define for each descriptor its own read handler.
Each string descriptor will use generic string read handler if
possible.

Change-Id: I468a082c6875400ec4515588131132ef27cc8082
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:15:38 -05:00
Szymon Janc 272128fece Bluetooth: Implement identity resolved callback in shell app
When identity is resolved only Identity Address should be used for
identifying connection.

Change-Id: Ic179286b09afced4997a755f1977eea818bc6e54
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:38 -05:00
Szymon Janc b7f6e31264 Bluetooth: Fix cancelling outgoing connection in shell app
default_conn is assigned only on connected event so there was
no way to cancel pending outgoing connection.

Change-Id: Iba5018e887c5b3f87513fc5c8f4585fb6ec40c8d
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:37 -05:00
Grzegorz Kolodziejczyk e2673b539f Bluetooth: Use strcmp instead of strncmp
There is no need to use strncmp for string type arguments terminaded
by NUL character.

Change-Id: Ib90517f4657de8da64f145afd0ac28aefa697026
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:15:37 -05:00
Grzegorz Kolodziejczyk c688f327b1 Bluetooth: Use unified help cmd tip label for advertise cmd
To avoid multiple prints with cmd help one label will be used.

Change-Id: Ieaaffd8b4321fdb2ad2f95894d293ec1d6eb8d10
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:15:37 -05:00
Szymon Janc 3b5bae6b96 Bluetooth: Fix tester application automated build
Due to bug in test case configuration file tester application
was not build by 'Build Automation'. This application has all
Bluetooth debugs enabled so it is essential for build verification
process.

Change-Id: I51115d17a28614b7746c6d207d4362a94bc0f591
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:37 -05:00
Grzegorz Kolodziejczyk 6e2132f724 Bluetooth: Separate char to hex helper
This patch separate character to hex character convertion part and
moves related code to helper.

Change-Id: I5c754669583228566e80a9b20a9db0e639641677
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:15:37 -05:00
Szymon Janc 2d4aac58f5 Bluetooth: Update authentication support in shell application
This allows to select more authentication options and reply
to all requests.

Change-Id: I220d945763b9381818c5caad52bf0f5e8b01ab54
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:37 -05:00
Andrei Emeltchenko 30c28925fa Bluetooth: Add new attribute with signed write permission
Change-Id: I731b4d3f3a31cff9c4be89dd1f911f4365b5e783
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:15:24 -05:00
Andrei Emeltchenko 2ccf1f11c0 Bluetooth: Add GATT Signed Write to shell
Bluetooth shell now supports Signed Write if CSRK key is present.

Change-Id: I035a0d314da4997105c64da58cf85bd95fdbaa5b
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:15:24 -05:00
Andrei Emeltchenko f9cd4105da Bluetooth: Add GATT Signed Write command
Add support for signed write with sign parameter for write without
response.

Change-Id: I79008532d88b10d34db1f68898ad4258dd3e761b
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:15:24 -05:00
Szymon Janc 669454f1e1 Bluetooth: Allow to enable authentication in btshell application
This allows to register pairing callbacks that will display passkey
in case of authenticated pairing.

Change-Id: I18422193785fdcd8a2e567adeb65199bfadcdd1f
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:15:24 -05:00
Andrei Emeltchenko 1fbaf56bc2 Bluetooth: Increase stack size to default value
Make stack size the same size as in hello app. Current stack cannot
handle correctly security tests.

Change-Id: I5946c6bbcbc5079cefefddbb229b3205364b24d0
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:15:23 -05:00
Luiz Augusto von Dentz 18dccd7f64 Bluetooth: Add gatt-write-without-response command to btshell
This adds gatt-write-without-response which can be used as following:

btshell> gatt-write-without-response <handle> <data>
bt: bt_gatt_write_without_response (0x0010f0a0): handle 0x0011 length 1
Write Complete (err 0)

Change-Id: Ide166049cf53e691a2269778bca1489f7027621f
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:15:23 -05:00
Luiz Augusto von Dentz c9b3116c5b Bluetooth: Add offset support to btshell gatt-write command
This adds offset to gatt-write which can be used as following:

btshell> gatt-write 0011 0001 01
bt: gatt_prepare_write (0x0010f680): handle 0x0011 offset 1 len 1
Write pending
btshell> bt: bt_att_recv (0x00111918): Received ATT code 0x17 len 6
bt: att_handle_prepare_write_rsp (0x00111918):
bt: att_prepare_write_rsp (0x00111918): err 0x00
bt: gatt_exec_write (0x00111918):
bt: bt_att_recv (0x00111918): Received ATT code 0x19 len 1
bt: att_handle_exec_write_rsp (0x00111918):
bt: att_write_rsp (0x00111918): err 0x00
Write complete: err 0

Change-Id: I4d3c038ea572da92efe0de8ce426ffca15506440
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:15:22 -05:00
Luiz Augusto von Dentz 0636edfdd7 Bluetooth: GATT: Add offset to bt_gatt_write
This enables writing from offset using Prepare Write + Execute Write
procedures including Long Write procedure when the data is bigger than
the MTU.

Change-Id: Id35d66c011ba582a4ba92ffe75444226e479335a
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:15:22 -05:00
Szymon Janc dabedeb449 Bluetooth: Register simple GAP service in btshell app
Some devices (eg. Android KitKat) are confused if remote database
is empty.

Change-Id: Ie27920b6f64b12903917068101d5abb171ab42c0
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:44 -05:00
Luiz Augusto von Dentz 66367b5ef3 Bluetooth: Check if bt_gatt_subscribe return -EALREADY
If bt_gatt_subscribe -EALREADY that means it is already subscribed and
shall not be reused.

Change-Id: I83c620454c40863c71b1289d37c2b42571a907fd
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:44 -05:00
Johan Hedberg e899c811e6 Bluetooth: Use async callback for enabling Bluetooth
In the peripheral sample app use the async feature of bt_enable() to
verify that it works as expected.

Change-Id: I15f7758944a8c34d1aaef84f0ba77a6b5bbb4695
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:44 -05:00
Johan Hedberg 79696d3b34 Bluetooth: Redesign Bluetooth init API
We need to be able to perform the init procedure asynchronously
through a callback. The RX fiber is a good candidate to use for the
callback since it's not active in its normal operation before
drv->open has been called. In order to prepare for a future
bt_disable() API the init API is renamed from bt_init() to
bt_enable(). If a NULL pointer is given as the callback the API
behaves synchronously like the old bt_init().

Change-Id: I4e78fa8f32dcf5477ea05a8db75aca5cdce591fd
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:44 -05:00
Luiz Augusto von Dentz 8697d207a0 Bluetooth: GATT: Fix using uint8_t for attribute length
Attribute length can be up to 512 bytes long so it needs to be at least
uint16_t, ATT already takes care that the MTU does not exceed 512 bytes.

Change-Id: I6c8dc80a4b63f212420c26c0a24d93939fa510fe
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:44 -05:00
Luiz Augusto von Dentz 369ff3bb90 Bluetooth: Make central sample discover HRS over GATT
This makes the central sample discover the attributes and subscribe
to receive notifications of HeartRate Measurement Characteristic.

Change-Id: Icedbdd759638be0b8fa8515112208aa61ad5eb90
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:43 -05:00
Luiz Augusto von Dentz f581894abf Bluetooth: Make central sample connect to devices supporting HRS
This makes central sample to parse the Advertising Data and in case the
device supports HeartRate Service stop scanning and connect to it, if the
device disconnects then start scanning again.

Change-Id: I49962eadb5c82c7a910185212063cd576cadf62e
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:43 -05:00
Luiz Augusto von Dentz 7942266868 Bluetooth: Add connection callbacks to central sample
This will be needed to monitor connections with peripherals.

Change-Id: Iccea2696af72b0b8b3f40aac180738dc6b80abc8
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:43 -05:00
Mariusz Skamra 6b4f7025f2 Bluetooth: Start using atomic flags to indicate bt_dev state
With this patch advertising state and scanning state are stored as flags.

Change-Id: I5d2dc37972620ee89aaf55d45e294e8be82863d3
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:14:43 -05:00
Luiz Augusto von Dentz 368cfb775e Bluetooth: Add gatt-unsubscribe command to btshell
This adds gatt-unsubscribe which works as follow:

btshell> gatt-unsubscribe <CCC handle>
bt: gatt_write_ccc (0x0010edc8): handle 0x0015 value 0x0000
Unsubscribe success

Change-Id: I812fd237f71c4cad8e188015f1cd4cd2f2902aa6
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:43 -05:00
Luiz Augusto von Dentz d39eb230ee Bluetooth: Add gatt-subscribe command to btshell
This adds gatt-subscribe which works as follow:

btshell> gatt-subscribe <CCC handle> <value handle>
bt: gatt_write_ccc (0x0010e594): handle 0x0015 value 0x0001
bt: bt_att_recv (0x0011082c): Received ATT code 0x13 len 1
bt: att_handle_write_rsp (0x0011082c):
bt: att_write_ccc_rsp (0x0011082c): err 0x00
Subscribe complete: err 0
Subscribe destroy
bt: bt_att_recv (0x0011082c): Received ATT code 0x1b len 4
bt: att_notify (0x0011082c): handle 0x0014
bt: bt_gatt_notification (0x0011082c): handle 0x0014 length 1
Notification: data 0010cea9 length 1

Change-Id: Ide1f737358857a87db6dac1ecd9097f8da99ed72
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:43 -05:00
Luiz Augusto von Dentz a6b826e918 Bluetooth: Use connection context in btshell
Once connected store the bt_conn as context, this save the trouble of
entering the same parameter over and over and remove the lookups from
commands that requires a connection.

Change-Id: I9671b8fa07a1a61db45516f63eb007f19f0e59a1
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:43 -05:00
Johan Hedberg 9698411362 Bluetooth: Minor coding style (white space) fix
Change-Id: I50f0f4548fdf5c79c783f4055974e427ba9cbfe8
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:43 -05:00
Peter Mitsis ad03f13db5 samples: Update sanity_chk usage notes
Removes reference to the unsupported "-T <toolchain>" option and the replaces
the deprecated "-B <BSP>" option with "-P <platform>".

Change-Id: I21ab863dded9cbfd4fc0ab2fcade59137add08cf
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:43 -05:00
Andrew Boie 6acbe63aea initial commit for next-gen sanity checks
The online help ./scripts/sanitycheck --help describes usage.
Most users will simply want to run with no arguments.

Change-Id: Icedbbfc22599a64a6e3dbbb808ff3276db06f2e0
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:14:42 -05:00
Luiz Augusto von Dentz 4c2a459305 Bluetooth: Add gatt-write command to btshell
This adds gatt-read which works as follow:

gatt-write <bdaddr> <bdaddr_type> <handle> <data>
bt: bt_gatt_write (0x0010e0f0): handle 0x0011 length 1
Write pending
btshell> bt: bt_att_recv (0x001102ec): Received ATT code 0x13 len 1
bt: att_handle_write_rsp (0x001102ec):
bt: att_write_rsp (0x001102ec): err 0x00
Write complete: err 0

Change-Id: Ibe9f510184ad98635b18cc7d92dc3573afd9cb03
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:41 -05:00
Arkadiusz Lichwa 08230f691c Bluetooth: GATT: Update btshell app
Adds to btshell app a command to enable mimic GATT client to
perform multiple read attributes request using set of input handles.
The syntax is: gatt-read-multiple <address> <addres-type> <h1> <h2> ...
Handles should be entered as hex values and are 2-octets wide each.

Change-Id: Ic37a4486a11c645685cbfc782d36457af0fe9453
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:14:40 -05:00
Arkadiusz Lichwa e4208e065d Bluetooth: Increase max ARGC in btshell
Allows shell commands read more number of input parameters.
It is updated to 10 input parameters.

Change-Id: Ia943e8c6f0caaaf74cebcdb9dbe3542d90b2e4b9
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:14:40 -05:00
Johan Hedberg fe41cec885 Bluetooth: Move bt_security to conn.h and rename it appropriately
Change-Id: Ibea6e4ef08c68e9debf0c53036dd2e4f75ea9a72
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:40 -05:00