Commit graph

1248 commits

Author SHA1 Message Date
Joakim Andersson
a9a7e27b21 Bluetooth: host: Document not waiting for TX context from sys workqueue
Document the GATT APIs not waiting for TX context when being called
from the system workqueue context. This is because the TX contexts
are freed by the system workqueue so blocking would cause a deadlock.

The number of TX contexts are by default equal to the number of
TX buffers in the system. Since TX contexts is allocated after a buffer,
but freed from a lower priority than the buffer then there can be more
allocated TX contexts than TX buffers.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-03-03 11:55:51 +01:00
Joakim Andersson
9d09d21627 Bluetooth: host: Remove incorrect note about indication callback
Remove the incorrect documentation note about the indication callback
being called from the system workqueue.
The callback will be called by the RX thread once the confirm indication
response has been received.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-03-03 11:55:51 +01:00
Vinayak Kariappa Chettimada
92f5b68f2c Bluetooth: Use bt_id_get function to get count
Allow NULL pointer to be passed to bt_id_get function so
that only count can be fetched.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-02-26 08:12:43 -05:00
Joakim Andersson
61584fb35f Bluetooth: host: Don't auto-update device name and document behavior
Don't auto-update the device name in the advertising data as that
would clear any other scan-response data set by the application.
Document the behavior of the advertise with device name option
and the need to update data by the application to make sure
advertising data does not get cleared.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-02-23 20:08:51 +01:00
Joakim Andersson
84dffe5b3c Bluetooth: host: Fix endianness issue in reading CPF descriptor
Fix endianness issue in reading CPF descriptor not converting from
native endianess to little-endian on the 'unit' and 'description'
fields.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-02-23 20:07:53 +01:00
Joakim Andersson
1b89ea50dc Bluetooth: host: Add GATT Characteristic Aggregated format definition
Add GATT Characteristic Aggregated Format UUID definition to public
header.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-02-23 20:07:53 +01:00
Joakim Andersson
e0787bf31b Bluetooth: host: Add definitions for generate DHKey v2 commands
Add definitions for the HCI command LE Generate DHKey v2.
This command includes the option to use the debug private key.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-02-18 13:50:22 +01:00
Andrzej Kaczmarek
9d8503c3b1 Bluetooth: controller: Initialize PDUs in set #0 on reset
Set #0 is used for legacy advertising when legacy HCI commands are used
and in such case it's possible to enable advertising without any prior
configuration. This means we should better always have PDUs in set #0
initialized with default empty data.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2021-02-18 13:29:37 +01:00
Piotr Pryga
0f6fcf9d75 Bluetooth: hci: Fix wrong values of cte type constants
Wrong values were used for CTE type constants. They were
update to comply with BT 5.1 spec.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-02-15 08:00:58 -05:00
Anas Nashif
5d1c535fc8 license: add missing SPDX headers
Add SPDX header to files with existing license.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-02-11 08:05:16 -05:00
Emil Hammarstrom
3cf64b17c3 bluetooth: host: expand l2cap CID abbreviation
Reduces some user confusion regarding whether it is related
to "Connection ID", "Channel ID", or "Company ID" for the
uninitiated.

Signed-off-by: Emil Hammarstrom <emil.hammarstrom@assaabloy.com>
2021-02-04 08:31:20 -05:00
Joakim Andersson
8a55e04e23 Bluetooth: host: Prevent bt_rand calls before bt_enable
Prevent the bt_rand function from being called before bt_enable.
Depending on the implementation of bt_rand this function cannot
be called before bluetooth has been initialized. With host supplied
crypto functions the HCI LE rand command is used for example.

The use case for calling bt_id_create before bt_enable is meant for
when the application has storage for the identity instead of the stack.
So we add the requirement that the application has to have storage
for the identity resolving key (IRK) in addition when the local
device is privacy-enabled.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-02-02 08:46:17 -05:00
Joakim Andersson
27bc7ad3a7 Bluetooth: host: Fix doxygen in addr header
Fix doxygen in addr.h file, missing /** needed for doxygen,
and placing the brief on the first line of the comment consistenly.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-02-02 08:46:17 -05:00
Joakim Andersson
b20b5c0d44 Bluetooth: host: Deprecate the bt_set_id_addr API function
Deprecate the bt_set_id_addr API function. This is merely a wrapper
for the bt_id_create function now, except an IRK cannot be given.
When CONFIG_BT_PRIVACY is enabled an IRK has to be given by the
application because the bt_rand function cannot be called before
bt_enable.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-02-02 08:46:17 -05:00
Joakim Andersson
c14da53772 Bluetooth: host: Remove the deprecated bt_conn_create_slave_le function
Remove the deprecated bt_conn_create_slave_le function.
This was deprecated in the 2.3.0 release.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-01-29 12:53:10 -05:00
Joakim Andersson
016b580beb Bluetooth: host: remove deprecated bt_conn_security function
Remove the deprecated bt_conn_security function.
This has been deprecated in the 2.3.0 release.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-01-29 12:53:10 -05:00
Joakim Andersson
58e4263efb Bluetooth: host: Remove deprecated connection create API functions.
Remove the deprecated connection create API functions.
These have been deprecated in the 2.3.0 release.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-01-29 12:53:10 -05:00
Joakim Andersson
6485a660fe Bluetooth: host: Remove the deprecated Advertising Types definitions
Remove the deprecated Advertising Types definitions.
These have been deprecated in the 2.3.0 release.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-01-29 12:53:10 -05:00
Joakim Andersson
bfbd6030e1 Bluetooth: host: Remove deprecated BT_BUF_USER_DATA_MIN macro
Remove the deprecated BT_BUF_USER_DATA_MIN macro.
This was deprecated for the 2.3.0 release.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-01-29 12:53:10 -05:00
Joakim Andersson
5f2a9ba8e4 Bluetooth: host: Remove deprecated security defines
Remove the deprecated security level define and the HCI error
code for authentication failure.
These have been deprecated since the 2.0.0 release.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-01-29 12:53:10 -05:00
Joakim Andersson
a0d62f03a0 Bluetooth: host: Remove deprecated scan filter duplicate params
Remove the deprecated scan filter duplicate enum values and parameter.
This was deprecated for the 2.3.0 release.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-01-29 12:53:10 -05:00
Alexey Tsvetkov
e87eb373bc bluetooth: update comment to LE Advertising Parameters struct
Update description to maximum and minimum values of interval_min and
interval_max fields of bt_le_adv_param struct according to
Bluetooth Core Specification 5.2

Signed-off-by: Alexey Tsvetkov <xeenych@gmail.com>
2021-01-18 17:00:03 -05:00
Piotr Pryga
472febfe69 Bluetooth: host: direction: Add public API to set CTE TX enable for adv
Add public function to set Constant Tone Extension transmission
enabled or disabled for periodic advertising.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-01-14 15:26:32 +01:00
Piotr Pryga
f36b7a8732 Bluetooth: controller: hci: Add HCI_Set_Connectionless_CTE_TX_Enable cmd
Add implementation of HCI_Set_Connecitonless_CTE_TX_Enable
command to HCI. Add scratch implementation of command handling
functions to controller.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-01-14 15:26:32 +01:00
chao an
1027b0e4f0 Bluetooth: host: add support for unregister scanner callback
This is a pairing function with bt_le_scan_cb_register()
to used for remove the scanner callback from callback list.

Signed-off-by: chao an <anchao@xiaomi.com>
2021-01-12 12:31:00 +02:00
chao.an
bc7e86b9ec Bluetooth: host: Unified namespace of hci event
BT_HCI_EV_LE_REMOTE_FEAT_COMPLETE ->
BT_HCI_EVT_LE_REMOTE_FEAT_COMPLETE

Signed-off-by: chao an <anchao@xiaomi.com>
2021-01-12 12:30:11 +02:00
Vinayak Kariappa Chettimada
6bc79ce33a Bluetooth: Define assigned number values of BIGInfo and Broadcast Code
Add defines for assigned number values of BIGInfo and
Broadcast Code.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-01-08 16:38:19 +02:00
Piotr Pryga
1c493b4a77 Bluetooth: host: direction: Add public API to set CTE TX params for adv.
Add publicly accessible function to set Constant Tone Extension
parameters for CTE transmission with periodic advertising.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-01-05 09:38:53 +01:00
Piotr Pryga
098f767298 Bluetooth: host: Add set connectionless CTE TX params wrapper function
Add implementation of a wrapper for HCI_LE_Set_-
Connectionless_CTE_Transmit_Parameters send command.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-01-05 09:38:53 +01:00
Piotr Pryga
9bfc095d4a Bluetooth: host: Add DF to initalization sequence
Add Direction Finding to host initialization sequence.
It allows to get information about Direction finding
optional CTE settings supported by controller.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-01-05 09:38:53 +01:00
Rihards Skuja
3b89f4a474 Bluetooth: fix C++ compile error
C++ disallows implicit cast to enum values.

Signed-off-by: Rihards Skuja <rihardssk@mikrotik.com>
2020-12-19 22:05:33 -05:00
Fabio Utzig
8713da70a3 doc: fix @param usage in callbacks
The proper usage of @param in callbacks is currently unsupported by
Doxygen so not warnings are generated. The issues fixed with this commit
where found while adding support to Doxygen for validating @param in
callbacks like it currently does for functions.

Signed-off-by: Fabio Utzig <fabio.utzig@nordicsemi.no>
2020-12-18 12:18:28 +01:00
Joakim Andersson
d840f42b33 Bluetooth: host: Document the allowed disconnect reasons.
Document the disconnect reasons that is allowed in the disconnect
command.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-12-15 11:20:34 +01:00
Piotr Pryga
307ac64374 Bluetooth: controller: Add set connectionless CTE TX parameters
Add implementation of HCI_LE_Set_Connectionless_CTE_-
Transmit_Parameters command in HCI.
Add implementation of command handling in controller.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2020-12-14 11:23:26 +01:00
Pavel Vasilyev
347a1ab19f Bluetooth: Mesh: Make access packet sizes defines public
This commit makes BT_MESH_*_SDU_MAX macros public so that applications
can use them.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2020-12-12 14:15:47 +02:00
Pavel Vasilyev
12bcf652e6 Bluetooth: Mesh: Make address defines public
This commit makes BT_MESH_ADDR_IS_* macros public so that applications
can use them.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
2020-12-12 14:15:47 +02:00
Joakim Andersson
ae841d0a11 Bluetooth: host: Add enum for LE read transmit power PHY values
Add enum for LE Read Transmit Power phy values, which are different
form the values used for PHY update procedure since it includes values
for the LE Coded PHY coding schemes.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-12-10 13:33:12 +01:00
Kamil Piszczek
fd8d03bd8b bluetooth: conn: add api for getting tx power level
Added a new Bluetooth API that can be used to read the current and
maximum transmit power level of the radio. The reading operation is
performed over HCI.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2020-12-10 13:33:12 +01:00
Kamil Piszczek
87468360b5 bluetooth: uuid: add tx power service uuids
Added UUIDs definitions that are used in the Tx Power Service.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2020-12-10 13:33:12 +01:00
Vinayak Kariappa Chettimada
aca176463b Bluetooth: Add helper defines for Extended Advertising parameters
Add helper defines for Extended Advertising parameters that
can be used while creating Extended Advertising sets.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-12-03 13:54:25 -05:00
Joakim Andersson
fae964c008 Bluetooth: host: Make bt_conn_ref return NULL if the ref count is zero
Make bt_conn_ref return NULL if the reference count has reached zero.
This makes it possible to re-use bt_conn_ref internally to re-use the
reference count mechanism to check if the reference is in use.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-12-03 13:52:02 +01:00
Wolfgang Puffitsch
9437a6a08d Bluetooth: hci: Add definitions for codec and controller delay info
Add defines and structs for reading information about supported codes,
codec capabilities and controller delays. Return parameter structs for
commands that return multiple variable-length fields only model the
fixed-length fields to minimize inconsistencies.

Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
2020-11-26 15:46:17 +01:00
Joakim Andersson
8d3b9bae3b Bluetooth: host: Make acl_data extension of bt_buf user data explicit
Clarify that the acl_data struct includes the bt_buf type as the
first variable in the user data struct.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-11-26 13:15:03 +01:00
Joakim Andersson
d76aebcf9c Bluetooth: host: Document functions and macros in addr.h
Document helper functions and definitions in addr.h header.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-11-26 13:15:03 +01:00
Joakim Andersson
4978c19c05 Bluetooth: host: Refactor out address handling to new file
Refactor implementation of functions defined in addr.h to its own
source file addr.c.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-11-26 13:15:03 +01:00
Piotr Pryga
2589b7ace2 Bluetooth: controller: hci: Add set connection CTE transmit params
Add implementation of HCI_LE_Set_Connection_CTE_Transmit_Parameters
for Bluetooth 5.1 Direction Finding.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2020-11-26 13:14:17 +01:00
Piotr Pryga
14890c8eb6 Bluetooth: host: Add read antenna information HCI command
Add Bluetooth 5.1 Direction Finding HCI command:
HCI_LE_Read_Antenna_Information handling to Host.
Add wrapper function to handle send the command
and receive response from Controller.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2020-11-26 13:14:17 +01:00
Vinayak Kariappa Chettimada
d80d79e7f9 Bluetooth: controller: Use HCI defines for constants
Use HCI defines for PHY, and RSSI constants.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-11-23 17:01:50 +01:00
Asger Munk Nielsen
3df64a306b Bluetooth: controller: Create HCI stubs for CIG/CIS and ISO tests
Put infrastructure for the following HCI commands/events in place:
* LE Setup ISO Data Path command
* LE Remove ISO Data Path command
* Configure Data Path command
* LE Set CIG Parameters Test command
* LE ISO Read Test Counters command
* LE ISO Receive Test command
* LE ISO Test End command
* LE ISO Transmit Test command

Signed-off-by: Asger Munk Nielsen <asmk@oticon.com>
2020-11-20 10:56:51 +01:00
Joakim Andersson
58be4c89f6 Bluetooth: host: Document security changed and no security level change
Document the security changed callback can be called with no change
in the security level when the encryption key has been changed
in the link-layer.

Also update the documentation for set security function to include
the bond information so that it matches the documentation for security
changed callback.

Update pairing process to pairing procedure for consistency.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-11-17 19:40:58 +01:00