mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
feat(ble/bluedroid): add LL Extended Feature Set host support (Core 6.0)
This commit is contained in:
@@ -1428,6 +1428,79 @@ void btm_ble_frame_space_update_complete_evt(UINT8 *p)
|
||||
}
|
||||
#endif // #if (BLE_FEAT_FRAME_SPACE_UPDATE == TRUE)
|
||||
|
||||
#if (BLE_FEAT_LL_EXT_FEAT == TRUE)
|
||||
tBTM_STATUS BTM_BleReadAllLocalSuppFeatures(void)
|
||||
{
|
||||
if (!btsnd_hcic_ble_read_all_local_supp_features()) {
|
||||
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
|
||||
cb_params.read_all_local_supp_feat.status = BTM_HCI_ERROR | HCI_ERR_MEMORY_FULL;
|
||||
BTM_ExtBleCallbackTrigger(BTM_BLE_5_GAP_READ_ALL_LOCAL_SUPP_FEAT_COMPLETE_EVT, &cb_params);
|
||||
return BTM_NO_RESOURCES;
|
||||
}
|
||||
return BTM_CMD_STARTED;
|
||||
}
|
||||
|
||||
void btm_ble_read_all_local_supp_features_complete(UINT8 *p)
|
||||
{
|
||||
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
|
||||
|
||||
STREAM_TO_UINT8(cb_params.read_all_local_supp_feat.status, p);
|
||||
if (cb_params.read_all_local_supp_feat.status == HCI_SUCCESS) {
|
||||
STREAM_TO_UINT8(cb_params.read_all_local_supp_feat.max_page, p);
|
||||
cb_params.read_all_local_supp_feat.le_features = btm_ble_local_supp_le_features;
|
||||
STREAM_TO_ARRAY(btm_ble_local_supp_le_features, p, BLE_LL_EXT_FEAT_DATA_LEN);
|
||||
} else {
|
||||
cb_params.read_all_local_supp_feat.status |= BTM_HCI_ERROR;
|
||||
}
|
||||
|
||||
BTM_ExtBleCallbackTrigger(BTM_BLE_5_GAP_READ_ALL_LOCAL_SUPP_FEAT_COMPLETE_EVT, &cb_params);
|
||||
}
|
||||
|
||||
tBTM_STATUS BTM_BleReadAllRemoteFeatures(UINT16 conn_handle, UINT8 page_requested)
|
||||
{
|
||||
tHCI_STATUS err;
|
||||
|
||||
err = btsnd_hcic_ble_read_all_remote_features(conn_handle, page_requested);
|
||||
if (err != HCI_SUCCESS) {
|
||||
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
|
||||
cb_params.read_all_remote_feat.status = BTM_HCI_ERROR | err;
|
||||
cb_params.read_all_remote_feat.conn_handle = conn_handle;
|
||||
BTM_ExtBleCallbackTrigger(BTM_BLE_5_GAP_READ_ALL_REMOTE_FEAT_COMPLETE_EVT, &cb_params);
|
||||
return BTM_NO_RESOURCES;
|
||||
}
|
||||
return BTM_CMD_STARTED;
|
||||
}
|
||||
|
||||
void btm_read_all_remote_feat_cmd_status(UINT8 status)
|
||||
{
|
||||
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
|
||||
|
||||
if (status == HCI_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
cb_params.read_all_remote_feat.status = status | BTM_HCI_ERROR;
|
||||
BTM_ExtBleCallbackTrigger(BTM_BLE_5_GAP_READ_ALL_REMOTE_FEAT_COMPLETE_EVT, &cb_params);
|
||||
}
|
||||
|
||||
void btm_ble_read_all_remote_features_complete_evt(UINT8 *p)
|
||||
{
|
||||
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
|
||||
|
||||
STREAM_TO_UINT8(cb_params.read_all_remote_feat.status, p);
|
||||
STREAM_TO_UINT16(cb_params.read_all_remote_feat.conn_handle, p);
|
||||
if (cb_params.read_all_remote_feat.status == HCI_SUCCESS) {
|
||||
STREAM_TO_UINT8(cb_params.read_all_remote_feat.max_remote_page, p);
|
||||
STREAM_TO_UINT8(cb_params.read_all_remote_feat.max_valid_page, p);
|
||||
cb_params.read_all_remote_feat.le_features = btm_ble_remote_supp_le_features;
|
||||
STREAM_TO_ARRAY(btm_ble_remote_supp_le_features, p, BLE_LL_EXT_FEAT_DATA_LEN);
|
||||
} else {
|
||||
cb_params.read_all_remote_feat.status |= BTM_HCI_ERROR;
|
||||
}
|
||||
|
||||
BTM_ExtBleCallbackTrigger(BTM_BLE_5_GAP_READ_ALL_REMOTE_FEAT_COMPLETE_EVT, &cb_params);
|
||||
}
|
||||
#endif // #if (BLE_FEAT_LL_EXT_FEAT == TRUE)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -595,6 +595,10 @@ void btm_ble_subrate_change_evt(tBTM_BLE_SUBRATE_CHANGE_EVT *params);
|
||||
#if (BLE_FEAT_FRAME_SPACE_UPDATE == TRUE)
|
||||
void btm_ble_frame_space_update_complete_evt(UINT8 *p);
|
||||
#endif // #if (BLE_FEAT_FRAME_SPACE_UPDATE == TRUE)
|
||||
#if (BLE_FEAT_LL_EXT_FEAT == TRUE)
|
||||
void btm_ble_read_all_local_supp_features_complete(UINT8 *p);
|
||||
void btm_ble_read_all_remote_features_complete_evt(UINT8 *p);
|
||||
#endif // #if (BLE_FEAT_LL_EXT_FEAT == TRUE)
|
||||
#if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
void btm_ble_pa_subevt_data_req_evt(tBTM_BLE_PA_SUBEVT_DATA_REQ_EVT *params);
|
||||
void btm_ble_pa_rsp_rpt_evt(tBTM_BLE_PA_RSP_REPORT_EVT *params);
|
||||
|
||||
@@ -1520,11 +1520,6 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
|
||||
btm_ble_read_all_local_supp_features_complete(p);
|
||||
break;
|
||||
#endif // #if (BLE_FEAT_LL_EXT_FEAT == TRUE)
|
||||
#if (BLE_FEAT_SHORTER_CONN_INTERVALS == TRUE)
|
||||
case HCI_BLE_READ_MIN_SUPP_CONN_INTERVAL:
|
||||
btm_ble_read_min_supp_conn_interval_complete(p);
|
||||
break;
|
||||
#endif // #if (BLE_FEAT_SHORTER_CONN_INTERVALS == TRUE)
|
||||
#endif /* (BLE_INCLUDED == TRUE) */
|
||||
|
||||
default: {
|
||||
|
||||
@@ -3145,6 +3145,46 @@ UINT8 btsnd_hcic_ble_frame_space_update(UINT16 conn_handle, UINT16 frame_space_m
|
||||
}
|
||||
#endif // #if (BLE_FEAT_FRAME_SPACE_UPDATE == TRUE)
|
||||
|
||||
#if (BLE_FEAT_LL_EXT_FEAT == TRUE)
|
||||
BOOLEAN btsnd_hcic_ble_read_all_local_supp_features(void)
|
||||
{
|
||||
BT_HDR *p;
|
||||
UINT8 *pp;
|
||||
|
||||
if ((p = HCI_GET_CMD_BUF(0)) == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
pp = (UINT8 *)(p + 1);
|
||||
p->len = HCIC_PREAMBLE_SIZE;
|
||||
p->offset = 0;
|
||||
|
||||
UINT16_TO_STREAM(pp, HCI_BLE_READ_ALL_LOCAL_SUPP_FEATURES);
|
||||
UINT8_TO_STREAM(pp, 0);
|
||||
|
||||
btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
UINT8 btsnd_hcic_ble_read_all_remote_features(UINT16 conn_handle, UINT8 page_requested)
|
||||
{
|
||||
BT_HDR *p;
|
||||
UINT8 *pp;
|
||||
|
||||
if (page_requested > BLE_LL_EXT_FEAT_MAX_PAGE) {
|
||||
return HCI_ERR_ILLEGAL_PARAMETER_FMT;
|
||||
}
|
||||
|
||||
HCIC_BLE_CMD_CREATED_U8(p, pp, HCIC_PARAM_SIZE_READ_ALL_REMOTE_FEATURES);
|
||||
|
||||
UINT16_TO_STREAM(pp, HCI_BLE_READ_ALL_REMOTE_FEATURES);
|
||||
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_READ_ALL_REMOTE_FEATURES);
|
||||
UINT16_TO_STREAM(pp, conn_handle);
|
||||
UINT8_TO_STREAM(pp, page_requested);
|
||||
|
||||
btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
|
||||
return HCI_SUCCESS;
|
||||
}
|
||||
#endif // #if (BLE_FEAT_LL_EXT_FEAT == TRUE)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -978,6 +978,10 @@ 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)
|
||||
#if (BLE_FEAT_LL_EXT_FEAT == TRUE)
|
||||
#define BTM_BLE_5_GAP_READ_ALL_LOCAL_SUPP_FEAT_COMPLETE_EVT 76
|
||||
#define BTM_BLE_5_GAP_READ_ALL_REMOTE_FEAT_COMPLETE_EVT 77
|
||||
#endif // #if (BLE_FEAT_LL_EXT_FEAT == TRUE)
|
||||
#if (BLE_FEAT_FRAME_SPACE_UPDATE == TRUE)
|
||||
#define BTM_BLE_5_GAP_FRAME_SPACE_UPDATE_COMPLETE_EVT 78
|
||||
#endif // #if (BLE_FEAT_FRAME_SPACE_UPDATE == TRUE)
|
||||
@@ -1235,6 +1239,25 @@ typedef struct {
|
||||
} tBTM_BLE_MONITOR_ADV_LIST_SIZE;
|
||||
#endif // #if (BLE_FEAT_ADV_MONITOR == TRUE)
|
||||
|
||||
#if (BLE_FEAT_LL_EXT_FEAT == TRUE)
|
||||
#ifndef BLE_LL_EXT_FEAT_DATA_LEN
|
||||
#define BLE_LL_EXT_FEAT_DATA_LEN 248
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
tBTM_STATUS status;
|
||||
UINT8 max_page;
|
||||
UINT8 *le_features;
|
||||
} tBTM_BLE_READ_ALL_LOCAL_SUPP_FEAT;
|
||||
|
||||
typedef struct {
|
||||
tBTM_STATUS status;
|
||||
UINT16 conn_handle;
|
||||
UINT8 max_remote_page;
|
||||
UINT8 max_valid_page;
|
||||
UINT8 *le_features;
|
||||
} tBTM_BLE_READ_ALL_REMOTE_FEAT;
|
||||
#endif // #if (BLE_FEAT_LL_EXT_FEAT == TRUE)
|
||||
|
||||
#if (BLE_FEAT_FRAME_SPACE_UPDATE == TRUE)
|
||||
typedef struct {
|
||||
@@ -1959,6 +1982,10 @@ typedef union {
|
||||
tBTM_BLE_MONITOR_ADV_REPORT monitor_adv_report;
|
||||
tBTM_BLE_MONITOR_ADV_LIST_SIZE monitor_adv_list_size;
|
||||
#endif // #if (BLE_FEAT_ADV_MONITOR == TRUE)
|
||||
#if (BLE_FEAT_LL_EXT_FEAT == TRUE)
|
||||
tBTM_BLE_READ_ALL_LOCAL_SUPP_FEAT read_all_local_supp_feat;
|
||||
tBTM_BLE_READ_ALL_REMOTE_FEAT read_all_remote_feat;
|
||||
#endif // #if (BLE_FEAT_LL_EXT_FEAT == TRUE)
|
||||
#if (BLE_FEAT_FRAME_SPACE_UPDATE == TRUE)
|
||||
tBTM_BLE_FRAME_SPACE_UPDATE frame_space_update;
|
||||
#endif // #if (BLE_FEAT_FRAME_SPACE_UPDATE == TRUE)
|
||||
@@ -3121,6 +3148,10 @@ tBTM_STATUS BTM_BleFrameSpaceUpdate(UINT16 conn_handle, UINT16 frame_space_min,
|
||||
UINT16 frame_space_max, UINT8 phys, UINT16 spacing_types);
|
||||
#endif // #if (BLE_FEAT_FRAME_SPACE_UPDATE == TRUE)
|
||||
|
||||
#if (BLE_FEAT_LL_EXT_FEAT == TRUE)
|
||||
tBTM_STATUS BTM_BleReadAllLocalSuppFeatures(void);
|
||||
tBTM_STATUS BTM_BleReadAllRemoteFeatures(UINT16 conn_handle, UINT8 page_requested);
|
||||
#endif // #if (BLE_FEAT_LL_EXT_FEAT == TRUE)
|
||||
|
||||
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
@@ -468,6 +468,10 @@
|
||||
#define HCI_BLE_SET_PERIOD_ADV_PARAMS_V2 (0x0086 | HCI_GRP_BLE_CMDS)
|
||||
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
#if (BLE_FEAT_LL_EXT_FEAT == TRUE)
|
||||
#define HCI_BLE_READ_ALL_LOCAL_SUPP_FEATURES (0x0087 | HCI_GRP_BLE_CMDS)
|
||||
#define HCI_BLE_READ_ALL_REMOTE_FEATURES (0x0088 | HCI_GRP_BLE_CMDS)
|
||||
#endif // #if (BLE_FEAT_LL_EXT_FEAT == TRUE)
|
||||
|
||||
#if (BLE_FEAT_DBAF == TRUE)
|
||||
#define HCI_BLE_SET_DECISION_DATA (0x0080 | HCI_GRP_BLE_CMDS)
|
||||
@@ -983,6 +987,9 @@
|
||||
#define HCI_BLE_PA_RESPONSE_REPORT_EVT 0x28
|
||||
#endif // #if (BT_BLE_FEAT_PAWR_EN == TRUE)
|
||||
|
||||
#if (BLE_FEAT_LL_EXT_FEAT == TRUE)
|
||||
#define HCI_BLE_READ_ALL_REMOTE_FEAT_COMPLETE_EVT 0x2B
|
||||
#endif // #if (BLE_FEAT_LL_EXT_FEAT == TRUE)
|
||||
|
||||
#if (BLE_FEAT_ADV_MONITOR == TRUE)
|
||||
#define HCI_BLE_MONITOR_ADV_REPORT_EVT 0x34
|
||||
|
||||
@@ -849,6 +849,14 @@ UINT8 btsnd_hcic_ble_frame_space_update(UINT16 conn_handle, UINT16 frame_space_m
|
||||
UINT16 frame_space_max, UINT8 phys, UINT16 spacing_types);
|
||||
#endif // #if (BLE_FEAT_FRAME_SPACE_UPDATE == TRUE)
|
||||
|
||||
#if (BLE_FEAT_LL_EXT_FEAT == TRUE)
|
||||
#define HCIC_PARAM_SIZE_READ_ALL_REMOTE_FEATURES 3
|
||||
#define BLE_LL_EXT_FEAT_DATA_LEN 248
|
||||
#define BLE_LL_EXT_FEAT_MAX_PAGE 10
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_read_all_local_supp_features(void);
|
||||
UINT8 btsnd_hcic_ble_read_all_remote_features(UINT16 conn_handle, UINT8 page_requested);
|
||||
#endif // #if (BLE_FEAT_LL_EXT_FEAT == TRUE)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user