Commit graph

922 commits

Author SHA1 Message Date
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Peter A. Bigot fae5d96618 Bluetooth: GATT: correct callback return value documentation
The indicate callback does not provide a return value.  The read
callback didn't document its return values.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-06-01 20:03:25 +02:00
Trond Einar Snekvik a385873336 Bluetooth: Mesh: Fail init on model init error
Adds propagation of error returns from the model init callbacks in
Access, and removing any other checks for successful init in the
foundation models.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-05-27 18:45:18 +02:00
Pete Johanson e550302a61 Bluetooth: Fix a typo in an HCI error code constant name
* Change "BT_HIC" to "BT_HCI" in one error constant.

Signed-off-by: Pete Johanson <peter@peterjohanson.com>
2020-05-16 22:39:10 +03:00
Luiz Augusto von Dentz d2caa658f5 Bluetooth: hci_raw: Fix build error on hci_usb_h4
BT_BUF_TX_SIZE is actually used for setting the MPS properly.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-05-07 22:38:31 -05:00
Joakim Andersson 6f0b8c1421 Bluetooth: host: Add application control of PHY change procedure
Add application control of initiating phy change procedure and it's
parameters.
The reasons for allowing the application control over the PHY:
 - Allow changing to Coded PHY.
 - Application may change PHY to react to changes in environment
   to balance throughput and range.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-07 20:12:29 +02:00
Joakim Andersson f55c8c9d0b Bluetooth: host: Document parameters to remote information callback
Document the parameters in the remote_info_available callback.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-07 20:12:29 +02:00
Joakim Andersson d9e228a4b0 Bluetooth: host: Add application control of data length procedure
Add application control of initiating data length procedure and it's
parameters.
The reasons for allowing the application control over the data length:
 - Bandwidth control adjusted based on number of active connections.
 - Changing data length before switching to coded phy.
 - Applying workarounds for interoperability problems.
 - Controlling order of ATT MTU and data length procedures.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-07 20:12:29 +02:00
Vinayak Kariappa Chettimada ba4e8ff2fd Bluetooth: Add identifiers for Bluetooth 5.2
The Bluetooth 5.2 specification was recently released, and has a new
version identifier (11) assigned to it in the Bluetooth Assigned
Numbers.

Relates to commit fa241f0249 ("bluetooth: Add decoding for BLE 5.2
version string")

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-05-07 19:26:13 +03:00
Luiz Augusto von Dentz 1c35cc18fe Bluetooth: hci_raw: Split TX into ACL and CMD pools
This might reduce the footprint if the supported sizes are different.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-05-07 10:31:36 +03:00
Joakim Andersson a2a7cc9fe6 Bluetooth: host: Only persist advertising with bt_le_adv_start API
Only persist advertising when the bt_le_adv_start API is used to start
the advertiser. For multiple advertising set a connectable advertiser
can only be started if there is a connection object available for the
advertiser. Leave the decision on which advertising set should be
advertising up to the application instead of suspending advertising
when no connection object is available.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-06 17:08:49 +03:00
Joakim Andersson ee9326d8c0 Bluetooth: host: Fix BT_CONN_LE_OPT_NONE renamed issue
Fix BT_LE_CONN_OPT_NONE renamed to BT_CONN_LE_OPT_NONE missed in 2
places in conn.h

Regression from commit: fdb3da8aff

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-04 21:07:55 +03:00
Joakim Andersson fdb3da8aff Bluetooth: host: Rename BT_LE_CONN_OPT to BT_CONN_LE_OPT
Rename connection options to be consistent with the rest of the API
names in conn.h

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-04 17:48:22 +03:00
Joakim Andersson 8b70079ebe Bluetooth: host: Remove BT_LE_CONN_OPT_2M option
Remove the BT_LE_CONN_OPT_2M option and update documentation.
This was a misunderstand about the init PHY HCI parameter.
The init PHY in the extended connection create command does not
determine which PHYs are accepted as the initial PHY of the
connection. This is instead determined by the secondary PHY of the
extended advertiser.
The init PHY parameter only specifies which conn parameters are
provided, and since we only provide one conn parameter this option
has no effect.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-04 17:48:22 +03:00
Luiz Augusto von Dentz ec5603da8d Bluetooth: L2CAP: Add status flag to track encrypt pending
This adds a new flag to track if the L2CAP channel is pending waiting
for encryption to be changed to resume connecting.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-05-02 15:59:14 +03:00
Luiz Augusto von Dentz e0cbdf3b87 Bluetooth: GATT: Add support for new PDUs
This adds support for ATT_MULTIPLE_HANDLE_VALUE_NTF,
ATT_READ_MULTIPLE_VARIABLE_REQ and ATT_READ_MULTIPLE_VARIABLE_RSP.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-05-02 15:59:14 +03:00
Luiz Augusto von Dentz f4192bda26 Bluetooth: ATT: Add support EATT bearer
This adds support for EATT bearer which was introduced in 5.2, they work
as extra channels to have GATT traffic, at the moment it is completely
transparent to application when they are in use since the allocation
happens automatically.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-05-02 15:59:14 +03:00
Luiz Augusto von Dentz d148f8648b Bluetooth: ATT: Add definitions from 5.2
This adds the definitions for Enhanced ATT along with new PDUs and UUIDs
introduced in 5.2.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-05-02 15:59:14 +03:00
Luiz Augusto von Dentz 14d6c00b9b Bluetooth: L2CAP: Add released callback
This adds a callback to indicate when the stack has released all
references to a given channel so the owner free up any resources
associated with that.

This is requires since EATT channels cannot rely on the destroy callback
as it does not use a fixed channel like ATT.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-05-02 15:59:14 +03:00
Luiz Augusto von Dentz f7586b0b04 Bluetooth: L2CAP: Add initial implementation of ECRED mode
This adds the initial implementation of ECRED mode which can connect up
to 5 channels simultaneously and is required by EATT.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-05-02 15:59:14 +03:00
Joakim Andersson 78a6cdb07c Bluetooth: host: Avoid use of array compound literals in API
Attempt to fix C++ error: taking address of temporary array.

According to GCC documentation:
  In C++, a compound literal designates a temporary object that only
  lives until the end of its full-expression.

Finishing with this recommendation:
  As an optimization, G++ sometimes gives array compound literals
  longer lifetimes: when the array either appears outside a function
  or has a const-qualified type.
  But it is probably safest just to avoid the use of array compound
  literals in C++ code.

Fix the issue by introducing INIT macros as an alternative, and use
these in the inline functions to avoid the use of array compound
literals in Bluetooth headers.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-05-02 13:08:59 +03:00
Kamil Piszczek 3223c43af2 bluetooth: uuid: add ots related uuids
This change contains UUID definitions for Object Transfer Service.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2020-04-30 13:34:38 +02:00
Joakim Andersson 89d1bbc639 Bluetooth: doc: Fix detailed API description rendered into text boxes
Fix detailed API description rendered into text boxes.
API documentation with more that one paragraph must use the @brief tag
to be rendered correctly.
Fix indentation level of '*' in doxygen documentation.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-30 13:34:28 +02:00
Joakim Andersson 28e99b7efb Bluetooth: doc: Include gap.h and addr.h in documentation build
Add gap.h and addr.h to the Generic Access Profile part of the
documentation build.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-30 13:34:28 +02:00
Joakim Andersson 87d9eadf50 Bluetooth: mesh: Convert bluetooth mesh to using k_timeout struct
Convert bluetooth mesh to using k_timeout struct. Many of the mesh
modules uses timeout calculations, so it is most practical to keep
the s32_t type and only initialize a k_timeout_t struct when
calling the kernel.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-30 13:46:48 +03:00
Joakim Andersson d858264d9e Bluetooth: host: Convert bluetooth host to using k_timeout_t struct
Convert bluetooth host to using k_timeout_struct for the timeout values.
This is mostly replacing s32_t with k_timeout_t.
In l2cap the handling of no timeout in send channel request was removed
since the timeout is both documented as minimum of 1 second and never
given any no timeout value.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-30 13:46:48 +03:00
Trond Einar Snekvik 86137c3a62 Bluetooth: Mesh: Add cfg cli list getters
Adds config client getters for all list commands:
- mod_app_get
- mod_sub_get
- net_key_get
- app_key_get

Closes #24505.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-04-23 14:03:17 +03:00
Lingao Meng be33f913ac Bluetooth: Mesh: Remove net_idx params when with app key
According Mesh Profile 1.0.1. A application key shall
binding single network key. And Device key shall bind all
network key, and dev key only known by cfg_cli and node self,
only used by cfg_cli & cfg_srv.

Fixes: #21088

Signed-off-by: Lingao Meng <mengabc1086@gmail.com>
2020-04-23 11:30:41 +03:00
Joakim Andersson d4f22a8216 Bluetooth: host: Add support for multiple advertising set
Add support for multiple advertising set. Move the advertising state
flags to be per advertising set and loop over advertising sets instead
of looking up legacy advertiser set or handle 0.

Since it is not certain that the advertising set terminated event can
arrive directly after the connection complete event there is currently
a limitation that there can only be one local identity used by
connectable advertisers at a time. This guarantees that we know
the local identity being used in the connection complete event.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-21 12:46:05 +03:00
Luiz Augusto von Dentz 4b622afbb3 Bluetooth: hci_raw: Move buffer management to common place
This makes hci_raw to manage RX and TX buffers so its logic don't have
to be replicated on each an every driver/application, it also makes it
simpler to deal with extra headers for H:4 mode since that then can be
done at earlier at buffer allocation.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-04-20 21:59:47 +03:00
Luiz Augusto von Dentz 05f0816f93 Bluetooth: hci_raw: Add support for command extention
This adds support for registering a command extention table which is
used to match incoming commands and then pass the buffer to its
function handler.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-04-20 21:59:47 +03:00
Luiz Augusto von Dentz b3ee8be80d Bluetooth: hci_raw: Add support for using H:4 transport
This adds 2 config options which enables hci_raw to work in
H:4 mode and enable it by default automatically.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-04-20 21:59:47 +03:00
Luiz Augusto von Dentz b4e71014f2 Bluetooth: hci_usb: Add implementation of Read/Set USB Transport Mode
This implements Read/Set USB Transport Mode in the Bluetooth class.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-04-20 21:59:47 +03:00
Joakim Andersson 18bee9178f Bluetooth: host: Add non-connectable directed advertising support
This patch introduces two major changes to the directed advertising
feature of the bluetooth host.

Deprecating the bt_conn_create_slave_le, and removing
bt_conn_le_create_slave which has never been released. This behaviour
has now been moved by to providing the peer direct address into the
advertising parameters.

Introducing directed advertising support for nonconnectable
directed extended advertising, both scannable and non-scannable.

A bug was also fixed in the the directed-adv command in the shell
when the argument "low" was given. The advertiseng parameter pointer
declared with BT_LE_ADV_CONN_DIR_LOW_DUTY was declared in a scope that
was no longer valid when it was used to start the advertiser.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-15 10:57:38 +03:00
Joakim Andersson 0158b76096 Bluetooth: host: Fix scan filter_dup parameter on big endian systems
Fix filter_dup and options in union with mixed size integral types,
this is not portable, and causes malfunction on big-endian systems.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-04-08 17:58:53 +03:00
Jordan Yates a038dc76f1 bluetooth: host: Dynamic bt_conn_le_create timeout
Extends the bt_conn_le_create_param struct to provide the option
to set a custom timeout for the initiation of the connection.

The logic for the default values of window_coded and interval_coded
were moved to conn.c in order to resolve all defaults for the
create_param struct at a single location.

Timeout is not added as a parameter to the BT_CONN_LE_CREATE_PARAM
macro due to the expectation that CONFIG_BT_CREATE_CONN_TIMEOUT
will be the typical value that users will expect.

Fixes #23468

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2020-04-06 13:29:49 +03:00
Joakim Andersson 29749af88a Bluetooth: host: Fix high-duty cycle directed extended advertising
Fix high-duty cycle directed advertising when extended advertising
feature has been enabled. The duration parameter when starting extended
high duty cycle directed advertising has to be set to a non-zero value
less than or equal to 1.28 seconds.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-03-31 12:48:19 +03:00
Joakim Andersson ed11ca1744 Bluetooth: host: Add error code to directed advertiser
Add error code to API for starting directed advertiser. Also rename the
API in order to follow the established naming pattern.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-03-30 00:38:23 +03:00
Joakim Andersson e1fafc8b9f Bluetooth: HCI: Add additional HCI defines for extended advertising
Add additional HCI defines for extended advertising. Renamed a few
parameters that are not yet in use.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-03-30 00:38:23 +03:00
Joakim Andersson 69a82170c4 Bluetooth: host: Add scan API for extended scanner
Add scanner API for extended scanner. This includes the options to scan
on the LE Coded PHY for long range, configuring scan timeout with scan
timeout callback and additional information received from the extended
advertising report.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-03-30 00:38:23 +03:00
Joakim Andersson f2d7b77e96 Bluetooth: host: Deprecate BT_LE_ADV defines in hci.h in favour of gap.h
Deprecate BT_LE_ADV defines in hci.h that are expected to be used by the
application in the scan received callback to identify the advertising
PDU type. These defines are mixing HCI input parameters and advertising
PDU types. Internally it is acceptable to mix these, but at the API we
should to mix in them.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-03-30 00:38:23 +03:00
Joakim Andersson be57dfbe2a Bluetooth: host: Rename and deprecate scan filter for more scan options
Rename filter_dup parameters used for scanning filter options to the
more generic name options, and make scan filter options follow same
naming patters as advertising and initiator scan options.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-03-30 00:38:23 +03:00
Joakim Andersson b8f48410e5 Bluetooth: host: Add API for advertising sets
Add API for creating and starting advertising sets. This allows to start
and advertising set for a specific timeout or number of events.
The advertising set can be configured to advertise extended data on
secondary advertising channels or advertise on LE Coded PHY to give the
advertiser longer range.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-03-30 00:38:23 +03:00
Joakim Andersson 405ce842ab Bluetooth: host: Add new argument and return code to bt_create_conn_le
Deprecate bt_create_conn_le and rename it to in order to add return
code, new arguments and to follow the established naming convention.

Add API for the application to control the scan parameters of the
initiator role. This allows the application more scheduling control
of the initiator in multi-role scenarios. Also provides options to
configure the initiator for LE Coded PHY for long range support.
We deprecate the old way of creating connection to make the name more
consistent with the rest of the API.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-03-30 00:38:23 +03:00
Joakim Andersson 7d5a10038d Bluetooth: host: Add GAP definitions
Add GAP definitions for advertising PDU types and properties LE PHY
types and values that signifies either invalid or disabled.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-03-30 00:38:23 +03:00
Joakim Andersson e4538c6807 Bluetooth: HCI: Re-organize vendor read static address handling
Add header definition for bt_read_static_addr function. Declaring it
without a header definition will not give any compilation error when
function definition changes.
Refactor nRF SoC specific code into nRF specific source files and
provide weak definitions when these are not implemented. This will make
it easier to add handlers per vendor.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-03-22 11:58:17 +02:00
Joakim Andersson 6339cd0c96 Bluetooth: host: Minor header file doxygen fixes
Minor header file doxygen fixes:
 - Use /** @brief consistently
 - Indent all comments to the same level
 - Use @note instead of NOTE:
 - Align @note text
 - Align @return text
 - Add /** to documentation comments

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-03-17 21:13:35 +02:00
Joakim Andersson 628b3bc416 Bluetooth: host: Allow get local OOB data while advertiser is enabled
Allow to get local OOB data while advertiser, scanner or whitelist
initiator is active. If direct initiator is active or the advertiser
is using the random address as a random static identity address then
the function will return error.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-03-13 17:16:51 +02:00
Joakim Andersson ba2a327c5b Bluetooth: host: Update documentation regarding LE SC and OOB pairing
Update documentation regarding LE SC and OOB to include full name
befor starting to use abbreviations. Rephrase some sentences to be more
clear and add references to Kconfig options.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-03-13 17:16:51 +02:00
Iván Morales cc0d2447f1 Bluetooth: smp: Adding Legacy OOB pairing support
Added support for Legacy pairing using OOB Temporary Key

Signed-off-by: Iván Morales <ivan98ams@gmail.com>
2020-03-12 12:30:15 +02:00