mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 10:40:47 +03:00
feat(ble/bluedroid): add DBAF host support (Core 6.0)
(cherry picked from commit e20d3f0197)
Co-authored-by: zhiweijian <zhiweijian@espressif.com>
This commit is contained in:
@@ -17,6 +17,15 @@ tBTM_BLE_EXTENDED_CB extend_adv_cb;
|
||||
|
||||
tBTM_BLE_5_HCI_CBACK ble_5_hci_cb;
|
||||
|
||||
#if (BLE_FEAT_LL_EXT_FEAT == TRUE)
|
||||
static UINT8 btm_ble_local_supp_le_features[BLE_LL_EXT_FEAT_DATA_LEN];
|
||||
static UINT8 btm_ble_remote_supp_le_features[BLE_LL_EXT_FEAT_DATA_LEN];
|
||||
#endif // #if (BLE_FEAT_LL_EXT_FEAT == TRUE)
|
||||
|
||||
#if (BLE_FEAT_SHORTER_CONN_INTERVALS == TRUE)
|
||||
static tBTM_BLE_MIN_CONN_INTERVAL_GROUP btm_ble_min_conn_interval_groups[BTM_BLE_MAX_CONN_INTERVAL_GROUPS];
|
||||
#endif // #if (BLE_FEAT_SHORTER_CONN_INTERVALS == TRUE)
|
||||
|
||||
#define INVALID_VALUE_8BIT 0XFF
|
||||
#define INVALID_VALUE_16BIT 0XFFFF
|
||||
#define INVALID_VALUE_32BIT 0XFFFFFFFF
|
||||
@@ -1411,6 +1420,47 @@ tBTM_STATUS BTM_BleEnableMonitorAdv(UINT8 enable)
|
||||
}
|
||||
#endif // #if (BLE_FEAT_ADV_MONITOR == TRUE)
|
||||
|
||||
#if (BLE_FEAT_DBAF == TRUE)
|
||||
tBTM_STATUS BTM_BleSetDecisionData(UINT8 adv_handle, UINT8 decision_type_flags,
|
||||
UINT8 data_len, const UINT8 *p_data)
|
||||
{
|
||||
tHCI_STATUS err;
|
||||
tBTM_STATUS status = BTM_SUCCESS;
|
||||
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
|
||||
|
||||
if ((err = btsnd_hcic_ble_set_decision_data(adv_handle, decision_type_flags, data_len, p_data)) != HCI_SUCCESS) {
|
||||
BTM_TRACE_ERROR("LE SetDecisionData: cmd err=0x%x", err);
|
||||
status = BTM_HCI_ERROR | err;
|
||||
}
|
||||
|
||||
cb_params.status = status;
|
||||
BTM_ExtBleCallbackTrigger(BTM_BLE_5_GAP_SET_DECISION_DATA_COMPLETE_EVT, &cb_params);
|
||||
return status;
|
||||
}
|
||||
|
||||
tBTM_STATUS BTM_BleSetDecisionInstructions(UINT8 num_tests, const UINT8 *test_flags,
|
||||
const UINT8 *test_fields, const UINT8 *test_params)
|
||||
{
|
||||
tHCI_STATUS err;
|
||||
tBTM_STATUS status = BTM_SUCCESS;
|
||||
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
|
||||
|
||||
if ((err = btsnd_hcic_ble_set_decision_instructions(num_tests, test_flags, test_fields,
|
||||
test_params)) != HCI_SUCCESS) {
|
||||
BTM_TRACE_ERROR("LE SetDecisionInstructions: cmd err=0x%x", err);
|
||||
status = BTM_HCI_ERROR | err;
|
||||
}
|
||||
|
||||
cb_params.status = status;
|
||||
BTM_ExtBleCallbackTrigger(BTM_BLE_5_GAP_SET_DECISION_INSTRUCTIONS_COMPLETE_EVT, &cb_params);
|
||||
return status;
|
||||
}
|
||||
#endif // #if (BLE_FEAT_DBAF == TRUE)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
void btm_ble_scan_req_received_evt(tBTM_BLE_SCAN_REQ_RECEIVED *params)
|
||||
{
|
||||
|
||||
@@ -1201,6 +1201,7 @@ void btm_read_remote_trans_pwr_level_cmpl(UINT8 status);
|
||||
void btm_subrate_req_cmd_status(UINT8 status);
|
||||
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
|
||||
|
||||
|
||||
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
|
||||
void btm_ble_cs_read_local_supp_caps_cmpl_evt(UINT8 *p);
|
||||
void btm_ble_cs_read_remote_supp_caps_cmd_status(UINT8 status);
|
||||
|
||||
@@ -2660,6 +2660,8 @@ static void btu_ble_monitor_adv_report_evt(UINT8 *p)
|
||||
}
|
||||
#endif // #if (BLE_FEAT_ADV_MONITOR == TRUE)
|
||||
|
||||
|
||||
|
||||
#if (BLE_50_EXTEND_SYNC_EN == TRUE)
|
||||
static void btu_ble_periodic_adv_sync_establish_evt(UINT8 *p, bool v2_evt)
|
||||
{
|
||||
@@ -3334,6 +3336,8 @@ static void btu_ble_subrate_change_evt(UINT8 *p)
|
||||
}
|
||||
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
|
||||
|
||||
|
||||
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
static void btu_ble_pa_subevt_data_request_evt(UINT8 *p)
|
||||
{
|
||||
|
||||
@@ -3054,6 +3054,79 @@ UINT8 btsnd_hcic_ble_enable_monitor_adv(UINT8 enable)
|
||||
}
|
||||
#endif // #if (BLE_FEAT_ADV_MONITOR == TRUE)
|
||||
|
||||
#if (BLE_FEAT_DBAF == TRUE)
|
||||
UINT8 btsnd_hcic_ble_set_decision_data(UINT8 adv_handle, UINT8 decision_type_flags,
|
||||
UINT8 data_len, const UINT8 *p_data)
|
||||
{
|
||||
BT_HDR *p;
|
||||
UINT8 *pp;
|
||||
UINT8 param_len;
|
||||
|
||||
if (data_len > BLE_DECISION_DATA_MAX_LEN) {
|
||||
return HCI_ERR_ILLEGAL_PARAMETER_FMT;
|
||||
}
|
||||
if (data_len > 0 && p_data == NULL) {
|
||||
return HCI_ERR_ILLEGAL_PARAMETER_FMT;
|
||||
}
|
||||
|
||||
param_len = HCIC_PARAM_SIZE_SET_DECISION_DATA_HDR + data_len;
|
||||
if (param_len > HCIC_PARAM_SIZE_SET_DECISION_DATA_MAX) {
|
||||
return HCI_ERR_ILLEGAL_PARAMETER_FMT;
|
||||
}
|
||||
|
||||
HCIC_BLE_CMD_CREATED_U8(p, pp, param_len);
|
||||
|
||||
UINT16_TO_STREAM(pp, HCI_BLE_SET_DECISION_DATA);
|
||||
UINT8_TO_STREAM(pp, param_len);
|
||||
UINT8_TO_STREAM(pp, adv_handle);
|
||||
UINT8_TO_STREAM(pp, decision_type_flags);
|
||||
UINT8_TO_STREAM(pp, data_len);
|
||||
if (data_len > 0) {
|
||||
ARRAY_TO_STREAM(pp, p_data, data_len);
|
||||
}
|
||||
|
||||
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
|
||||
}
|
||||
|
||||
UINT8 btsnd_hcic_ble_set_decision_instructions(UINT8 num_tests, const UINT8 *test_flags,
|
||||
const UINT8 *test_fields, const UINT8 *test_params)
|
||||
{
|
||||
BT_HDR *p;
|
||||
UINT8 *pp;
|
||||
UINT8 param_len;
|
||||
|
||||
if (num_tests == 0 || num_tests > BLE_DECISION_MAX_TESTS) {
|
||||
return HCI_ERR_ILLEGAL_PARAMETER_FMT;
|
||||
}
|
||||
if (test_flags == NULL || test_fields == NULL || test_params == NULL) {
|
||||
return HCI_ERR_ILLEGAL_PARAMETER_FMT;
|
||||
}
|
||||
|
||||
param_len = HCIC_PARAM_SIZE_SET_DECISION_INSTRUCTIONS(num_tests);
|
||||
if (param_len > HCIC_PARAM_SIZE_SET_DECISION_INSTRUCTIONS_MAX) {
|
||||
return HCI_ERR_ILLEGAL_PARAMETER_FMT;
|
||||
}
|
||||
|
||||
HCIC_BLE_CMD_CREATED_U8(p, pp, param_len);
|
||||
|
||||
UINT16_TO_STREAM(pp, HCI_BLE_SET_DECISION_INSTRUCTIONS);
|
||||
UINT8_TO_STREAM(pp, param_len);
|
||||
UINT8_TO_STREAM(pp, num_tests);
|
||||
for (UINT8 i = 0; i < num_tests; i++) {
|
||||
UINT8_TO_STREAM(pp, test_flags[i]);
|
||||
UINT8_TO_STREAM(pp, test_fields[i]);
|
||||
ARRAY_TO_STREAM(pp, test_params + i * BLE_DECISION_TEST_PARAM_LEN,
|
||||
BLE_DECISION_TEST_PARAM_LEN);
|
||||
}
|
||||
|
||||
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
|
||||
}
|
||||
#endif // #if (BLE_FEAT_DBAF == TRUE)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
UINT8 btsnd_hcic_ble_set_periodic_adv_subevt_data(UINT8 adv_handle, UINT8 num_subevents_with_data, ble_subevent_params *subevent_params)
|
||||
{
|
||||
|
||||
@@ -990,7 +990,11 @@ typedef void (tBTM_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK) (tBTM_STATUS st
|
||||
#define BTM_BLE_5_GAP_READ_MONITOR_ADV_LIST_SIZE_COMPLETE_EVT 74
|
||||
#define BTM_BLE_5_GAP_ENABLE_MONITOR_ADV_COMPLETE_EVT 75
|
||||
#endif // #if (BLE_FEAT_ADV_MONITOR == TRUE)
|
||||
#define BTM_BLE_5_GAP_UNKNOWN_EVT 76
|
||||
#if (BLE_FEAT_DBAF == TRUE)
|
||||
#define BTM_BLE_5_GAP_SET_DECISION_DATA_COMPLETE_EVT 79
|
||||
#define BTM_BLE_5_GAP_SET_DECISION_INSTRUCTIONS_COMPLETE_EVT 80
|
||||
#endif // #if (BLE_FEAT_DBAF == TRUE)
|
||||
#define BTM_BLE_5_GAP_UNKNOWN_EVT 91
|
||||
typedef UINT8 tBTM_BLE_5_GAP_EVENT;
|
||||
|
||||
#if (BLE_FEAT_ISO_EN == TRUE)
|
||||
@@ -1240,6 +1244,10 @@ typedef struct {
|
||||
} tBTM_BLE_MONITOR_ADV_LIST_SIZE;
|
||||
#endif // #if (BLE_FEAT_ADV_MONITOR == TRUE)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
UINT16 sync_handle;
|
||||
UINT8 tx_power;
|
||||
@@ -1463,6 +1471,7 @@ typedef struct {
|
||||
UINT16 conn_handle;
|
||||
} tBTM_BLE_CS_SEC_ENABLE_CMPL_EVT;
|
||||
|
||||
|
||||
typedef struct {
|
||||
UINT8 status;
|
||||
UINT16 conn_handle;
|
||||
@@ -3109,6 +3118,18 @@ tBTM_STATUS BTM_BleClearMonitorAdvList(void);
|
||||
tBTM_STATUS BTM_BleReadMonitorAdvListSize(void);
|
||||
tBTM_STATUS BTM_BleEnableMonitorAdv(UINT8 enable);
|
||||
#endif // #if (BLE_FEAT_ADV_MONITOR == TRUE)
|
||||
|
||||
#if (BLE_FEAT_DBAF == TRUE)
|
||||
tBTM_STATUS BTM_BleSetDecisionData(UINT8 adv_handle, UINT8 decision_type_flags,
|
||||
UINT8 data_len, const UINT8 *p_data);
|
||||
tBTM_STATUS BTM_BleSetDecisionInstructions(UINT8 num_tests, const UINT8 *test_flags,
|
||||
const UINT8 *test_fields, UINT8 test_params_len,
|
||||
const UINT8 *test_params);
|
||||
#endif // #if (BLE_FEAT_DBAF == TRUE)
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
#if (BLE_50_DTM_TEST_EN == TRUE)
|
||||
|
||||
@@ -439,6 +439,7 @@
|
||||
#define HCI_BLE_ENABLE_MONITOR_ADV (0x009C | HCI_GRP_BLE_CMDS)
|
||||
#endif // #if (BLE_FEAT_ADV_MONITOR == TRUE)
|
||||
|
||||
|
||||
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
|
||||
#define HCI_BLE_ENH_READ_TRANS_POWER_LEVEL (0x0076 | HCI_GRP_BLE_CMDS)
|
||||
#define HCI_BLE_READ_REMOTE_TRANS_POWER_LEVEL (0x0077 | HCI_GRP_BLE_CMDS)
|
||||
@@ -464,6 +465,12 @@
|
||||
#define HCI_BLE_SET_PERIOD_ADV_PARAMS_V2 (0x0086 | HCI_GRP_BLE_CMDS)
|
||||
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
|
||||
#if (BLE_FEAT_DBAF == TRUE)
|
||||
#define HCI_BLE_SET_DECISION_DATA (0x0080 | HCI_GRP_BLE_CMDS)
|
||||
#define HCI_BLE_SET_DECISION_INSTRUCTIONS (0x0081 | HCI_GRP_BLE_CMDS)
|
||||
#endif // #if (BLE_FEAT_DBAF == TRUE)
|
||||
|
||||
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
|
||||
#define HCI_BLE_CS_READ_LOCAL_SUPP_CAPS (0x0089 | HCI_GRP_BLE_CMDS)
|
||||
#define HCI_BLE_CS_READ_REMOTE_SUPP_CAPS (0x008A | HCI_GRP_BLE_CMDS)
|
||||
@@ -479,6 +486,9 @@
|
||||
#define HCI_BLE_CS_SET_PROCEDURE_ENABLE (0x0094 | HCI_GRP_BLE_CMDS)
|
||||
#endif // (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
|
||||
|
||||
|
||||
|
||||
|
||||
// Vendor OGF define
|
||||
#define HCI_VENDOR_OGF 0x3F
|
||||
|
||||
@@ -970,10 +980,14 @@
|
||||
#define HCI_BLE_PA_RESPONSE_REPORT_EVT 0x28
|
||||
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
|
||||
#if (BLE_FEAT_ADV_MONITOR == TRUE)
|
||||
#define HCI_BLE_MONITOR_ADV_REPORT_EVT 0x34
|
||||
#endif // #if (BLE_FEAT_ADV_MONITOR == TRUE)
|
||||
|
||||
|
||||
|
||||
|
||||
#if (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
|
||||
#define HCI_BLE_CS_READ_REMOTE_SUPP_CAPS_CMPL_EVT 0x2C
|
||||
#define HCI_BLE_CS_READ_REMOTE_FAE_TAB_CMPL_EVT 0x2D
|
||||
|
||||
@@ -825,6 +825,26 @@ BOOLEAN btsnd_hcic_ble_read_monitor_adv_list_size(void);
|
||||
UINT8 btsnd_hcic_ble_enable_monitor_adv(UINT8 enable);
|
||||
#endif // #if (BLE_FEAT_ADV_MONITOR == TRUE)
|
||||
|
||||
#if (BLE_FEAT_DBAF == TRUE)
|
||||
#define HCIC_PARAM_SIZE_SET_DECISION_DATA_HDR 3
|
||||
#define HCIC_PARAM_SIZE_SET_DECISION_DATA_MAX 251
|
||||
#define HCIC_PARAM_SIZE_SET_DECISION_INSTRUCTIONS_HDR 1
|
||||
#define HCIC_PARAM_SIZE_SET_DECISION_INSTRUCTIONS_MAX 251
|
||||
#define BLE_DECISION_DATA_MAX_LEN 248
|
||||
#define BLE_DECISION_MAX_TESTS 8
|
||||
#define BLE_DECISION_TEST_PARAMS_MAX_LEN 229
|
||||
|
||||
UINT8 btsnd_hcic_ble_set_decision_data(UINT8 adv_handle, UINT8 decision_type_flags,
|
||||
UINT8 data_len, const UINT8 *p_data);
|
||||
UINT8 btsnd_hcic_ble_set_decision_instructions(UINT8 num_tests, const UINT8 *test_flags,
|
||||
const UINT8 *test_fields, UINT8 test_params_len,
|
||||
const UINT8 *test_params);
|
||||
#endif // #if (BLE_FEAT_DBAF == TRUE)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ULP HCI command */
|
||||
BOOLEAN btsnd_hcic_ble_set_evt_mask (BT_EVENT_MASK event_mask);
|
||||
|
||||
@@ -1355,4 +1375,5 @@ UINT8 btsnd_hcic_ble_cs_set_procedure_params(UINT16 conn_handle, UINT8 config_id
|
||||
UINT8 btsnd_hcic_ble_cs_procedure_enable(UINT16 conn_handle, UINT8 config_id, UINT8 enable);
|
||||
#endif // (BT_BLE_FEAT_CHANNEL_SOUNDING == TRUE)
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user