Commit graph

14 commits

Author SHA1 Message Date
Rubin Gerritsen 9984adf24e Bluetooth: Host: Support concurrent initiating and scanning
The HCI command LE Read Supported States command returns
if the controller supports running the scanner and initiator
roles in parallel.

This commit utilizes this information in the host:
- It does not prevent initiating a connection when the scanner is
  running
- It does not prevent the host from restarting the background
  scanner when there the host wants to auto-initiate a connection.
- It does not stop the scanner when the host wants to auto-initiate
  a connection.

To support this feature, the scanner and initiator
always have to use the same address.
This because the HCI command LE Set Random Address
cannot be issued after the initiator or scanner has started.
1. When privacy is disabled, the scanner has to use its identity
   address to ensure it uses the same address as the initiator.
2. Only one identity is supported.

To simplify the implementation, it is a requirement to use
extended advertising commands to avoid interfering with
the random address used by the advertiser(s).

Also, it is a requirement to never use time-limited scanning,
as RPA this feature does not work when privacy is being used.
See https://github.com/zephyrproject-rtos/zephyr/issues/73634.

The changes in this commit will be tested out of tree as the
Zephyr Bluetooth Controller does not support this functionality.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2024-06-13 08:04:42 -04:00
Sean Madigan 0b327db097 Bluetooth: Add support for Path Loss Monitoring feature
This commit adds host support for the Path Loss Monitoring
feature see Bluetooth Core specification, Version 5.4,
Vol 6, Part B, Section 4.6.32.

Limited logic is required, just adding a wrapper around the
HCI command and callback for HCI event.

Add new zone - BT_CONN_LE_PATH_LOSS_ZONE_UNAVAILABLE, to
convert 0xFF path loss to a useful zone.

Add new Kconfigs and functionality to the bt shell.

Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
2024-06-07 15:04:11 +02:00
Lyle Zhu 514c78546c include: Bluetooth: Add BT COD macros to hci_types.h
Add macros to get Major Service Classes, Major Device
Class and Minor Device Class.

Define Major Device Class code.
Define Minor Device Class field for Computer Major
Class.
Define Minor Device Class field for Phone Major Class.
Define Minor Device Class field for Audio/Video Major
Class.

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-05-16 09:15:49 +02:00
Vinayak Kariappa Chettimada 3997479b49 Bluetooth: HCI: Rename to bt_hci_iso_sdu_hdr and bt_hci_iso_sdu_ts_hdr
Rename struct bt_hci_iso_data_hdr to bt_hci_iso_sdu_hdr, and
struct bt_hci_iso_ts_data_hdr to bt_hci_iso_sdu_ts_hdr.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-05-10 15:02:10 +02:00
Pisit Sawangvonganan 3d39926f94 bluetooth: hci: refactored bluetooth hci packet type indicators
Introduced a unified definition for HCI packet type indicators in
'bluetooth/hci_types.h. This change streamlines the code in
'drivers/bluetooth/hci/', reducing redundancy.
Enhances maintainability and consistency across all HCI drivers.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-05-01 10:33:12 +02:00
Sungwoo Kim 2ca179c96e Bluetooth: Host: Add a validation for hci_le_read_max_data_len()
Check max_tx_octects and max_tx_time are in the valid range, according
to the BT Core spec 5.4 [Vol 4, Part E, 7.8.46]
Fix #70472

Signed-off-by: Sungwoo Kim <iam@sung-woo.kim>
2024-03-26 09:30:11 +00:00
Jonathan Rico f2d6cdfc00 Bluetooth: HCI: Add full opcode to hci_types.h
Mental arithmetic shouldn't be required to analyze logs.

With this, a user can just "grep" the Bluetooth tree for the opcode
reported in an HCI error.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-02-09 16:32:24 -06:00
Lyle Zhu 4e7be1ecaa Bluetooth: Host: set valid SCO packet type
The SCO cannot be created if the eSCO is unsupported.
It is caused by the packet type cannot be set
correctly.

Set valid bitmap for SCO and eSCO packet type in
command "Accept Synchronous Connection Request".

Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
2024-02-05 17:46:49 +01:00
Kyra Lengfeld 93e5cf6e61 Bluetooth: Host: Add LE Power Control Request Procedure APIs
This commits adds the LE API's for the LE Power Control Request Feature
in Zephyr.

The support of feature is provided with the controller-based feature
selection with BT_CTLR_LE_POWER_CONTROL_SUPPORT and is selectable via
BT_TRANSMIT_POWER_CONTROL.

With the new APIs, the applications will:
get improved reading of local and remote tx power
be aware of changes in remote or local tx power

Defined HCI commands in Core Spec v5.4:
7.8.117 LE Enhanced Read Transmit Power Level command:
improvement to existing local tx power reading.
7.8.118 LE Read Remote Transmit Power Level command:
Remote tx power is read through an event (LE Transmit Power Reporting)
7.8.121 LE Set Transmit Power Reporting Enable command:
Enables local or remote tx power reporting to monitor changes in tx power
7.7.65.33 LE Transmit Power Reporting event

Note: to utilize the Feature fully Nordic-LL-only vendor-specific commands
are needed. These will not be added in RTOS zephyr but instead
implemented in a maintainable way in sdk.

Signed-off-by: Kyra Lengfeld <kyra.lengfeld@nordicsemi.no>
2023-11-29 09:59:39 +01:00
Emil Gydesen f93caa3903 Bluetooth: Audio: BT_AUDIO_CODEC_LC3_ID -> BT_HCI_CODING_FORMAT_LC3
Replace the BT_AUDIO_CODEC_LC3_ID macro with the
BT_HCI_CODING_FORMAT_LC3 as there is no reason to
define and use the LC3 ID different than the other
allowed codec IDs.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2023-09-20 20:19:50 +01:00
Victor Chavez 82222eb1ab Bluetooth: controller: Added HCI SCO header definition
Added HCI SCO header definition and included comments
that refer to the Bluetooth core spec sections for
the other HCI header types.

Signed-off-by: Victor Chavez <chavez-bermudez@fh-aachen.de>
2023-08-30 10:18:41 +02:00
Morten Priess 856e555b51 Bluetooth: controller: Fix HCI ISO header RFU bit masking
Mask out RFU bits in HCI ISO header to prevent set RFU bits leaking into
length values.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2023-08-21 15:11:48 +02:00
Pierce Lowe 2019c044ba Bluetooth: hci: Add 5.4 HCI error codes
Add new bluetooth hci error codes from Bluetooth 5.4 specification

Signed-off-by: Pierce Lowe <pierce.lowe@nordicsemi.no>
2023-06-13 13:32:17 -04:00
Carles Cufi 22f73992b2 Bluetooth: Rework the HCI header set
In order to have clean, self-contained HCI headers that do not have any
dependencies towards the Host or any other part of the system (except
types), reorganize the headers in the following way:

- Split out the macros and structs from hci.h to a new hci_types.h
- Merge the existing hci_err.h into the new hci_types.h

Fixes #58214.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-06-12 06:20:24 -04:00