diff --git a/components/bt/host/bluedroid/api/esp_ble_iso_api.c b/components/bt/host/bluedroid/api/esp_ble_iso_api.c index e634e9a688..826991e6bf 100644 --- a/components/bt/host/bluedroid/api/esp_ble_iso_api.c +++ b/components/bt/host/bluedroid/api/esp_ble_iso_api.c @@ -214,35 +214,6 @@ esp_err_t esp_ble_iso_remove_iso_data_path(esp_ble_iso_remove_data_path_params_t == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } -esp_err_t esp_ble_iso_set_host_feature(uint16_t bit_num, uint8_t bit_val) -{ - btc_msg_t msg = {0}; - btc_ble_iso_args_t arg; - - if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) { - return ESP_ERR_INVALID_STATE; - } - -#if (BLE_FEAT_ISO_60_EN == TRUE) - if (bit_num > 0x07BF) { - return ESP_ERR_INVALID_ARG; - } -#else - if (bit_num > 0xFF) { - return ESP_ERR_INVALID_ARG; - } -#endif - msg.sig = BTC_SIG_API_CALL; - msg.pid = BTC_PID_ISO_BLE; - msg.act = BTC_ISO_ACT_SET_HOST_FEATURE; - - arg.iso_set_host_feature_params.bit_num = bit_num; - arg.iso_set_host_feature_params.bit_val = bit_val; - - return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_iso_args_t), NULL, NULL) - == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); -} - esp_err_t esp_ble_iso_read_iso_tx_sync(uint16_t iso_handle) { btc_msg_t msg = {0}; diff --git a/components/bt/host/bluedroid/api/esp_gap_ble_api.c b/components/bt/host/bluedroid/api/esp_gap_ble_api.c index bfa800e6ba..1897e05ceb 100644 --- a/components/bt/host/bluedroid/api/esp_gap_ble_api.c +++ b/components/bt/host/bluedroid/api/esp_gap_ble_api.c @@ -1963,3 +1963,34 @@ esp_err_t esp_ble_gap_subrate_request(esp_ble_subrate_req_param_t *subrate_req_p == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); } #endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE) + +#if (BLE_50_FEATURE_SUPPORT == TRUE) +esp_err_t esp_ble_gap_set_host_feature(uint16_t bit_num, uint8_t bit_val) +{ + btc_msg_t msg; + btc_ble_5_gap_args_t arg; + + if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) { + return ESP_ERR_INVALID_STATE; + } + +#if (BLE_FEAT_ISO_60_EN == TRUE) + if (bit_num > 0x07BF) { + return ESP_ERR_INVALID_ARG; + } +#else + if (bit_num > 0xFF) { + return ESP_ERR_INVALID_ARG; + } +#endif + msg.sig = BTC_SIG_API_CALL; + msg.pid = BTC_PID_GAP_BLE; + msg.act = BTC_GAP_ACT_SET_HOST_FEATURE; + + arg.set_host_feature_params.bit_num = bit_num; + arg.set_host_feature_params.bit_val = bit_val; + + return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_5_gap_args_t), NULL, NULL) + == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); +} +#endif //#if (BLE_50_FEATURE_SUPPORT == TRUE) diff --git a/components/bt/host/bluedroid/api/include/api/esp_ble_iso_api.h b/components/bt/host/bluedroid/api/include/api/esp_ble_iso_api.h index a24b9cff70..5531393e77 100644 --- a/components/bt/host/bluedroid/api/include/api/esp_ble_iso_api.h +++ b/components/bt/host/bluedroid/api/include/api/esp_ble_iso_api.h @@ -26,7 +26,6 @@ typedef enum { ESP_BLE_ISO_BIG_SYNC_TERMINATE_CMPL_EVT, /*!< When BIG sync terminate complete, the event comes */ ESP_BLE_ISO_BIGINFO_ADV_REPORT_EVT, /*!< When receiving an Advertising PDU that contained a BIGInfo field, the event comes */ ESP_BLE_ISO_ISO_DATA_PATH_UPDATE_EVT, /*!< When ISO data path update complete, the event comes */ - ESP_BLE_ISO_SET_HOST_FEATURE_CMPL_EVT, /*!< When host feature set complete, the event comes */ ESP_BLE_ISO_READ_ISO_TX_SYNC_CMPL_EVT, /*!< When reading tx sync complete, the event comes */ ESP_BLE_ISO_READ_LINK_QUALITY_CMPL_EVT, /*!< When reading link quality complete, the event comes */ ESP_BLE_ISO_SET_CIG_PARAMS_CMPL_EVT, /*!< When CIG parameters set complete, the event comes */ @@ -295,12 +294,6 @@ typedef union { ESP_BLE_ISO_DATA_PATH_UPDATE_TYPE op_type; /*!< data path update type, setup or remove */ uint16_t iso_hdl; /*!< Connection handle of the CIS or BIS */ } data_path; /*!< Event parameter of ESP_BLE_ISO_ISO_DATA_PATH_UPDATE_EVT */ - /** - * @brief ESP_BLE_ISO_SET_HOST_FEATURE_CMPL_EVT - */ - struct ble_iso_set_host_feature_evt_param { - esp_bt_status_t status; /*!< Indicate host feature update success status */ - } host_feature; /*!< Event parameter of ESP_BLE_ISO_SET_HOST_FEATURE_CMPL_EVT */ /** * @brief ESP_BLE_ISO_READ_ISO_TX_SYNC_CMPL_EVT */ @@ -529,19 +522,6 @@ esp_err_t esp_ble_iso_set_iso_data_path(esp_ble_iso_set_data_path_params_t *data */ esp_err_t esp_ble_iso_remove_iso_data_path(esp_ble_iso_remove_data_path_params_t *data_path_params); -/** - * @brief This function is called to set host feature. - * - * @param[in] bit_num: the bit position in the FeatureSet. - * @param[in] bit_val: the feature is enabled or disabled - * - * @return - * - ESP_OK : success - * - other : failed - * - */ -esp_err_t esp_ble_iso_set_host_feature(uint16_t bit_num, uint8_t bit_val); - /** * @brief This function is called to read tx sync. * diff --git a/components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h b/components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h index 2c87fb192e..1812d4946a 100644 --- a/components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h +++ b/components/bt/host/bluedroid/api/include/api/esp_gap_ble_api.h @@ -244,6 +244,7 @@ typedef enum { ESP_GAP_BLE_SET_DEFAULT_SUBRATE_COMPLETE_EVT, /*!< when set default subrate complete, the event comes */ ESP_GAP_BLE_SUBRATE_REQUEST_COMPLETE_EVT, /*!< when subrate request command complete, the event comes */ ESP_GAP_BLE_SUBRATE_CHANGE_EVT, /*!< when Connection Subrate Update procedure has completed and some parameters of the specified connection have changed, the event comes */ + ESP_GAP_BLE_SET_HOST_FEATURE_CMPL_EVT, /*!< When host feature set complete, the event comes */ ESP_GAP_BLE_EVT_MAX, /*!< when maximum advertising event complete, the event comes */ } esp_gap_ble_cb_event_t; @@ -1775,6 +1776,14 @@ typedef union { uint16_t supervision_timeout; /*!< New supervision timeout for this connection(Time = N × 10 ms). Range: 0x000A to 0x0C80, Time Range: 100 ms to 32 s */ } subrate_change_evt; /*!< Event parameter of ESP_GAP_BLE_SUBRATE_CHANGE_EVT */ #endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE) +#if (BLE_50_FEATURE_SUPPORT == TRUE) + /** + * @brief ESP_GAP_BLE_SET_HOST_FEATURE_CMPL_EVT + */ + struct ble_set_host_feature_evt_param { + esp_bt_status_t status; /*!< Indicate host feature update success status */ + } host_feature; /*!< Event parameter of ESP_GAP_BLE_SET_HOST_FEATURE_CMPL_EVT */ +#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) } esp_ble_gap_cb_param_t; /** @@ -3096,6 +3105,19 @@ esp_err_t esp_ble_gap_set_default_subrate(esp_ble_default_subrate_param_t *defau */ esp_err_t esp_ble_gap_subrate_request(esp_ble_subrate_req_param_t *subrate_req_params); +/** + * @brief This function is called to set host feature. + * + * @param[in] bit_num: the bit position in the FeatureSet. + * @param[in] bit_val: the feature is enabled or disabled + * + * @return + * - ESP_OK : success + * - other : failed + * + */ +esp_err_t esp_ble_gap_set_host_feature(uint16_t bit_num, uint8_t bit_val); + #ifdef __cplusplus } #endif diff --git a/components/bt/host/bluedroid/bta/dm/bta_dm_act.c b/components/bt/host/bluedroid/bta/dm/bta_dm_act.c index 70e70b6fe0..d39dbd3485 100644 --- a/components/bt/host/bluedroid/bta/dm/bta_dm_act.c +++ b/components/bt/host/bluedroid/bta/dm/bta_dm_act.c @@ -6136,12 +6136,6 @@ void bta_dm_ble_iso_remove_data_path(tBTA_DM_MSG *p_data) BTM_BleIsoRemoveDataPath(param.conn_handle, param.data_path_dir); } -void bta_dm_ble_iso_set_host_feature(tBTA_DM_MSG *p_data) -{ - APPL_TRACE_API("%s", __func__); - BTM_BleIsoSetHostFeature(p_data->iso_set_host_feat.bit_num, p_data->iso_set_host_feat.bit_val); -} - void bta_dm_ble_iso_read_tx_sync(tBTA_DM_MSG *p_data) { APPL_TRACE_API("%s", __func__); @@ -6301,6 +6295,13 @@ void bta_dm_api_subrate_request(tBTA_DM_MSG *p_data) } #endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE) +#if (BLE_50_FEATURE_SUPPORT == TRUE) +void bta_dm_ble_set_host_feature(tBTA_DM_MSG *p_data) +{ + BTM_BleSetHostFeature(p_data->set_host_feat.bit_num, p_data->set_host_feat.bit_val); +} +#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) + #if (BLE_HOST_SETUP_STORAGE_EN == TRUE) /******************************************************************************* ** diff --git a/components/bt/host/bluedroid/bta/dm/bta_dm_api.c b/components/bt/host/bluedroid/bta/dm/bta_dm_api.c index 81e32511e5..b72e1fa034 100644 --- a/components/bt/host/bluedroid/bta/dm/bta_dm_api.c +++ b/components/bt/host/bluedroid/bta/dm/bta_dm_api.c @@ -3109,6 +3109,25 @@ void BTA_DmBleGapSubrateReqest(uint16_t conn_handle, uint16_t subrate_min, uint1 } #endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE) +#if (BLE_50_FEATURE_SUPPORT == TRUE) +void BTA_DmBleGapSetHostFeature(uint16_t bit_num, uint8_t bit_val) +{ + tBTA_DM_API_SET_HOST_FEATURE *p_msg; + APPL_TRACE_API("%s", __func__); + if ((p_msg = (tBTA_DM_API_SET_HOST_FEATURE *) osi_malloc(sizeof(tBTA_DM_API_SET_HOST_FEATURE))) != NULL) { + memset(p_msg, 0, sizeof(tBTA_DM_API_SET_HOST_FEATURE)); + p_msg->hdr.event = BTA_DM_API_SET_HOST_FEATURE_EVT; + + p_msg->bit_num = bit_num; + p_msg->bit_val = bit_val; + //start sent the msg to the bta system control module + bta_sys_sendmsg(p_msg); + } else { + APPL_TRACE_ERROR("%s malloc failed", __func__); + } +} +#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) + /******************************************************************************* ** ** Function BTA_VendorInit @@ -3841,23 +3860,6 @@ void BTA_DmBleGapIsoDataPathRemove(tBTA_DM_BLE_ISO_REMOVE_DATA_PATH_PARAMS *p_is } } -void BTA_DmBleGapIsoSetHostFeature(uint16_t bit_num, uint8_t bit_val) -{ - tBTA_DM_API_ISO_SET_HOST_FEATURE *p_msg; - APPL_TRACE_API("%s", __func__); - if ((p_msg = (tBTA_DM_API_ISO_SET_HOST_FEATURE *) osi_malloc(sizeof(tBTA_DM_API_ISO_SET_HOST_FEATURE))) != NULL) { - memset(p_msg, 0, sizeof(tBTA_DM_API_ISO_SET_HOST_FEATURE)); - p_msg->hdr.event = BTA_DM_API_ISO_SET_HOST_FEATURE_EVT; - - p_msg->bit_num = bit_num; - p_msg->bit_val = bit_val; - //start sent the msg to the bta system control module - bta_sys_sendmsg(p_msg); - } else { - APPL_TRACE_ERROR("%s malloc failed", __func__); - } -} - void BTA_DmBleGapIsoReadTxSync(uint16_t iso_handle) { tBTA_DM_API_ISO_READ_TX_SYNC *p_msg; diff --git a/components/bt/host/bluedroid/bta/dm/bta_dm_main.c b/components/bt/host/bluedroid/bta/dm/bta_dm_main.c index 0ba4dc0112..ed640bdd0c 100644 --- a/components/bt/host/bluedroid/bta/dm/bta_dm_main.c +++ b/components/bt/host/bluedroid/bta/dm/bta_dm_main.c @@ -293,7 +293,6 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = { #endif// #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE) bta_dm_ble_iso_set_data_path, /* BTA_DM_API_ISO_SET_DATA_PATH_EVT */ bta_dm_ble_iso_remove_data_path, /* BTA_DM_API_ISO_REMOVE_DATA_PATH_EVT */ - bta_dm_ble_iso_set_host_feature, /* BTA_DM_API_ISO_SET_HOST_FEATURE_EVT */ bta_dm_ble_iso_read_tx_sync, /* BTA_DM_API_ISO_READ_TX_SYNC_EVT */ bta_dm_ble_iso_read_link_quality, /* BTA_DM_API_ISO_READ_LINK_QUALITY_EVT */ #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE) @@ -335,6 +334,9 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = { bta_dm_api_set_default_subrate, /* BTA_DM_API_SET_DEFALT_SUBRATE */ bta_dm_api_subrate_request, /* BTA_DM_API_SUBRATE_REQUEST */ #endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE) +#if (BLE_50_FEATURE_SUPPORT == TRUE) + bta_dm_ble_set_host_feature, /* BTA_DM_API_SET_HOST_FEATURE_EVT */ +#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) }; diff --git a/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h b/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h index 4c429df603..36025b8705 100644 --- a/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h +++ b/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h @@ -287,7 +287,6 @@ enum { #endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE) BTA_DM_API_ISO_SET_DATA_PATH_EVT, BTA_DM_API_ISO_REMOVE_DATA_PATH_EVT, - BTA_DM_API_ISO_SET_HOST_FEATURE_EVT, BTA_DM_API_ISO_READ_TX_SYNC_EVT, BTA_DM_API_ISO_READ_LINK_QUALITY_EVT, #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE) @@ -329,6 +328,9 @@ enum { BTA_DM_API_SET_DEFALT_SUBRATE, BTA_DM_API_SUBRATE_REQUEST, #endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE) +#if (BLE_50_FEATURE_SUPPORT == TRUE) + BTA_DM_API_SET_HOST_FEATURE_EVT, +#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) BTA_DM_MAX_EVT }; @@ -1127,6 +1129,14 @@ typedef struct { } tBTA_DM_API_BLE_SUBRATE_REQUEST; #endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE) +#if (BLE_50_FEATURE_SUPPORT == TRUE) +typedef struct { + BT_HDR hdr; + uint16_t bit_num; + uint8_t bit_val; +} tBTA_DM_API_SET_HOST_FEATURE; +#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) + #endif /* BLE_INCLUDED */ #if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE) @@ -1410,12 +1420,6 @@ typedef struct { tBTA_DM_BLE_ISO_REMOVE_DATA_PATH_PARAMS iso_data_path_remove_param; } tBTA_DM_API_ISO_DATA_PATH_REMOVE; -typedef struct { - BT_HDR hdr; - uint16_t bit_num; - uint8_t bit_val; -} tBTA_DM_API_ISO_SET_HOST_FEATURE; - typedef struct { BT_HDR hdr; uint16_t iso_hdl; @@ -1803,7 +1807,6 @@ typedef union { #endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE) tBTA_DM_API_ISO_DATA_PATH iso_set_data_path; tBTA_DM_API_ISO_DATA_PATH_REMOVE iso_remove_data_path; - tBTA_DM_API_ISO_SET_HOST_FEATURE iso_set_host_feat; tBTA_DM_API_ISO_READ_TX_SYNC iso_read_tx_sync; tBTA_DM_API_ISO_READ_LINK_QUALITY iso_read_link_quality; #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE) @@ -1846,6 +1849,9 @@ typedef union { tBTA_DM_API_BLE_SET_DEFAULT_SUBRATE default_subrate; tBTA_DM_API_BLE_SUBRATE_REQUEST subrate_request; #endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE) +#if (BLE_50_FEATURE_SUPPORT == TRUE) + tBTA_DM_API_SET_HOST_FEATURE set_host_feat; +#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) } tBTA_DM_MSG; @@ -2461,7 +2467,6 @@ extern void bta_dm_ble_big_sync_terminate(tBTA_DM_MSG *p_data); #endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE) extern void bta_dm_ble_iso_set_data_path(tBTA_DM_MSG *p_data); extern void bta_dm_ble_iso_remove_data_path(tBTA_DM_MSG *p_data); -extern void bta_dm_ble_iso_set_host_feature(tBTA_DM_MSG *p_data); extern void bta_dm_ble_iso_read_tx_sync(tBTA_DM_MSG *p_data); void bta_dm_ble_iso_read_link_quality(tBTA_DM_MSG *p_data); #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE) @@ -2507,4 +2512,7 @@ void bta_dm_api_set_trans_power_reporting_en(tBTA_DM_MSG *p_data); void bta_dm_api_set_default_subrate(tBTA_DM_MSG *p_data); void bta_dm_api_subrate_request(tBTA_DM_MSG *p_data); #endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE) +#if (BLE_50_FEATURE_SUPPORT == TRUE) +extern void bta_dm_ble_set_host_feature(tBTA_DM_MSG *p_data); +#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) #endif /* BTA_DM_INT_H */ diff --git a/components/bt/host/bluedroid/bta/include/bta/bta_api.h b/components/bt/host/bluedroid/bta/include/bta/bta_api.h index 997ab2ae2d..a060ead8f6 100644 --- a/components/bt/host/bluedroid/bta/include/bta/bta_api.h +++ b/components/bt/host/bluedroid/bta/include/bta/bta_api.h @@ -1690,6 +1690,9 @@ typedef struct { #define BTA_BLE_GAP_SUBRATE_REQUEST_EVT BTM_BLE_GAP_SUBRATE_REQUEST_EVT #define BTA_BLE_GAP_SUBRATE_CHANGE_EVT BTM_BLE_GAP_SUBRATE_CHANGE_EVT #endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE) +#if (BLE_50_FEATURE_SUPPORT == TRUE) +#define BTA_BLE_GAP_SET_HOST_FEATURE_EVT BTM_BLE_GAP_SET_HOST_FEATURE_EVT +#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) #define BTA_DM_BLE_5_GAP_UNKNOWN_EVT BTM_BLE_5_GAP_UNKNOWN_EVT typedef tBTM_BLE_5_GAP_EVENT tBTA_DM_BLE_5_GAP_EVENT; @@ -1713,7 +1716,6 @@ extern tBTM_BLE_5_HCI_CBACK ble_5_hci_cb; #define BTA_BLE_ISO_BIGINFO_ADV_REPORT_EVT BTM_BLE_ISO_BIGINFO_ADV_REPORT_EVT #endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE) #define BTA_BLE_ISO_DATA_PATH_UPFATE_EVT BTM_BLE_ISO_DATA_PATH_UPFATE_EVT -#define BTA_BLE_ISO_SET_HOST_FEATURE_EVT BTM_BLE_ISO_SET_HOST_FEATURE_EVT #define BTA_BLE_ISO_READ_TX_SYNC_EVT BTM_BLE_ISO_READ_TX_SYNC_EVT #define BTA_BLE_ISO_READ_LINK_QUALITY_EVT BTM_BLE_ISO_READ_LINK_QUALITY_EVT #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE) @@ -3066,6 +3068,10 @@ void BTA_DmBleGapSubrateReqest(uint16_t conn_handle, uint16_t subrate_min, uint1 uint16_t max_latency, uint16_t continuation_number, uint16_t supervision_timeout); #endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE) +#if (BLE_50_FEATURE_SUPPORT == TRUE) +extern void BTA_DmBleGapSetHostFeature(uint16_t bit_num, uint8_t bit_val); +#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) + /******************************************************************************* ** ** Function BTA_DmBleSetStorageParams @@ -3353,7 +3359,6 @@ extern void BTA_DmBleGapIsoBigSyncTerminate(tBTA_DM_BLE_BIG_SYNC_TERMINATE_PARAM #endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE) extern void BTA_DmBleGapIsoDataPathSet(tBTA_DM_BLE_ISO_SET_DATA_PATH_PARAMS *p_iso_data_path_param); extern void BTA_DmBleGapIsoDataPathRemove(tBTA_DM_BLE_ISO_REMOVE_DATA_PATH_PARAMS *p_iso_data_path_param); -extern void BTA_DmBleGapIsoSetHostFeature(uint16_t bit_num, uint8_t bit_val); extern void BTA_DmBleGapIsoReadTxSync(uint16_t iso_handle); #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE) extern void BTA_DmBleIsoSetCigParams(uint8_t cig_id, uint32_t sdu_int_c_to_p, uint32_t sdu_int_p_to_c, uint8_t worse_case_SCA, uint8_t packing, diff --git a/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_ble.c b/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_ble.c index 86d0e53a18..f77bd8a965 100644 --- a/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_ble.c +++ b/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_ble.c @@ -1270,6 +1270,12 @@ static void btc_ble_5_gap_callback(tBTA_DM_BLE_5_GAP_EVENT event, param.subrate_change_evt.supervision_timeout = params->subrate_change_evt.supervision_timeout; break; #endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE) +#if (BLE_50_FEATURE_SUPPORT == TRUE) + case BTA_BLE_GAP_SET_HOST_FEATURE_EVT: + msg.act = ESP_GAP_BLE_SET_HOST_FEATURE_CMPL_EVT; + param.host_feature.status = btc_btm_status_to_esp_status(params->status); + break; +#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) default: break; } @@ -2621,6 +2627,11 @@ void btc_gap_ble_call_handler(btc_msg_t *msg) arg_5->subrate_req_param.max_latency, arg_5->subrate_req_param.continuation_number, arg_5->subrate_req_param.supervision_timeout); break; #endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE) +#if (BLE_50_FEATURE_SUPPORT == TRUE) + case BTC_GAP_ACT_SET_HOST_FEATURE: + BTA_DmBleGapSetHostFeature(arg_5->set_host_feature_params.bit_num, arg_5->set_host_feature_params.bit_val); + break; +#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) default: break; } diff --git a/components/bt/host/bluedroid/btc/profile/std/include/btc_gap_ble.h b/components/bt/host/bluedroid/btc/profile/std/include/btc_gap_ble.h index 2b93b1cb17..c672125181 100644 --- a/components/bt/host/bluedroid/btc/profile/std/include/btc_gap_ble.h +++ b/components/bt/host/bluedroid/btc/profile/std/include/btc_gap_ble.h @@ -133,6 +133,9 @@ typedef enum { BTC_GAP_BLE_SET_DEFALT_SUBRATE, BTC_GAP_BLE_SUBRATE_REQUEST, #endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE) +#if (BLE_50_FEATURE_SUPPORT == TRUE) + BTC_GAP_ACT_SET_HOST_FEATURE, +#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) } btc_gap_ble_act_t; /* btc_ble_gap_args_t */ @@ -519,6 +522,10 @@ typedef union { uint16_t supervision_timeout; } subrate_req_param; #endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE) + struct set_host_feature_arg { + uint16_t bit_num; + uint8_t bit_val; + } set_host_feature_params; } btc_ble_5_gap_args_t; #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) diff --git a/components/bt/host/bluedroid/btc/profile/std/include/btc_iso_ble.h b/components/bt/host/bluedroid/btc/profile/std/include/btc_iso_ble.h index 8a4b72825c..4e734b1202 100644 --- a/components/bt/host/bluedroid/btc/profile/std/include/btc_iso_ble.h +++ b/components/bt/host/bluedroid/btc/profile/std/include/btc_iso_ble.h @@ -52,7 +52,6 @@ typedef enum { #endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE) BTC_ISO_ACT_SET_DATA_PATH, BTC_ISO_ACT_REMOVE_DATA_PATH, - BTC_ISO_ACT_SET_HOST_FEATURE, BTC_ISO_ACT_READ_ISO_TX_SYNC, BTC_ISO_ACT_READ_ISO_LINK_QUALITY, #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE) @@ -146,11 +145,6 @@ typedef union { uint8_t data_path_dir; } iso_remove_data_path_params; - struct iso_set_host_feature_arg { - uint16_t bit_num; - uint8_t bit_val; - } iso_set_host_feature_params; - struct iso_read_tx_sync_arg { uint16_t iso_handle; } iso_read_tx_sync_params; diff --git a/components/bt/host/bluedroid/btc/profile/std/iso/btc_iso_ble.c b/components/bt/host/bluedroid/btc/profile/std/iso/btc_iso_ble.c index ad89c629ed..825d956301 100644 --- a/components/bt/host/bluedroid/btc/profile/std/iso/btc_iso_ble.c +++ b/components/bt/host/bluedroid/btc/profile/std/iso/btc_iso_ble.c @@ -112,10 +112,6 @@ static void btc_ble_iso_callback(tBTM_BLE_ISO_EVENT event, param.data_path.status = btc_btm_status_to_esp_status(params->btm_data_path_update.status); param.data_path.iso_hdl = params->btm_data_path_update.conn_hdl; break; - case BTA_BLE_ISO_SET_HOST_FEATURE_EVT: - msg.act = ESP_BLE_ISO_SET_HOST_FEATURE_CMPL_EVT; - param.host_feature.status = btc_btm_status_to_esp_status(params->status); - break; case BTA_BLE_ISO_READ_TX_SYNC_EVT: msg.act = ESP_BLE_ISO_READ_ISO_TX_SYNC_CMPL_EVT; param.read_tx_sync.status = btc_btm_status_to_esp_status(params->btm_read_tx_sync.status); @@ -329,9 +325,6 @@ void btc_iso_ble_call_handler(btc_msg_t *msg) case BTC_ISO_ACT_REMOVE_DATA_PATH: BTA_DmBleGapIsoDataPathRemove((tBTA_DM_BLE_ISO_REMOVE_DATA_PATH_PARAMS *)&arg->iso_remove_data_path_params); break; - case BTC_ISO_ACT_SET_HOST_FEATURE: - BTA_DmBleGapIsoSetHostFeature(arg->iso_set_host_feature_params.bit_num, arg->iso_set_host_feature_params.bit_val); - break; case BTC_ISO_ACT_READ_ISO_TX_SYNC: BTA_DmBleGapIsoReadTxSync(arg->iso_read_tx_sync_params.iso_handle); break; diff --git a/components/bt/host/bluedroid/stack/btm/btm_ble_5_gap.c b/components/bt/host/bluedroid/stack/btm/btm_ble_5_gap.c index 52ffbe113b..f2dcad5de6 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_ble_5_gap.c +++ b/components/bt/host/bluedroid/stack/btm/btm_ble_5_gap.c @@ -1707,3 +1707,24 @@ void btm_ble_subrate_change_evt(tBTM_BLE_SUBRATE_CHANGE_EVT *params) BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_SUBRATE_CHANGE_EVT, (tBTM_BLE_5_GAP_CB_PARAMS *)params); } #endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE) + +#if (BLE_50_FEATURE_SUPPORT == TRUE) +tBTM_STATUS BTM_BleSetHostFeature(uint16_t bit_num, uint8_t bit_val) +{ + tHCI_STATUS err = HCI_SUCCESS; + tBTM_STATUS status = BTM_SUCCESS; + tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0}; + + BTM_TRACE_DEBUG("BTM_BleSetHostFeature bit_num %d bit_value %d\n", bit_num, bit_val); + + if ((err = btsnd_hcic_ble_set_host_feature(bit_num, bit_val)) != HCI_SUCCESS) { + BTM_TRACE_ERROR("set host feature, cmd err=0x%x", err); + status = BTM_HCI_ERROR | err; + } + + cb_params.status = status; + BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_SET_HOST_FEATURE_EVT, &cb_params); + + return status; +} +#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) diff --git a/components/bt/host/bluedroid/stack/btm/btm_ble_iso.c b/components/bt/host/bluedroid/stack/btm/btm_ble_iso.c index 3bcb70a58c..c66f10b9c0 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_ble_iso.c +++ b/components/bt/host/bluedroid/stack/btm/btm_ble_iso.c @@ -393,25 +393,6 @@ tBTM_STATUS BTM_BleIsoRemoveDataPath(uint16_t conn_handle, uint8_t data_path_dir return BTM_SUCCESS; } -tBTM_STATUS BTM_BleIsoSetHostFeature(uint16_t bit_num, uint8_t bit_val) -{ - tHCI_STATUS err = HCI_SUCCESS; - tBTM_STATUS status = BTM_SUCCESS; - tBTM_BLE_ISO_CB_PARAMS cb_params = {0}; - - BTM_TRACE_DEBUG("BTM_BleIsoSetHostFeature bit_num %d bit_value %d\n", bit_num, bit_val); - - if ((err = btsnd_hcic_ble_iso_set_host_feature(bit_num, bit_val)) != HCI_SUCCESS) { - BTM_TRACE_ERROR("iso set host feature, cmd err=0x%x", err); - status = BTM_HCI_ERROR | err; - } - - cb_params.status = status; - BTM_IsoBleCallbackTrigger(BTM_BLE_ISO_SET_HOST_FEATURE_EVT, &cb_params); - - return status; -} - tBTM_STATUS BTM_BleIsoReadTxSync(uint16_t iso_hdl) { tHCI_STATUS err = HCI_SUCCESS; diff --git a/components/bt/host/bluedroid/stack/hcic/hciblecmds.c b/components/bt/host/bluedroid/stack/hcic/hciblecmds.c index 5ce942bd1f..242ddd1868 100644 --- a/components/bt/host/bluedroid/stack/hcic/hciblecmds.c +++ b/components/bt/host/bluedroid/stack/hcic/hciblecmds.c @@ -2201,33 +2201,6 @@ UINT8 btsnd_hcic_ble_iso_remove_data_path(uint16_t conn_handle, uint8_t data_pat return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p); } -UINT8 btsnd_hcic_ble_iso_set_host_feature(uint16_t bit_num, uint8_t bit_val) -{ - BT_HDR *p; - UINT8 *pp; - - HCI_TRACE_DEBUG("hci set host feature: bit_num %d bit_val %d", bit_num, bit_val); -#if (BLE_FEAT_ISO_60_EN == TRUE) - HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_ISO_SET_HOST_FEATURE_PARAMS_V2); -#else - HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_ISO_SET_HOST_FEATURE_PARAMS); -#endif // #if (BLE_FEAT_ISO_60_EN == TRUE) - pp = (UINT8 *)(p + 1); -#if (BLE_FEAT_ISO_60_EN == TRUE) - UINT16_TO_STREAM(pp, HCI_BLE_ISO_SET_HOST_FEATURE_V2); - UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_ISO_SET_HOST_FEATURE_PARAMS_V2); - // Bit_Number V1 - UINT16_TO_STREAM(pp, bit_num); -#else - UINT16_TO_STREAM(pp, HCI_BLE_ISO_SET_HOST_FEATURE); - UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_ISO_SET_HOST_FEATURE_PARAMS); - // Bit_Number V1 - UINT8_TO_STREAM(pp, bit_num); -#endif // #if (BLE_FEAT_ISO_60_EN == TRUE) - UINT8_TO_STREAM(pp, bit_val); - return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p); -} - UINT8 btsnd_hcic_ble_iso_read_tx_sync(uint16_t iso_hdl) { BT_HDR *p; @@ -2804,3 +2777,32 @@ UINT8 btsnd_hcic_ble_subrate_request(UINT16 conn_handle, UINT16 subrate_min, UIN return TRUE; } #endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE) + +#if (BLE_50_FEATURE_SUPPORT == TRUE) +UINT8 btsnd_hcic_ble_set_host_feature(uint16_t bit_num, uint8_t bit_val) +{ + BT_HDR *p; + UINT8 *pp; + + HCI_TRACE_DEBUG("hci set host feature: bit_num %d bit_val %d", bit_num, bit_val); +#if (BLE_FEAT_ISO_60_EN == TRUE) + HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_SET_HOST_FEATURE_PARAMS_V2); +#else + HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_SET_HOST_FEATURE_PARAMS); +#endif // #if (BLE_FEAT_ISO_60_EN == TRUE) + pp = (UINT8 *)(p + 1); +#if (BLE_FEAT_ISO_60_EN == TRUE) + UINT16_TO_STREAM(pp, HCI_BLE_SET_HOST_FEATURE_V2); + UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_SET_HOST_FEATURE_PARAMS_V2); + // Bit_Number V1 + UINT16_TO_STREAM(pp, bit_num); +#else + UINT16_TO_STREAM(pp, HCI_BLE_SET_HOST_FEATURE); + UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_SET_HOST_FEATURE_PARAMS); + // Bit_Number V1 + UINT8_TO_STREAM(pp, bit_num); +#endif // #if (BLE_FEAT_ISO_60_EN == TRUE) + UINT8_TO_STREAM(pp, bit_val); + return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p); +} +#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) diff --git a/components/bt/host/bluedroid/stack/include/stack/btm_ble_api.h b/components/bt/host/bluedroid/stack/include/stack/btm_ble_api.h index 4d52f936f5..a236c4db99 100644 --- a/components/bt/host/bluedroid/stack/include/stack/btm_ble_api.h +++ b/components/bt/host/bluedroid/stack/include/stack/btm_ble_api.h @@ -1086,7 +1086,10 @@ typedef void (tBTM_SET_VENDOR_EVT_MASK_CBACK) (tBTM_STATUS status); #define BTM_BLE_GAP_SUBRATE_REQUEST_EVT 49 #define BTM_BLE_GAP_SUBRATE_CHANGE_EVT 50 #endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE) -#define BTM_BLE_5_GAP_UNKNOWN_EVT 51 +#if (BLE_50_FEATURE_SUPPORT == TRUE) +#define BTM_BLE_GAP_SET_HOST_FEATURE_EVT 51 +#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) +#define BTM_BLE_5_GAP_UNKNOWN_EVT 52 typedef UINT8 tBTM_BLE_5_GAP_EVENT; #if (BLE_FEAT_ISO_EN == TRUE) @@ -1101,7 +1104,6 @@ typedef UINT8 tBTM_BLE_5_GAP_EVENT; #define BTM_BLE_ISO_BIGINFO_ADV_REPORT_EVT 6 #endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE) #define BTM_BLE_ISO_DATA_PATH_UPFATE_EVT 7 -#define BTM_BLE_ISO_SET_HOST_FEATURE_EVT 8 #define BTM_BLE_ISO_READ_TX_SYNC_EVT 9 #define BTM_BLE_ISO_READ_LINK_QUALITY_EVT 10 #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE) @@ -3296,8 +3298,6 @@ tBTM_STATUS BTM_BleIsoSetDataPath(uint16_t conn_handle, uint8_t data_path_dir, u uint8_t *codec_cfg); tBTM_STATUS BTM_BleIsoRemoveDataPath(uint16_t conn_handle, uint8_t data_path_dir); -tBTM_STATUS BTM_BleIsoSetHostFeature(uint16_t bit_num, uint8_t bit_val); - tBTM_STATUS BTM_BleIsoReadTxSync(uint16_t iso_hdl); tBTM_STATUS BTM_BleIsoReadLinkQuality(uint16_t iso_hdl); @@ -3355,5 +3355,7 @@ void BTM_BleSetDefaultSubrate(UINT16 subrate_min, UINT16 subrate_max, UINT16 max void BTM_BleSubrateRequest(UINT16 conn_handle, UINT16 subrate_min, UINT16 subrate_max, UINT16 max_latency, UINT16 continuation_number, UINT16 supervision_timeout); #endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE) - +#if (BLE_50_FEATURE_SUPPORT == TRUE) +tBTM_STATUS BTM_BleSetHostFeature(uint16_t bit_num, uint8_t bit_val); +#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) #endif diff --git a/components/bt/host/bluedroid/stack/include/stack/hcidefs.h b/components/bt/host/bluedroid/stack/include/stack/hcidefs.h index eeaed77e3e..bb08401880 100644 --- a/components/bt/host/bluedroid/stack/include/stack/hcidefs.h +++ b/components/bt/host/bluedroid/stack/include/stack/hcidefs.h @@ -425,9 +425,9 @@ #define HCI_BLE_BIG_TERMINATE_SYNC (0x006C | HCI_GRP_BLE_CMDS) #define HCI_BLE_ISO_SET_DATA_PATH (0x006E | HCI_GRP_BLE_CMDS) #define HCI_BLE_ISO_REMOVE_DATA_PATH (0x006F | HCI_GRP_BLE_CMDS) -#define HCI_BLE_ISO_SET_HOST_FEATURE (0x0074 | HCI_GRP_BLE_CMDS) +#define HCI_BLE_SET_HOST_FEATURE (0x0074 | HCI_GRP_BLE_CMDS) #define HCI_BLE_ISO_READ_ISO_LINK_QUALITY (0x0075 | HCI_GRP_BLE_CMDS) -#define HCI_BLE_ISO_SET_HOST_FEATURE_V2 (0x0097 | HCI_GRP_BLE_CMDS) +#define HCI_BLE_SET_HOST_FEATURE_V2 (0x0097 | HCI_GRP_BLE_CMDS) #if (BLE_FEAT_POWER_CONTROL_EN == TRUE) #define HCI_BLE_ENH_READ_TRANS_POWER_LEVEL (0x0076 | HCI_GRP_BLE_CMDS) diff --git a/components/bt/host/bluedroid/stack/include/stack/hcimsgs.h b/components/bt/host/bluedroid/stack/include/stack/hcimsgs.h index 457f20cd3e..a5d92536cc 100644 --- a/components/bt/host/bluedroid/stack/include/stack/hcimsgs.h +++ b/components/bt/host/bluedroid/stack/include/stack/hcimsgs.h @@ -1099,8 +1099,6 @@ UINT8 btsnd_hcic_ble_set_default_periodic_adv_sync_trans_params(UINT8 mode, UINT #endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE) #define HCIC_PARAM_SIZE_ISO_SET_DATA_PATH_PARAMS 13 #define HCIC_PARAM_SIZE_ISO_REMOVE_DATA_PATH_PARAMS 3 -#define HCIC_PARAM_SIZE_ISO_SET_HOST_FEATURE_PARAMS 2 -#define HCIC_PARAM_SIZE_ISO_SET_HOST_FEATURE_PARAMS_V2 3 #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE) struct ble_hci_le_cis_params { @@ -1174,8 +1172,6 @@ UINT8 btsnd_hcic_ble_iso_set_data_path(uint16_t conn_handle, uint8_t data_path_d uint8_t *codec_cfg); UINT8 btsnd_hcic_ble_iso_remove_data_path(uint16_t conn_handle, uint8_t data_path_dir); -UINT8 btsnd_hcic_ble_iso_set_host_feature(uint16_t bit_num, uint8_t bit_val); - UINT8 btsnd_hcic_ble_iso_read_tx_sync(uint16_t iso_hdl); UINT8 btsnd_hcic_ble_iso_read_iso_link_quality(uint16_t iso_hdl); @@ -1237,4 +1233,10 @@ UINT8 btsnd_hcic_ble_subrate_request(UINT16 conn_handle, UINT16 subrate_min, UIN UINT16 continuation_number, UINT16 supervision_timeout); #endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE) +#if (BLE_50_FEATURE_SUPPORT == TRUE) +#define HCIC_PARAM_SIZE_SET_HOST_FEATURE_PARAMS 2 +#define HCIC_PARAM_SIZE_SET_HOST_FEATURE_PARAMS_V2 3 +UINT8 btsnd_hcic_ble_set_host_feature(uint16_t bit_num, uint8_t bit_val); +#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) + #endif