Commit graph

42249 commits

Author SHA1 Message Date
Johan Hedberg
fa1bf41477 Bluetooth: Fix minor coding style issues
Change-Id: I0e78bce8cdbf46252f4cfc4483995ba7583915f7
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:24 -05:00
Johan Hedberg
4905835bad Bluetooth: Fix max_latency calculation comment
Change-Id: I4afcd6e206b95fe219c3483d1e273d78c1dfcb2f
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:24 -05:00
Arkadiusz Lichwa
ac98b4e221 Bluetooth: Handle update connection parameters
When connected, the peripheral/slave can trigger changing connection parameters.
Handle such request on central/master and if needed update controller settings
regarding the relevant connection parameters.

Change-Id: If3c1d91752f8d3875918bd8bfe923330790f530e
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:14:24 -05:00
Szymon Janc
a9e4291d4b Bluetooth: Use address instead of connection ID in shell
This converts connection handling to use addresses instead of
connection ID.

btshell> connect 7C:2F:80:94:96:EC public
btshell> Connected: 7C:2F:80:94:96:EC (public)
btshell> disconnect 7C:2F:80:94:96:EC public
btshell> Disconnected: 7C:2F:80:94:96:EC (public)

Change-Id: I545fcf71954ceda1fb89deb9bf8647149fb54e94
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:24 -05:00
Szymon Janc
441e01ec04 Bluetooth: Add bt_conn_get_dst function
This function allows to pick connection destination address.

Change-Id: I3e4959eec00905c64de3d8b9ef810b613c2e9f91
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:24 -05:00
Arkadiusz Lichwa
b40b3363e4 Bluetooth: Enable basic interaction with LE scan
Adds new commands to shell app allowing turn on/off active LE scan.
App uses scan results callback to get feedback when found any
advertisers around.
The dummy app's callback prints out info about findings.

Change-Id: Ifffe77b804230c19bbbcbc4f38e47210c835106d
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:14:24 -05:00
Johan Hedberg
5a72e9aaaa Bluetooth: Add doxygen documentation for buf.h
Change-Id: Ia60227e9f960f9563c82cdc4a044a2f9a538331c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:24 -05:00
Johan Hedberg
f77d80121e Bluetooth: Clean up doxygen documentation in gatt.h
Change-Id: Idc554e46f5806b4b7bf84f9d5c4ac8a46fdd7888
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:24 -05:00
Johan Hedberg
640a8cdc96 Bluetooth: Add doxygen documentation to conn.h
Change-Id: Ifb7b7c5bf089590059aa97f498751679e34ae35e
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:24 -05:00
Jukka Rissanen
0344c11ad7 net: Add preliminary UDP support
Use the Contiki simple UDP API when sending and receiving the
application data.

Change-Id: I39a379f30c8f7febbea223fcf8f8702faf82e39e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:24 -05:00
Jukka Rissanen
e024dba08f net: uip: Add support for user data in simple UDP API
Adding the user pointer to the uIP simple-udp API is vital so that
we can pass the net_buf to UDP receiver callback.

Change-Id: If7ee24f344fbd23eb7e0c3a99e78deb996d3667d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:24 -05:00
Jukka Rissanen
7e0951982a net: Add helper function to context for getting recv queue
Needed only in net_init.c so did not put the prototype into .h file.

Change-Id: If84e835d32bcfafd8e403ffa4def51fa72e0aa3e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:24 -05:00
Jukka Rissanen
e494de2449 net: Simple UDP process declaration was missing
Needed so that UDP process can be called from net init.

Change-Id: Iaa165d7773b7f5851d0088aa0d7480b23e1a9199
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:24 -05:00
Jukka Rissanen
7d7d4e4161 net: Enable logging in uIP stack
Allow the uIP stack to print information about its internal
status. By default the logging is disabled.

Change-Id: I55a03051d3f541b5f6ea950fdd6406814f937197
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:24 -05:00
Jukka Rissanen
cc4b282e46 net: Make sure to get the debug prints from uIP to console
Change-Id: Ic4d57f00f4752084ab5bd2ebc9f3f18c4747f1ab
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:24 -05:00
Jukka Rissanen
53fd129094 net: Add max length of the IPv6 address as a string
Change-Id: If7f5f3624cd34b5bff4ebb77c95ae7397e058430
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:24 -05:00
Jukka Rissanen
66fc2795e5 net: Add loopback and any IPv6 address definitions
Create IN6ADDR_ANY_INIT and IN6ADDR_LOOPBACK_INIT address
definitions for applications.

Change-Id: Ic864f559cae90a5f85e45ee90d73127b0ed8fde6
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:24 -05:00
Jukka Rissanen
6b3c739d7d net: Add helper function to set the link local address
Network driver should call this when it knows the device MAC or
EUI-64 address.

Change-Id: Ie03a80fcdb9a10cd1cb15f12037b3802da13bca9
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:24 -05:00
Jukka Rissanen
0028a541f6 net: uip: Set the link local IPv6 address according to linkaddr
Create a separate utility function to set the IPv6 link local
address using the supplied MAC/EUI-64 address. This is needed
because the net_init() is normally called before the
MAC address is set.

Change-Id: I5d46bd8d802e95a99b4b340d1f37af893b798db8
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:24 -05:00
Jukka Rissanen
8ccc4b229a net: Make the union in net_addr anonymous
The network address union that holds IPv4 and IPv6 address
should be anonymous as there is no need to refer the union
separately.

Change-Id: I70bab6b91dcf49dfb5adb405eb2b9c602f932603
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:24 -05:00
Johan Hedberg
32388b9a5f Bluetooth: Clean up doxygen documentation in bluetooth.h
Make the documentation style consistent and add documentation to
functions that were missing it.

Change-Id: I1822480a604bb2efcb0dbfc63ae0675ebf4b5987
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:24 -05:00
Jukka Rissanen
8dcb1494a9 net: Fix the environment variable in Makefile
TIMO_ENV changed to ZEPHYR_ENV as that one is now in use.

Change-Id: Ia7d7729a7210401ea2191710c708985c0282257a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:24 -05:00
Johan Hedberg
55218cd6de Bluetooth: Be consistent with the spelling of 'Bluetooth'
Change-Id: Ic9cbfe792f0b46071e38b52d1e082ce1da83e708
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:24 -05:00
Arkadiusz Lichwa
1d748ba760 Bluetooth: Address conversion user helpers
Adds user helper functions dealing with formatting bluetooth
address.
Refactors internal helpers using public ones.

Change-Id: If7b9f9a93b2aef3d25df55d6cfae9de05d8830b0
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:14:24 -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
e41d9512ce Bluetooth: Update shell doxygen comments
Change-Id: I4888144700e692c9080e6695c6966ad99e59f911
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:24 -05:00
Szymon Janc
e35a5294fc Bluetooth: Fix typo in shell application
Change-Id: Ib5a41d5a9cf02508c591d39f8a96e323701005bf
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:24 -05:00
Szymon Janc
0c421b038c Bluetooth: Make command handler in shell app return void
Return code from command handler is not needed and was already ignored.

Change-Id: Ief073ccfe2ccd316b6d4eec5168fb564e96786ee
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:24 -05:00
Szymon Janc
c14b14953d Bluetooth: Use argc/argv for commands in shell application
This makes code looks similar to POSIX style parameter handling.
Also code is easier to read and doesn't require tricks like
'p += strlen(p) + 1' for next parameter.

Change-Id: I013e714ba81681da38e320fb69851c7b5a75bb52
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:24 -05:00
Luiz Augusto von Dentz
afc6628c26 Bluetooth: Use hexadecimal format when printing GATT handles
hexadecimal is the usual format when defining GATT handles values so
printing in the same format makes it easier to debug.

Change-Id: I6babcadaf5a4cffbac73db29c155343540cee120
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:23 -05:00
Luiz Augusto von Dentz
168446d058 Bluetooth: Disable GATT notifications while disconnected
Once disconnected disable CCC configuration and enabling it back once
reconnected:

bt: bt_gatt_disconnected (0x0010c610): conn 0x0010a1f4
bt: disconnected_cb (0x0010c610): ccc 0x00108e44 reseted
Disconnected
Connected
bt: bt_gatt_connected (0x0010c610): conn 0x0010a1f4
bt: gatt_ccc_changed (0x0010c610): ccc 0x00108e44 value 0x0001

Change-Id: Ia4ac6793176f80ea9c6f255a4d151f9080660b0d
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:23 -05:00
Johan Hedberg
ea15db12ba Bluetooth: Make bt_conn_lookup_addr_le public
This API is useful for applications wanting to monitor and disconnect
connections.

Change-Id: Ib1a98ece364f137262515fbb1163c6b08ddf792c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:23 -05:00
Johan Hedberg
029046e02e Bluetooth: Make connection lookup functions return a new ref
To be able to make these APIs usable for apps where the calls may
happen from preemptible tasks, it's safest to return a dedicated
reference and let the caller do bt_conn_put() once its done with the
object.

Change-Id: If227e088385b8c6f61f4061a54c745c0bff7a6c3
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:23 -05:00
Johan Hedberg
89e775c1f6 Bluetooth: Fix coding style (missing braces)
Change-Id: I66dcc96da7b00181ff08773642b54ae19b3bdf5f
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:23 -05:00
Mariusz Skamra
4ccef33723 Bluetooth: Add interactive connection and disconnection commands
Adds above commands to the shell app.
Connection is made based on given address and type eg:
btshell> connect 00:00:00:00:00:00 public

In callback we get local connection id which is in fact,
the number of array entry in which the pointer to the corresponding
bt_conn has been written.

To disconnect, just provide the id eg:
btshell> disconnect 0

Change-Id: I24f7ec2de7f84c53ab847ded28a1821753c2a60d
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:14:23 -05:00
Mariusz Skamra
0b501a1f5c Bluetooth: Add defines of HCI error codes
Adds defines of HCI error codes used in HCI disconnect command.

Change-Id: If06f9342338cf88209c20856b41675f45184b89f
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:14:23 -05:00
Johan Hedberg
fe669a52e8 Bluetooth: Clean up document style in bluetooth.h
Change-Id: Icd5cbda6ff73b7f4b2d6a4183bb23138fd1ad0be
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:23 -05:00
Johan Hedberg
8c26ce63d1 Bluetooth: Remove bt_hci_reset() API
There's no clear need for this API (at least for now) and supporting
it means we really need to get all state cleanup procedures correct.
Remove it for now.

Change-Id: Ia2c7d51d410117bef12bc08f4f97a4e38ccfb77a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:23 -05:00
Johan Hedberg
f56636e90b Bluetooth: Fix typo in shell sample app
Change-Id: I2b7453022046a4c5725c2c958f0f4e7b9b2c56b2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:23 -05:00
Johan Hedberg
9bea2c3cfc Bluetooth: Move HCI driver API to dedicated header file
This makes it clearer that this is a specialized API not intended for
general app usage (unlike most other things in bluetooth.h).

Change-Id: I0ce1d5903610a9b3a99cf0be9f0e1462b04bf45a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:23 -05:00
Johan Hedberg
939544b75d Bluetooth: Move logging helpers to a dedicated header file
To make it clearer that these helpers are intended only for
Bluetooth-subsystem internal code, move them to a separate file.

Change-Id: Iea64780f5c61c1c96e12c9df378676bc49498fe4
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:23 -05:00
Szymon Janc
d90ce68d9d Bluetooth: Add central and tester samples to bt_regression
This allows to easily checks if all samples builds with supported
configurations. Also tester application is (unlike other samples)
build with all Bluetooth debugs enabled.

Change-Id: Ia151b97d14c75b0509243e2c1dc8d26211f70e83
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:23 -05:00
Johan Hedberg
c816923003 Bluetooth: Add missing stddef.h include for size_t
Change-Id: I716382a9d29f39cf6d3b94e66df0c4db3ff1156c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:23 -05:00
Szymon Janc
19fe40764c Bluetooth: Make bt_stop_scanning parameters explicit void
Change-Id: I47ece76e00719d2fef702763c061055a1e9c5f76
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:23 -05:00
Luiz Augusto von Dentz
801c09757e Bluetooth: Add support for ATT Read Multiple
This adds parsing for ATT Read Multiple Request and Response:

> ACL Data RX: Handle 3585 flags 0x02 dlen 11
      ATT: Read Multiple Request (0x0e) len 6
        Handle: 0x0001
        Handle: 0x0002
        Handle: 0x0003
< ACL Data TX: Handle 3585 flags 0x00 dlen 27
      ATT: Read Multiple Response (0x0f) len 22
        00 18 02 03 00 00 2a 54 65 73 74 20 70 65 72 69  ......*Test peri
        70 68 65 72 61 6c                                pheral

Change-Id: I08efe2b73342423634c156f95baa2bba84bd50a9
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:23 -05:00
Luiz Augusto von Dentz
32eb9150f7 Bluetooth: Make Bluetooth UUID defines consistent
Always prefix UUIDS for characteristics with service name.

Change-Id: Ic435fa725e6bc8918af631632156b071121cd0e0
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:23 -05:00
Luiz Augusto von Dentz
f9281b7eef Bluetooth: Update documentation of Bluetooth UUID API
This makes use of new guidelines to document Bluetooth UUID API.

Change-Id: Ib4c96f97709610b762f6e839294a4db3ac447e73
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:23 -05:00
Mariusz Skamra
b2574b645b Bluetooth: Terminate connection
Adds routine for termination of connection.

Change-Id: I444e4cba3297c51fbd9f89bbdba89db45af195c6
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:14:23 -05:00
Arkadiusz Lichwa
f5ae4b70f1 Bluetooth: Add basic interface for LE connection
Adds internal HCI interface routine for creation of basic ACL LE link.
Most of the command interface parameters are fixed.
The internal interface is then used directly by simple public interface with
no connection validation.

Change-Id: I8ed72a9d01348e2a05b62facc9e85060e4500631
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:14:23 -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