mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-08-24 10:49:58 +00:00
(feat) nimble : Add hci event and startup for Bluetooth LE 5.1 Direction Finding feature.
This commit is contained in:
@@ -103,6 +103,12 @@ static ble_hs_hci_evt_le_fn ble_hs_hci_evt_le_transmit_power_report;
|
||||
#if MYNEWT_VAL(BLE_CONN_SUBRATING)
|
||||
static ble_hs_hci_evt_le_fn ble_hs_hci_evt_le_subrate_change;
|
||||
#endif
|
||||
#if MYNEWT_VAL(BLE_AOA_AOD)
|
||||
static ble_hs_hci_evt_le_fn ble_hs_hci_evt_le_connless_iq_report;
|
||||
static ble_hs_hci_evt_le_fn ble_hs_hci_evt_le_conn_iq_report;
|
||||
static ble_hs_hci_evt_le_fn ble_hs_hci_evt_le_cte_req_failed;
|
||||
#endif
|
||||
|
||||
|
||||
/* Statistics */
|
||||
struct host_hci_stats {
|
||||
@@ -177,6 +183,11 @@ static ble_hs_hci_evt_le_fn * const ble_hs_hci_evt_le_dispatch[] = {
|
||||
#if MYNEWT_VAL(BLE_CONN_SUBRATING)
|
||||
[BLE_HCI_LE_SUBEV_SUBRATE_CHANGE] = ble_hs_hci_evt_le_subrate_change,
|
||||
#endif
|
||||
#if MYNEWT_VAL(BLE_AOA_AOD)
|
||||
[BLE_HCI_LE_SUBEV_CONNLESS_IQ_RPT] = ble_hs_hci_evt_le_connless_iq_report,
|
||||
[BLE_HCI_LE_SUBEV_CONN_IQ_RPT] = ble_hs_hci_evt_le_conn_iq_report,
|
||||
[BLE_HCI_LE_SUBEV_CTE_REQ_FAILED] = ble_hs_hci_evt_le_cte_req_failed,
|
||||
#endif
|
||||
};
|
||||
|
||||
#define BLE_HS_HCI_EVT_LE_DISPATCH_SZ \
|
||||
@@ -990,6 +1001,52 @@ ble_hs_hci_evt_le_subrate_change(uint8_t subevent, const void *data,
|
||||
}
|
||||
#endif
|
||||
|
||||
#if MYNEWT_VAL(BLE_AOA_AOD)
|
||||
static int
|
||||
ble_hs_hci_evt_le_connless_iq_report(uint8_t subevent, const void *data,
|
||||
unsigned int len)
|
||||
{
|
||||
const struct ble_hci_ev_le_subev_connless_iq_rpt *ev = data;
|
||||
|
||||
if (len < sizeof(*ev)) {
|
||||
return BLE_HS_ECONTROLLER;
|
||||
}
|
||||
|
||||
ble_gap_rx_connless_iq_report(ev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
ble_hs_hci_evt_le_conn_iq_report(uint8_t subevent, const void *data,
|
||||
unsigned int len)
|
||||
{
|
||||
const struct ble_hci_ev_le_subev_conn_iq_rpt *ev = data;
|
||||
if (len < sizeof(*ev)) {
|
||||
return BLE_HS_ECONTROLLER;
|
||||
}
|
||||
|
||||
ble_gap_rx_conn_iq_report(ev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
ble_hs_hci_evt_le_cte_req_failed(uint8_t subevent, const void *data,
|
||||
unsigned int len)
|
||||
{
|
||||
const struct ble_hci_ev_le_subev_cte_req_failed *ev = data;
|
||||
|
||||
if (len != sizeof(*ev)) {
|
||||
return BLE_HS_ECONTROLLER;
|
||||
}
|
||||
|
||||
ble_gap_rx_cte_req_failed(ev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NIMBLE_BLE_CONNECT
|
||||
static int
|
||||
ble_hs_hci_evt_le_conn_upd_complete(uint8_t subevent, const void *data,
|
||||
|
||||
@@ -281,6 +281,18 @@ ble_hs_startup_le_set_evmask_tx(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if MYNEWT_VAL(BLE_AOA_AOD)
|
||||
if (version >= BLE_HCI_VER_BCS_5_1) {
|
||||
/**
|
||||
* Enable the following LE events:
|
||||
* 0x0000000000100000 LE Connectionless IQ Report event
|
||||
* 0x0000000000200000 LE Connection IQ Report event
|
||||
* 0x0000000000400000 LE CTE Request Failed event
|
||||
*/
|
||||
mask |= 0x0000000000700000;
|
||||
}
|
||||
#endif
|
||||
|
||||
cmd.event_mask = htole64(mask);
|
||||
|
||||
rc = ble_hs_hci_cmd_tx(BLE_HCI_OP(BLE_HCI_OGF_LE,
|
||||
|
||||
Reference in New Issue
Block a user