feat(ble/bluedroid): move vendor hci api to ble internal code

This commit is contained in:
zhiweijian
2024-04-08 19:54:36 +08:00
committed by Wei Yu Han
parent 8ea943e258
commit 379484f4db
8 changed files with 154 additions and 151 deletions

View File

@@ -1618,3 +1618,31 @@ esp_err_t esp_ble_gap_set_periodic_adv_sync_trans_params(esp_bd_addr_t addr, con
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif //#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
esp_err_t esp_ble_gap_vendor_command_send(esp_ble_vendor_cmd_params_t *vendor_cmd_param)
{
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
if (!vendor_cmd_param || !vendor_cmd_param->p_param_buf || !vendor_cmd_param->param_len) {
return ESP_ERR_NOT_ALLOWED;
}
// If command is not a VSC, return error
if ((vendor_cmd_param->opcode & VENDOR_HCI_CMD_MASK) != VENDOR_HCI_CMD_MASK) {
return ESP_ERR_NOT_ALLOWED;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_ACT_VENDOR_HCI_CMD_EVT;
arg.vendor_cmd_send.opcode = vendor_cmd_param->opcode;
arg.vendor_cmd_send.param_len = vendor_cmd_param->param_len;
arg.vendor_cmd_send.p_param_buf = vendor_cmd_param->p_param_buf;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), btc_gap_ble_arg_deep_copy, btc_gap_ble_arg_deep_free)
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}