Bluetooth: Host: Minor doc and rename for LE remote feature exchange
Rename `BT_CONN_AUTO_FEATURE_EXCH` to `BT_CONN_LE_FEATURES_EXCHANGED`,
and add some comments for readability.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c
index e11375b..3ffbc2c 100644
--- a/subsys/bluetooth/host/conn.c
+++ b/subsys/bluetooth/host/conn.c
@@ -2812,7 +2812,7 @@
int bt_conn_get_remote_info(struct bt_conn *conn,
struct bt_conn_remote_info *remote_info)
{
- if (!atomic_test_bit(conn->flags, BT_CONN_AUTO_FEATURE_EXCH) ||
+ if (!atomic_test_bit(conn->flags, BT_CONN_LE_FEATURES_EXCHANGED) ||
(IS_ENABLED(CONFIG_BT_REMOTE_VERSION) &&
!atomic_test_bit(conn->flags, BT_CONN_AUTO_VERSION_INFO))) {
return -EBUSY;
diff --git a/subsys/bluetooth/host/conn_internal.h b/subsys/bluetooth/host/conn_internal.h
index 1b9993e..d890368 100644
--- a/subsys/bluetooth/host/conn_internal.h
+++ b/subsys/bluetooth/host/conn_internal.h
@@ -71,7 +71,7 @@
BT_CONN_ATT_MTU_EXCHANGED, /* If ATT MTU has been exchanged. */
#endif /* CONFIG_BT_GATT_CLIENT */
- BT_CONN_AUTO_FEATURE_EXCH, /* Auto-initiated LE Feat done */
+ BT_CONN_LE_FEATURES_EXCHANGED, /* bt_conn.le.features is valid */
BT_CONN_AUTO_VERSION_INFO, /* Auto-initiated LE version done */
BT_CONN_CTE_RX_ENABLED, /* CTE receive and sampling is enabled */
@@ -103,6 +103,11 @@
uint8_t conn_param_retry_countdown;
#endif
+ /** @brief Remote LE features
+ *
+ * Available after `atomic_test_bit(conn->flags, BT_CONN_LE_FEATURES_EXCHANGED)`.
+ * Signaled by bt_conn_cb.remote_info_available().
+ */
uint8_t features[8];
struct bt_keys *keys;
diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c
index 427e0c1..1b2b1ac 100644
--- a/subsys/bluetooth/host/hci_core.c
+++ b/subsys/bluetooth/host/hci_core.c
@@ -1035,6 +1035,7 @@
cp = net_buf_add(buf, sizeof(*cp));
cp->handle = sys_cpu_to_le16(conn->handle);
+ /* Results in BT_HCI_EVT_LE_REMOTE_FEAT_COMPLETE */
return bt_hci_cmd_send_sync(BT_HCI_OP_LE_READ_REMOTE_FEATURES, buf, NULL);
}
@@ -1206,7 +1207,7 @@
return;
}
- if (!atomic_test_bit(conn->flags, BT_CONN_AUTO_FEATURE_EXCH) &&
+ if (!atomic_test_bit(conn->flags, BT_CONN_LE_FEATURES_EXCHANGED) &&
((conn->role == BT_HCI_ROLE_CENTRAL) ||
BT_FEAT_LE_PER_INIT_FEAT_XCHG(bt_dev.le.features))) {
err = hci_le_read_remote_features(conn);
@@ -1801,7 +1802,7 @@
sizeof(conn->le.features));
}
- atomic_set_bit(conn->flags, BT_CONN_AUTO_FEATURE_EXCH);
+ atomic_set_bit(conn->flags, BT_CONN_LE_FEATURES_EXCHANGED);
if (IS_ENABLED(CONFIG_BT_REMOTE_INFO) &&
!IS_ENABLED(CONFIG_BT_REMOTE_VERSION)) {