Skip to content

Commit

Permalink
fixup! bluetooth: host: CS support for remote capabilities and FAE table
Browse files Browse the repository at this point in the history
  • Loading branch information
olivier-le-sage committed Sep 16, 2024
1 parent 601621e commit c9bea05
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 24 deletions.
20 changes: 13 additions & 7 deletions include/zephyr/bluetooth/conn.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,8 @@ struct bt_conn_le_cs_capabilities {
/** Maximum number of consecutive CS procedures.
*
* When set to zero, indicates support for both fixed and indefinite
* numbers of CS procedures before termination. */
* numbers of CS procedures before termination.
*/
uint16_t max_consecutive_procedures_supported;
/** Number of antennas. */
uint8_t num_antennas_supported;
Expand All @@ -281,7 +282,7 @@ struct bt_conn_le_cs_capabilities {
bool reflector_supported;
/** Mode-3 */
bool mode_3_supported;
/** RTT AA Only */
/** RTT AA-Only */
bool rtt_aa_only_supported;
/** RTT Sounding */
bool rtt_sounding_supported;
Expand All @@ -308,23 +309,28 @@ struct bt_conn_le_cs_capabilities {
/** Number of CS steps needed to achieve the
* accuracy requirements for RTT AA Only.
*
* Set to 0 if RTT AA Only isn't supported. */
* Set to 0 if RTT AA Only isn't supported.
*/
uint8_t rtt_aa_only_n;
/** Number of CS steps needed to achieve the
* accuracy requirements for RTT Sounding.
*
* Set to 0 if RTT Sounding isn't supported. */
* Set to 0 if RTT Sounding isn't supported
*/
uint8_t rtt_sounding_n;
/** Number of CS steps needed to achieve the
* accuracy requirements for RTT Random Payload.
*
* Set to 0 if RTT Random Payload isn't supported. */
* Set to 0 if RTT Random Payload isn't supported.
*/
uint8_t rtt_random_payload_n;
/** Phase-based normalized attack detector metric
* when a CS_SYNC with sounding sequence is received. */
* when a CS_SYNC with sounding sequence is received.
*/
bool phase_based_nadm_sounding_supported;
/** Phase-based normalized attack detector metric
* when a CS_SYNC with random sequence is received. */
* when a CS_SYNC with random sequence is received.
*/
bool phase_based_nadm_random_supported;
/** CS_SYNC LE 2M PHY. */
bool cs_sync_2m_phy_supported;
Expand Down
8 changes: 4 additions & 4 deletions include/zephyr/bluetooth/cs.h
Original file line number Diff line number Diff line change
Expand Up @@ -425,11 +425,11 @@ struct bt_cs_test_param {
*

Check failure on line 425 in include/zephyr/bluetooth/cs.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

TRAILING_WHITESPACE

include/zephyr/bluetooth/cs.h:425 trailing whitespace

Check failure on line 425 in include/zephyr/bluetooth/cs.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

TRAILING_WHITESPACE

include/zephyr/bluetooth/cs.h:425 trailing whitespace
* This command is used to query the CS capabilities that are supported

Check notice on line 426 in include/zephyr/bluetooth/cs.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/bluetooth/cs.h:426 - * + *

Check notice on line 426 in include/zephyr/bluetooth/cs.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

include/zephyr/bluetooth/cs.h:426 - * + *
* by the remote controller.
*
*
* @note To use this API @kconfig{CONFIG_BT_CHANNEL_SOUNDING} must be set.
*
*
* @param conn Connection Object.
*
*
* @return Zero on success or (negative) error code on failure.
*/
int bt_cs_read_remote_supported_capabilities(struct bt_conn *conn);
Expand All @@ -451,7 +451,7 @@ int bt_cs_set_default_settings(struct bt_conn *conn,

/** @brief Read Remote FAE Table
*
* This command is used to to read the per-channel mode-0 Frequency Actuation Error
* This command is used to read the per-channel mode-0 Frequency Actuation Error
* table of the remote Controller.
*
* @note To use this API @kconfig{CONFIG_BT_CHANNEL_SOUNDING} must be set.
Expand Down
6 changes: 3 additions & 3 deletions include/zephyr/bluetooth/hci_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -3321,9 +3321,9 @@ struct bt_hci_evt_le_subrate_change {

#define BT_HCI_LE_CS_MODES_SUPPORTED_MODE_3_MASK BIT(0)

#define BT_HCI_LE_CS_RTT_CAPABILITY_RTT_AA_ONLY_N_10NS_PRECISION_MASK BIT(0)
#define BT_HCI_LE_CS_RTT_CAPABILITY_RTT_SOUNDING_N_10NS_PRECISION_MASK BIT(1)
#define BT_HCI_LE_CS_RTT_CAPABILITY_RTT_RANDOM_PAYLOAD_N_10NS_PRECISION_MASK BIT(2)
#define BT_HCI_LE_CS_RTT_AA_ONLY_N_10NS_PRECISION_MASK BIT(0)
#define BT_HCI_LE_CS_RTT_SOUNDING_N_10NS_PRECISION_MASK BIT(1)
#define BT_HCI_LE_CS_RTT_RANDOM_PAYLOAD_N_10NS_PRECISION_MASK BIT(2)

#define BT_HCI_LE_CS_NADM_SOUNDING_CAPABILITY_PHASE_BASED_MASK BIT(0)
#define BT_HCI_LE_CS_NADM_RANDOM_CAPABILITY_PHASE_BASED_MASK BIT(0)
Expand Down
14 changes: 5 additions & 9 deletions subsys/bluetooth/host/cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void bt_hci_le_cs_read_remote_supported_capabilities_complete(struct net_buf *bu
evt = net_buf_pull_mem(buf, sizeof(*evt));

if (evt->status) {
LOG_INF("Read Remote Supported Capabilities failed with status 0x%02X", evt->status);
LOG_INF("Read Remote Supported Capabilities failed (status 0x%02X)", evt->status);
return;
}

Expand Down Expand Up @@ -83,21 +83,21 @@ void bt_hci_le_cs_read_remote_supported_capabilities_complete(struct net_buf *bu

if (evt->rtt_aa_only_n) {
remote_cs_capabilities.rtt_aa_only_10ns_accurate =
evt->rtt_capability & BT_HCI_LE_CS_RTT_CAPABILITY_RTT_AA_ONLY_N_10NS_PRECISION_MASK;
evt->rtt_capability & BT_HCI_LE_CS_RTT_AA_ONLY_N_10NS_PRECISION_MASK;
} else {
remote_cs_capabilities.rtt_aa_only_10ns_accurate = false;
}

if (evt->rtt_sounding_n) {
remote_cs_capabilities.rtt_sounding_10ns_accurate =
evt->rtt_capability & BT_HCI_LE_CS_RTT_CAPABILITY_RTT_SOUNDING_N_10NS_PRECISION_MASK;
evt->rtt_capability & BT_HCI_LE_CS_RTT_SOUNDING_N_10NS_PRECISION_MASK;
} else {
remote_cs_capabilities.rtt_sounding_10ns_accurate = false;
}

if (evt->rtt_random_payload_n) {
remote_cs_capabilities.rtt_random_payload_10ns_accurate =
evt->rtt_capability & BT_HCI_LE_CS_RTT_CAPABILITY_RTT_RANDOM_PAYLOAD_N_10NS_PRECISION_MASK;
evt->rtt_capability & BT_HCI_LE_CS_RTT_RANDOM_PAYLOAD_N_10NS_PRECISION_MASK;
} else {
remote_cs_capabilities.rtt_random_payload_10ns_accurate = false;
}
Expand Down Expand Up @@ -189,10 +189,6 @@ void bt_hci_le_cs_read_remote_fae_table_complete(struct net_buf *buf)
LOG_INF("Read Remote FAE Table failed with status 0x%02X", evt->status);
return;
}
else
{
LOG_INF("Read Remote FAE Table success");
}

conn = bt_conn_lookup_handle(
sys_le16_to_cpu(evt->conn_handle),
Expand Down Expand Up @@ -245,7 +241,7 @@ int bt_cs_start_test(const struct bt_cs_test_param *params)
cp->drbg_nonce = sys_cpu_to_le16(params->drbg_nonce);
cp->channel_map_repetition = params->override_config_0.channel_map_repetition;
cp->override_config = sys_cpu_to_le16(params->override_config);

uint8_t override_parameters_length = 0;

if (params->override_config & BT_HCI_OP_LE_CS_TEST_OVERRIDE_CONFIG_0_MASK) {
Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/host/hci_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3630,7 +3630,7 @@ static int le_init(void)
if (IS_ENABLED(CONFIG_BT_CHANNEL_SOUNDING) &&
BT_FEAT_LE_CHANNEL_SOUNDING(bt_dev.le.features)) {
err = le_set_host_feature(BT_LE_FEAT_BIT_CHANNEL_SOUNDING_HOST, 1);
if(err) {
if (err) {
return err;
}
}
Expand Down

0 comments on commit c9bea05

Please sign in to comment.