Commit graph

97 commits

Author SHA1 Message Date
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
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
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
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 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 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 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
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 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
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
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
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
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 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 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 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
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 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 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
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
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
Peter Mitsis 9d63adf3ea Renames supported platform configurations
Renames supported platform configurations to conform to new platform
configuration naming scheme.

Example usage with PLATFORM_CONFIG:
    make PLATFORM_CONFIG=basic_cortex_m3
    make PLATFORM_CONFIG=basic_atom
    make PLATFORM_CONFIG=basic_minuteia
    make PLATFORM_CONFIG=galileo

  xxx_ti_lm3s6965_defconfig           -> xxx_basic_cortex_m3_defconfig
  xxx_generic_pc_atom_n28xx_defconfig -> xxx_basic_atom_defconfig
  xxx_generic_pc_minuteia_defconfig   -> xxx_basic_minuteia_defconfig
  xxx_quark_defconfig                 -> xxx_galileo_defconfig

Change-Id: I696eb8b9ad9a72d7a72efbe1341ce23500335764
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:39 -05:00
Peter Mitsis 519351ee92 Use PLATFORM_CONFIG to specify configuration
Uses PLATFORM_CONFIG to specify the configuration file instead of
KBUILD_DEFCONFIG.  This name is more intuitive to Zephyr users and
it is not tied to kbuild.

Example usage:
    make PLATFORM_CONFIG=generic_pc_atom_n28xx
    make PLATFORM_CONFIG=generic_pc_minuteia
    make PLATFORM_CONFIG=quark
    make PLATFORM_CONFIG=ti_lm3s6965
    make PLATFORM_CONFIG=fsl_frdm_k64f

Change-Id: I177608942c3e77c2f152743c862aad1d460c0e33
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:38 -05:00
Peter Mitsis 3b33a3b437 sample projects: change default KBUILD_DEFCONFIG
Changes default KBUILD_DEFCONFIG to xxx_generic_pc_atom_n28xx_defconfig as
the xxx_generic_pc_defconfig configuration will not be supported in the future.
Note that like generic_pc, atom_n28xx runs on QEMU.

Change-Id: I49c5708e4b24dbf723eefc1efddfea4174d9cb1c
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:38 -05:00
Peter Mitsis bb2e5daacd Bluetooth sample projects no longer use BSP
Bluetooth sample projects now use KBUILD_DEFCONFIG instead of BSP.  This is
a necessary step in transitioning from BSPs to platforms.

Change-Id: I42c89d0b5c3d7de7ea62297950bb00f56ca97ed2
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:38 -05:00
Arkadiusz Lichwa d81689e915 Bluetooth: Introduce LE scan callback
Enables sending LE discovery results to user app.
Updates central apps to use new scan API.

Change-Id: Id319c96e15554f2eed4cf507cddd114ca74aa8e5
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:14:24 -05:00
Szymon Janc 26be0d55f2 Bluetooth: Use ccflags-y instead of EXTRA_CFLAGS
According to section 3.7 of Documentation/kbuild/makefiles.txt, using
EXTRA_CFLAGS in Makefiles is "still supported but their usage is
deprecated."

Change-Id: I585a9f84e8239a59b0f5b29eed0dc70efa253522
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:23 -05:00
Arkadiusz Lichwa 0225b6b299 Bluetooth: Update simple LE scan app
Adjust app to build system.

Change-Id: I5366ea9b38b261762724006fef0ec61ed3c6e251
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:14:18 -05:00
Anas Nashif b8823770d2 Rename TIMO -> ZEPHYR
Change-Id: Id44a129e275fb0cfe1fce6ec2a03c2d86ffe3995
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:16 -05:00
Allan Stephens 815c6406bc Rename VPF files to use MDEF file extension
The file extension indicates a "Microkernel DEFinitions" file,
and no longer reflects the obsolete VxMicro/Viper branding.

Change-Id: Ib95b271404a4a4737e851d603c371244fa609e4d
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:15 -05:00
Allan Stephens 5b291d3567 Eliminate VxMicro branding in main application include file
File is renamed to zephyr.h.

Change-Id: Ice7ab9318c525630572023614b5bed67ae0400c1
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:15 -05:00
Juan Manuel Cruz dc5a457847 Kbuild: Changing build parameter CONF_OVERLAY to CONF_FILE
This commit changes the build parameter CONF_OVERLAY with the
name CONF_FILE.

Change-Id: I404a4aa87b167a9ca4e7b395d53c2f7794b232bc
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
2016-02-05 20:14:09 -05:00
Anas Nashif ebde8bf780 Kbuild: make new bluetooth sample build
Change-Id: I0664e7f96274e8dad8d66082ca7336a1f094ec47

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:09 -05:00
Johan Hedberg 06098aa73e Bluetooth: Remove CONFIG_BLUETOOTH_DEBUG_HCI_CORE from samples
There's no point in enabling BLUETOOTH_DEBUG_HCI_CORE for the samples
as the user/developer is unlikely to be interested in this specific
sub-module of the Bluetooth stack. The samples already have the
BLUETOOTH_DEBUG enabled, so leave it up to the user/developer to
decide if they want to add specific sub-module debug options.

Change-Id: I327086464561667a2462db0aab00d0ffcdd40d4c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:03 -05:00
Johan Hedberg a60a4aba2e Bluetooth: Fix includes for sample apps
Update the includes in the sample apps to match what their actual
dependencies are.

Change-Id: I6fdfa4ba0cda563433d51f0ec35fef8f2ee0fa40
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:02 -05:00
Arkadiusz Lichwa f170898634 Bluetooth: Add simple LE scan app
Use scan functionality by simple app that starts LE scan
and in a while stops it.
It uses basic HCI scan interface prepared for
supporting LE central role feature.

Change-Id: Idcde4c742290d46931ab86522e51b0fc547a2d42
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:13:58 -05:00