Merge branch 'feat/support_bluedroid_host_iso_feature_master_v5.4' into 'release/v5.4'

Support bluedroid host new  features (v5.4)

See merge request espressif/esp-idf!38163
This commit is contained in:
Island
2025-04-07 16:01:16 +08:00
51 changed files with 9207 additions and 31 deletions

View File

@ -451,6 +451,19 @@ if(CONFIG_BT_ENABLED)
list(APPEND srcs "esp_ble_mesh/core/bluedroid_host/adapter.c")
endif()
if(CONFIG_BT_BLE_FEAT_ISO_EN)
list(APPEND srcs "host/bluedroid/stack/btm/btm_ble_iso.c"
"host/bluedroid/btc/profile/std/iso/btc_iso_ble.c"
"host/bluedroid/api/esp_ble_iso_api.c"
"host/bluedroid/hci/ble_hci_iso.c")
endif()
if(CONFIG_BT_BLE_FEAT_CTE_EN)
list(APPEND srcs "host/bluedroid/stack/btm/btm_ble_cte.c"
"host/bluedroid/btc/profile/std/cte/btc_ble_cte.c"
"host/bluedroid/api/esp_ble_cte_api.c")
endif()
endif()
if(CONFIG_BLE_MESH)

View File

@ -24,6 +24,8 @@
#include "btc_gattc.h"
#include "btc_gatt_common.h"
#include "btc_gap_ble.h"
#include "btc_iso_ble.h"
#include "btc_ble_cte.h"
#include "btc/btc_dm.h"
#include "bta/bta_gatt_api.h"
#if CLASSIC_BT_INCLUDED
@ -258,6 +260,12 @@ static const btc_func_t profile_tab[BTC_PID_NUM] = {
[BTC_PID_BLE_MESH_BLE_COEX] = {btc_ble_mesh_ble_call_handler, btc_ble_mesh_ble_cb_handler },
#endif /* CONFIG_BLE_MESH_BLE_COEX_SUPPORT */
#endif /* #if CONFIG_BLE_MESH */
#if (BLE_FEAT_ISO_EN == TRUE)
[BTC_PID_ISO_BLE] = {btc_iso_ble_call_handler, btc_iso_ble_cb_handler },
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
[BTC_PID_BLE_CTE] = {btc_ble_cte_call_handler, btc_ble_cte_cb_handler },
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
};
/*****************************************************************************
@ -525,6 +533,12 @@ bt_status_t btc_init(void)
#if (BLE_INCLUDED == TRUE)
btc_gap_callback_init();
#if (BLE_FEAT_ISO_EN == TRUE)
btc_iso_callback_init();
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
btc_cte_callback_init();
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
btc_gap_ble_init();
#endif ///BLE_INCLUDED == TRUE

View File

@ -105,6 +105,12 @@ typedef enum {
BTC_PID_MBT_SERVER,
BTC_PID_BLE_MESH_BLE_COEX,
#endif /* CONFIG_BLE_MESH */
#if (BLE_FEAT_ISO_EN == TRUE)
BTC_PID_ISO_BLE,
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
BTC_PID_BLE_CTE,
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
BTC_PID_NUM,
} btc_pid_t; //btc profile id

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -124,6 +124,11 @@ static char IRAM_ATTR *bt_data_type_to_str(uint8_t data_type)
// self-defining data
tag = "S";
break;
case HCI_LOG_DATA_TYPE_ISO_DATA:
// 5.2 iso data
tag = "I";
break;
break;
default:
// unknown data type
tag = "U";

View File

@ -21,6 +21,7 @@ extern "C" {
#define HCI_LOG_DATA_TYPE_ADV (5)
#define HCI_LOG_DATA_TYPE_SELF_DEFINE (6)
#define HCI_LOG_DATA_TYPE_C2H_ACL (7)
#define HCI_LOG_DATA_TYPE_ISO_DATA (8)
/**
*

View File

@ -1340,6 +1340,118 @@ config BT_BLE_42_SCAN_EN
help
This enables BLE v4.2 scan
menuconfig BT_BLE_FEAT_ISO_EN
bool "Enable BLE 5.2 iso feature"
depends on (BT_BLE_50_FEATURES_SUPPORTED && ((BT_CONTROLLER_ENABLED && SOC_BLE_AUDIO_SUPPORTED) || BT_CONTROLLER_DISABLED)) # NOERROR
default n
help
Enable BLE 5.2 iso
config BT_BLE_FEAT_ISO_60_EN
bool "Enable ISO v6.0 feature"
depends on BT_BLE_FEAT_ISO_EN
default n
help
Enable iso 6.0 feature
config BT_BLE_FEAT_ISO_BIG_BROCASTER
bool "Enable BLE iso BIG brocaster"
depends on BT_BLE_FEAT_ISO_EN
default y
help
Enable BLE 5.2 BIG brocaster
config BT_BLE_FEAT_ISO_BIG_SYNCER
bool "Enable BLE iso BIG syncer"
depends on BT_BLE_FEAT_ISO_EN
default y
help
Enable BLE 5.2 BIG syncer
config BT_BLE_ISO_BIS_MAX_COUNT
int "Maximum bis count"
depends on BT_BLE_FEAT_ISO_EN && (BT_BLE_FEAT_ISO_BIG_BROCASTER || BT_BLE_FEAT_ISO_BIG_SYNCER)
default 2
range 1 31
help
Enable BLE 5.2 CIG peripheral
config BT_BLE_FEAT_ISO_CIG_CENTRAL
bool "Enable BLE iso CIG central"
depends on BT_BLE_FEAT_ISO_EN
default y
help
Enable BLE 5.2 CIG central
config BT_BLE_FEAT_ISO_CIG_PERIPHERAL
bool "Enable BLE iso CIG peripheral"
depends on BT_BLE_FEAT_ISO_EN
default y
help
Enable BLE 5.2 CIG peripheral
config BT_BLE_ISO_CIS_MAX_COUNT
int "Maximum cis count"
depends on BT_BLE_FEAT_ISO_EN && (BT_BLE_FEAT_ISO_CIG_CENTRAL || BT_BLE_FEAT_ISO_CIG_PERIPHERAL)
default 2
range 1 31
help
Enable BLE 5.2 CIG peripheral
choice BT_BLE_ISO_FLOW_CONTROL
prompt "Select ISO flow control type"
depends on BT_BLE_FEAT_ISO_EN
default BT_BLE_ISO_NON_STD_FLOW_CTRL
help
Select ISO flow control type
config BT_BLE_ISO_STD_FLOW_CTRL
bool "ISO standard flow control"
help
Enable ISO standard flow control
config BT_BLE_ISO_NON_STD_FLOW_CTRL
bool "ISO non-standard flow control"
help
Enable ISO non-standard flow control
endchoice
menuconfig BT_BLE_FEAT_CTE_EN
bool "Enable BLE CTE feature"
depends on (BT_BLE_50_FEATURES_SUPPORTED && ((BT_CONTROLLER_ENABLED && SOC_BLE_CTE_SUPPORTED) || BT_CONTROLLER_DISABLED)) # NOERROR
default n
help
Enable BLE 5.1 CTE
config BT_BLE_FEAT_CTE_CONNECTIONLESS_EN
bool "Enable BLE CTE connectionless feature"
depends on BT_BLE_FEAT_CTE_EN
default y
help
Transmission of CTE in periodic advertising
config BT_BLE_FEAT_CTE_CONNECTION_EN
bool "Enable BLE CTE connection feature"
depends on BT_BLE_FEAT_CTE_EN
default y
help
Transmission of CTE by ACL connection
config BT_BLE_FEAT_POWER_CONTROL
bool "Enable BLE power control feature"
depends on (BT_BLE_50_FEATURES_SUPPORTED && ((BT_CONTROLLER_ENABLED && SOC_BLE_POWER_CONTROL_SUPPORTED) || BT_CONTROLLER_DISABLED)) # NOERROR
default n
help
Enable BLE power control feature
config BT_BLE_FEAT_CONN_SUBRATING
bool "Enable BLE connection subrating feature"
depends on (BT_BLE_50_FEATURES_SUPPORTED && ((BT_CONTROLLER_ENABLED && SOC_BLE_SUBRATE_SUPPORTED) || BT_CONTROLLER_DISABLED)) # NOERROR
default n
help
Enable BLE connection subrating feature
config BT_BLE_HIGH_DUTY_ADV_INTERVAL
bool "Enable BLE high duty advertising interval feature"
depends on BT_BLE_ENABLED

View File

@ -0,0 +1,224 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <string.h>
#include "esp_bt_device.h"
#include "esp_bt_main.h"
#if (BLE_FEAT_CTE_EN == TRUE)
#include "esp_ble_cte_api.h"
#include "btc_ble_cte.h"
#include "btc/btc_manage.h"
esp_err_t esp_ble_cte_register_callback(esp_ble_cte_cb_t callback)
{
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
return (btc_profile_cb_set(BTC_PID_BLE_CTE, callback) == 0 ? ESP_OK : ESP_FAIL);
}
esp_ble_cte_cb_t esp_ble_cte_get_callback(void)
{
return (esp_ble_cte_cb_t) btc_profile_cb_get(BTC_PID_BLE_CTE);
}
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
esp_err_t esp_ble_cte_set_connectionless_trans_params(esp_ble_cte_connless_trans_params_t *cte_trans_params)
{
btc_msg_t msg;
btc_ble_cte_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
if ((cte_trans_params == NULL) || (cte_trans_params->antenna_ids == NULL)) {
return ESP_ERR_INVALID_ARG;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_BLE_CTE;
msg.act = BTC_CTE_ACT_SET_TRANS_PARAMS;
arg.cte_trans_params.adv_handle = cte_trans_params->adv_handle;
arg.cte_trans_params.cte_len = cte_trans_params->cte_len;
arg.cte_trans_params.cte_type = cte_trans_params->cte_type;
arg.cte_trans_params.cte_count = cte_trans_params->cte_count;
arg.cte_trans_params.switching_pattern_len = cte_trans_params->switching_pattern_len;
arg.cte_trans_params.antenna_ids = cte_trans_params->antenna_ids;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_cte_args_t), btc_ble_cte_arg_deep_copy, btc_ble_cte_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_cte_set_connectionless_trans_enable(esp_ble_cte_trans_enable_params_t *cte_trans_enable)
{
btc_msg_t msg;
btc_ble_cte_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
if (cte_trans_enable == NULL) {
return ESP_ERR_INVALID_ARG;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_BLE_CTE;
msg.act = BTC_CTE_ACT_SET_TRANS_ENABLE;
arg.cte_trans_enable.adv_handle = cte_trans_enable->adv_handle;
arg.cte_trans_enable.cte_enable = cte_trans_enable->cte_enable;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_cte_args_t), NULL , NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_cte_set_connectionless_iq_sampling_enable(esp_ble_cte_iq_sampling_params_t *iq_sampling_en)
{
btc_msg_t msg;
btc_ble_cte_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
if ((iq_sampling_en == NULL) || (iq_sampling_en->antenna_ids == NULL)) {
return ESP_ERR_INVALID_ARG;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_BLE_CTE;
msg.act = BTC_CTE_ACT_SET_IQ_SAMPLING_EN;
arg.cte_iq_sampling_en.sync_handle = iq_sampling_en->sync_handle;
arg.cte_iq_sampling_en.sampling_en = iq_sampling_en->sampling_en;
arg.cte_iq_sampling_en.slot_dur = iq_sampling_en->slot_dur;
arg.cte_iq_sampling_en.max_sampled_ctes = iq_sampling_en->max_sampled_ctes;
arg.cte_iq_sampling_en.switching_pattern_len = iq_sampling_en->switching_pattern_len;
arg.cte_iq_sampling_en.antenna_ids = iq_sampling_en->antenna_ids;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_cte_args_t), btc_ble_cte_arg_deep_copy, btc_ble_cte_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
esp_err_t esp_ble_cte_set_connection_receive_params(esp_ble_cte_recv_params_params_t *cte_recv_params)
{
btc_msg_t msg;
btc_ble_cte_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
if ((cte_recv_params == NULL) || (cte_recv_params->antenna_ids == NULL)) {
return ESP_ERR_INVALID_ARG;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_BLE_CTE;
msg.act = BTC_CTE_ACT_SET_CONN_CTE_RECV_PARAMS;
arg.cte_recv_params.conn_handle = cte_recv_params->conn_handle;
arg.cte_recv_params.sampling_en = cte_recv_params->sampling_en;
arg.cte_recv_params.slot_dur = cte_recv_params->slot_dur;
arg.cte_recv_params.switching_pattern_len = cte_recv_params->switching_pattern_len;
arg.cte_recv_params.antenna_ids = cte_recv_params->antenna_ids;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_cte_args_t), btc_ble_cte_arg_deep_copy, btc_ble_cte_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_cte_set_connection_transmit_params(esp_ble_cte_conn_trans_params_t *cte_conn_trans_params)
{
btc_msg_t msg;
btc_ble_cte_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
if ((cte_conn_trans_params == NULL) || (cte_conn_trans_params->antenna_ids == NULL)) {
return ESP_ERR_INVALID_ARG;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_BLE_CTE;
msg.act = BTC_CTE_ACT_SET_CONN_CTE_TRANS_PARAMS;
arg.cte_conn_trans_params.conn_handle = cte_conn_trans_params->conn_handle;
arg.cte_conn_trans_params.cte_types = cte_conn_trans_params->cte_types;
arg.cte_conn_trans_params.switching_pattern_len = cte_conn_trans_params->switching_pattern_len;
arg.cte_conn_trans_params.antenna_ids = cte_conn_trans_params->antenna_ids;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_cte_args_t), btc_ble_cte_arg_deep_copy, btc_ble_cte_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_cte_connection_cte_request_enable(esp_ble_cte_req_en_params_t *cte_conn_req_en)
{
btc_msg_t msg;
btc_ble_cte_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
if (cte_conn_req_en == NULL) {
return ESP_ERR_INVALID_ARG;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_BLE_CTE;
msg.act = BTC_CTE_ACT_SET_CONN_CTE_REQUEST_EN;
arg.cte_req_en.conn_handle = cte_conn_req_en->conn_handle;
arg.cte_req_en.enable = cte_conn_req_en->enable;
arg.cte_req_en.cte_req_interval = cte_conn_req_en->cte_req_interval;
arg.cte_req_en.req_cte_len = cte_conn_req_en->req_cte_len;
arg.cte_req_en.req_cte_Type = cte_conn_req_en->req_cte_Type;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_cte_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_cte_connection_cte_response_enable(esp_ble_cte_rsp_en_params_t *cte_conn_rsp_en)
{
btc_msg_t msg;
btc_ble_cte_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
if (cte_conn_rsp_en == NULL) {
return ESP_ERR_INVALID_ARG;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_BLE_CTE;
msg.act = BTC_CTE_ACT_SET_CONN_CTE_RESPONSE_EN;
arg.cte_rsp_en.conn_handle = cte_conn_rsp_en->conn_handle;
arg.cte_rsp_en.enable = cte_conn_rsp_en->enable;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_cte_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
esp_err_t esp_ble_cte_read_antenna_information(void)
{
btc_msg_t msg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_BLE_CTE;
msg.act = BTC_CTE_ACT_READ_ANTENNA_INFOR;
return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif // #if (BLE_FEAT_CTE_EN == TRUE)

View File

@ -0,0 +1,425 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <string.h>
#include "esp_bt_device.h"
#include "esp_bt_main.h"
#include "esp_ble_iso_api.h"
#include "btc_iso_ble.h"
#include "btc/btc_manage.h"
esp_err_t esp_ble_iso_register_callback(esp_ble_iso_cb_t callback)
{
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
return (btc_profile_cb_set(BTC_PID_ISO_BLE, callback) == 0 ? ESP_OK : ESP_FAIL);
}
esp_ble_iso_cb_t esp_ble_iso_get_callback(void)
{
return (esp_ble_iso_cb_t) btc_profile_cb_get(BTC_PID_ISO_BLE);
}
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
esp_err_t esp_ble_iso_create_big(esp_ble_iso_big_creat_params_t *big_creat_param)
{
btc_msg_t msg;
btc_ble_iso_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
if (big_creat_param == NULL) {
return ESP_ERR_INVALID_ARG;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_ISO_BLE;
msg.act = BTC_ISO_ACT_BIG_CREATE;
memcpy(&arg.iso_big_creat_params, big_creat_param, sizeof(esp_ble_iso_big_creat_params_t));
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_create_big_test(esp_ble_iso_big_creat_test_params_t *big_creat_test_param)
{
btc_msg_t msg;
btc_ble_iso_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
if (big_creat_test_param == NULL) {
return ESP_ERR_INVALID_ARG;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_ISO_BLE;
msg.act = BTC_ISO_ACT_BIG_CREATE_TEST;
memcpy(&arg.iso_big_creat_test_params, big_creat_test_param, sizeof(esp_ble_iso_big_creat_test_params_t));
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_terminate_big(uint8_t big_handle, uint8_t reason)
{
btc_msg_t msg;
btc_ble_iso_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_ISO_BLE;
msg.act = BTC_ISO_ACT_BIG_TERMINATE;
arg.iso_big_terminate_params.big_handle = big_handle;
arg.iso_big_terminate_params.reason = reason;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_iso_args_t), NULL, NULL)
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif // #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
esp_err_t esp_ble_iso_big_create_sync(esp_ble_iso_big_sync_creat_params_t *big_sync_create_param)
{
btc_msg_t msg;
btc_ble_iso_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
if (big_sync_create_param == NULL) {
return ESP_ERR_INVALID_ARG;
}
if (big_sync_create_param->num_bis > BLE_ISO_BIS_MAX_COUNT) {
return ESP_ERR_INVALID_ARG;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_ISO_BLE;
msg.act = BTC_ISO_ACT_BIG_SYNC_CREATE;
arg.iso_big_sync_creat_params.big_handle = big_sync_create_param->big_handle;
arg.iso_big_sync_creat_params.sync_handle = big_sync_create_param->sync_handle;
arg.iso_big_sync_creat_params.encryption = big_sync_create_param->encryption;
memcpy(&arg.iso_big_sync_creat_params.bc_code[0], &big_sync_create_param->bc_code[0], 16);
arg.iso_big_sync_creat_params.mse = big_sync_create_param->mse;
arg.iso_big_sync_creat_params.big_sync_timeout = big_sync_create_param->big_sync_timeout;
arg.iso_big_sync_creat_params.num_bis = big_sync_create_param->num_bis;
for (uint8_t i = 0; i < big_sync_create_param->num_bis; i++)
{
arg.iso_big_sync_creat_params.bis[i] = big_sync_create_param->bis[i];
}
// memcpy(&arg.iso_big_sync_creat_params, big_sync_create_param, sizeof(esp_ble_iso_big_sync_creat_params_t));
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_big_terminate_sync(uint8_t big_handle)
{
btc_msg_t msg;
btc_ble_iso_args_t arg;
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_ISO_BLE;
msg.act = BTC_ISO_ACT_BIG_SYNC_TERMINATE;
arg.iso_big_sync_terminate_params.big_handle = big_handle;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_iso_args_t), NULL, NULL)
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
esp_err_t esp_ble_iso_set_iso_data_path(esp_ble_iso_set_data_path_params_t *data_path_params)
{
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 (data_path_params == NULL) {
return ESP_ERR_INVALID_ARG;
}
if (data_path_params->codec_cfg_len && (!data_path_params->codec_cfg)) {
return ESP_ERR_INVALID_ARG;
}
if (data_path_params->codec_cfg && (!data_path_params->codec_cfg_len)) {
return ESP_ERR_INVALID_ARG;
}
if (data_path_params->data_path_dir > ESP_BLE_ISO_DATA_PATH_DIR_OUTPUT) {
return ESP_ERR_INVALID_ARG;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_ISO_BLE;
msg.act = BTC_ISO_ACT_SET_DATA_PATH;
arg.iso_set_data_path_params.conn_handle = data_path_params->iso_handle;
arg.iso_set_data_path_params.data_path_dir = data_path_params->data_path_dir;
arg.iso_set_data_path_params.data_path_id = data_path_params->data_path_id;
arg.iso_set_data_path_params.coding_fmt = data_path_params->coding_fmt;
arg.iso_set_data_path_params.company_id = data_path_params->company_id;
arg.iso_set_data_path_params.vs_codec_id = data_path_params->vs_codec_id;
arg.iso_set_data_path_params.controller_delay = data_path_params->controller_delay;
arg.iso_set_data_path_params.codec_cfg_len = data_path_params->codec_cfg_len;
arg.iso_set_data_path_params.codec_cfg = data_path_params->codec_cfg;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_iso_args_t), btc_iso_ble_arg_deep_copy, btc_iso_ble_arg_deep_free)
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_iso_remove_iso_data_path(esp_ble_iso_remove_data_path_params_t *data_path_params)
{
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 (data_path_params == NULL) {
return ESP_ERR_INVALID_ARG;
}
if (data_path_params->data_path_dir == 0 || data_path_params->data_path_dir > ESP_BLE_ISO_DATA_PATH_DIR_ALL_BIT_MASK) {
return ESP_ERR_INVALID_ARG;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_ISO_BLE;
msg.act = BTC_ISO_ACT_REMOVE_DATA_PATH;
arg.iso_remove_data_path_params.conn_handle = data_path_params->iso_handle;
arg.iso_remove_data_path_params.data_path_dir = data_path_params->data_path_dir;
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};
btc_ble_iso_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_ISO_BLE;
msg.act = BTC_ISO_ACT_READ_ISO_TX_SYNC;
arg.iso_read_tx_sync_params.iso_handle = iso_handle;
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_link_quality(uint16_t iso_handle)
{
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;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_ISO_BLE;
msg.act = BTC_ISO_ACT_READ_ISO_LINK_QUALITY;
arg.iso_read_link_quality_params.iso_handle = iso_handle;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_iso_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
esp_err_t esp_ble_iso_set_cig_parameters(struct esp_ble_iso_set_cig_params *cig_params)
{
btc_msg_t msg;
btc_ble_iso_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
if ((cig_params == NULL) || (cig_params->cis_cnt > BLE_ISO_CIS_MAX_COUNT)) {
return ESP_ERR_INVALID_ARG;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_ISO_BLE;
msg.act = BTC_ISO_ACT_SET_CIG_PARAMS;
arg.set_cig_params.cig_id = cig_params->cig_id;
arg.set_cig_params.sdu_int_c_to_p = cig_params->sdu_int_c_to_p;
arg.set_cig_params.sdu_int_p_to_c = cig_params->sdu_int_p_to_c;
arg.set_cig_params.worse_case_SCA = cig_params->worse_case_SCA;
arg.set_cig_params.packing = cig_params->packing;
arg.set_cig_params.framing = cig_params->framing;
arg.set_cig_params.mtl_c_to_p = cig_params->mtl_c_to_p;
arg.set_cig_params.mtl_p_to_c = cig_params->mtl_p_to_c;
arg.set_cig_params.cis_cnt = cig_params->cis_cnt;
memcpy(&arg.set_cig_params.cis_params[0], &cig_params->cis_params[0], sizeof(struct ble_iso_cis_params) * cig_params->cis_cnt);
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_set_cig_parameters_test(struct esp_ble_iso_set_cig_params_test *cig_params_test)
{
btc_msg_t msg;
btc_ble_iso_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
if ((cig_params_test == NULL) || (cig_params_test->cis_cnt > BLE_ISO_CIS_MAX_COUNT)) {
return ESP_ERR_INVALID_ARG;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_ISO_BLE;
msg.act = BTC_ISO_ACT_SET_CIG_PARAMS_TEST;
arg.set_cig_params_test.cig_id = cig_params_test->cig_id;
arg.set_cig_params_test.sdu_int_c_to_p = cig_params_test->sdu_int_c_to_p;
arg.set_cig_params_test.sdu_int_p_to_c = cig_params_test->sdu_int_p_to_c;
arg.set_cig_params_test.ft_c_to_p = cig_params_test->ft_c_to_p;
arg.set_cig_params_test.ft_p_to_c = cig_params_test->ft_p_to_c;
arg.set_cig_params_test.iso_interval = cig_params_test->iso_interval;
arg.set_cig_params_test.worse_case_SCA = cig_params_test->worse_case_SCA;
arg.set_cig_params_test.packing = cig_params_test->packing;
arg.set_cig_params_test.framing = cig_params_test->framing;
arg.set_cig_params_test.cis_cnt = cig_params_test->cis_cnt;
memcpy(&arg.set_cig_params_test.cis_params_test[0], &cig_params_test->cis_params_test[0], sizeof(struct ble_iso_cis_params_test) * cig_params_test->cis_cnt);
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_create_cis(struct esp_ble_iso_create_cis_params *creat_cis_params)
{
btc_msg_t msg;
btc_ble_iso_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
if ((creat_cis_params == NULL) || (creat_cis_params->cis_count > BLE_ISO_CIS_MAX_COUNT)) {
return ESP_ERR_INVALID_ARG;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_ISO_BLE;
msg.act = BTC_ISO_ACT_CREATE_CIS;
arg.creat_cis_params.cis_count = creat_cis_params->cis_count;
for (uint8_t i = 0; i < creat_cis_params->cis_count; i++)
{
arg.creat_cis_params.cis_hdls[i].cis_hdl = creat_cis_params->cis_hdl_info[i].cis_hdl;
arg.creat_cis_params.cis_hdls[i].acl_hdl = creat_cis_params->cis_hdl_info[i].acl_hdl;
}
//memcpy(&arg.creat_cis_params.cis_hdl_info[0], &creat_cis_params->cis_hdl_info[0], creat_cis_params->cis_count * 4);
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_remove_cig(uint8_t cig_id)
{
btc_msg_t msg;
btc_ble_iso_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_ISO_BLE;
msg.act = BTC_ISO_ACT_REMOVE_CIG;
arg.remove_cig_params.cig_id = cig_id;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_iso_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
esp_err_t esp_ble_iso_accept_cis_request(uint16_t cis_handle)
{
btc_msg_t msg;
btc_ble_iso_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_ISO_BLE;
msg.act = BTC_ISO_ACT_ACCEPT_CIS_REQ;
arg.accept_cis_req_params.cis_handle = cis_handle;
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_reject_cis_request(uint16_t cis_handle, uint8_t reason)
{
btc_msg_t msg;
btc_ble_iso_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_ISO_BLE;
msg.act = BTC_ISO_ACT_REJECT_CIS_REQ;
arg.reject_cis_req_params.cis_handle = cis_handle;
arg.reject_cis_req_params.reason = reason;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_iso_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_EN == TRUE)
esp_err_t esp_ble_iso_disconnect_cis(uint16_t cis_handle, uint8_t reason)
{
btc_msg_t msg;
btc_ble_iso_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_ISO_BLE;
msg.act = BTC_ISO_ACT_DISCON_CIS;
arg.discon_cis_params.cis_handle = cis_handle;
arg.discon_cis_params.reason = reason;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_iso_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)

View File

@ -1803,3 +1803,194 @@ esp_err_t esp_ble_gap_set_vendor_event_mask(uint32_t event_mask)
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL)
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
esp_err_t esp_ble_gap_enhanced_read_transmit_power_level(uint16_t conn_handle, esp_ble_tx_power_phy_t phy)
{
btc_msg_t msg = {0};
btc_ble_5_gap_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_ENH_READ_TRANS_POWER_LEVEL;
arg.enh_read_trans_pwr_level.conn_handle = conn_handle;
arg.enh_read_trans_pwr_level.phy = phy;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL)
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gap_read_remote_transmit_power_level(uint16_t conn_handle, esp_ble_tx_power_phy_t phy)
{
btc_msg_t msg = {0};
btc_ble_5_gap_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_READ_REM_TRANS_POWER_LEVEL;
arg.read_rem_trans_pwr_level.conn_handle = conn_handle;
arg.read_rem_trans_pwr_level.phy = phy;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL)
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gap_set_path_loss_reporting_params(esp_ble_path_loss_rpt_params_t *path_loss_rpt_params)
{
btc_msg_t msg = {0};
btc_ble_5_gap_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_SET_PATH_LOSS_REPORT_PARAMS;
arg.set_path_loss_rpt_params.conn_handle = path_loss_rpt_params->conn_handle;
arg.set_path_loss_rpt_params.high_threshold = path_loss_rpt_params->high_threshold;
arg.set_path_loss_rpt_params.high_hysteresis = path_loss_rpt_params->high_hysteresis;
arg.set_path_loss_rpt_params.low_threshold = path_loss_rpt_params->low_threshold;
arg.set_path_loss_rpt_params.low_hysteresis = path_loss_rpt_params->low_hysteresis;
arg.set_path_loss_rpt_params.min_time_spent = path_loss_rpt_params->min_time_spent;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL)
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gap_set_path_loss_reporting_enable(uint16_t conn_handle, bool enable)
{
btc_msg_t msg = {0};
btc_ble_5_gap_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_SET_PATH_LOSS_REPORTING_EN;
arg.set_path_loss_rpt_en.conn_handle = conn_handle;
arg.set_path_loss_rpt_en.enable = enable;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL)
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gap_set_transmit_power_reporting_enable(uint16_t conn_handle, bool local_enable, bool remote_enable)
{
btc_msg_t msg = {0};
btc_ble_5_gap_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_SET_TRANS_POWER_REPORTING_EN;
arg.set_trans_pwr_rpting_en.conn_handle = conn_handle;
arg.set_trans_pwr_rpting_en.local_enable = local_enable;
arg.set_trans_pwr_rpting_en.remote_enable = remote_enable;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL)
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
esp_err_t esp_ble_gap_set_default_subrate(esp_ble_default_subrate_param_t *default_subrate_params)
{
btc_msg_t msg = {0};
btc_ble_5_gap_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
if (!default_subrate_params) {
return ESP_ERR_NOT_ALLOWED;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_SET_DEFALT_SUBRATE;
arg.default_subrate_param.subrate_min = default_subrate_params->subrate_min;
arg.default_subrate_param.subrate_max = default_subrate_params->subrate_max;
arg.default_subrate_param.max_latency = default_subrate_params->max_latency;
arg.default_subrate_param.continuation_number = default_subrate_params->continuation_number;
arg.default_subrate_param.supervision_timeout = default_subrate_params->supervision_timeout;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL)
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_ble_gap_subrate_request(esp_ble_subrate_req_param_t *subrate_req_params)
{
btc_msg_t msg = {0};
btc_ble_5_gap_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
if (!subrate_req_params) {
return ESP_ERR_NOT_ALLOWED;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_SUBRATE_REQUEST;
arg.subrate_req_param.conn_handle = subrate_req_params->conn_handle;
arg.subrate_req_param.subrate_min = subrate_req_params->subrate_min;
arg.subrate_req_param.subrate_max = subrate_req_params->subrate_max;
arg.subrate_req_param.max_latency = subrate_req_params->max_latency;
arg.subrate_req_param.continuation_number = subrate_req_params->continuation_number;
arg.subrate_req_param.supervision_timeout = subrate_req_params->supervision_timeout;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL)
== 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)

View File

@ -0,0 +1,379 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __ESP_BLE_CTE_API_H__
#define __ESP_BLE_CTE_API_H__
#include <stdint.h>
#include <stdbool.h>
#include "esp_err.h"
#include "esp_bt_defs.h"
#ifdef __cplusplus
extern "C" {
#endif
/// BLE CTE callback event type
typedef enum {
ESP_BLE_CTE_SET_CONNLESS_TRANS_PARAMS_CMPL_EVT = 0, /*!< When CTE set connectionless transmit parameters complete, the event comes */
ESP_BLE_CTE_SET_CONNLESS_TRANS_ENABLE_CMPL_EVT, /*!< When CTE set connectionless transmit enable complete, the event comes */
ESP_BLE_CTE_SET_CONNLESS_IQ_SAMPLING_ENABLE_CMPL_EVT, /*!< When CTE set connectionless IQ sampling enable complete, the event comes */
ESP_BLE_CTE_SET_CONN_RECV_PARAMS_CMPL_EVT, /*!< When CTE set connection receive parameters complete, the event comes */
ESP_BLE_CTE_SET_CONN_TRANS_PARAMS_CMPL_EVT, /*!< When CTE set connection transmit parameters complete, the event comes */
ESP_BLE_CTE_SET_CONN_REQ_ENABLE_CMPL_EVT, /*!< When CTE set connection CTE request enable complete, the event comes */
ESP_BLE_CTE_SET_CONN_RSP_ENABLE_CMPL_EVT, /*!< When CTE set connection CTE response enable complete, the event comes */
ESP_BLE_CTE_READ_ANT_INFOR_CMPL_EVT, /*!< When CTE read antenna information complete, the event comes */
ESP_BLE_CTE_CONNLESS_IQ_REPORT_EVT, /*!< When the device receives CTE connectionless IQ information, the event comes */
ESP_BLE_CTE_CONN_IQ_REPORT_EVT, /*!< When the device receives CTE connection IQ information , the event comes */
ESP_BLE_CTE_REQUEST_FAILED_EVT, /*!< When CTE request progress failed , the event comes */
ESP_BLE_CTE_EVT_MAX, /*!< when maximum advertising event complete, the event comes */
} esp_ble_cte_cb_event_t;
#define ESP_BLE_CTE_SAMPLING_DISABLE (0x00)
#define ESP_BLE_CTE_SAMPLING_ENABLE (0x01)
#define ESP_BLE_CTE_ADV_WITH_CTE_DISABLE (0x00)
#define ESP_BLE_CTE_ADV_WITH_CTE_ENABLE (0x01)
// Constant Tone Extension length in 8 µs units
#define ESP_BLE_CTE_MIN_CTE_LENGTH (0x02)
#define ESP_BLE_CTE_MAX_CTE_LENGTH (0x14)
#define ESP_BLE_CTE_TYPE_AOA (0x00) /*!< AoA Constant Tone Extension */
#define ESP_BLE_CTE_TYPE_AOD_WITH_1US (0x01) /*!< AoD Constant Tone Extension with 1 µs slots */
#define ESP_BLE_CTE_TYPE_AOD_WITH_2US (0x02) /*!< AoD Constant Tone Extension with 2 µs slots */
typedef uint8_t esp_ble_cte_type_t;
#define ESP_BLE_CTE_MIN_CTE_COUNT (0x01)
#define ESP_BLE_CTE_MAX_CTE_COUNT (0x10)
#define ESP_BLE_CTE_MIN_SWITCHING_PATTERN_LENGTH (0x02)
#define ESP_BLE_CTE_MAX_SWITCHING_PATTERN_LENGTH (0x4B)
#define ESP_BLE_CTE_SLOT_DURATION_1US (0x01)
#define ESP_BLE_CTE_SLOT_DURATION_2US (0x02)
typedef uint8_t esp_ble_cte_slot_dur_type_t;
#define ESP_BLE_CTE_MIN_SAMPLED_CTES (0x00)
#define ESP_BLE_CTE_MAX_SAMPLED_CTES (0x10)
#define ESP_BLE_CTE_TYPES_AOA_RESPONSE (0x01)
#define ESP_BLE_CTE_TYPES_AOD_RESPONSE_WITH_1US (0x02)
#define ESP_BLE_CTE_TYPES_AOD_RESPONSE_WITH_2US (0x04)
#define ESP_BLE_CTE_TYPES_ALL (ESP_BLE_CTE_TYPES_AOA_RESPONSE | ESP_BLE_CTE_TYPES_AOD_RESPONSE_WITH_1US | ESP_BLE_CTE_TYPES_AOD_RESPONSE_WITH_2US)
typedef uint8_t esp_ble_cte_conn_cte_types_t;
#define ESP_BLE_CTE_REQUEST_FOR_CONNECTION_DISABLE (0x00)
#define ESP_BLE_CTE_REQUEST_FOR_CONNECTION_ENABLE (0x01)
#define ESP_BLE_CTE_MIN_REQUESTED_CTE_LENGTH (0x02)
#define ESP_BLE_CTE_MAX_REQUESTED_CTE_LENGTH (0x14)
#define ESP_BLE_CTE_RESPONSE_FOR_CONNECTION_DISABLE (0x00)
#define ESP_BLE_CTE_RESPONSE_FOR_CONNECTION_ENABLE (0x01)
typedef struct {
uint8_t adv_handle; /*!< Used to identify an advertising set */
uint8_t cte_len; /*!< Constant Tone Extension length in 8 µs units, range: 0x02 to 0x14 */
esp_ble_cte_type_t cte_type; /*!< AoA or AoD Constant Tone Extension */
uint8_t cte_count; /*!< The number of Constant Tone Extensions to transmit in each periodic advertising interval, range: 0x01 to 0x10 */
uint8_t switching_pattern_len; /*!< The number of Antenna IDs in the pattern, range: 0x02 to 0x4B */
uint8_t *antenna_ids; /*!< Antenna ID in the pattern */
} __attribute__((packed)) esp_ble_cte_connless_trans_params_t;
typedef struct {
uint8_t adv_handle; /*!< Identifier for the advertising set in which Constant Tone Extension is being enabled or disabled */
uint8_t cte_enable; /*!< Advertising with Constant Tone Extension is enabled or disabled */
} __attribute__((packed)) esp_ble_cte_trans_enable_params_t;
typedef struct {
uint16_t sync_handle; /*!< Identifier for the periodic advertising train */
uint8_t sampling_en; /*!< Enable or disable connectionless IQ sampling */
esp_ble_cte_slot_dur_type_t slot_dur; /*!< Switching and sampling slots, 1 us or 2 us */
uint8_t max_sampled_ctes; /*!< The maximum number of CTE to sample and report in each periodic advertising interval, range: 0x00 - 0x10 */
uint8_t switching_pattern_len; /*!< The number of Antenna IDs in the pattern, range: 0x02 to 0x4B */
uint8_t *antenna_ids; /*!< Antenna ID in the pattern */
} __attribute__((packed)) esp_ble_cte_iq_sampling_params_t;
typedef struct {
uint16_t conn_handle; /*!< Connection_Handle */
uint8_t sampling_en; /*!< Enable or disable connection IQ sampling */
esp_ble_cte_slot_dur_type_t slot_dur; /*!< Switching and sampling slots, 1 us or 2 us */
uint8_t switching_pattern_len; /*!< The number of Antenna IDs in the pattern, range: 0x02 to 0x4B */
uint8_t *antenna_ids; /*!< Antenna ID in the pattern */
} __attribute__((packed)) esp_ble_cte_recv_params_params_t;
typedef struct {
uint16_t conn_handle; /*!< Connection_Handle */
esp_ble_cte_conn_cte_types_t cte_types; /*!< Allow AoA or AoD Constant Tone Extension Response */
uint8_t switching_pattern_len; /*!< The number of Antenna IDs in the pattern, range: 0x02 to 0x4B */
uint8_t *antenna_ids; /*!< Antenna ID in the pattern */
} __attribute__((packed)) esp_ble_cte_conn_trans_params_t;
typedef struct {
uint16_t conn_handle; /*!< Connection_Handle */
uint8_t enable; /*!< Enable or disable Constant Tone Extension Request for the connection */
uint16_t cte_req_interval; /*!< Requested interval for initiating the CTE Request procedure in number of underlying connection events, range: 0x0000 - 0xFFFF */
uint8_t req_cte_len; /*!< Minimum length of the Constant Tone Extension being requested in 8 µs units, range: 0x02 - 0x14 */
esp_ble_cte_type_t req_cte_Type; /*!< AoA or AoD Constant Tone Extension, range: 0x00 - 0x02 */
} __attribute__((packed)) esp_ble_cte_req_en_params_t;
typedef struct {
uint16_t conn_handle; /*!< Connection_Handle */
uint8_t enable; /*!< Enable or disable Constant Tone Extension Response for the connection */
} __attribute__((packed)) esp_ble_cte_rsp_en_params_t;
/**
* @brief CTE callback parameters union
*/
typedef union {
/**
* @brief ESP_BLE_CTE_SET_CONNLESS_TRANS_PARAMS_CMPL_EVT
*/
struct ble_set_trans_params_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate setting transmit parameters status, status = (controller error code | 0x100) if status is not equal to 0 */
} set_trans_params_cmpl; /*!< Event parameter of ESP_BLE_CTE_SET_CONNLESS_TRANS_PARAMS_CMPL_EVT */
/**
* @brief ESP_BLE_CTE_SET_CONNLESS_TRANS_ENABLE_CMPL_EVT
*/
struct ble_set_trans_enable_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate setting transmit enable status, status = (controller error code | 0x100) if status is not equal to 0 */
} set_trans_enable_cmpl; /*!< Event parameter of ESP_BLE_CTE_SET_CONNLESS_TRANS_ENABLE_CMPL_EVT */
/**
* @brief ESP_BLE_CTE_SET_CONNLESS_IQ_SAMPLING_ENABLE_CMPL_EVT
*/
struct ble_set_iq_sampling_en_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate setting IQ sampling enable status, status = (controller error code | 0x100) if status is not equal to 0 */
uint16_t sync_handle; /*!< Sync_Handle identifying the periodic advertising */
} iq_sampling_enable_cmpl; /*!< Event parameter of ESP_BLE_CTE_SET_CONNLESS_IQ_SAMPLING_ENABLE_CMPL_EVT */
/**
* @brief ESP_BLE_CTE_SET_CONN_RECV_PARAMS_CMPL_EVT
*/
struct ble_set_conn_recv_params_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate setting received parameters status, status = (controller error code | 0x100) if status is not equal to 0 */
uint16_t conn_handle; /*!< The connection identifier */
} conn_recv_params_cmpl; /*!< Event parameter of ESP_BLE_CTE_SET_CONN_RECV_PARAMS_CMPL_EVT */
/**
* @brief ESP_BLE_CTE_SET_CONN_TRANS_PARAMS_CMPL_EVT
*/
struct ble_set_conn_trans_params_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate setting connection transmit parameters status, status = (controller error code | 0x100) if status is not equal to 0 */
uint16_t conn_handle; /*!< The connection identifier */
} conn_trans_params_cmpl; /*!< Event parameter of ESP_BLE_CTE_SET_CONN_TRANS_PARAMS_CMPL_EVT */
/**
* @brief ESP_BLE_CTE_SET_CONN_REQ_ENABLE_CMPL_EVT
*/
struct ble_set_conn_req_en_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate setting connection request enable status, status = (controller error code | 0x100) if status is not equal to 0 */
uint16_t conn_handle; /*!< The connection identifier */
} conn_req_en_cmpl; /*!< Event parameter of ESP_BLE_CTE_SET_CONN_REQ_ENABLE_CMPL_EVT */
/**
* @brief ESP_BLE_CTE_SET_CONN_RSP_ENABLE_CMPL_EVT
*/
struct ble_set_conn_rsp_en_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate setting connection response enable status, status = (controller error code | 0x100) if status is not equal to 0 */
uint16_t conn_handle; /*!< The connection identifier */
} conn_rsp_en_cmpl; /*!< Event parameter of ESP_BLE_CTE_SET_CONN_RSP_ENABLE_CMPL_EVT */
/**
* @brief ESP_BLE_CTE_READ_ANT_INFOR_CMPL_EVT
*/
struct ble_read_ant_infor_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate reading antenna information status, status = (controller error code | 0x100) if status is not equal to 0 */
uint8_t supported_switching_sampling_rates; /*!< bit 0: 1 µs switching supported for AoD transmission
bit 1: 1 µs sampling supported for AoD reception
bit 2: 1 µs switching and sampling supported for AoA reception */
uint8_t num_antennae; /*!< The number of antennae supported by the Controller */
uint8_t max_switching_pattern_len; /*!< Maximum length of antenna switching pattern supported by the Controller */
uint8_t max_cte_len; /*!< Maximum length of a transmitted Constant Tone Extension supported in 8 µs units */
} read_ant_infor_cmpl; /*!< Event parameter of ESP_BLE_CTE_READ_ANT_INFOR_CMPL_EVT */
/**
* @brief ESP_BLE_CTE_CONNLESS_IQ_REPORT_EVT
*/
struct ble_cte_connless_iq_rpt_evt_param {
uint16_t sync_handle; /*!< Sync_Handle identifying the periodic advertising train */
uint8_t channel_idx; /*!< The index of the channel on which the packet was received */
int16_t rssi; /*!< RSSI of the packet, Range: -1270 to +200, Units: 0.1 dBm */
uint8_t rssi_ant_id; /*!< Antenna ID */
uint8_t cte_type; /*!< The type of Constant Tone Extension, range: 0x00 - 0x02 */
uint8_t slot_dur; /*!< Switching and sampling slots, 1 us or 2us, range: 0x01 - 0x02 */
uint8_t pkt_status; /*!< indicates whether the received packet had a valid CRC, range: 0x00 - 0x02 and 0xFF */
uint16_t periodic_evt_counter; /*!< The value of paEventCounter for the reported AUX_SYNC_IND PDU */
uint8_t sample_count; /*!< Total number of sample pairs, range: 0x00 and 0x09 - 0x52*/
uint8_t *i_sample; /*!< I sample for the reported packet. No valid sample available if value is 0x80 */
uint8_t *q_sample; /*!< Q sample for the reported packet. No valid sample available if value is 0x80 */
} connless_iq_rpt; /*!< Event parameter of ESP_BLE_CTE_CONNLESS_IQ_REPORT_EVT */
/**
* @brief ESP_BLE_CTE_CONN_IQ_REPORT_EVT
*/
struct ble_cte_conn_iq_rpt_evt_param {
uint16_t conn_handle; /*!< Connection_Handle */
uint8_t rx_phy; /*!< The receiver PHY for the connection, range: 0x01 - 0x02 */
uint8_t data_channel_idx; /*!< The index of the data channel on which the Data Physical Channel PDU was received, range: 0x00 - 0x24 */
int16_t rssi; /*!< RSSI of the packet, range: -1270 - +200, units: 0.1 dBm */
uint8_t rssi_ant_id; /*!< ID of the antenna on which the RSSI is measured */
uint8_t cte_type; /*!< AoA or AoD Constant Tone Extension, range: 0x00 - 0x02 */
uint8_t slot_dur; /*!< Switching and sampling slots, range: 0x01 - 0x02 */
uint8_t pkt_status; /*!< indicates whether the received packet had a valid CRC, range: 0x00 - 0x02 and 0xFF */
uint16_t conn_evt_counter; /*!< The value of connEventCounter for the reported PDU */
uint8_t sample_count; /*!< Total number of sample pairs, range: 0x00 and 0x09 - 0x52 */
uint8_t *i_sample; /*!< I sample for the reported PDU. No valid sample available if value is 0x80 */
uint8_t *q_sample; /*!< Q sample for the reported PDU,. No valid sample available if value is 0x80 */
} conn_iq_rpt; /*!< Event parameter of ESP_BLE_CTE_CONN_IQ_REPORT_EVT */
/**
* @brief ESP_BLE_CTE_REQUEST_FAILED_EVT
*/
struct ble_cte_req_failed_evt_param{
uint8_t reason; /*!< value: 0x00, LL_CTE_RSP PDU received successfully but without a Constant Tone Extension field;
value: 0x01 to 0xFF, Peer rejected the request, see [Vol 1] Part F controller error codes and descriptions */
uint16_t conn_handle; /*!< Connection_Handle */
} req_failed_evt; /*!< Event parameter of ESP_BLE_CTE_REQUEST_FAILED_EVT */
} esp_ble_cte_cb_param_t;
/**
* @brief CTE callback function type
* @param event : Event type
* @param param : Point to callback parameter, currently is union type
*/
typedef void (* esp_ble_cte_cb_t)(esp_ble_cte_cb_event_t event, esp_ble_cte_cb_param_t *param);
/**
* @brief This function is called to occur cte event
*
* @param[in] callback: callback function
*
* @return
* - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_cte_register_callback(esp_ble_cte_cb_t callback);
/**
* @brief This function is called to get the current cte callback
*
* @return
* - esp_ble_cte_cb_t : callback function
*
*/
esp_ble_cte_cb_t esp_ble_cte_get_callback(void);
/**
* @brief This function is called to set parameters for the transmission of CTE in the periodic advertising.
*
* @param[in] cte_trans_params: pointer to User defined cte_trans_params data structure.
* @return
* - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_cte_set_connectionless_trans_params(esp_ble_cte_connless_trans_params_t *cte_trans_params);
/**
* @brief This function is called to request that the Controller enables or disables the use of CTE in the periodic advertising.
*
* @param[in] cte_trans_enable: pointer to User defined cte_trans_enable data structure.
* @return
* - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_cte_set_connectionless_trans_enable(esp_ble_cte_trans_enable_params_t *cte_trans_enable);
/**
* @brief This function is called to request that the Controller enables or disables capturing IQ samples from the CTE
* of periodic advertising packets.
*
* @param[in] iq_sampling_en: pointer to User defined iq_sampling_en data structure.
* @return
* - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_cte_set_connectionless_iq_sampling_enable(esp_ble_cte_iq_sampling_params_t *iq_sampling_en);
/**
* @brief This function is called to enable or disable sampling received CTE fields on the connection.
*
* @param[in] cte_recv_params: pointer to User defined cte_recv_params data structure.
* @return
* - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_cte_set_connection_receive_params(esp_ble_cte_recv_params_params_t *cte_recv_params);
/**
* @brief This function is called to set the parameters used for transmitting CTE requested by the peer
* device on the connection.
*
* @param[in] cte_conn_trans_params: pointer to User defined cte_conn_trans_params data structure.
* @return
* - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_cte_set_connection_transmit_params(esp_ble_cte_conn_trans_params_t *cte_conn_trans_params);
/**
* @brief This function is called to request the Controller to start or stop initiating the CTE Request
* procedure on a connection.
*
* @param[in] cte_conn_req_en: pointer to User defined cte_conn_req_en data structure.
* @return
* - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_cte_connection_cte_request_enable(esp_ble_cte_req_en_params_t *cte_conn_req_en);
/**
* @brief This function is called to request the Controller to respond to LL_CTE_REQ PDUs with
* LL_CTE_RSP PDUs on the specified connection.
*
* @param[in] cte_conn_rsp_en: pointer to User defined cte_conn_rsp_en data structure.
* @return
* - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_cte_connection_cte_response_enable(esp_ble_cte_rsp_en_params_t *cte_conn_rsp_en);
/**
* @brief This function is called to read the parameters of a transmitted CTE supported by the Controller.
*
* @param[in] none.
* @return
* - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_cte_read_antenna_information(void);
#ifdef __cplusplus
}
#endif
#endif /* __ESP_BLE_CTE_API_H__ */

View File

@ -0,0 +1,660 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __ESP_BLE_ISO_API_H__
#define __ESP_BLE_ISO_API_H__
#include <stdint.h>
#include <stdbool.h>
#include "esp_err.h"
#include "esp_bt_defs.h"
#ifdef __cplusplus
extern "C" {
#endif
/// ISO BLE callback event type
typedef enum {
ESP_BLE_ISO_BIG_CREATE_CMPL_EVT = 0, /*!< When BIG create complete, the event comes */
ESP_BLE_ISO_BIG_TERMINATE_CMPL_EVT, /*!< When BIG terminate complete, the event comes */
ESP_BLE_ISO_BIG_SYNC_ESTABLISHED_EVT, /*!< When BIG sync established, the event comes */
ESP_BLE_ISO_BIG_SYNC_LOST_EVT, /*!< When BIG sync lost, the event comes */
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_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 */
ESP_BLE_ISO_CREATE_CIS_CMPL_EVT, /*!< When CIS create complete, the event comes */
ESP_BLE_ISO_REMOVE_CIG_CMPL_EVT, /*!< When CIG remove complete, the event comes */
ESP_BLE_ISO_CIS_REQUEST_EVT, /*!< When Receiving CIS request event, the event comes */
ESP_BLE_ISO_ACCEPT_CIS_REQ_CMPL_EVT, /*!< When CIS request event accept complete, the event comes */
ESP_BLE_ISO_REJECT_CIS_REQ_CMPL_EVT, /*!< When CIS request event reject complete, the event comes */
ESP_BLE_ISO_CIS_ESTABLISHED_EVT, /*!< When CIS is established, the event comes */
ESP_BLE_ISO_CIS_DISCONNECTED_EVT, /*!< When CIS is disconnected, the event comes */
ESP_BLE_ISO_EVT_MAX, /*!< when maximum advertising event complete, the event comes */
} esp_ble_iso_cb_event_t;
typedef enum {
ESP_BLE_ISO_DATA_PATH_UNKNOWN = 0,
ESP_BLE_ISO_DATA_PATH_SETUP = 1,
ESP_BLE_ISO_DATA_PATH_REMOVE = 2,
ESP_BLE_ISO_DATA_PATH_MAX,
} ESP_BLE_ISO_DATA_PATH_UPDATE_TYPE;
#define ESP_BLE_ISO_DATA_PATH_DIR_INPUT (0x00)
#define ESP_BLE_ISO_DATA_PATH_DIR_OUTPUT (0x01)
#define ESP_BLE_ISO_DATA_PATH_DIR_INPUT_BIT_MASK (1 << 0)
#define ESP_BLE_ISO_DATA_PATH_DIR_OUTPUT_BIT_MASK (1 << 1)
#define ESP_BLE_ISO_DATA_PATH_DIR_ALL_BIT_MASK (ESP_BLE_ISO_DATA_PATH_DIR_INPUT_BIT_MASK | ESP_BLE_ISO_DATA_PATH_DIR_OUTPUT_BIT_MASK)
#define ESP_BLE_MAX_BIS_NUM (31)
#define ESP_BLE_MAX_CIS_NUM (31)
#define BLE_ISO_SDU_INT_MIN (0x0000FF)
#define BLE_ISO_SDU_INT_MAX (0x0FFFFF)
#define BLE_ISO_WORST_CASE_SCA_LEVEL_500_PPM (0x00)
#define BLE_ISO_WORST_CASE_SCA_LEVEL_250_PPM (0x01)
#define BLE_ISO_WORST_CASE_SCA_LEVEL_150_PPM (0x02)
#define BLE_ISO_WORST_CASE_SCA_LEVEL_100_PPM (0x03)
#define BLE_ISO_WORST_CASE_SCA_LEVEL_75_PPM (0x04)
#define BLE_ISO_WORST_CASE_SCA_LEVEL_50_PPM (0x05)
#define BLE_ISO_WORST_CASE_SCA_LEVEL_30_PPM (0x06)
#define BLE_ISO_WORST_CASE_SCA_LEVEL_20_PPM (0x07)
#define BLE_ISO_PACKING_SEQUENTIAL (0x00)
#define BLE_ISO_PACKING_INTERLEAVED (0x00)
#define BLE_ISO_FRAMING_UNFRAMED_PDU (0x00)
#define BLE_ISO_FRAMING_FRAMED_PDU_SEGMENTABLE_MODE (0x01)
#define BLE_ISO_FRAMING_FRAMED_PDU_UNSEGMENTABLE_MODE (0x02)
#define BLE_ISO_MAX_TRANSPORT_LATENCY_MIN (0x0005)
#define BLE_ISO_MAX_TRANSPORT_LATENCY_MAX (0x0FA0)
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
typedef struct {
uint8_t big_handle; /*!< Used to identify the BIG, value 0x00 to 0xEF */
uint8_t adv_handle; /*!< Used to identify the periodic advertising train, value 0x00 to 0xEF */
uint8_t num_bis; /*!< Total number of BISes in the BIG, value 0x01 to 0x1F */
uint32_t sdu_interval; /*!< The interval, in microseconds, of periodic SDUs, value 0x0000FF to 0x0FFFFF*/
uint16_t max_sdu; /*!< Maximum size of an SDU, in octets, value 0x0001 to 0x0FFF */
uint16_t max_transport_latency; /*!< Maximum transport latency, in milliseconds, value 0x0005 to 0x0FA0 */
uint8_t rtn; /*!< The number of times that every BIS Data PDU should be retransmitted, value 0x00 to 0x1E */
uint8_t phy; /*!< The transmitter PHY of packets, value bit[0, 2] */
uint8_t packing; /*!< The preferred method of arranging subevents of multiple BISes, value 0x00 to 0x01 */
uint8_t framing; /*!< The format of the BIS Data PDUs and the mode of framed PDUs that the Controller shall use on the specified BIG, value 0x00 to 0x02 */
uint8_t encryption; /*!< The encryption mode of the BISes in the BIG, value 0x00 to 0x01 */
uint8_t broadcast_code[16]; /*!< The code used to derive the session key that is used to encrypt and decrypt BIS payloads */
} esp_ble_iso_big_creat_params_t;
typedef struct {
uint8_t big_handle; /*!< Used to identify the BIG, value 0x00 to 0xEF */
uint8_t adv_handle; /*!< Used to identify the periodic advertising train, value 0x00 to 0xEF */
uint8_t num_bis; /*!< Total number of BISes in the BIG, value 0x01 to 0x1F */
uint32_t sdu_interval; /*!< The interval, in microseconds, of periodic SDUs, value 0x0000FF to 0x0FFFFF*/
uint16_t iso_interval; /*!< the time between two consecutive BIG anchor points, Range: 0x0004 to 0x0C80, Time = N × 1.25 ms */
uint8_t nse; /*!< The total number of subevents in each interval of each BIS in the BIG, value 0x01 to 0x1F */
uint16_t max_sdu; /*!< Maximum size, in octets, of an SDU */
uint16_t max_pdu; /*!< Maximum size, in octets, of payload, value 0x0001 to 0x00FB */
uint8_t phy; /*!< The transmitter PHY of packets */
uint8_t packing; /*!< The preferred method of arranging subevents of multiple BISes, value 0x00 to 0x01 */
uint8_t framing; /*!< The format of the BIS Data PDUs and the mode of framed PDUs that the Controller shall use on the specified BIG, value 0x00 to 0x02 */
uint8_t bn; /*!< The number of new payloads in each interval for each BIS, value 0x01 to 0x07 */
uint8_t irc; /*!< The number of times the scheduled payloads are transmitted in a given event, value 0x01 to 0x0F */
uint8_t pto; /*!< Offset used for pre-transmissions, value 0x00 to 0x0F */
uint8_t encryption; /*!< The encryption mode of the BISes in the BIG, value 0x00 to 0x01 */
uint8_t broadcast_code[16]; /*!< The code used to derive the session key that is used to encrypt and decrypt BIS payloads */
} esp_ble_iso_big_creat_test_params_t;
#endif //#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
typedef struct {
uint8_t big_handle; /*!< Used to identify the BIG, value 0x00 to 0xEF */
uint16_t sync_handle; /*!< Identifier of the periodic advertising train, value 0x0000 to 0x0EFF*/
uint8_t encryption; /*!< Broadcast_Code is valid or invalid, value 0x00 to 0x01 */
uint8_t bc_code[16]; /*!< 128-bit code used for deriving the session key for decrypting payloads of BISes in the BIG */
uint8_t mse; /*!< Maximum number of subevents that should be used to receive data payloads in each BIS event, value 0x00 to 0x1F */
uint16_t big_sync_timeout; /*!< Synchronization timeout for the BIG, Range: 0x000A to 0x4000, Time = N × 10 ms, Time Range: 100 ms to 163.84 s*/
uint8_t num_bis; /*!< Total number of BISes to synchronize, value 0x01 to 0x1F */
uint8_t bis[ESP_BLE_MAX_BIS_NUM]; /*!< Index of a BIS, value 0x01 to 0x1F */
} esp_ble_iso_big_sync_creat_params_t;
#endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
typedef struct {
uint16_t iso_handle; /*!< Connection handle of the CIS or BIS*/
uint8_t data_path_dir; /*!< The direction for which the data path is being configured, value 0x00 to 0x01 */
uint8_t data_path_id; /*!< The data transport path used, value 0x00 to 0xFE */
uint8_t coding_fmt; /*!< See Assigned Numbers for Coding Format */
uint16_t company_id; /*!< Company ID, see Assigned Numbers for Company Identifier. Shall be ignored if coding_fmt is not 0xFF*/
uint16_t vs_codec_id; /*!< Vendor-defined codec ID, Shall be ignored if coding_fmt is not 0xFF */
uint32_t controller_delay; /*!< Controller delay in microseconds, range: 0x000000 to 0x3D0900, time range: 0 s to 4 s*/
uint8_t codec_cfg_len; /*!< Length of codec configuration */
uint8_t *codec_cfg; /*!< Codec-specific configuration data */
} esp_ble_iso_set_data_path_params_t;
typedef struct {
uint16_t iso_handle; /*!< Connection handle of the CIS or BIS. Range: 0x0000 to 0x0EFF */
uint8_t data_path_dir; /*!< which directions are to have the data path removed */
} __attribute__((packed)) esp_ble_iso_remove_data_path_params_t;
struct ble_iso_cis_params {
uint8_t cis_id; /*!< Used to identify a CIS */
uint16_t max_sdu_c_to_p; /*!< Maximum size, in octets, of the payload from the Centrals Host */
uint16_t max_sdu_p_to_c; /*!< Maximum size, in octets, of the payload from the Peripherals Host */
uint8_t phy_c_to_p; /*!< The transmitter PHY of packets from the Central */
uint8_t phy_p_to_c; /*!< The transmitter PHY of packets from the Peripheral */
uint8_t rtn_c_to_p; /*!< Number of times every CIS Data PDU should be retransmitted from the Central to the Peripheral */
uint8_t rtn_p_to_c; /*!< Number of times every CIS Data PDU should be retransmitted from the Peripheral to the Central */
} __attribute__((packed));
struct ble_iso_cis_params_test {
uint8_t cis_id; /*!< Used to identify a CIS */
uint8_t nse; /*!< Maximum number of subevents in each CIS event */
uint16_t max_sdu_c_to_p; /*!< Maximum size, in octets, of the payload from the Centrals Host */
uint16_t max_sdu_p_to_c; /*!< Maximum size, in octets, of the payload from the Peripherals Host */
uint16_t max_pdu_c_to_p; /*!< Maximum size, in octets, of the payload from the Centrals Link Layer to the Peripherals Link Layer */
uint16_t max_pdu_p_to_c; /*!< Maximum size, in octets, of the payload from the Peripherals Link Layer to the Centrals Link Layer */
uint8_t phy_c_to_p; /*!< The transmitter PHY of packets from the Central */
uint8_t phy_p_to_c; /*!< The transmitter PHY of packets from the Peripheral */
uint8_t bn_c_to_p; /*!< The burst number for Central to Peripheral */
uint8_t bn_p_to_c; /*!< The burst number for Peripheral to Central */
} __attribute__((packed));
#if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
struct esp_ble_iso_set_cig_params {
uint8_t cig_id; /*!< Used to identify the CIG */
uint32_t sdu_int_c_to_p; /*!< The interval, in microseconds, of periodic SDUs */
uint32_t sdu_int_p_to_c; /*!< The interval, in microseconds, of periodic SDUs */
uint8_t worse_case_SCA; /*!< The worst-case sleep clock accuracy of all the Peripherals that will participate in the CIG */
uint8_t packing; /*!< The preferred method of arranging subevents of multiple CISes */
uint8_t framing; /*!< The format of the CIS Data PDUs of the specified CISes' framing mode that the Host is requesting for the CIG */
uint16_t mtl_c_to_p; /*!< The maximum transport latency from the Central to the Peripheral, in milliseconds */
uint16_t mtl_p_to_c; /*!< The maximum transport latency from the Peripheral to the Central, in milliseconds */
uint8_t cis_cnt; /*!< Total number of CIS configurations in the CIG being added or modified */
struct ble_iso_cis_params cis_params[ESP_BLE_MAX_CIS_NUM]; /*!< */
}__attribute__((packed));
struct esp_ble_iso_set_cig_params_test {
uint8_t cig_id; /*!< Used to identify the CIG */
uint32_t sdu_int_c_to_p; /*!< The interval, in microseconds, of periodic SDUs */
uint32_t sdu_int_p_to_c; /*!< The interval, in microseconds, of periodic SDUs */
uint8_t ft_c_to_p; /*!< The flush timeout in multiples of ISO_Interval for each payload sent from the Central to Peripheral */
uint8_t ft_p_to_c; /*!< The flush timeout in multiples of ISO_Interval for each payload sent from the Peripheral to Central */
uint16_t iso_interval; /*!< Time between consecutive CIS anchor points. Range: 0x0004 to 0x0C80, Time = N × 1.25 ms, Time Range: 5 ms to 4 s */
uint8_t worse_case_SCA; /*!< The worst-case sleep clock accuracy of all the Peripherals that will participate in the CIG */
uint8_t packing; /*!< The preferred method of arranging subevents of multiple CISes */
uint8_t framing; /*!< The format of the CIS Data PDUs of the specified CISes' framing mode that the Host is requesting for the CIG */
uint8_t cis_cnt; /*!< Total number of CIS configurations in the CIG being added or modified */
struct ble_iso_cis_params_test cis_params_test[ESP_BLE_MAX_CIS_NUM];
} __attribute__((packed));
struct esp_ble_gatt_cis_hdl {
uint16_t cis_hdl; /*!< Connection handle of a CIS */
uint16_t acl_hdl; /*!< Connection handle of an ACL connection */
}__attribute__((packed));
struct esp_ble_iso_create_cis_params {
uint8_t cis_count; /*!< Total number of CISes to be created */
struct esp_ble_gatt_cis_hdl cis_hdl_info[ESP_BLE_MAX_CIS_NUM];
}__attribute__((packed));
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
/**
* @brief ISO callback parameters union
*/
typedef union {
/**
* @brief ESP_BLE_ISO_BIG_CREATE_CMPL_EVT
*/
struct ble_big_create_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate the BIG was successfully created */
uint8_t big_handle; /*!< The identifier of the BIG */
uint32_t big_sync_delay; /*!< The maximum time, in microseconds, for transmission of PDUs of all BISes in a BIG event */
uint32_t transport_latency; /*!< The actual transport latency, in microseconds */
uint8_t phy; /*!< The PHY used to create the BIG */
uint8_t nse; /*!< The number of subevents in each BIS event in the BIG. The value shall be an integer multiple of BN */
uint8_t bn; /*!< The number of new payloads in each BIS event */
uint8_t pto; /*!< Offset used for pre-transmissions */
uint8_t irc; /*!< The number of times a payload is transmitted in a BIS event */
uint16_t max_pdu; /*!< Maximum size, in octets, of the payload */
uint16_t iso_interval; /*!< The time between two consecutive BIG anchor points, Time = N × 1.25 ms */
uint8_t num_bis; /*!< Total number of BISes in the BIG */
uint16_t bis_handle[ESP_BLE_MAX_BIS_NUM]; /*!< Connection handle of a BIS */
} create_big_cmpl; /*!< Event parameter of ESP_BLE_ISO_BIG_CREATE_CMPL_EVT */
/**
* @brief ESP_BLE_ISO_BIG_TERMINATE_CMPL_EVT
*/
struct ble_big_term_cmpl_evt_param {
esp_bt_status_t status;/*!< Indicate BIG terminate complete */
uint8_t big_handle; /*!< The identifier of the BIG */
uint8_t reason; /*!< Reason for termination. See [Vol 1] Part F, Controller Error Codes for a list of error codes and descriptions */
} term_big_cmpl; /*!< Event parameter of ESP_BLE_ISO_BIG_TERMINATE_CMPL_EVT */
/**
* @brief ESP_BLE_ISO_BIG_SYNC_ESTABLISHED_EVT
*/
struct ble_big_sync_estab_evt_param {
esp_bt_status_t status; /*!< Indicate synchronization to the BIG is completed */
uint8_t big_handle; /*!< The identifier of the BIG */
uint32_t transport_latency; /*!< The actual transport latency, in microseconds */
uint8_t nse; /*!< The number of subevents in each BIS event in the BIG */
uint8_t bn; /*!< The number of new payloads in each BIS event */
uint8_t pto; /*!< The offset in number of ISO_Intervals for pre transmissions of data packets */
uint8_t irc; /*!< The number of times a payload is transmitted in a BIS event */
uint16_t max_pdu; /*!< The maximum size of every BIS Data PDU for every BIS in the BIG */
uint16_t iso_interval; /*!< The time duration between two consecutive BIG anchor points */
uint8_t num_bis; /*!< The total number of BISes in the BIG */
uint16_t bis_handle[ESP_BLE_MAX_BIS_NUM]; /*!< Connection handle of a BIS in the BIG */
} big_sync_estab; /*!< Event parameter of ESP_BLE_ISO_BIG_SYNC_ESTABLISHED_EVT */
/**
* @brief ESP_BLE_ISO_BIG_SYNC_LOST_EVT
*/
struct ble_big_sync_lost_evt_param {
uint8_t big_handle; /*!< The identifier of a BIG */
uint8_t reason; /*!< The synchronization to BIG is terminated. See [Vol 1] Part F, Controller Error Codes for a list of error codes and descriptions */
} big_sync_lost; /*!< Event parameter of ESP_BLE_ISO_BIG_SYNC_LOST_EVT */
/**
* @brief ESP_BLE_ISO_BIG_SYNC_TERMINATE_CMPL_EVT
*/
struct ble_big_sync_term_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate BIG sync terminate success or not */
uint8_t big_handle; /*!< Identifier of the BIG */
} term_big_sync; /*!< Event parameter of ESP_BLE_ISO_BIG_SYNC_TERMINATE_CMPL_EVT */
/**
* @brief ESP_BLE_ISO_BIGINFO_ADV_REPORT_EVT
*/
struct ble_biginfo_report_evt_param {
uint16_t sync_handle; /*!< Identify the periodic advertising train containing the BIGInfo field */
uint8_t num_bis; /*!< The total number of BISes in the BIG */
uint8_t nse; /*!< The total number of subevents that are used to transmit BIS Data PDUs for each BIS in a BIG event */
uint16_t iso_interval; /*!< The time duration between two consecutive BIG anchor points */
uint8_t bn; /*!< The number of new payloads for each BIS */
uint8_t pto; /*!< The offset in number of ISO_Intervals for pre transmissions of data packets */
uint8_t irc; /*!< The number of times the scheduled data packet is transmitted */
uint16_t max_pdu; /*!< The maximum size of every BIS Data PDU for every BIS in the BIG */
uint32_t sdu_interval; /*!< The time interval of the periodic SDUs */
uint16_t max_sdu; /*!< The maximum size of an SDU */
uint8_t phy; /*!< The transmitter PHY of packets */
uint8_t framing; /*!< The format of the BIS Data PDUs and the mode of framed PDUs that the Controller used on the specified BIG */
uint8_t encryption; /*!< The encryption mode of the BISes in the BIG */
} biginfo_report; /*!< Event parameter of ESP_BLE_ISO_BIGINFO_ADV_REPORT_EVT */
/**
* @brief ESP_BLE_ISO_ISO_DATA_PATH_UPDATE_EVT
*/
struct ble_iso_data_path_update_evt_param {
esp_bt_status_t status; /*!< Indicate data path update success status */
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_READ_ISO_TX_SYNC_CMPL_EVT
*/
struct ble_iso_read_tx_sync_evt_param {
esp_bt_status_t status; /*!< Indicate tx sync read success status */
uint16_t iso_hdl; /*!< Connection handle of the CIS or BIS */
uint16_t pkt_seq_num; /*!< The packet sequence number of an SDU */
uint32_t tx_time_stamp; /*!< The CIG reference point or BIG anchor point of a transmitted SDU derived using the Controller's free running reference clock (in microseconds) */
uint32_t time_offset; /*!< The time offset, in microseconds, that is associated with a transmitted SDU */
} read_tx_sync; /*!< Event parameter of ESP_BLE_ISO_READ_ISO_TX_SYNC_CMPL_EVT */
/**
* @brief ESP_BLE_ISO_READ_LINK_QUALITY_CMPL_EVT
*/
struct ble_iso_read_link_quality_evt_param {
esp_bt_status_t status; /*!< Indicate link quality read success status */
uint16_t iso_hdl; /*!< The identifier of the BIS or CIS */
uint32_t tx_unacked_pkts; /*!< for CIS, The Link Layer does not receive an acknowledgment for a CIS Data PDU that it transmitted at least once by its flush point*/
uint32_t tx_flushed_pkts; /*!< for CIS, The Link Layer does not transmit a specific payload by its flush point */
uint32_t tx_last_subevt_pkts; /*!< for CIS in Peripheral role, The Link Layer transmits a CIS Data PDU in the last subevent of a CIS event */
uint32_t retransmitted_pkts; /*!< for CIS, The Link Layer retransmits a CIS Data PDU */
uint32_t crc_error_pkts; /*!< for CIS and BIS, The Link Layer receives a packet with a CRC error */
uint32_t rx_unreceived_pkts; /*!< for CIS and BIS, The Link Layer does not receive a specific payload by its flush point (on a CIS) or the end of the event */
uint32_t duplicate_pkts; /*!< for CIS, The Link Layer receives a retransmission of a CIS Data PDU */
} read_link_quality; /*!< Event parameter of ESP_BLE_ISO_READ_LINK_QUALITY_CMPL_EVT */
/**
* @brief ESP_BLE_ISO_SET_CIG_PARAMS_CMPL_EVT
*/
struct ble_iso_set_cig_params_evt_param {
esp_bt_status_t status; /*!< Indicate CIG parameters update success status */
uint8_t cig_id; /*!< Used to identify a CIG */
uint8_t cis_count; /*!< Total number of CIS configurations added or modified by this command */
uint16_t cis_hdl[ESP_BLE_MAX_CIS_NUM]; /*!< Connection handle of the CIS in the CIG */
} set_cig_params; /*!< Event parameter of ESP_BLE_ISO_SET_CIG_PARAMS_CMPL_EVT */
/**
* @brief ESP_BLE_ISO_CREATE_CIS_CMPL_EVT
*/
struct ble_iso_create_cis_params_evt_param {
esp_bt_status_t status; /*!< Indicate creating cis success status */
} create_cis; /*!< Event parameter of ESP_BLE_ISO_CREATE_CIS_CMPL_EVT */
/**
* @brief ESP_BLE_ISO_CIS_ESTABLISHED_EVT
*/
struct ble_iso_cis_estab_evt_params{
esp_bt_status_t status; /*!< Indicate the CIS is successfully established or not */
uint16_t cis_handle; /*!< Connection handle of the CIS */
uint32_t cig_sync_delay; /*!< The maximum time, in microseconds, for transmission of PDUs of all CISes in a CIG event */
uint32_t cis_sync_delay; /*!< he maximum time, in microseconds, for transmission of PDUs of the speci-fied CIS in a CIG event */
uint32_t trans_lat_c_to_p; /*!< The actual transport latency, in microseconds, from Central to Peripheral */
uint32_t trans_lat_p_to_c; /*!< The actual transport latency, in microseconds, from Peripheral to Central */
uint8_t phy_c_to_p; /*!< The transmitter PHY of packets from the Central */
uint8_t phy_p_to_c; /*!< The transmitter PHY of packets from the Peripheral */
uint8_t nse; /*!< Maximum number of subevents in each CIS event */
uint8_t bn_c_to_p; /*!< The burst number for Central to Peripheral transmission */
uint8_t bn_p_to_c; /*!< The burst number for Peripheral to Central transmission */
uint8_t ft_c_to_p; /*!< The flush timeout, in multiples of the ISO_Interval for the CIS, for each payload sent from the Central to the Peripheral */
uint8_t ft_p_to_c; /*!< The flush timeout, in multiples of the ISO_Interval for the CIS, for each payload sent from the Peripheral to the Central */
uint16_t max_pdu_c_to_p; /*!< Maximum size, in octets, of the payload from Central to Peripheral */
uint16_t max_pdu_p_to_c; /*!< Maximum size, in octets, of the payload from Peripheral to Central */
uint16_t iso_interval; /*!< The time between two consecutive CIS anchor points, Time = N × 1.25 ms */
#if (BLE_FEAT_ISO_60_EN == TRUE)
uint32_t sub_interval; /*!< Time, in microseconds, between the start of consecutive subevents in a CIS event */
uint16_t max_sdu_c_to_p; /*!< Maximum size, in octets, of the payload from the Centrals Host */
uint16_t max_sdu_p_to_c; /*!< Maximum size, in octets, of the payload from the Peripherals Host */
uint32_t sdu_int_c_to_p; /*!< Time, in microseconds, between the start of consecutive SDUs sent by the Central */
uint32_t sdu_int_p_to_c; /*!< Time, in microseconds, between the start of consecutive SDUs sent by the Peripheral */
uint8_t framing; /*!< The format of the CIS Data PDUs and the mode of framed PDUs that the Controller used on the specified CIG */
#endif // #if (BLE_FEAT_ISO_60_EN == TRUE)
} cis_estab; /*!< Event parameter of ESP_BLE_ISO_CIS_ESTABLISHED_EVT */
/**
* @brief ESP_BLE_ISO_CIS_DISCONNECTED_EVT
*/
struct ble_iso_cis_dis_evt_params{
uint16_t cis_handle; /*!< Connection handle of the CIS */
uint8_t reason; /*!< Reason for disconnection. See [Vol 1] Part F, Controller Error Codes for error codes and descriptions */
} cis_disconnected; /*!< Event parameter of ESP_BLE_ISO_CIS_DISCONNECTED_EVT */
/**
* @brief ESP_BLE_ISO_CIS_REQUEST_EVT
*/
struct ble_iso_cis_request_evt_params{
uint16_t acl_handle; /*!< Connection handle of the ACL */
uint16_t cis_handle; /*!< Connection handle of the CIS */
uint8_t cig_id; /*!< Identifier of the CIG */
uint8_t cis_id; /*!< Identifier of the CIS */
} cis_request; /*!< Event parameter of ESP_BLE_ISO_CIS_REQUEST_EVT */
/**
* @brief ESP_BLE_ISO_REMOVE_CIG_CMPL_EVT
*/
struct ble_iso_remove_cig_params{
esp_bt_status_t status; /*!< Indicate CIG remove succeeded or not*/
uint8_t cig_id; /*!< Identifier of a CIG */
} remove_cig; /*!< Event parameter of ESP_BLE_ISO_REMOVE_CIG_CMPL_EVT */
/**
* @brief ESP_BLE_ISO_ACCEPT_CIS_REQ_CMPL_EVT
*/
struct ble_iso_accept_req_evt_params{
esp_bt_status_t status; /*!< Indicate the CIS request is accepted successfully */
} accept_req; /*!< Event parameter of ESP_BLE_ISO_ACCEPT_CIS_REQ_CMPL_EVT */
/**
* @brief ESP_BLE_ISO_REJECT_CIS_REQ_CMPL_EVT
*/
struct ble_iso_reject_req_evt_params{
esp_bt_status_t status; /*!< Indicate the CIS request is rejected successfully */
uint16_t cis_handle; /*!< The connection handle of the CIS to be rejected */
} reject_req; /*!< Event parameter of ESP_BLE_ISO_REJECT_CIS_REQ_CMPL_EVT */
} esp_ble_iso_cb_param_t;
/**
* @brief ISO callback function type
* @param event : Event type
* @param param : Point to callback parameter, currently is union type
*/
typedef void (* esp_ble_iso_cb_t)(esp_ble_iso_cb_event_t event, esp_ble_iso_cb_param_t *param);
/**
* @brief This function is called to occur iso event, such as scan result
*
* @param[in] callback: callback function
*
* @return
* - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_iso_register_callback(esp_ble_iso_cb_t callback);
/**
* @brief This function is called to get the current iso callback
*
* @return
* - esp_ble_iso_cb_t : callback function
*
*/
esp_ble_iso_cb_t esp_ble_iso_get_callback(void);
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
/**
* @brief This function is called to create BIG.
*
* @param[in] big_creat_param: pointer to User defined big_creat_param data structure.
* @return
* - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_iso_create_big(esp_ble_iso_big_creat_params_t *big_creat_param);
/**
* @brief This function is called to create BIG test.
*
* @param[in] big_creat_test_param: pointer to User defined big_creat_test_param data structure.
* @return
* - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_iso_create_big_test(esp_ble_iso_big_creat_test_params_t *big_creat_test_param);
/**
* @brief This function is called to terminate a BIG.
*
* @param[in] big_handle: Used to identify the BIG.
* @param[in] reason: indicate the reason why the BIG is to be terminated.
*
* @return
* - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_iso_terminate_big(uint8_t big_handle, uint8_t reason);
#endif // #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
/**
* @brief This function is called to create BIG sync.
*
* @param[in] big_sync_create_param: pointer to User defined big_sync_create_param data structure.
* @return
* - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_iso_big_create_sync(esp_ble_iso_big_sync_creat_params_t *big_sync_create_param);
/**
* @brief This function is called to terminate BIG sync.
*
* @param[in] big_handle: Identifier of the BIG.
* @return
* - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_iso_big_terminate_sync(uint8_t big_handle);
#endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
/**
* @brief This function is called to set iso data path.
*
* @param[in] data_path_params: pointer to User defined data_path_params data structure.
* @return
* - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_iso_set_iso_data_path(esp_ble_iso_set_data_path_params_t *data_path_params);
/**
* @brief This function is called to remove iso data path.
*
* @param[in] data_path_params: pointer to User defined data_path_params data structure.
* @return
* - ESP_OK : success
* - other : failed
*
*/
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 read tx sync.
*
* @param[in] iso_handle: Connection handle of the CIS or BIS.
*
* @return
* - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_iso_read_iso_tx_sync(uint16_t iso_handle);
/**
* @brief This function is called to read link quality.
*
* @param[in] iso_handle: Connection handle of the CIS or BIS.
*
* @return
* - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_iso_read_link_quality(uint16_t iso_handle);
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
/**
* @brief This function is called to accept cis request.
*
* @param[in] cis_handle: Connection handle of the CIS
*
* @return
* - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_iso_accept_cis_request(uint16_t cis_handle);
/**
* @brief This function is called to reject cis request.
*
* @param[in] cis_handle: Connection handle of the CIS
* @param[in] reason: The reason for rejecting the CIS request
*
*
* @return
* - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_iso_reject_cis_request(uint16_t cis_handle, uint8_t reason);
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
/**
* @brief This function is called to set cig parameters.
*
* @param[in] cig_params: pointer to User defined cig_params data structure.
* @return
* - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_iso_set_cig_parameters(struct esp_ble_iso_set_cig_params *cig_params);
/**
* @brief This function is called to set cig test parameters.
*
* @param[in] cig_params_test: pointer to User defined cig_params_test data structure.
* @return
* - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_iso_set_cig_parameters_test(struct esp_ble_iso_set_cig_params_test *cig_params_test);
/**
* @brief This function is called to create cis.
*
* @param[in] creat_cis_params: pointer to User defined creat_cis_params data structure.
* @return
* - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_iso_create_cis(struct esp_ble_iso_create_cis_params *creat_cis_params);
/**
* @brief This function is called to remove CIG.
*
* @param[in] cig_id: Identifier of a CIG.
* @return
* - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_iso_remove_cig(uint8_t cig_id);
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_EN == TRUE)
/**
* @brief This function is called to disconnect cis.
*
* @param[in] cis_handle: Connection handle of the CIS
* @param[in] reason: The reason for disconnecting the CIS. ESP_HCI_ERR_REMOTE_USER_TERM_CONN is recommended.
*
* The value of the reason is one of the following values:
* - ESP_HCI_ERR_AUTH_FAIL
* - ESP_HCI_ERR_REMOTE_USER_TERM_CONN
* - ESP_HCI_ERR_REMOTE_LOW_RESOURCES
* - ESP_HCI_ERR_REMOTE_POWER_OFF
* - ESP_HCI_ERR_UNSUPP_REMOTE_FEATURE
* - ESP_HCI_ERR_PAIRING_NOT_SUPPORTED
* - ESP_HCI_ERR_UNACCEPT_CONN_PARAM
*
* @return
* - ESP_OK : success
* - other : failed
*
*/
esp_err_t esp_ble_iso_disconnect_cis(uint16_t cis_handle, uint8_t reason);
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)
#ifdef __cplusplus
}
#endif
#endif /* __ESP_BLE_ISO_API_H__ */

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -21,6 +21,82 @@ extern "C" {
#define ESP_BT_STATUS_BASE_FOR_HCI_ERR 0X0100 /* base for converting HCI error code to ESP status */
/* See [Vol 1] Part F, Controller Error Codes for a list of error codes and descriptions */
#define ESP_HCI_ERR_SUCCESS 0x00 /* Success */
#define ESP_HCI_ERR_UNKNOWN_CMD 0x01 /* Unknown HCI Command */
#define ESP_HCI_ERR_UNKNOWN_CONN_ID 0x02 /* Unknown Connection Identifier */
#define ESP_HCI_ERR_HW_FAILURE 0x03 /* Hardware Failure */
#define ESP_HCI_ERR_PAGE_TIMEOUT 0x04 /* Page Timeout */
#define ESP_HCI_ERR_AUTH_FAIL 0x05 /* Authentication Failure */
#define ESP_HCI_ERR_PIN_OR_KEY_MISSING 0x06 /* PIN or Key Missing */
#define ESP_HCI_ERR_MEM_CAPACITY_EXCEEDED 0x07 /* Memory Capacity Exceeded */
#define ESP_HCI_ERR_CONN_TIMEOUT 0x08 /* Connection Timeout */
#define ESP_HCI_ERR_CONN_LIMIT_EXCEEDED 0x09 /* Connection Limit Exceeded */
#define ESP_HCI_ERR_SYNC_CONN_LIMIT_EXCEEDED 0x0A /* ASynchronous Connection Limit To A Device Exceeded */
#define ESP_HCI_ERR_CONN_ALREADY_EXISTS 0x0B /* Connection Already Exists */
#define ESP_HCI_ERR_CMD_DISALLOWED 0x0C /* Command Disallowed */
#define ESP_HCI_ERR_INSUFFICIENT_RESOURCES 0x0D /* Connection Rejected due to Limited Resources */
#define ESP_HCI_ERR_INSUFFICIENT_SECURITY 0x0E /* Connection Rejected Due To Security Reasons */
#define ESP_HCI_ERR_BD_ADDR_UNACCEPTABLE 0x0F /* Connection Rejected due to Unacceptable BD_ADDR */
#define ESP_HCI_ERR_CONN_ACCEPT_TIMEOUT 0x10 /* Connection Accept Timeout Exceeded */
#define ESP_HCI_ERR_UNSUPP_FEATURE_PARAM_VAL 0x11 /* Unsupported Feature or Parameter Value */
#define ESP_HCI_ERR_INVALID_PARAM 0x12 /* Invalid HCI Command Parameters */
#define ESP_HCI_ERR_REMOTE_USER_TERM_CONN 0x13 /* Remote User Terminated Connection */
#define ESP_HCI_ERR_REMOTE_LOW_RESOURCES 0x14 /* Remote Device Terminated Connection due to Low Resources */
#define ESP_HCI_ERR_REMOTE_POWER_OFF 0x15 /* Remote Device Terminated Connection due to Power Off */
#define ESP_HCI_ERR_LOCALHOST_TERM_CONN 0x16 /* Connection Terminated By Local Host */
#define ESP_HCI_ERR_REPEATED_ATTEMPTS 0x17 /* Repeated Attempts */
#define ESP_HCI_ERR_PAIRING_NOT_ALLOWED 0x18 /* Pairing Not Allowed */
#define ESP_HCI_ERR_UNKNOWN_LMP_PDU 0x19 /* Unknown LMP PDU */
#define ESP_HCI_ERR_UNSUPP_REMOTE_FEATURE 0x1A /* Unsupported Remote Feature */
#define ESP_HCI_ERR_SCO_OFFSET_REJECTED 0x1B /* SCO Offset Rejected */
#define ESP_HCI_ERR_SCO_INTERVAL_REJECTED 0x1C /* SCO Interval Rejected */
#define ESP_HCI_ERR_SCO_AIR_MODE_REJECTED 0x1D /* SCO Air Mode Rejected */
#define ESP_HCI_ERR_INVALID_LL_PARAM 0x1E /* Invalid LMP Parameters / Invalid LL Parameters */
#define ESP_HCI_ERR_UNSPECIFIED 0x1F /* Unspecified Error */
#define ESP_HCI_ERR_UNSUPP_LL_PARAM_VAL 0x20 /* Unsupported LMP Parameter Value / Unsupported LL Parameter Value */
#define ESP_HCI_ERR_ROLE_CHANGE_NOT_ALLOWED 0x21 /* Role Change Not Allowed */
#define ESP_HCI_ERR_LL_RESP_TIMEOUT 0x22 /* LMP Response Timeout / LL Response Timeout */
#define ESP_HCI_ERR_LL_PROC_COLLISION 0x23 /* LMP Error Transaction Collision / LL Procedure Collision */
#define ESP_HCI_ERR_LMP_PDU_NOT_ALLOWED 0x24 /* LMP PDU Not Allowed */
#define ESP_HCI_ERR_ENC_MODE_NOT_ACCEPTABLE 0x25 /* Encryption Mode Not Acceptable */
#define ESP_HCI_ERR_LINK_KEY_CANNOT_BE_CHANGED 0x26 /* Link Key cannot be Changed */
#define ESP_HCI_ERR_REQUESTED_QOS_NOT_SUPPORTED 0x27 /* Requested QoS Not Supported */
#define ESP_HCI_ERR_INSTANT_PASSED 0x28 /* Instant Passed */
#define ESP_HCI_ERR_PAIRING_NOT_SUPPORTED 0x29 /* Pairing With Unit Key Not Supported */
#define ESP_HCI_ERR_DIFF_TRANS_COLLISION 0x2A /* Different Transaction Collision */
#define ESP_HCI_ERR_UNDEFINED_0x2B 0x2B /* Reserved for future use */
#define ESP_HCI_ERR_QOS_UNACCEPTABLE_PARAM 0x2C /* QoS Unacceptable Parameter */
#define ESP_HCI_ERR_QOS_REJECTED 0x2D /* QoS Rejected */
#define ESP_HCI_ERR_CHAN_ASSESS_NOT_SUPPORTED 0x2E /* Channel Classification Not Supported */
#define ESP_HCI_ERR_INSUFF_SECURITY 0x2F /* Insufficient Security */
#define ESP_HCI_ERR_PARAM_OUT_OF_MANDATORY_RANGE 0x30 /* Parameter Out Of Mandatory Range */
#define ESP_HCI_ERR_UNDEFINED_0x31 0x31 /* Reserved for future use */
#define ESP_HCI_ERR_ROLE_SWITCH_PENDING 0x32 /* Role Switch Pending */
#define ESP_HCI_ERR_UNDEFINED_0x33 0x33 /* Reserved for future use */
#define ESP_HCI_ERR_RESERVED_SLOT_VIOLATION 0x34 /* Reserved Slot Violation */
#define ESP_HCI_ERR_ROLE_SWITCH_FAILED 0x35 /* Role Switch Failed */
#define ESP_HCI_ERR_EXT_INQ_RESP_TOO_LARGE 0x36 /* Extended Inquiry Response Too Large */
#define ESP_HCI_ERR_SIMPLE_PAIR_NOT_SUPP_BY_HOST 0x37 /* Secure Simple Pairing Not Supported By Host */
#define ESP_HCI_ERR_HOST_BUSY_PAIRING 0x38 /* Host Busy - Pairing*/
#define ESP_HCI_ERR_CONN_REJECTED_DUE_TO_NO_CHAN 0x39 /* Connection Rejected due to No Suitable Channel Found */
#define ESP_HCI_ERR_CONTROLLER_BUSY 0x3A /* Controller Busy */
#define ESP_HCI_ERR_UNACCEPT_CONN_PARAM 0x3B /* Unacceptable Connection Parameters */
#define ESP_HCI_ERR_ADV_TIMEOUT 0x3C /* Advertising Timeout */
#define ESP_HCI_ERR_TERM_DUE_TO_MIC_FAIL 0x3D /* Connection Terminated due to MIC Failure */
#define ESP_HCI_ERR_CONN_FAIL_TO_ESTAB 0x3E /* Connection Failed to be Established / Synchronization Timeout */
#define ESP_HCI_ERR_MAC_CONN_FAILED 0x3F /* Previously used */
#define ESP_HCI_ERR_CLOCK_ADJUST_REJECTED 0x40 /* Coarse Clock Adjustment Rejected but Will Try to Adjust Using Clock Dragging */
#define ESP_HCI_ERR_SUBMAP_NOT_DEFINED 0x41 /* Type0 Submap Not Defined */
#define ESP_HCI_ERR_UNKNOWN_ADV_IDENTIFIER 0x42 /* Unknown Advertising Identifier */
#define ESP_HCI_ERR_LIMIT_REACHED 0x43 /* Limit Reached */
#define ESP_HCI_ERR_OP_CANCELLED_BY_HOST 0x44 /* Operation Cancelled by Host */
#define ESP_HCI_ERR_PACKET_TOO_LONG 0x45 /* Packet Too Long */
#define ESP_HCI_ERR_TOO_LATE 0x46 /* Too Late */
#define ESP_HCI_ERR_TOO_EARLY 0x47 /* Too Early */
#define ESP_HCI_ERR_INSUFFICIENT_CHANNELS 0x48 /* Insufficient Channels */
/* relate to BT_STATUS_xxx in bt_def.h */
/// Status Return Value
typedef enum {

View File

@ -232,6 +232,19 @@ typedef enum {
ESP_GAP_BLE_SET_CSA_SUPPORT_COMPLETE_EVT, /*!< When set CSA support complete, the event comes */
ESP_GAP_BLE_SET_VENDOR_EVT_MASK_COMPLETE_EVT, /*!< When set vendor event mask complete, the event comes */
ESP_GAP_BLE_VENDOR_HCI_EVT, /*!< When BLE vendor HCI event received, the event comes */
// BLE power control
ESP_GAP_BLE_ENH_READ_TRANS_PWR_LEVEL_EVT, /*!< When reading the current and maximum transmit power levels of the local Controller complete, the event comes */
ESP_GAP_BLE_READ_REMOTE_TRANS_PWR_LEVEL_EVT, /*!< When reading the transmit power level used by the remote Controller on the ACL connection complete, the event comes */
ESP_GAP_BLE_SET_PATH_LOSS_RPTING_PARAMS_EVT, /*!< when set the path loss threshold reporting parameters complete, the event comes */
ESP_GAP_BLE_SET_PATH_LOSS_RPTING_ENABLE_EVT, /*!< when enable or disable path loss reporting complete, the event comes */
ESP_GAP_BLE_SET_TRANS_PWR_RPTING_ENABLE_EVT, /*!< when enable or disable the reporting to the local Host of transmit power level changes complete, the event comes */
ESP_GAP_BLE_PATH_LOSS_THRESHOLD_EVT, /*!< when receive a path loss threshold crossing, the event comes */
ESP_GAP_BLE_TRANS_PWR_RPTING_EVT, /*!< when receive a transmit power level report, the event comes */
// BLE connection subrating
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;
@ -1078,6 +1091,71 @@ typedef enum{
ESP_BLE_DEVICE_PRIVACY_MODE = 0X01, /*!< Device Privacy Mode for peer device */
} esp_ble_privacy_mode_t;
/**
* @brief path loss report parameters
*/
typedef struct {
uint16_t conn_handle; /*!< Connection_Handle */
uint8_t high_threshold; /*!< High threshold for the path loss (dB) */
uint8_t high_hysteresis; /*!< Hysteresis value for the high threshold (dB) */
uint8_t low_threshold; /*!< Low threshold for the path loss (dB) */
uint8_t low_hysteresis; /*!< Hysteresis value for the low threshold (dB) */
uint16_t min_time_spent; /*!< Minimum time in number of connection events to be observed
once the path loss crosses the threshold before an event is generated */
} esp_ble_path_loss_rpt_params_t;
typedef enum {
/*!< No PHY is set, should not be used */
ESP_BLE_CONN_TX_POWER_PHY_NONE = 0,
/*!< LE 1M PHY */
ESP_BLE_CONN_TX_POWER_PHY_1M = 0x01,
/*!< LE 2M PHY */
ESP_BLE_CONN_TX_POWER_PHY_2M = 0x02,
/*!< LE Coded PHY using S=8 coding */
ESP_BLE_CONN_TX_POWER_PHY_CODED_S8 = 0x03,
/*!< LE Coded PHY using S=2 coding */
ESP_BLE_CONN_TX_POWER_PHY_CODED_S2 = 0x04,
} esp_ble_tx_power_phy_t;
typedef enum {
/*!< Low zone entered */
ESP_BLE_CONN_PATH_LOSS_ZONE_ENTERED_LOW = 0x00,
/*!< Middle zone entered */
ESP_BLE_CONN_PATH_LOSS_ZONE_ENTERED_MIDDLE = 0x01,
/*!< High zone entered */
ESP_BLE_CONN_PATH_LOSS_ZONE_ENTERED_HIGH = 0x02,
} esp_ble_path_loss_zone_t;
/**
* @brief Connection subrating default parameters
*/
typedef struct {
uint16_t subrate_min; /*!< Minimum subrate factor allowed in requests by a Peripheral. Range: 0x0001 to 0x01F4, default: 0x0001 */
uint16_t subrate_max; /*!< Maximum subrate factor allowed in requests by a Peripheral. Range: 0x0001 to 0x01F4, default: 0x0001. subrate_max × (max_latency + 1) should not be greater than 500 */
uint16_t max_latency; /*!< Maximum Peripheral latency allowed in requests by a Peripheral, in units of subrated connection intervals.
Range: 0x0000 to 0x01F3, default: 0x0000 */
uint16_t continuation_number; /*!< Minimum number of underlying connection events to remain active after a packet containing a Link Layer
PDU with a non-zero Length field is sent or received in requests by a Peripheral. Range: 0x0000 to 0x01F3,
default: 0x0000. continuation_number should not greater than or equal to subrate_max */
uint16_t supervision_timeout; /*!< Maximum supervision timeout allowed in requests by a Peripheral (N * 10 ms). Range: 0x000A to 0x0C80,
Time Range: 100 ms to 32 s, default: 0x0C80 (32 s) */
} esp_ble_default_subrate_param_t;
/**
* @brief Connection subrating request parameters
*/
typedef struct {
uint16_t conn_handle; /*!< Connection handle of the ACL */
uint16_t subrate_min; /*!< Minimum subrate factor to be applied to the underlying connection interval. Range: 0x0001 to 0x01F4 */
uint16_t subrate_max; /*!< Maximum subrate factor to be applied to the underlying connection interval. Range: 0x0001 to 0x01F4 */
uint16_t max_latency; /*!< Maximum Peripheral latency for the connection in units of subrated connection intervals. Range: 0x0000 to 0x01F3 */
uint16_t continuation_number; /*!< Minimum number of underlying connection events to remain active after a packet containing
a Link Layer PDU with a non-zero Length field is sent or received. Range: 0x0000 to 0x01F3 */
uint16_t supervision_timeout; /*!< Supervision timeout for this connection (N * 10 ms). Range: 0x000A to 0x0C80, Time Range: 100 ms to 32 s
The supervision_timeout, in milliseconds, shall be greater than 2 × current connection interval × subrate_max × (max_latency + 1) */
} esp_ble_subrate_req_param_t;
/**
* @brief Gap callback parameters union
*/
@ -1597,6 +1675,115 @@ typedef union {
uint8_t param_len; /*!< The length of the event parameter buffer */
uint8_t *param_buf; /*!< The pointer of the event parameter buffer */
} vendor_hci_evt; /*!< Event parameter buffer of ESP_GAP_BLE_VENDOR_HCI_EVT */
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
/**
* @brief ESP_GAP_BLE_ENH_READ_TRANS_PWR_LEVEL_EVT
*/
struct ble_enh_read_trans_pwr_level_param {
esp_bt_status_t status; /*!< Indicate enhance reading transmit power level complete status, status = (controller error code | 0x100) if status is not equal to 0 */
uint16_t conn_handle; /*!< Connection_Handle */
uint8_t phy; /*!< 1M, 2M, Coded S2 or Coded S8 phy
0x01: LE 1M PHY
0x02: LE 2M PHY
0x03: LE Coded PHY with S=8 data coding
0x04: LE Coded PHY with S=2 data coding
*/
int8_t cur_tx_pwr_level; /*!< Current transmit power level, Range: -127 to 20, Units: dBm */
int8_t max_tx_pwr_level; /*!< Maximum transmit power level, Range: -127 to 20, Units: dBm */
} enh_trans_pwr_level_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_CSA_SUPPORT_COMPLETE_EVT */
/**
* @brief ESP_GAP_BLE_READ_REMOTE_TRANS_PWR_LEVEL_EVT
*/
struct ble_read_remote_trans_pwr_level_param {
esp_bt_status_t status; /*!< Indicate reading remote transmit power level complete status, status = (controller error code | 0x100) if status is not equal to 0 */
} read_remote_trans_pwr_level_cmpl; /*!< Event parameter of ESP_GAP_BLE_READ_REMOTE_TRANS_PWR_LEVEL_EVT */
/**
* @brief ESP_GAP_BLE_SET_PATH_LOSS_RPTING_PARAMS_EVT
*/
struct ble_set_path_loss_rpting_param {
esp_bt_status_t status; /*!< Indicate setting path loss reporting paramwters complete status, status = (controller error code | 0x100) if status is not equal to 0 */
uint16_t conn_handle; /*!< The ACL connection identifier */
} set_path_loss_rpting_params; /*!< Event parameter of ESP_GAP_BLE_SET_PATH_LOSS_RPTING_PARAMS_EVT */
/**
* @brief ESP_GAP_BLE_SET_PATH_LOSS_RPTING_ENABLE_EVT
*/
struct ble_set_path_loss_rpting_enable {
esp_bt_status_t status; /*!< Indicate setting path loss reporting enable complete status, status = (controller error code | 0x100) if status is not equal to 0 */
uint16_t conn_handle; /*!< The ACL connection identifier */
} set_path_loss_rpting_enable; /*!< Event parameter of ESP_GAP_BLE_SET_PATH_LOSS_RPTING_ENABLE_EVT */
/**
* @brief ESP_GAP_BLE_SET_TRANS_PWR_RPTING_ENABLE_EVT
*/
struct ble_set_trans_pwr_rpting_enable {
esp_bt_status_t status; /*!< Indicate setting transmit power reporting enable complete status, status = (controller error code | 0x100) if status is not equal to 0 */
uint16_t conn_handle; /*!< The ACL connection identifier */
} set_trans_pwr_rpting_enable; /*!< Event parameter of ESP_GAP_BLE_SET_TRANS_PWR_RPTING_ENABLE_EVT */
/**
* @brief ESP_GAP_BLE_PATH_LOSS_THRESHOLD_EVT
*/
struct ble_path_loss_thres_evt {
uint16_t conn_handle; /*!< The ACL connection identifier */
uint8_t cur_path_loss; /*!< Current path loss (always zero or positive), Units: dB */
esp_ble_path_loss_zone_t zone_entered; /*!< which zone was entered. If cur_path_loss is set to 0xFF then zone_entered shall be ignored */
} path_loss_thres_evt; /*!< Event parameter of ESP_GAP_BLE_PATH_LOSS_THRESHOLD_EVT */
/**
* @brief ESP_GAP_BLE_TRANS_PWR_RPTING_EVT
*/
struct ble_trans_power_report_evt {
esp_bt_status_t status; /*!< Indicate esp_ble_gap_read_remote_transmit_power_level() command success, status = (controller error code | 0x100) if status is not equal to 0 */
uint16_t conn_handle; /*!< The ACL connection identifier */
uint8_t reason; /*!< indicate why the event was sent and the device whose transmit power level is being reported
0x00: Local transmit power changed
0x01: Remote transmit power changed
0x02: esp_ble_gap_read_remote_transmit_power_level() command completed,
In this case, the phy, tx_power_level, tx_power_level_flag and delta parameters shall refer to the remote device */
esp_ble_tx_power_phy_t phy; /*!< 1M, 2M, Coded S2 or Coded S8 phy
0x01: LE 1M PHY
0x02: LE 2M PHY
0x03: LE Coded PHY with S=8 data coding
0x04: LE Coded PHY with S=2 data coding */
int8_t tx_power_level; /*!< Transmit power level, range: -127 to 20, units: dBm
0x7E: Remote device is not managing power levels on this PHY
0x7F: Transmit power level is not available */
uint8_t tx_power_level_flag; /*!< whether the transmit power level that is being reported has reached its minimum and/or maximum level */
int8_t delta; /*!< Change in transmit power level (positive indicates increased power, negative indicates decreased power, zero indicates unchanged) Units: dB.
0x7F: Change is not available or is out of range */
} trans_power_report_evt; /*!< Event parameter of ESP_GAP_BLE_TRANS_PWR_RPTING_EVT */
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
/**
* @brief ESP_GAP_BLE_SET_DEFAULT_SUBRATE_COMPLETE_EVT
*/
struct ble_default_subrate_evt {
esp_bt_status_t status; /*!< Indicate setting default subrate command success, status = (controller error code | 0x100) if status is not equal to 0 */
} set_default_subrate_evt; /*!< Event parameter of ESP_GAP_BLE_SET_DEFAULT_SUBRATE_COMPLETE_EVT */
/**
* @brief ESP_GAP_BLE_SUBRATE_REQUEST_COMPLETE_EVT
*/
struct ble_subrate_request_evt {
esp_bt_status_t status; /*!< Indicate subrate request command success, status = (controller error code | 0x100) if status is not equal to 0 */
} subrate_req_cmpl_evt; /*!< Event parameter of ESP_GAP_BLE_SUBRATE_REQUEST_COMPLETE_EVT */
/**
* @brief ESP_GAP_BLE_SUBRATE_CHANGE_EVT
*/
struct ble_subrate_change_evt {
esp_bt_status_t status; /*!< command succeeded or this event was generated following a request from the peer device. status = (controller error code | 0x100) if status is not equal to 0 */
uint16_t conn_handle; /*!< connection handle */
uint16_t subrate_factor; /*!< New subrate factor applied to the specified underlying connection interval, range 0x0001 to 0x01F4 */
uint16_t peripheral_latency; /*!< New Peripheral latency for the connection in number of subrated connection events, range: 0x0000 to 0x01F3 */
uint16_t continuation_number; /*!< Number of underlying connection events to remain active after a packet containing a Link Layer PDU with a non-zero Length field is sent or received, range: 0x0000 to 0x01F3 */
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;
/**
@ -2810,6 +2997,127 @@ esp_err_t esp_ble_gap_set_csa_support(uint8_t csa_select);
*/
esp_err_t esp_ble_gap_set_vendor_event_mask(uint32_t event_mask);
/**
* @brief This function is used to read the current and maximum transmit power levels of the local Controller.
*
*
* @param[in] conn_handle: The ACL connection identified.
* @param[in] phy: 1M, 2M, Coded S2 or Coded S8.
*
* @return
* - ESP_OK : success
* - other : failed
*/
esp_err_t esp_ble_gap_enhanced_read_transmit_power_level(uint16_t conn_handle, esp_ble_tx_power_phy_t phy);
/**
* @brief This function is used to read the transmit power level used by the remote Controller on the ACL connection.
*
*
* @param[in] conn_handle: The ACL connection identifier.
* @param[in] phy: 1M, 2M, Coded S2 or Coded S8.
*
* @return
* - ESP_OK : success
* - other : failed
*/
esp_err_t esp_ble_gap_read_remote_transmit_power_level(uint16_t conn_handle, esp_ble_tx_power_phy_t phy);
/**
* @brief This function is used to set the path loss threshold reporting parameters.
*
*
* @param[in] path_loss_rpt_params: The path loss threshold reporting parameters.
*
*
* @return
* - ESP_OK : success
* - other : failed
*/
esp_err_t esp_ble_gap_set_path_loss_reporting_params(esp_ble_path_loss_rpt_params_t *path_loss_rpt_params);
/**
* @brief This function is used to enable or disable path loss reporting.
*
*
* @param[in] conn_handle: The ACL connection identifier.
* @param[in] enable: Reporting disabled or enabled.
*
*
* @return
* - ESP_OK : success
* - other : failed
*/
esp_err_t esp_ble_gap_set_path_loss_reporting_enable(uint16_t conn_handle, bool enable);
/**
* @brief This function is used to enable or disable the reporting to the local Host of transmit power level changes in the local and remote Controllers.
*
*
* @param[in] conn_handle: The ACL connection identifier.
* @param[in] local_enable: Disable or enable local transmit power reports.
* @param[in] remote_enable: Disable or enable remote transmit power reports.
*
* @return
* - ESP_OK : success
* - other : failed
*/
esp_err_t esp_ble_gap_set_transmit_power_reporting_enable(uint16_t conn_handle, bool local_enable, bool remote_enable);
/**
* @brief This function is used to set the initial values for the acceptable parameters for subrating requests,
* for all future ACL connections where the Controller is the Central. This command does not affect any
* existing connection.
*
*
* @param[in] default_subrate_params: The default subrate parameters.
*
*
* @return
* - ESP_OK : success
* - other : failed
*/
esp_err_t esp_ble_gap_set_default_subrate(esp_ble_default_subrate_param_t *default_subrate_params);
/**
* @brief This function is used by a Central or a Peripheral to request a change to the subrating factor and/or other parameters
* applied to an existing connection.
*
* If this API is issued on the Central, the following rules shall apply when the Controller initiates the Connection Subrate Update procedure:
* 1. The Peripheral latency shall be less than or equal to max_latency.
* 2. The subrate factor shall be between subrate_min and subrate_max.
* 3. The continuation number shall be equal to the lesser of continuation_number and (subrate factor - 1).
* 4. The connection supervision timeout shall be equal to supervision_timeout.
*
* If this API is issued on the Peripheral, the following rules shall apply when the Controller initiates the Connection Subrate Request procedure:
* 1. The Peripheral latency shall be less than or equal to max_latency.
* 2. The minimum and maximum subrate factors shall be between subrate_min and subrate_max.
* 3. The continuation number shall be equal to the lesser of continuation_number and (maximum subrate factor - 1).
* 4.The connection supervision timeout shall be equal to supervision_timeout.
*
*
* @param[in] subrate_req_params: The subrate request parameters.
*
*
* @return
* - ESP_OK : success
* - other : failed
*/
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

View File

@ -6096,6 +6096,239 @@ void bta_dm_ble_gap_set_periodic_adv_sync_trans_params(tBTA_DM_MSG *p_data)
p_data->ble_set_past_params.params.cte_type);
}
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
void bta_dm_ble_big_create(tBTA_DM_MSG *p_data)
{
APPL_TRACE_API("%s", __func__);
tBTA_DM_BLE_BIG_CREATE_PARAMS param = p_data->big_creat.big_creat_param;
BTM_BleBigCreate(param.big_handle, param.adv_handle, param.num_bis,
param.sdu_interval, param.max_sdu, param.max_transport_latency,
param.rtn, param.phy, param.packing, param.framing,
param.encryption, &param.broadcast_code[0]);
}
void bta_dm_ble_big_create_test(tBTA_DM_MSG *p_data)
{
APPL_TRACE_API("%s", __func__);
tBTA_DM_BLE_BIG_CREATE_TEST_PARAMS param = p_data->big_creat_test.big_creat_test_param;
BTM_BleBigCreateTest(param.big_handle, param.adv_handle, param.num_bis,
param.sdu_interval, param.iso_interval, param.nse,
param.max_sdu, param.max_pdu, param.phy,
param.packing, param.framing, param.bn, param.irc,
param.pto, param.encryption, &param.broadcast_code[0]);
}
void bta_dm_ble_big_terminate(tBTA_DM_MSG *p_data)
{
APPL_TRACE_API("%s", __func__);
tBTA_DM_BLE_BIG_TERMINATE_PARAMS param = p_data->big_terminate.big_terminate_param;
BTM_BleBigTerminate(param.big_handle, param.reason);
}
#endif // #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
void bta_dm_ble_big_sync_create(tBTA_DM_MSG *p_data)
{
APPL_TRACE_API("%s", __func__);
tBTA_DM_BLE_BIG_SYNC_CREATE_PARAMS param = p_data->big_sync.big_sync_param;
BTM_BleBigSyncCreate(param.big_handle, param.sync_handle,
param.encryption, &param.bc_code[0],
param.mse, param.big_sync_timeout,
param.num_bis, &param.bis[0]);
}
void bta_dm_ble_big_sync_terminate(tBTA_DM_MSG *p_data)
{
APPL_TRACE_API("%s", __func__);
tBTA_DM_BLE_BIG_SYNC_TERMINATE_PARAMS param = p_data->big_sync_terminate.big_sync_terminate_param;
BTM_BleBigSyncTerminate(param.big_handle);
}
#endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
void bta_dm_ble_iso_set_data_path(tBTA_DM_MSG *p_data)
{
APPL_TRACE_API("%s", __func__);
tBTA_DM_BLE_ISO_SET_DATA_PATH_PARAMS param = p_data->iso_set_data_path.iso_data_path_param;
BTM_BleIsoSetDataPath(param.conn_handle, param.data_path_dir, param.data_path_id, param.coding_fmt,
param.company_id, param.vs_codec_id, param.controller_delay, param.codec_len,
param.codec_cfg);
}
void bta_dm_ble_iso_remove_data_path(tBTA_DM_MSG *p_data)
{
APPL_TRACE_API("%s", __func__);
tBTA_DM_BLE_ISO_REMOVE_DATA_PATH_PARAMS param = p_data->iso_remove_data_path.iso_data_path_remove_param;
BTM_BleIsoRemoveDataPath(param.conn_handle, param.data_path_dir);
}
void bta_dm_ble_iso_read_tx_sync(tBTA_DM_MSG *p_data)
{
APPL_TRACE_API("%s", __func__);
BTM_BleIsoReadTxSync(p_data->iso_read_tx_sync.iso_hdl);
}
void bta_dm_ble_iso_read_link_quality(tBTA_DM_MSG *p_data)
{
APPL_TRACE_API("%s", __func__);
BTM_BleIsoReadLinkQuality(p_data->iso_read_link_quality.iso_hdl);
}
#if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
void bta_dm_ble_set_cig_params(tBTA_DM_MSG *p_data)
{
APPL_TRACE_API("%s", __func__);
BTM_BleSetCigParams(p_data->api_cig_params.cig_id, p_data->api_cig_params.sdu_int_c_to_p, p_data->api_cig_params.sdu_int_p_to_c, p_data->api_cig_params.worse_case_SCA, p_data->api_cig_params.packing,
p_data->api_cig_params.framing, p_data->api_cig_params.mtl_c_to_p, p_data->api_cig_params.mtl_p_to_c, p_data->api_cig_params.cis_cnt, (uint8_t *)p_data->api_cig_params.cis_params);
}
void bta_dm_ble_set_cig_params_test(tBTA_DM_MSG *p_data)
{
APPL_TRACE_API("%s", __func__);
BTM_BleSetCigParamsTest(p_data->api_cig_params_test.cig_id, p_data->api_cig_params_test.sdu_int_c_to_p, p_data->api_cig_params_test.sdu_int_p_to_c,
p_data->api_cig_params_test.ft_c_to_p, p_data->api_cig_params_test.ft_p_to_c, p_data->api_cig_params_test.iso_interval,
p_data->api_cig_params_test.worse_case_SCA, p_data->api_cig_params_test.packing, p_data->api_cig_params_test.framing,
p_data->api_cig_params_test.cis_cnt, (uint8_t *)p_data->api_cig_params_test.cis_params_test);
}
void bta_dm_ble_create_cis(tBTA_DM_MSG *p_data)
{
APPL_TRACE_API("%s", __func__);
BTM_BleCreateCis(p_data->create_cis.cis_count, (uint8_t *)&p_data->create_cis.cis_hdls[0]);
}
void bta_dm_ble_remove_cig(tBTA_DM_MSG *p_data)
{
APPL_TRACE_API("%s", __func__);
BTM_BleRemoveCig(p_data->remove_cig.cig_id);
}
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
void bta_dm_ble_accept_cis_req(tBTA_DM_MSG *p_data)
{
APPL_TRACE_API("%s", __func__);
BTM_BleAcceptCisReq(p_data->accept_cis_req.cis_handle);
}
void bta_dm_ble_reject_cis_req(tBTA_DM_MSG *p_data)
{
APPL_TRACE_API("%s", __func__);
BTM_BleRejectCisReq(p_data->reject_cis_req.cis_handle, p_data->reject_cis_req.reason);
}
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_EN == TRUE)
void bta_dm_ble_discon_cis(tBTA_DM_MSG *p_data)
{
APPL_TRACE_API("%s", __func__);
BTM_BleDisconCis(p_data->discon_cis.cis_handle, p_data->discon_cis.reason);
}
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
void bta_dm_ble_set_cte_trans_params(tBTA_DM_MSG *p_data)
{
BTM_BleSetCteTransParams(p_data->set_cte_trans_params.adv_handle, p_data->set_cte_trans_params.cte_len, p_data->set_cte_trans_params.cte_type,
p_data->set_cte_trans_params.cte_count, p_data->set_cte_trans_params.switching_pattern_len, p_data->set_cte_trans_params.antenna_ids);
}
void bta_dm_ble_set_cte_trans_enable(tBTA_DM_MSG *p_data)
{
BTM_BleCteSetConnectionlessTransEnable(p_data->set_trans_en.adv_handle, p_data->set_trans_en.cte_enable);
}
void bta_dm_ble_set_iq_sampling_en(tBTA_DM_MSG *p_data)
{
BTM_BleCteSetConnectionlessIqSamplingEnable(p_data->iq_samp_en.sync_handle, p_data->iq_samp_en.sampling_en, p_data->iq_samp_en.slot_dur,
p_data->iq_samp_en.max_sampled_ctes, p_data->iq_samp_en.switching_pattern_len, p_data->iq_samp_en.antenna_ids);
}
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
void bta_dm_ble_set_conn_cte_recv_params(tBTA_DM_MSG *p_data)
{
BTM_BleCteSetConnectionReceiveParams(p_data->recv_params.conn_handle, p_data->recv_params.sampling_en, p_data->recv_params.slot_dur,
p_data->recv_params.switching_pattern_len, p_data->recv_params.antenna_ids);
}
void bta_dm_ble_set_conn_trans_params(tBTA_DM_MSG *p_data)
{
BTM_BleCteSetConnectionTransParams(p_data->conn_trans_params.conn_handle, p_data->conn_trans_params.cte_types,
p_data->conn_trans_params.switching_pattern_len, p_data->conn_trans_params.antenna_ids);
}
void bta_dm_ble_set_conn_cte_req_en(tBTA_DM_MSG *p_data)
{
BTM_BleCteSetConnectionRequestEnable(p_data->conn_req_en.conn_handle, p_data->conn_req_en.enable, p_data->conn_req_en.cte_req_interval,
p_data->conn_req_en.req_cte_len, p_data->conn_req_en.req_cte_Type);
}
void bta_dm_ble_set_conn_cte_rsp_en(tBTA_DM_MSG *p_data)
{
BTM_BleCteSetConnectionRspEnable(p_data->conn_rsp_en.conn_handle, p_data->conn_rsp_en.enable);
}
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
void bta_dm_ble_read_cte_ant_infor(tBTA_DM_MSG *p_data)
{
BTM_BleCteReadAntInfor();
}
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
void bta_dm_api_enh_read_trans_power_level(tBTA_DM_MSG *p_data)
{
BTM_BleEnhReadTransPowerLevel(p_data->enh_read_trans_pwr_level.conn_handle, p_data->enh_read_trans_pwr_level.phy);
}
void bta_dm_api_read_rem_trans_power_level(tBTA_DM_MSG *p_data)
{
BTM_BleReadRemoteTransPwrLevel(p_data->remote_trans_pwr_level.conn_handle, p_data->remote_trans_pwr_level.phy);
}
void bta_dm_api_set_path_loss_report_params(tBTA_DM_MSG *p_data)
{
BTM_BleSetPathLossRptParams(p_data->path_loss_rpt_params.conn_handle, p_data->path_loss_rpt_params.high_threshold, p_data->path_loss_rpt_params.high_hysteresis,
p_data->path_loss_rpt_params.low_threshold, p_data->path_loss_rpt_params.low_hysteresis, p_data->path_loss_rpt_params.min_time_spent);
}
void bta_dm_api_set_path_loss_reporting_en(tBTA_DM_MSG *p_data)
{
BTM_BleSetPathLossRptEnable(p_data->path_loss_rpt_en.conn_handle, p_data->path_loss_rpt_en.enable);
}
void bta_dm_api_set_trans_power_reporting_en(tBTA_DM_MSG *p_data)
{
BTM_BleSetTransPwrRptEnable(p_data->trans_pwr_rpt_en.conn_handle, p_data->trans_pwr_rpt_en.local_enable, p_data->trans_pwr_rpt_en.remote_enable);
}
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
void bta_dm_api_set_default_subrate(tBTA_DM_MSG *p_data)
{
BTM_BleSetDefaultSubrate(p_data->default_subrate.subrate_min, p_data->default_subrate.subrate_max, p_data->default_subrate.max_latency,
p_data->default_subrate.continuation_number, p_data->default_subrate.supervision_timeout);
}
void bta_dm_api_subrate_request(tBTA_DM_MSG *p_data)
{
BTM_BleSubrateRequest(p_data->subrate_request.conn_handle, p_data->subrate_request.subrate_min, p_data->subrate_request.subrate_max,
p_data->subrate_request.max_latency, p_data->subrate_request.continuation_number, p_data->subrate_request.supervision_timeout);
}
#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)
/*******************************************************************************
**

View File

@ -3026,6 +3026,133 @@ void BTA_DmBleGapSetVendorEventMask(uint32_t evt_mask, tBTA_SET_VENDOR_EVT_MASK_
}
}
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
void BTA_DmBleGapEnhReadTransPwrLevel(uint16_t conn_handle, uint8_t phy)
{
tBTA_DM_API_BLE_ENH_READ_TANS_PWR_LEVEL *p_msg;
if ((p_msg = (tBTA_DM_API_BLE_ENH_READ_TANS_PWR_LEVEL *)osi_malloc(sizeof(tBTA_DM_API_BLE_ENH_READ_TANS_PWR_LEVEL)))
!= NULL) {
p_msg->hdr.event = BTA_DM_API_ENH_READ_TRANS_POWER_LEVEL;
p_msg->conn_handle = conn_handle;
p_msg->phy = phy;
bta_sys_sendmsg(p_msg);
}
}
void BTA_DmBleGapReadRemoteTransPwrLevel(uint16_t conn_handle, uint8_t phy)
{
tBTA_DM_API_BLE_READ_REMOTE_TANS_PWR_LEVEL *p_msg;
if ((p_msg = (tBTA_DM_API_BLE_READ_REMOTE_TANS_PWR_LEVEL *)osi_malloc(sizeof(tBTA_DM_API_BLE_READ_REMOTE_TANS_PWR_LEVEL)))
!= NULL) {
p_msg->hdr.event = BTA_DM_API_READ_REM_TRANS_POWER_LEVEL;
p_msg->conn_handle = conn_handle;
p_msg->phy = phy;
bta_sys_sendmsg(p_msg);
}
}
void BTA_DmBleGapSetPathLossRptParams(uint16_t conn_handle, uint8_t high_threshold, uint8_t high_hysteresis,
uint8_t low_threshold, uint8_t low_hysteresis, uint16_t min_time_spent)
{
tBTA_DM_API_BLE_SET_PATH_LOSS_RPT_PARAMS *p_msg;
if ((p_msg = (tBTA_DM_API_BLE_SET_PATH_LOSS_RPT_PARAMS *)osi_malloc(sizeof(tBTA_DM_API_BLE_SET_PATH_LOSS_RPT_PARAMS)))
!= NULL) {
p_msg->hdr.event = BTA_DM_API_SET_PATH_LOSS_REPORT_PARAMS;
p_msg->conn_handle = conn_handle;
p_msg->high_threshold = high_threshold;
p_msg->high_hysteresis = high_hysteresis;
p_msg->low_threshold = low_threshold;
p_msg->low_hysteresis = low_hysteresis;
p_msg->min_time_spent = min_time_spent;
bta_sys_sendmsg(p_msg);
}
}
void BTA_DmBleGapSetPathLossRptEnable(uint16_t conn_handle, uint8_t enable)
{
tBTA_DM_API_BLE_SET_PATH_LOSS_RPT_ENABLE *p_msg;
if ((p_msg = (tBTA_DM_API_BLE_SET_PATH_LOSS_RPT_ENABLE *)osi_malloc(sizeof(tBTA_DM_API_BLE_SET_PATH_LOSS_RPT_ENABLE)))
!= NULL) {
p_msg->hdr.event = BTA_DM_API_SET_PATH_LOSS_REPORTING_EN;
p_msg->conn_handle = conn_handle;
p_msg->enable = enable;
bta_sys_sendmsg(p_msg);
}
}
void BTA_DmBleGapSetTransPwrRptEnable(uint16_t conn_handle, uint8_t local_enable, uint8_t remote_enable)
{
tBTA_DM_API_BLE_SET_TRANS_PWR_RPT_ENABLE *p_msg;
if ((p_msg = (tBTA_DM_API_BLE_SET_TRANS_PWR_RPT_ENABLE *)osi_malloc(sizeof(tBTA_DM_API_BLE_SET_TRANS_PWR_RPT_ENABLE)))
!= NULL) {
p_msg->hdr.event = BTA_DM_API_SET_TRANS_POWER_REPORTING_EN;
p_msg->conn_handle = conn_handle;
p_msg->local_enable = local_enable;
p_msg->remote_enable = remote_enable;
bta_sys_sendmsg(p_msg);
}
}
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
void BTA_DmBleGapSetDefaultSubrate(uint16_t subrate_min, uint16_t subrate_max, uint16_t max_latency, uint16_t continuation_number, uint16_t supervision_timeout)
{
tBTA_DM_API_BLE_SET_DEFAULT_SUBRATE *p_msg;
if ((p_msg = (tBTA_DM_API_BLE_SET_DEFAULT_SUBRATE *)osi_malloc(sizeof(tBTA_DM_API_BLE_SET_DEFAULT_SUBRATE)))
!= NULL) {
p_msg->hdr.event = BTA_DM_API_SET_DEFALT_SUBRATE;
p_msg->subrate_min = subrate_min;
p_msg->subrate_max = subrate_max;
p_msg->max_latency = max_latency;
p_msg->continuation_number = continuation_number;
p_msg->supervision_timeout = supervision_timeout;
bta_sys_sendmsg(p_msg);
}
}
void BTA_DmBleGapSubrateReqest(uint16_t conn_handle, uint16_t subrate_min, uint16_t subrate_max, uint16_t max_latency, uint16_t continuation_number, uint16_t supervision_timeout)
{
tBTA_DM_API_BLE_SUBRATE_REQUEST *p_msg;
if ((p_msg = (tBTA_DM_API_BLE_SUBRATE_REQUEST *)osi_malloc(sizeof(tBTA_DM_API_BLE_SUBRATE_REQUEST)))
!= NULL) {
p_msg->hdr.event = BTA_DM_API_SUBRATE_REQUEST;
p_msg->conn_handle = conn_handle;
p_msg->subrate_min = subrate_min;
p_msg->subrate_max = subrate_max;
p_msg->max_latency = max_latency;
p_msg->continuation_number = continuation_number;
p_msg->supervision_timeout = supervision_timeout;
bta_sys_sendmsg(p_msg);
}
}
#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
@ -3593,4 +3720,500 @@ void BTA_DmBleGapSetPeriodicAdvSyncTransParams(BD_ADDR peer_addr, tBTA_DM_BLE_PA
}
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
void BTA_DmBleGapIsoBigCreate(tBTA_DM_BLE_BIG_CREATE_PARAMS *p_big_creat_param)
{
tBTA_DM_API_BIG_CREATE *p_msg;
APPL_TRACE_API("%s.", __func__);
if ((p_msg = (tBTA_DM_API_BIG_CREATE *) osi_malloc(sizeof(tBTA_DM_API_BIG_CREATE))) != NULL) {
memset(p_msg, 0, sizeof(tBTA_DM_API_BIG_CREATE));
p_msg->hdr.event = BTA_DM_API_ISO_BIG_CREATE_EVT;
p_msg->big_creat_param.big_handle = p_big_creat_param->big_handle;
p_msg->big_creat_param.adv_handle = p_big_creat_param->adv_handle;
p_msg->big_creat_param.num_bis = p_big_creat_param->num_bis;
p_msg->big_creat_param.sdu_interval = p_big_creat_param->sdu_interval;
p_msg->big_creat_param.max_sdu = p_big_creat_param->max_sdu;
p_msg->big_creat_param.max_transport_latency = p_big_creat_param->max_transport_latency;
p_msg->big_creat_param.rtn = p_big_creat_param->rtn;
p_msg->big_creat_param.phy = p_big_creat_param->phy;
p_msg->big_creat_param.packing = p_big_creat_param->packing;
p_msg->big_creat_param.framing = p_big_creat_param->framing;
p_msg->big_creat_param.encryption = p_big_creat_param->encryption;
memcpy(&p_msg->big_creat_param.broadcast_code[0], p_big_creat_param->broadcast_code, 16);
//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_DmBleGapIsoBigCreateTest(tBTA_DM_BLE_BIG_CREATE_TEST_PARAMS *p_big_creat_test_param)
{
tBTA_DM_API_BIG_CREATE_TEST *p_msg;
APPL_TRACE_API("%s.", __func__);
if ((p_msg = (tBTA_DM_API_BIG_CREATE_TEST *) osi_malloc(sizeof(tBTA_DM_API_BIG_CREATE_TEST))) != NULL) {
memset(p_msg, 0, sizeof(tBTA_DM_API_BIG_CREATE_TEST));
p_msg->hdr.event = BTA_DM_API_ISO_BIG_CREATE_TEST_EVT;
p_msg->big_creat_test_param.big_handle = p_big_creat_test_param->big_handle;
p_msg->big_creat_test_param.adv_handle = p_big_creat_test_param->adv_handle;
p_msg->big_creat_test_param.num_bis = p_big_creat_test_param->num_bis;
p_msg->big_creat_test_param.sdu_interval = p_big_creat_test_param->sdu_interval;
p_msg->big_creat_test_param.iso_interval = p_big_creat_test_param->iso_interval;
p_msg->big_creat_test_param.nse = p_big_creat_test_param->nse;
p_msg->big_creat_test_param.max_sdu = p_big_creat_test_param->max_sdu;
p_msg->big_creat_test_param.max_pdu = p_big_creat_test_param->max_pdu;
p_msg->big_creat_test_param.phy = p_big_creat_test_param->phy;
p_msg->big_creat_test_param.packing = p_big_creat_test_param->packing;
p_msg->big_creat_test_param.framing = p_big_creat_test_param->framing;
p_msg->big_creat_test_param.bn = p_big_creat_test_param->bn;
p_msg->big_creat_test_param.irc = p_big_creat_test_param->irc;
p_msg->big_creat_test_param.pto = p_big_creat_test_param->pto;
p_msg->big_creat_test_param.encryption = p_big_creat_test_param->encryption;
memcpy(&p_msg->big_creat_test_param.broadcast_code[0], p_big_creat_test_param->broadcast_code, 16);
//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_DmBleGapIsoBigTerminate(tBTA_DM_BLE_BIG_TERMINATE_PARAMS *p_big_terminate_param)
{
tBTA_DM_API_BIG_TERMINATE *p_msg;
APPL_TRACE_API("%s.", __func__);
if ((p_msg = (tBTA_DM_API_BIG_TERMINATE *) osi_malloc(sizeof(tBTA_DM_API_BIG_TERMINATE))) != NULL) {
memset(p_msg, 0, sizeof(tBTA_DM_API_BIG_TERMINATE));
p_msg->hdr.event = BTA_DM_API_ISO_BIG_TERMINATE_EVT;
p_msg->big_terminate_param.big_handle = p_big_terminate_param->big_handle;
p_msg->big_terminate_param.reason = p_big_terminate_param->reason;
//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_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
void BTA_DmBleGapIsoBigSyncCreate(tBTA_DM_BLE_BIG_SYNC_CREATE_PARAMS *p_big_sync_param)
{
tBTA_DM_API_BIG_SYNC_CREATE *p_msg;
APPL_TRACE_API("%s.", __func__);
if ((p_msg = (tBTA_DM_API_BIG_SYNC_CREATE *) osi_malloc(sizeof(tBTA_DM_API_BIG_SYNC_CREATE))) != NULL) {
memset(p_msg, 0, sizeof(tBTA_DM_API_BIG_SYNC_CREATE));
p_msg->hdr.event = BTA_DM_API_ISO_BIG_SYNC_CREATE_EVT;
p_msg->big_sync_param.big_handle = p_big_sync_param->big_handle;
p_msg->big_sync_param.sync_handle = p_big_sync_param->sync_handle;
p_msg->big_sync_param.encryption = p_big_sync_param->encryption;
memcpy(&p_msg->big_sync_param.bc_code[0], &p_big_sync_param->bc_code[0], 16);
p_msg->big_sync_param.mse = p_big_sync_param->mse;
p_msg->big_sync_param.big_sync_timeout = p_big_sync_param->big_sync_timeout;
p_msg->big_sync_param.num_bis = p_big_sync_param->num_bis;
memcpy(&p_msg->big_sync_param.bis[0], &p_big_sync_param->bis[0], p_big_sync_param->num_bis);
//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_DmBleGapIsoBigSyncTerminate(tBTA_DM_BLE_BIG_SYNC_TERMINATE_PARAMS *p_big_sync_terminate_param)
{
tBTA_DM_API_BIG_SYNC_TERMINATE *p_msg;
APPL_TRACE_API("%s.", __func__);
if ((p_msg = (tBTA_DM_API_BIG_SYNC_TERMINATE *) osi_malloc(sizeof(tBTA_DM_API_BIG_SYNC_TERMINATE))) != NULL) {
memset(p_msg, 0, sizeof(tBTA_DM_API_BIG_SYNC_TERMINATE));
p_msg->hdr.event = BTA_DM_API_ISO_BIG_SYNC_TERMINATE_EVT;
p_msg->big_sync_terminate_param.big_handle = p_big_sync_terminate_param->big_handle;
//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_FEAT_ISO_BIG_SYNCER_EN == TRUE)
void BTA_DmBleGapIsoDataPathSet(tBTA_DM_BLE_ISO_SET_DATA_PATH_PARAMS *p_iso_data_path_param)
{
tBTA_DM_API_ISO_DATA_PATH *p_msg;
uint8_t codec_cfg_len = p_iso_data_path_param->codec_len;
APPL_TRACE_API("%s", __func__);
if ((p_msg = (tBTA_DM_API_ISO_DATA_PATH *) osi_malloc(sizeof(tBTA_DM_API_ISO_DATA_PATH) + codec_cfg_len)) != NULL) {
memset(p_msg, 0, sizeof(tBTA_DM_API_ISO_DATA_PATH));
p_msg->hdr.event = BTA_DM_API_ISO_SET_DATA_PATH_EVT;
p_msg->iso_data_path_param.conn_handle = p_iso_data_path_param->conn_handle;
p_msg->iso_data_path_param.data_path_dir = p_iso_data_path_param->data_path_dir;
p_msg->iso_data_path_param.data_path_id = p_iso_data_path_param->data_path_id;
p_msg->iso_data_path_param.coding_fmt = p_iso_data_path_param->coding_fmt;
p_msg->iso_data_path_param.company_id = p_iso_data_path_param->company_id;
p_msg->iso_data_path_param.vs_codec_id = p_iso_data_path_param->vs_codec_id;
p_msg->iso_data_path_param.controller_delay = p_iso_data_path_param->controller_delay;
p_msg->iso_data_path_param.codec_len = p_iso_data_path_param->codec_len;
p_msg->iso_data_path_param.codec_cfg = (codec_cfg_len != 0) ? (UINT8 *)(p_msg + 1) : NULL;
if (codec_cfg_len) {
memcpy(p_msg->iso_data_path_param.codec_cfg, p_iso_data_path_param->codec_cfg, p_iso_data_path_param->codec_len);
}
//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_DmBleGapIsoDataPathRemove(tBTA_DM_BLE_ISO_REMOVE_DATA_PATH_PARAMS *p_iso_data_path_param)
{
tBTA_DM_API_ISO_DATA_PATH_REMOVE *p_msg;
APPL_TRACE_API("%s", __func__);
if ((p_msg = (tBTA_DM_API_ISO_DATA_PATH_REMOVE *) osi_malloc(sizeof(tBTA_DM_API_ISO_DATA_PATH_REMOVE))) != NULL) {
memset(p_msg, 0, sizeof(tBTA_DM_API_ISO_DATA_PATH_REMOVE));
p_msg->hdr.event = BTA_DM_API_ISO_REMOVE_DATA_PATH_EVT;
p_msg->iso_data_path_remove_param.conn_handle = p_iso_data_path_param->conn_handle;
p_msg->iso_data_path_remove_param.data_path_dir = p_iso_data_path_param->data_path_dir;
//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;
APPL_TRACE_API("%s", __func__);
if ((p_msg = (tBTA_DM_API_ISO_READ_TX_SYNC *) osi_malloc(sizeof(tBTA_DM_API_ISO_READ_TX_SYNC))) != NULL) {
memset(p_msg, 0, sizeof(tBTA_DM_API_ISO_READ_TX_SYNC));
p_msg->hdr.event = BTA_DM_API_ISO_READ_TX_SYNC_EVT;
p_msg->iso_hdl= iso_handle;
//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_DmBleGapIsoReadLinkQuality(uint16_t iso_handle)
{
tBTA_DM_API_ISO_READ_LINK_QUALITY *p_msg;
APPL_TRACE_API("%s", __func__);
if ((p_msg = (tBTA_DM_API_ISO_READ_LINK_QUALITY *) osi_malloc(sizeof(tBTA_DM_API_ISO_READ_LINK_QUALITY))) != NULL) {
memset(p_msg, 0, sizeof(tBTA_DM_API_ISO_READ_LINK_QUALITY));
p_msg->hdr.event = BTA_DM_API_ISO_READ_LINK_QUALITY_EVT;
p_msg->iso_hdl= iso_handle;
//start sent the msg to the bta system control module
bta_sys_sendmsg(p_msg);
} else {
APPL_TRACE_ERROR("%s malloc failed", __func__);
}
}
#if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
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,
uint8_t framing, uint16_t mtl_c_to_p, uint16_t mtl_p_to_c, uint8_t cis_cnt, uint8_t *cis_params)
{
tBTA_DM_API_SET_CIG_PARAM *p_buf;
if ((p_buf = (tBTA_DM_API_SET_CIG_PARAM *)osi_malloc(sizeof(tBTA_DM_API_SET_CIG_PARAM))) != NULL) {
p_buf->hdr.event = BTA_DM_API_SET_CIG_PARAMS_EVT;
p_buf->cig_id = cig_id;
p_buf->sdu_int_c_to_p = sdu_int_c_to_p;
p_buf->sdu_int_p_to_c = sdu_int_p_to_c;
p_buf->worse_case_SCA = worse_case_SCA;
p_buf->packing = packing;
p_buf->framing = framing;
p_buf->mtl_c_to_p = mtl_c_to_p;
p_buf->mtl_p_to_c = mtl_p_to_c;
p_buf->cis_cnt = cis_cnt;
memcpy(&p_buf->cis_params[0], cis_params, sizeof(struct bta_iso_cis_params) * cis_cnt);
bta_sys_sendmsg(p_buf);
}
return;
}
void BTA_DmBleIsoSetCigParamsTest(uint8_t cig_id, uint32_t sdu_int_c_to_p, uint32_t sdu_int_p_to_c, uint8_t ft_c_to_p, uint8_t ft_p_to_c,
uint16_t iso_interval, uint8_t worse_case_SCA, uint8_t packing, uint8_t framing, uint8_t cis_cnt, uint8_t *cis_params_test)
{
tBTA_DM_API_SET_CIG_PARAM_TEST *p_buf;
if ((p_buf = (tBTA_DM_API_SET_CIG_PARAM_TEST *)osi_malloc(sizeof(tBTA_DM_API_SET_CIG_PARAM_TEST))) != NULL) {
p_buf->hdr.event = BTA_DM_API_SET_CIG_PARAMS_TEST_EVT;
p_buf->cig_id = cig_id;
p_buf->sdu_int_c_to_p = sdu_int_c_to_p;
p_buf->sdu_int_p_to_c = sdu_int_p_to_c;
p_buf->ft_c_to_p = ft_c_to_p;
p_buf->ft_p_to_c = ft_p_to_c;
p_buf->iso_interval = iso_interval;
p_buf->worse_case_SCA = worse_case_SCA;
p_buf->packing = packing;
p_buf->framing = framing;
p_buf->cis_cnt = cis_cnt;
memcpy(&p_buf->cis_params_test[0], cis_params_test, sizeof(struct bta_iso_cis_params_test) * cis_cnt);
bta_sys_sendmsg(p_buf);
}
return;
}
void BTA_DmBleIsoCreateCis(uint8_t cig_count, uint8_t *cis_hdl_info)
{
tBTA_DM_API_CREATE_CIS_PARAM *p_buf;
if ((p_buf = (tBTA_DM_API_CREATE_CIS_PARAM *)osi_malloc(sizeof(tBTA_DM_API_CREATE_CIS_PARAM))) != NULL) {
p_buf->hdr.event = BTA_DM_API_CREATE_CIS_EVT;
p_buf->cis_count = cig_count;
struct bta_iso_cis_hdls *hdls = (struct bta_iso_cis_hdls *)cis_hdl_info;
for (uint8_t i = 0; i < cig_count; i++)
{
p_buf->cis_hdls[i].cis_hdl = hdls[i].cis_hdl;
p_buf->cis_hdls[i].acl_hdl = hdls[i].acl_hdl;
}
bta_sys_sendmsg(p_buf);
}
return;
}
void BTA_DmBleIsoRemoveCig(uint8_t cig_id)
{
tBTA_DM_API_REMOVE_CIG_PARAM *p_buf;
if ((p_buf = (tBTA_DM_API_REMOVE_CIG_PARAM *)osi_malloc(sizeof(tBTA_DM_API_REMOVE_CIG_PARAM))) != NULL) {
p_buf->hdr.event = BTA_DM_API_REMOVE_CIG_PARAMS_EVT;
p_buf->cig_id = cig_id;
bta_sys_sendmsg(p_buf);
}
return;
}
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
void BTA_DmBleIsoAcceptCisReq(uint16_t cis_handle)
{
tBTA_DM_API_ACCEPT_CIS_REQ_PARAM *p_buf;
if ((p_buf = (tBTA_DM_API_ACCEPT_CIS_REQ_PARAM *)osi_malloc(sizeof(tBTA_DM_API_ACCEPT_CIS_REQ_PARAM))) != NULL) {
p_buf->hdr.event = BTA_DM_API_ACCEPT_CIS_REQ_PARAMS_EVT;
p_buf->cis_handle = cis_handle;
bta_sys_sendmsg(p_buf);
}
return;
}
void BTA_DmBleIsoRejectCisReq(uint16_t cis_handle, uint8_t reason)
{
tBTA_DM_API_REJECT_CIS_REQ_PARAM *p_buf;
if ((p_buf = (tBTA_DM_API_REJECT_CIS_REQ_PARAM *)osi_malloc(sizeof(tBTA_DM_API_REJECT_CIS_REQ_PARAM))) != NULL) {
p_buf->hdr.event = BTA_DM_API_REJECT_CIS_REQ_PARAMS_EVT;
p_buf->cis_handle = cis_handle;
p_buf->reason = reason;
bta_sys_sendmsg(p_buf);
}
return;
}
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_EN == TRUE)
void BTA_DmBleIsoDisconCis(uint16_t cis_handle, uint8_t reason)
{
tBTA_DM_API_DISCON_CIS_PARAM *p_buf;
if ((p_buf = (tBTA_DM_API_DISCON_CIS_PARAM *)osi_malloc(sizeof(tBTA_DM_API_DISCON_CIS_PARAM))) != NULL) {
p_buf->hdr.event = BTA_DM_API_DISCON_CIS_EVT;
p_buf->cis_handle = cis_handle;
p_buf->reason = reason;
bta_sys_sendmsg(p_buf);
}
return;
}
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
void BTA_DmBleCteSetConnectionlessTransParams(uint8_t adv_handle, uint8_t cte_len, uint8_t cte_type,
uint8_t cte_count, uint8_t switching_pattern_len, uint8_t *antenna_ids)
{
APPL_TRACE_API("%s", __func__);
tBTA_DM_BLE_CTE_SET_TRANS_PARAMS *p_buf;
if ((p_buf = (tBTA_DM_BLE_CTE_SET_TRANS_PARAMS *) osi_malloc(sizeof(tBTA_DM_BLE_CTE_SET_TRANS_PARAMS) + switching_pattern_len)) != NULL) {
memset(p_buf, 0, sizeof(tBTA_DM_BLE_CTE_SET_TRANS_PARAMS) + switching_pattern_len);
p_buf->hdr.event = BTA_DM_API_CTE_SET_TRANS_PARAMS;
p_buf->adv_handle = adv_handle;
p_buf->cte_len = cte_len;
p_buf->cte_type = cte_type;
p_buf->cte_count = cte_count;
p_buf->switching_pattern_len = switching_pattern_len;
p_buf->antenna_ids = (switching_pattern_len != 0) ? (UINT8 *)(p_buf + 1) : NULL;
if (switching_pattern_len) {
memcpy(p_buf->antenna_ids, antenna_ids, switching_pattern_len);
}
//start sent the msg to the bta system control module
bta_sys_sendmsg(p_buf);
} else {
APPL_TRACE_ERROR("%s malloc failed", __func__);
}
}
void BTA_DmBleCteSetConnectionlessTransEnable(uint8_t adv_handle, uint8_t cte_en)
{
APPL_TRACE_API("%s", __func__);
tBTA_DM_BLE_CTE_SET_TRANS_ENABLE *p_buf;
if ((p_buf = (tBTA_DM_BLE_CTE_SET_TRANS_ENABLE *) osi_malloc(sizeof(tBTA_DM_BLE_CTE_SET_TRANS_ENABLE))) != NULL) {
memset(p_buf, 0, sizeof(tBTA_DM_BLE_CTE_SET_TRANS_ENABLE));
p_buf->hdr.event = BTA_DM_API_CTE_SET_TRANS_ENABLE;
p_buf->adv_handle = adv_handle;
p_buf->cte_enable = cte_en;
// start sent the msg to the bta system control module
bta_sys_sendmsg(p_buf);
} else {
APPL_TRACE_ERROR("%s malloc failed", __func__);
}
}
void BTA_DmBleCteSetConnectionlessIqSamplingEnable(uint16_t sync_handle, uint8_t sampling_en, uint8_t slot_dur,
uint8_t max_sampled_ctes, uint8_t switching_pattern_len, uint8_t *ant_ids)
{
APPL_TRACE_API("%s", __func__);
tBTA_DM_BLE_CTE_IQ_SAMP_EN *p_buf;
if ((p_buf = (tBTA_DM_BLE_CTE_IQ_SAMP_EN *) osi_malloc(sizeof(tBTA_DM_BLE_CTE_IQ_SAMP_EN) + switching_pattern_len)) != NULL) {
memset(p_buf, 0, sizeof(tBTA_DM_BLE_CTE_IQ_SAMP_EN) + switching_pattern_len);
p_buf->hdr.event = BTA_DM_API_CTE_SET_IQ_SAMPLING_EN;
p_buf->sync_handle = sync_handle;
p_buf->sampling_en = sampling_en;
p_buf->slot_dur = slot_dur;
p_buf->max_sampled_ctes = max_sampled_ctes;
p_buf->switching_pattern_len = switching_pattern_len;
p_buf->antenna_ids = (switching_pattern_len != 0) ? (UINT8 *)(p_buf + 1) : NULL;
if (switching_pattern_len) {
memcpy(p_buf->antenna_ids, ant_ids, switching_pattern_len);
}
// start sent the msg to the bta system control module
bta_sys_sendmsg(p_buf);
} else {
APPL_TRACE_ERROR("%s malloc failed", __func__);
}
}
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
void BTA_DmBleCteSetConnectionReceiveParams(uint16_t conn_handle, uint8_t sampling_en, uint8_t slot_dur,
uint8_t switching_pattern_len, uint8_t *ant_ids)
{
APPL_TRACE_API("%s", __func__);
tBTA_DM_BLE_CTE_RECV_PARAMS *p_buf;
if ((p_buf = (tBTA_DM_BLE_CTE_RECV_PARAMS *) osi_malloc(sizeof(tBTA_DM_BLE_CTE_RECV_PARAMS) + switching_pattern_len)) != NULL) {
memset(p_buf, 0, sizeof(tBTA_DM_BLE_CTE_RECV_PARAMS) + switching_pattern_len);
p_buf->hdr.event = BTA_DM_API_CTE_SET_CONN_CTE_RECV_PARAMS;
p_buf->conn_handle = conn_handle;
p_buf->sampling_en = sampling_en;
p_buf->slot_dur = slot_dur;
p_buf->switching_pattern_len = switching_pattern_len;
p_buf->antenna_ids = (switching_pattern_len != 0) ? (UINT8 *)(p_buf + 1) : NULL;
if (switching_pattern_len) {
memcpy(p_buf->antenna_ids, ant_ids, switching_pattern_len);
}
// start sent the msg to the bta system control module
bta_sys_sendmsg(p_buf);
} else {
APPL_TRACE_ERROR("%s malloc failed", __func__);
}
}
void BTA_DmBleCteSetConnectionTransParams(uint16_t conn_handle, uint8_t cte_types, uint8_t switching_pattern_len, uint8_t *ant_ids)
{
APPL_TRACE_API("%s", __func__);
tBTA_DM_BLE_CONN_CTE_TRANS_PARAMS *p_buf;
if ((p_buf = (tBTA_DM_BLE_CONN_CTE_TRANS_PARAMS *) osi_malloc(sizeof(tBTA_DM_BLE_CONN_CTE_TRANS_PARAMS) + switching_pattern_len)) != NULL) {
memset(p_buf, 0, sizeof(tBTA_DM_BLE_CONN_CTE_TRANS_PARAMS) + switching_pattern_len);
p_buf->hdr.event = BTA_DM_API_CTE_SET_CONN_CTE_TRANS_PARAMS;
p_buf->conn_handle = conn_handle;
p_buf->cte_types = cte_types;
p_buf->switching_pattern_len = switching_pattern_len;
p_buf->antenna_ids = (switching_pattern_len != 0) ? (UINT8 *)(p_buf + 1) : NULL;
if (switching_pattern_len) {
memcpy(p_buf->antenna_ids, ant_ids, switching_pattern_len);
}
// start sent the msg to the bta system control module
bta_sys_sendmsg(p_buf);
} else {
APPL_TRACE_ERROR("%s malloc failed", __func__);
}
}
void BTA_DmBleCteSetConnectionRequestEnable(uint16_t conn_handle, uint8_t enable, uint16_t cte_req_interval,
uint8_t req_cte_len, uint8_t req_cte_Type)
{
APPL_TRACE_API("%s", __func__);
tBTA_DM_BLE_CONN_CTE_REQ_EN *p_buf;
if ((p_buf = (tBTA_DM_BLE_CONN_CTE_REQ_EN *) osi_malloc(sizeof(tBTA_DM_BLE_CONN_CTE_REQ_EN))) != NULL) {
memset(p_buf, 0, sizeof(tBTA_DM_BLE_CONN_CTE_REQ_EN));
p_buf->hdr.event = BTA_DM_API_CTE_SET_CONN_CTE_REQUEST_EN;
p_buf->conn_handle = conn_handle;
p_buf->enable = enable;
p_buf->cte_req_interval = cte_req_interval;
p_buf->req_cte_len = req_cte_len;
p_buf->req_cte_Type = req_cte_Type;
// start sent the msg to the bta system control module
bta_sys_sendmsg(p_buf);
} else {
APPL_TRACE_ERROR("%s malloc failed", __func__);
}
}
void BTA_DmBleCteSetConnectionRspEnable(uint16_t conn_handle, uint8_t enable)
{
APPL_TRACE_API("%s", __func__);
tBTA_DM_BLE_CONN_CTE_RSP_EN *p_buf;
if ((p_buf = (tBTA_DM_BLE_CONN_CTE_RSP_EN *) osi_malloc(sizeof(tBTA_DM_BLE_CONN_CTE_RSP_EN))) != NULL) {
memset(p_buf, 0, sizeof(tBTA_DM_BLE_CONN_CTE_RSP_EN));
p_buf->hdr.event = BTA_DM_API_CTE_SET_CONN_CTE_RESPONSE_EN;
p_buf->conn_handle = conn_handle;
p_buf->enable = enable;
// start sent the msg to the bta system control module
bta_sys_sendmsg(p_buf);
} else {
APPL_TRACE_ERROR("%s malloc failed", __func__);
}
}
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
void BTA_DmBleCteReadAntInfor(void)
{
APPL_TRACE_API("%s", __func__);
tBTA_DM_BLE_READ_ANT_INFOR *p_buf;
if ((p_buf = (tBTA_DM_BLE_READ_ANT_INFOR *) osi_malloc(sizeof(tBTA_DM_BLE_READ_ANT_INFOR))) != NULL) {
memset(p_buf, 0, sizeof(tBTA_DM_BLE_READ_ANT_INFOR));
p_buf->hdr.event = BTA_DM_API_CTE_READ_ANTENNA_INFOR;
// start sent the msg to the bta system control module
bta_sys_sendmsg(p_buf);
} else {
APPL_TRACE_ERROR("%s malloc failed", __func__);
}
}
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
#endif

View File

@ -287,6 +287,62 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
bta_dm_ble_gap_set_csa_support, /* BTA_DM_API_BLE_SET_CSA_SUPPORT_EVT */
bta_dm_ble_gap_set_vendor_evt_mask, /* BTA_DM_API_BLE_SET_VENDOR_EVT_MASK_EVT */
#endif
#if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
bta_dm_ble_big_create, /* BTA_DM_API_ISO_BIG_CREATE_EVT */
bta_dm_ble_big_create_test, /* BTA_DM_API_ISO_BIG_CREATE_TEST_EVT */
bta_dm_ble_big_terminate, /* BTA_DM_API_ISO_BIG_TERMINATE_EVT */
#endif// #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
bta_dm_ble_big_sync_create, /* BTA_DM_API_ISO_BIG_SYNC_CREATE_EVT */
bta_dm_ble_big_sync_terminate, /* BTA_DM_API_ISO_BIG_SYNC_TERMINATE_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_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)
bta_dm_ble_set_cig_params, /* BTA_DM_API_SET_CIG_PARAMS_EVT */
bta_dm_ble_set_cig_params_test, /* BTA_DM_API_SET_CIG_PARAMS_TEST_EVT */
bta_dm_ble_create_cis, /* BTA_DM_API_CREATE_CIS_EVT */
bta_dm_ble_remove_cig, /* BTA_DM_API_REMOVE_CIG_PARAMS_EVT*/
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
bta_dm_ble_accept_cis_req, /* BTA_DM_API_ACCEPT_CIS_REQ_PARAMS_EVT */
bta_dm_ble_reject_cis_req, /* BTA_DM_API_REJECT_CIS_REQ_PARAMS_EVT */
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_EN == TRUE)
bta_dm_ble_discon_cis, /* BTA_DM_API_DISCON_CIS_EVT */
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
bta_dm_ble_set_cte_trans_params, /* BTA_DM_API_CTE_SET_TRANS_PARAMS */
bta_dm_ble_set_cte_trans_enable, /* BTA_DM_API_CTE_SET_TRANS_ENABLE */
bta_dm_ble_set_iq_sampling_en, /* BTA_DM_API_CTE_SET_IQ_SAMPLING_EN */
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
bta_dm_ble_set_conn_cte_recv_params, /* BTA_DM_API_CTE_SET_CONN_CTE_RECV_PARAMS */
bta_dm_ble_set_conn_trans_params, /* BTA_DM_API_CTE_SET_CONN_CTE_TRANS_PARAMS */
bta_dm_ble_set_conn_cte_req_en, /* BTA_DM_API_CTE_SET_CONN_CTE_REQUEST_EN */
bta_dm_ble_set_conn_cte_rsp_en, /* BTA_DM_API_CTE_SET_CONN_CTE_RESPONSE_EN */
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
bta_dm_ble_read_cte_ant_infor, /* BTA_DM_API_CTE_READ_ANTENNA_INFOR */
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
bta_dm_api_enh_read_trans_power_level, /* BTA_DM_API_ENH_READ_TRANS_POWER_LEVEL */
bta_dm_api_read_rem_trans_power_level, /* BTA_DM_API_READ_REM_TRANS_POWER_LEVEL */
bta_dm_api_set_path_loss_report_params, /* BTA_DM_API_SET_PATH_LOSS_REPORT_PARAMS */
bta_dm_api_set_path_loss_reporting_en, /* BTA_DM_API_SET_PATH_LOSS_REPORTING_EN */
bta_dm_api_set_trans_power_reporting_en, /* BTA_DM_API_SET_TRANS_POWER_REPORTING_EN */
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
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)
};

View File

@ -278,6 +278,62 @@ enum {
BTA_DM_API_BLE_SET_CSA_SUPPORT_EVT,
BTA_DM_API_BLE_SET_VENDOR_EVT_MASK_EVT,
#endif
#if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
BTA_DM_API_ISO_BIG_CREATE_EVT,
BTA_DM_API_ISO_BIG_CREATE_TEST_EVT,
BTA_DM_API_ISO_BIG_TERMINATE_EVT,
#endif // #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
BTA_DM_API_ISO_BIG_SYNC_CREATE_EVT,
BTA_DM_API_ISO_BIG_SYNC_TERMINATE_EVT,
#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_READ_TX_SYNC_EVT,
BTA_DM_API_ISO_READ_LINK_QUALITY_EVT,
#if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
BTA_DM_API_SET_CIG_PARAMS_EVT,
BTA_DM_API_SET_CIG_PARAMS_TEST_EVT,
BTA_DM_API_CREATE_CIS_EVT,
BTA_DM_API_REMOVE_CIG_PARAMS_EVT,
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
BTA_DM_API_ACCEPT_CIS_REQ_PARAMS_EVT,
BTA_DM_API_REJECT_CIS_REQ_PARAMS_EVT,
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_EN == TRUE)
BTA_DM_API_DISCON_CIS_EVT,
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
BTA_DM_API_CTE_SET_TRANS_PARAMS,
BTA_DM_API_CTE_SET_TRANS_ENABLE,
BTA_DM_API_CTE_SET_IQ_SAMPLING_EN,
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
BTA_DM_API_CTE_SET_CONN_CTE_RECV_PARAMS,
BTA_DM_API_CTE_SET_CONN_CTE_TRANS_PARAMS,
BTA_DM_API_CTE_SET_CONN_CTE_REQUEST_EN,
BTA_DM_API_CTE_SET_CONN_CTE_RESPONSE_EN,
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
BTA_DM_API_CTE_READ_ANTENNA_INFOR,
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
BTA_DM_API_ENH_READ_TRANS_POWER_LEVEL,
BTA_DM_API_READ_REM_TRANS_POWER_LEVEL,
BTA_DM_API_SET_PATH_LOSS_REPORT_PARAMS,
BTA_DM_API_SET_PATH_LOSS_REPORTING_EN,
BTA_DM_API_SET_TRANS_POWER_REPORTING_EN,
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
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
};
@ -1027,6 +1083,72 @@ typedef struct {
tBTA_SET_VENDOR_EVT_MASK_CBACK *p_cback;
} tBTA_DM_API_BLE_SET_VENDOR_EVT_MASK;
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
typedef struct {
BT_HDR hdr;
UINT16 conn_handle;
UINT8 phy;
} tBTA_DM_API_BLE_ENH_READ_TANS_PWR_LEVEL;
typedef struct {
BT_HDR hdr;
UINT16 conn_handle;
UINT8 phy;
} tBTA_DM_API_BLE_READ_REMOTE_TANS_PWR_LEVEL;
typedef struct {
BT_HDR hdr;
UINT16 conn_handle;
UINT8 high_threshold;
UINT8 high_hysteresis;
UINT8 low_threshold;
UINT8 low_hysteresis;
UINT16 min_time_spent;
} tBTA_DM_API_BLE_SET_PATH_LOSS_RPT_PARAMS;
typedef struct {
BT_HDR hdr;
UINT16 conn_handle;
UINT8 enable;
} tBTA_DM_API_BLE_SET_PATH_LOSS_RPT_ENABLE;
typedef struct {
BT_HDR hdr;
UINT16 conn_handle;
UINT8 local_enable;
UINT8 remote_enable;
} tBTA_DM_API_BLE_SET_TRANS_PWR_RPT_ENABLE;
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
typedef struct {
BT_HDR hdr;
UINT16 subrate_min;
UINT16 subrate_max;
UINT16 max_latency;
UINT16 continuation_number;
UINT16 supervision_timeout;
} tBTA_DM_API_BLE_SET_DEFAULT_SUBRATE;
typedef struct {
BT_HDR hdr;
UINT16 conn_handle;
UINT16 subrate_min;
UINT16 subrate_max;
UINT16 max_latency;
UINT16 continuation_number;
UINT16 supervision_timeout;
} 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)
@ -1274,6 +1396,215 @@ typedef struct {
} tBTA_DM_API_SET_PAST_PARAMS;
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
typedef struct {
BT_HDR hdr;
tBTA_DM_BLE_BIG_CREATE_PARAMS big_creat_param;
} tBTA_DM_API_BIG_CREATE;
typedef struct {
BT_HDR hdr;
tBTA_DM_BLE_BIG_CREATE_TEST_PARAMS big_creat_test_param;
} tBTA_DM_API_BIG_CREATE_TEST;
typedef struct {
BT_HDR hdr;
tBTA_DM_BLE_BIG_TERMINATE_PARAMS big_terminate_param;
} tBTA_DM_API_BIG_TERMINATE;
#endif // #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
typedef struct {
BT_HDR hdr;
tBTA_DM_BLE_BIG_SYNC_CREATE_PARAMS big_sync_param;
} tBTA_DM_API_BIG_SYNC_CREATE;
typedef struct {
BT_HDR hdr;
tBTA_DM_BLE_BIG_SYNC_TERMINATE_PARAMS big_sync_terminate_param;
} tBTA_DM_API_BIG_SYNC_TERMINATE;
#endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
typedef struct {
BT_HDR hdr;
tBTA_DM_BLE_ISO_SET_DATA_PATH_PARAMS iso_data_path_param;
} tBTA_DM_API_ISO_DATA_PATH;
typedef struct {
BT_HDR hdr;
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 iso_hdl;
} tBTA_DM_API_ISO_READ_TX_SYNC;
typedef struct {
BT_HDR hdr;
uint16_t iso_hdl;
} tBTA_DM_API_ISO_READ_LINK_QUALITY;
#if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
struct bta_iso_cis_params {
UINT8 cis_id;
UINT16 max_sdu_c_to_p;
UINT16 max_sdu_p_to_c;
UINT8 phy_c_to_p;
UINT8 phy_p_to_c;
UINT8 rtn_c_to_p;
UINT8 rtn_p_to_c;
} __attribute__((packed));
struct bta_iso_cis_params_test {
UINT8 cis_id;
UINT8 nse;
UINT16 max_sdu_c_to_p;
UINT16 max_sdu_p_to_c;
UINT16 max_pdu_c_to_p;
UINT16 max_pdu_p_to_c;
UINT8 phy_c_to_p;
UINT8 phy_p_to_c;
UINT8 bn_c_to_p;
UINT8 bn_p_to_c;
} __attribute__((packed));
typedef struct {
BT_HDR hdr;
UINT8 cig_id;
UINT32 sdu_int_c_to_p;
UINT32 sdu_int_p_to_c;
UINT8 worse_case_SCA;
UINT8 packing;
UINT8 framing;
UINT16 mtl_c_to_p; // max_transport_latency_c_to_p
UINT16 mtl_p_to_c; // max_transport_latency_p_to_c
UINT8 cis_cnt;
struct bta_iso_cis_params cis_params[BLE_ISO_CIS_MAX_COUNT];
} tBTA_DM_API_SET_CIG_PARAM;
typedef struct {
BT_HDR hdr;
UINT8 cig_id;
UINT32 sdu_int_c_to_p;
UINT32 sdu_int_p_to_c;
UINT8 ft_c_to_p;
UINT8 ft_p_to_c;
UINT16 iso_interval;
UINT8 worse_case_SCA;
UINT8 packing;
UINT8 framing;
UINT8 cis_cnt;
struct bta_iso_cis_params_test cis_params_test[BLE_ISO_CIS_MAX_COUNT];
} tBTA_DM_API_SET_CIG_PARAM_TEST;
struct bta_iso_cis_hdls {
uint16_t cis_hdl;
uint16_t acl_hdl;
}__attribute__((packed));
typedef struct {
BT_HDR hdr;
uint8_t cis_count;
struct bta_iso_cis_hdls cis_hdls[BLE_ISO_CIS_MAX_COUNT];
} tBTA_DM_API_CREATE_CIS_PARAM;
typedef struct {
BT_HDR hdr;
UINT8 cig_id;
} tBTA_DM_API_REMOVE_CIG_PARAM;
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
typedef struct {
BT_HDR hdr;
UINT16 cis_handle;
} tBTA_DM_API_ACCEPT_CIS_REQ_PARAM;
typedef struct {
BT_HDR hdr;
UINT16 cis_handle;
UINT8 reason;
} tBTA_DM_API_REJECT_CIS_REQ_PARAM;
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_EN == TRUE)
typedef struct {
BT_HDR hdr;
UINT16 cis_handle;
UINT8 reason;
} tBTA_DM_API_DISCON_CIS_PARAM;
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
typedef struct {
BT_HDR hdr;
UINT8 adv_handle;
UINT8 cte_len;
UINT8 cte_type;
UINT8 cte_count;
UINT8 switching_pattern_len;
UINT8 *antenna_ids;
} tBTA_DM_BLE_CTE_SET_TRANS_PARAMS;
typedef struct {
BT_HDR hdr;
UINT8 adv_handle;
UINT8 cte_enable;
} tBTA_DM_BLE_CTE_SET_TRANS_ENABLE;
typedef struct {
BT_HDR hdr;
UINT16 sync_handle;
UINT8 sampling_en;
UINT8 slot_dur;
UINT8 max_sampled_ctes;
UINT8 switching_pattern_len;
UINT8 *antenna_ids;
} tBTA_DM_BLE_CTE_IQ_SAMP_EN;
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
typedef struct {
BT_HDR hdr;
UINT16 conn_handle;
UINT8 sampling_en;
UINT8 slot_dur;
UINT8 switching_pattern_len;
UINT8 *antenna_ids;
} tBTA_DM_BLE_CTE_RECV_PARAMS;
typedef struct {
BT_HDR hdr;
UINT16 conn_handle;
UINT8 cte_types;
UINT8 switching_pattern_len;
UINT8 *antenna_ids;
} tBTA_DM_BLE_CONN_CTE_TRANS_PARAMS;
typedef struct {
BT_HDR hdr;
UINT16 conn_handle;
UINT8 enable;
UINT16 cte_req_interval;
UINT8 req_cte_len;
UINT8 req_cte_Type;
} tBTA_DM_BLE_CONN_CTE_REQ_EN;
typedef struct {
BT_HDR hdr;
UINT16 conn_handle;
UINT8 enable;
} tBTA_DM_BLE_CONN_CTE_RSP_EN;
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
typedef struct {
BT_HDR hdr;
} tBTA_DM_BLE_READ_ANT_INFOR;
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
/* union of all data types */
typedef union {
/* event buffer header */
@ -1479,6 +1810,63 @@ typedef union {
tBTA_DM_API_REMOVE_ALL_ACL remove_all_acl;
#endif // #if (BLE_HOST_REMOVE_ALL_ACL_EN == TRUE)
#if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
tBTA_DM_API_BIG_CREATE big_creat;
tBTA_DM_API_BIG_CREATE_TEST big_creat_test;
tBTA_DM_API_BIG_TERMINATE big_terminate;
#endif // #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
tBTA_DM_API_BIG_SYNC_CREATE big_sync;
tBTA_DM_API_BIG_SYNC_TERMINATE big_sync_terminate;
#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_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)
tBTA_DM_API_SET_CIG_PARAM api_cig_params;
tBTA_DM_API_SET_CIG_PARAM_TEST api_cig_params_test;
tBTA_DM_API_CREATE_CIS_PARAM create_cis;
tBTA_DM_API_REMOVE_CIG_PARAM remove_cig;
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
tBTA_DM_API_ACCEPT_CIS_REQ_PARAM accept_cis_req;
tBTA_DM_API_REJECT_CIS_REQ_PARAM reject_cis_req;
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_EN == TRUE)
tBTA_DM_API_DISCON_CIS_PARAM discon_cis;
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
tBTA_DM_BLE_CTE_SET_TRANS_PARAMS set_cte_trans_params;
tBTA_DM_BLE_CTE_SET_TRANS_ENABLE set_trans_en;
tBTA_DM_BLE_CTE_IQ_SAMP_EN iq_samp_en;
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
tBTA_DM_BLE_CTE_RECV_PARAMS recv_params;
tBTA_DM_BLE_CONN_CTE_TRANS_PARAMS conn_trans_params;
tBTA_DM_BLE_CONN_CTE_REQ_EN conn_req_en;
tBTA_DM_BLE_CONN_CTE_RSP_EN conn_rsp_en;
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
tBTA_DM_BLE_READ_ANT_INFOR read_ant_infor;
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
tBTA_DM_API_BLE_ENH_READ_TANS_PWR_LEVEL enh_read_trans_pwr_level;
tBTA_DM_API_BLE_READ_REMOTE_TANS_PWR_LEVEL remote_trans_pwr_level;
tBTA_DM_API_BLE_SET_PATH_LOSS_RPT_PARAMS path_loss_rpt_params;
tBTA_DM_API_BLE_SET_PATH_LOSS_RPT_ENABLE path_loss_rpt_en;
tBTA_DM_API_BLE_SET_TRANS_PWR_RPT_ENABLE trans_pwr_rpt_en;
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
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;
@ -2085,4 +2473,64 @@ extern void bta_dm_ble_gap_periodic_adv_set_info_trans(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_gap_set_periodic_adv_sync_trans_params(tBTA_DM_MSG *p_data);
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
extern void bta_dm_ble_big_create(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_big_create_test(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_big_terminate(tBTA_DM_MSG *p_data);
#endif // #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
extern void bta_dm_ble_big_sync_create(tBTA_DM_MSG *p_data);
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_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)
void bta_dm_ble_set_cig_params(tBTA_DM_MSG *p_data);
void bta_dm_ble_set_cig_params_test(tBTA_DM_MSG *p_data);
void bta_dm_ble_create_cis(tBTA_DM_MSG *p_data);
void bta_dm_ble_remove_cig(tBTA_DM_MSG *p_data);
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
void bta_dm_ble_accept_cis_req(tBTA_DM_MSG *p_data);
void bta_dm_ble_reject_cis_req(tBTA_DM_MSG *p_data);
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_EN == TRUE)
void bta_dm_ble_discon_cis(tBTA_DM_MSG *p_data);
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
void bta_dm_ble_set_cte_trans_params(tBTA_DM_MSG *p_data);
void bta_dm_ble_set_cte_trans_enable(tBTA_DM_MSG *p_data);
void bta_dm_ble_set_iq_sampling_en(tBTA_DM_MSG *p_data);
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
void bta_dm_ble_set_conn_cte_recv_params(tBTA_DM_MSG *p_data);
void bta_dm_ble_set_conn_trans_params(tBTA_DM_MSG *p_data);
void bta_dm_ble_set_conn_cte_req_en(tBTA_DM_MSG *p_data);
void bta_dm_ble_set_conn_cte_rsp_en(tBTA_DM_MSG *p_data);
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
void bta_dm_ble_read_cte_ant_infor(tBTA_DM_MSG *p_data);
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
void bta_dm_api_enh_read_trans_power_level(tBTA_DM_MSG *p_data);
void bta_dm_api_read_rem_trans_power_level(tBTA_DM_MSG *p_data);
void bta_dm_api_set_path_loss_report_params(tBTA_DM_MSG *p_data);
void bta_dm_api_set_path_loss_reporting_en(tBTA_DM_MSG *p_data);
void bta_dm_api_set_trans_power_reporting_en(tBTA_DM_MSG *p_data);
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
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 */

View File

@ -1679,6 +1679,25 @@ typedef struct {
#define BTA_BLE_GAP_SET_PAST_PARAMS_COMPLETE_EVT BTM_BLE_GAP_SET_PAST_PARAMS_COMPLETE_EVT
#define BTA_BLE_GAP_PERIODIC_ADV_SYNC_TRANS_RECV_EVT BTM_BLE_GAP_PERIODIC_ADV_SYNC_TRANS_RECV_EVT
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#define BTA_BLE_GAP_ENH_READ_TRANS_POWER_LEVEL_EVT BTM_BLE_GAP_ENH_READ_TRANS_POWER_LEVEL_EVT
#define BTA_BLE_GAP_READ_REMOTE_TRANS_POWER_LEVEL_EVT BTM_BLE_GAP_READ_REMOTE_TRANS_POWER_LEVEL_EVT
#define BTA_BLE_GAP_SET_PATH_LOSS_REPORTING_PARAMS_EVT BTM_BLE_GAP_SET_PATH_LOSS_REPORTING_PARAMS_EVT
#define BTA_BLE_GAP_SET_PATH_LOSS_REPORTING_ENABLE_EVT BTM_BLE_GAP_SET_PATH_LOSS_REPORTING_ENABLE_EVT
#define BTA_BLE_GAP_SET_TRANS_POWER_REPORTING_ENABLE_EVT BTM_BLE_GAP_SET_TRANS_POWER_REPORTING_ENABLE_EVT
#define BTA_BLE_GAP_PATH_LOSS_THRESHOLD_EVT BTM_BLE_GAP_PATH_LOSS_THRESHOLD_EVT
#define BTA_BLE_GAP_TRANMIT_POWER_REPORTING_EVT BTM_BLE_GAP_TRANMIT_POWER_REPORTING_EVT
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
#define BTA_BLE_GAP_SET_DEFAULT_SUBRATE_EVT BTM_BLE_GAP_SET_DEFAULT_SUBRATE_EVT
#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;
@ -1689,6 +1708,62 @@ extern tBTM_BLE_5_HCI_CBACK ble_5_hci_cb;
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#define BTA_BLE_ISO_BIG_CREATE_COMPLETE_EVT BTM_BLE_ISO_BIG_CREATE_COMPLETE_EVT
#define BTA_BLE_ISO_BIG_TERMINATE_COMPLETE_EVT BTM_BLE_ISO_BIG_TERMINATE_COMPLETE_EVT
#endif // #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
#define BTA_BLE_ISO_BIG_SYNC_ESTABLISHED_EVT BTM_BLE_ISO_BIG_SYNC_ESTABLISHED_EVT
#define BTA_BLE_ISO_BIG_SYNC_LOST_EVT BTM_BLE_ISO_BIG_SYNC_LOST_EVT
#define BTA_BLE_ISO_BIG_SYNC_TERMINATE_COMPLETE_EVT BTM_BLE_ISO_BIG_SYNC_TERMINATE_COMPLETE_EVT
#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_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)
#define BTA_BLE_ISO_SET_CIG_PARAMS_EVT BTM_BLE_ISO_SET_CIG_PARAMS_EVT
#define BTA_BLE_ISO_CREATE_CIS_EVT BTM_BLE_ISO_CREATE_CIS_EVT
#define BTA_BLE_ISO_REMOVE_CIG_EVT BTM_BLE_ISO_REMOVE_CIG_EVT
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#define BTA_BLE_ISO_ACCEPT_CIS_REQ_EVT BTM_BLE_ISO_ACCEPT_CIS_REQ_EVT
#define BTA_BLE_ISO_REJECT_CIS_REQ_EVT BTM_BLE_ISO_REJECT_CIS_REQ_EVT
#define BTA_BLE_ISO_CIS_REQUEST_EVT BTM_BLE_ISO_CIS_REQUEST_EVT
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_EN == TRUE)
#define BTA_BLE_ISO_CIS_ESTABLISHED_EVT BTM_BLE_ISO_CIS_ESTABLISHED_EVT
#define BTA_BLE_ISO_CIS_DISCONNECTED_EVT BTM_BLE_ISO_CIS_DISCONNECTED_EVT
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)
#define BTA_DM_BLE_ISO_UNKNOWN_EVT BTM_BLE_ISO_UNKNOWN_EVT
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#define BTA_BLE_CTE_SET_TRANS_PARAMS_EVT BTM_BLE_CTE_SET_TRANS_PARAMS_EVT
#define BTA_BLE_CTE_SET_TRANS_ENABLE_EVT BTM_BLE_CTE_SET_TRANS_ENABLE_EVT
#define BTA_BLE_CTE_SET_IQ_SAMP_ENABLE_EVT BTM_BLE_CTE_SET_IQ_SAMP_ENABLE_EVT
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
#define BTA_BLE_CTE_SET_CONN_RECV_PARAMS_EVT BTM_BLE_CTE_SET_CONN_RECV_PARAMS_EVT
#define BTA_BLE_CTE_SET_CONN_TRANS_PARAMS_EVT BTM_BLE_CTE_SET_CONN_TRANS_PARAMS_EVT
#define BTA_BLE_CTE_SET_CONN_REQ_ENABLE_EVT BTM_BLE_CTE_SET_CONN_REQ_ENABLE_EVT
#define BTA_BLE_CTE_SET_CONN_RSP_ENABLE_EVT BTM_BLE_CTE_SET_CONN_RSP_ENABLE_EVT
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
#define BTA_BLE_CTE_READ_ANT_INFOR_EVT BTM_BLE_CTE_READ_ANT_INFOR_EVT
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#define BTA_BLE_CTE_CONNLESS_IQ_REPORT_EVT BTM_BLE_CTE_CONNLESS_IQ_REPORT_EVT
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
#define BTA_BLE_CTE_CONN_IQ_REPORT_EVT BTM_BLE_CTE_CONN_IQ_REPORT_EVT
#define BTA_BLE_CTE_REQUEST_FAILED_EVT BTM_BLE_CTE_REQUEST_FAILED_EVT
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
typedef struct {
UINT8 mode;
@ -1698,6 +1773,77 @@ typedef struct {
} tBTA_DM_BLE_PAST_PARAMS;
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#if (BLE_FEAT_ISO_EN == TRUE)
typedef struct {
UINT8 big_handle;
UINT8 adv_handle;
UINT8 num_bis;
UINT32 sdu_interval;
UINT16 max_sdu;
UINT16 max_transport_latency;
UINT8 rtn;
UINT8 phy;
UINT8 packing;
UINT8 framing;
UINT8 encryption;
UINT8 broadcast_code[16];
} tBTA_DM_BLE_BIG_CREATE_PARAMS;
typedef struct {
UINT8 big_handle;
UINT8 adv_handle;
UINT8 num_bis;
UINT32 sdu_interval;
UINT16 iso_interval;
UINT8 nse;
UINT16 max_sdu;
UINT16 max_pdu;
UINT8 phy;
UINT8 packing;
UINT8 framing;
UINT8 bn;
UINT8 irc;
UINT8 pto;
UINT8 encryption;
UINT8 broadcast_code[16];
} tBTA_DM_BLE_BIG_CREATE_TEST_PARAMS;
typedef struct {
UINT8 big_handle;
UINT8 reason;
} tBTA_DM_BLE_BIG_TERMINATE_PARAMS;
typedef struct {
UINT8 big_handle;
UINT16 sync_handle;
UINT8 encryption;
UINT8 bc_code[16];
UINT8 mse;
UINT16 big_sync_timeout;
UINT8 num_bis;
UINT8 bis[BLE_ISO_BIS_MAX_COUNT];
} tBTA_DM_BLE_BIG_SYNC_CREATE_PARAMS;
typedef struct {
UINT8 big_handle;
} tBTA_DM_BLE_BIG_SYNC_TERMINATE_PARAMS;
typedef struct {
uint16_t conn_handle;
uint8_t data_path_dir;
uint8_t data_path_id;
uint8_t coding_fmt;
uint16_t company_id;
uint16_t vs_codec_id;
uint32_t controller_delay;
uint8_t codec_len;
uint8_t *codec_cfg;
} tBTA_DM_BLE_ISO_SET_DATA_PATH_PARAMS;
typedef struct {
uint16_t conn_handle;
uint8_t data_path_dir;
} tBTA_DM_BLE_ISO_REMOVE_DATA_PATH_PARAMS;
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
/*****************************************************************************
** External Function Declarations
*****************************************************************************/
@ -2925,6 +3071,25 @@ extern void BTA_DmBleGapSetCsaSupport(uint8_t csa_select, tBTM_SET_CSA_SUPPORT_C
extern void BTA_DmBleGapSetVendorEventMask(uint32_t evt_mask, tBTA_SET_VENDOR_EVT_MASK_CBACK *p_callback);
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
void BTA_DmBleGapEnhReadTransPwrLevel(uint16_t conn_handle, uint8_t phy);
void BTA_DmBleGapReadRemoteTransPwrLevel(uint16_t conn_handle, uint8_t phy);
void BTA_DmBleGapSetPathLossRptParams(uint16_t conn_handle, uint8_t high_threshold, uint8_t high_hysteresis,
uint8_t low_threshold, uint8_t low_hysteresis, uint16_t min_time_spent);
void BTA_DmBleGapSetPathLossRptEnable(uint16_t conn_handle, uint8_t enable);
void BTA_DmBleGapSetTransPwrRptEnable(uint16_t conn_handle, uint8_t local_enable, uint8_t remote_enable);
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
void BTA_DmBleGapSetDefaultSubrate(uint16_t subrate_min, uint16_t subrate_max, uint16_t max_latency,
uint16_t continuation_number, uint16_t supervision_timeout);
void BTA_DmBleGapSubrateReqest(uint16_t conn_handle, uint16_t subrate_min, uint16_t subrate_max,
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
@ -3200,6 +3365,57 @@ extern void BTA_DmBleGapPeriodicAdvSetInfoTrans(BD_ADDR peer_addr, UINT16 servic
extern void BTA_DmBleGapSetPeriodicAdvSyncTransParams(BD_ADDR peer_addr, tBTA_DM_BLE_PAST_PARAMS *params);
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
extern void BTA_DmBleGapIsoBigCreate(tBTA_DM_BLE_BIG_CREATE_PARAMS *p_big_creat_param);
extern void BTA_DmBleGapIsoBigCreateTest(tBTA_DM_BLE_BIG_CREATE_TEST_PARAMS *p_big_creat_test_param);
extern void BTA_DmBleGapIsoBigTerminate(tBTA_DM_BLE_BIG_TERMINATE_PARAMS *p_big_terminate_param);
#endif// #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
extern void BTA_DmBleGapIsoBigSyncCreate(tBTA_DM_BLE_BIG_SYNC_CREATE_PARAMS *p_big_sync_param);
extern void BTA_DmBleGapIsoBigSyncTerminate(tBTA_DM_BLE_BIG_SYNC_TERMINATE_PARAMS *p_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_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,
uint8_t framing, uint16_t mtl_c_to_p, uint16_t mtl_p_to_c, uint8_t cis_cnt, uint8_t *cis_params);
void BTA_DmBleIsoSetCigParamsTest(uint8_t cig_id, uint32_t sdu_int_c_to_p, uint32_t sdu_int_p_to_c, uint8_t ft_c_to_p, uint8_t ft_p_to_c,
uint16_t iso_interval, uint8_t worse_case_SCA, uint8_t packing, uint8_t framing, uint8_t cis_cnt, uint8_t *cis_params_test);
extern void BTA_DmBleIsoCreateCis(uint8_t cig_count, uint8_t *cis_hdl_info);
extern void BTA_DmBleIsoRemoveCig(uint8_t cig_id);
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
extern void BTA_DmBleIsoAcceptCisReq(uint16_t cis_handle);
extern void BTA_DmBleIsoRejectCisReq(uint16_t cis_handle, uint8_t reason);
#endif // BLE_FEAT_ISO_CIG_PERIPHERAL_EN
#if (BLE_FEAT_ISO_CIG_EN == TRUE)
extern void BTA_DmBleIsoDisconCis(uint16_t cis_handle, uint8_t reason);
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)
#endif // if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
void BTA_DmBleCteSetConnectionlessTransParams(uint8_t adv_handle, uint8_t cte_len, uint8_t cte_type,
uint8_t cte_count, uint8_t switching_pattern_len, uint8_t *antenna_ids);
void BTA_DmBleCteSetConnectionlessTransEnable(uint8_t adv_handle, uint8_t cte_en);
void BTA_DmBleCteSetConnectionlessIqSamplingEnable(uint16_t sync_handle, uint8_t sampling_en, uint8_t slot_dur,
uint8_t max_sampled_ctes, uint8_t switching_pattern_len, uint8_t *ant_ids);
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
void BTA_DmBleCteSetConnectionReceiveParams(uint16_t conn_handle, uint8_t sampling_en, uint8_t slot_dur,
uint8_t switching_pattern_len, uint8_t *ant_ids);
void BTA_DmBleCteSetConnectionTransParams(uint16_t conn_handle, uint8_t cte_types, uint8_t switching_pattern_len, uint8_t *ant_ids);
void BTA_DmBleCteSetConnectionRequestEnable(uint16_t conn_handle, uint8_t enable, uint16_t cte_req_interval,
uint8_t req_cte_len, uint8_t req_cte_Type);
void BTA_DmBleCteSetConnectionRspEnable(uint16_t conn_handle, uint8_t enable);
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
void BTA_DmBleCteReadAntInfor(void);
#endif // if (BLE_FEAT_CTE_EN == TRUE)
#endif
enum {

View File

@ -0,0 +1,395 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <string.h>
#include "osi/allocator.h"
#include "bta/bta_api.h"
#include "bta/bta_dm_co.h"
#include "btc/btc_task.h"
#include "btc/btc_util.h"
#if (BLE_FEAT_CTE_EN == TRUE)
#include "btc_ble_cte.h"
static inline void btc_cte_ble_cb_to_app(esp_ble_cte_cb_event_t event, esp_ble_cte_cb_param_t *param)
{
esp_ble_cte_cb_t btc_cte_ble_cb = (esp_ble_cte_cb_t)btc_profile_cb_get(BTC_PID_BLE_CTE);
if (btc_cte_ble_cb) {
btc_cte_ble_cb(event, param);
}
}
static void btc_ble_cte_callback(tBTM_BLE_CTE_EVENT event,
tBTM_BLE_CTE_CB_PARAMS *params)
{
esp_ble_cte_cb_param_t param;
bt_status_t ret;
btc_msg_t msg;
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_BLE_CTE;
BTC_TRACE_DEBUG("%s event %d\n", __func__, event);
switch(event) {
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
case BTA_BLE_CTE_SET_TRANS_PARAMS_EVT:
msg.act = ESP_BLE_CTE_SET_CONNLESS_TRANS_PARAMS_CMPL_EVT;
param.set_trans_params_cmpl.status = btc_btm_status_to_esp_status(params->cte_trans_params_cmpl.status);
break;
case BTA_BLE_CTE_SET_TRANS_ENABLE_EVT:
msg.act = ESP_BLE_CTE_SET_CONNLESS_TRANS_ENABLE_CMPL_EVT;
param.set_trans_enable_cmpl.status = btc_btm_status_to_esp_status(params->cte_trans_params_cmpl.status);
break;
case BTA_BLE_CTE_SET_IQ_SAMP_ENABLE_EVT:
msg.act = ESP_BLE_CTE_SET_CONNLESS_IQ_SAMPLING_ENABLE_CMPL_EVT;
param.iq_sampling_enable_cmpl.status = btc_btm_status_to_esp_status(params->cte_iq_samp_en_cmpl.status);
param.iq_sampling_enable_cmpl.sync_handle = params->cte_iq_samp_en_cmpl.sync_handle;
break;
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
case BTA_BLE_CTE_SET_CONN_RECV_PARAMS_EVT:
msg.act = ESP_BLE_CTE_SET_CONN_RECV_PARAMS_CMPL_EVT;
param.conn_recv_params_cmpl.status = btc_btm_status_to_esp_status(params->cte_recv_params_cmpl.status);
param.conn_recv_params_cmpl.conn_handle = params->cte_recv_params_cmpl.conn_handle;
break;
case BTA_BLE_CTE_SET_CONN_TRANS_PARAMS_EVT:
msg.act = ESP_BLE_CTE_SET_CONN_TRANS_PARAMS_CMPL_EVT;
param.conn_trans_params_cmpl.status = btc_btm_status_to_esp_status(params->cte_conn_trans_params_cmpl.status);
param.conn_trans_params_cmpl.conn_handle = params->cte_conn_trans_params_cmpl.conn_handle;
break;
case BTA_BLE_CTE_SET_CONN_REQ_ENABLE_EVT:
msg.act = ESP_BLE_CTE_SET_CONN_REQ_ENABLE_CMPL_EVT;
param.conn_req_en_cmpl.status = btc_btm_status_to_esp_status(params->cte_conn_req_en_cmpl.status);
param.conn_req_en_cmpl.conn_handle = params->cte_conn_req_en_cmpl.conn_handle;
break;
case BTA_BLE_CTE_SET_CONN_RSP_ENABLE_EVT:
msg.act = ESP_BLE_CTE_SET_CONN_RSP_ENABLE_CMPL_EVT;
param.conn_rsp_en_cmpl.status = btc_btm_status_to_esp_status(params->cte_conn_rsp_en_cmpl.status);
param.conn_rsp_en_cmpl.conn_handle = params->cte_conn_rsp_en_cmpl.conn_handle;
break;
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
case BTA_BLE_CTE_READ_ANT_INFOR_EVT:
msg.act = ESP_BLE_CTE_READ_ANT_INFOR_CMPL_EVT;
param.read_ant_infor_cmpl.status = btc_btm_status_to_esp_status(params->cte_read_ant_infor_cmpl.status);
param.read_ant_infor_cmpl.supported_switching_sampling_rates = params->cte_read_ant_infor_cmpl.supported_switching_sampling_rates;
param.read_ant_infor_cmpl.num_antennae = params->cte_read_ant_infor_cmpl.num_ant;
param.read_ant_infor_cmpl.max_switching_pattern_len = params->cte_read_ant_infor_cmpl.max_switching_pattern_len;
param.read_ant_infor_cmpl.max_cte_len = params->cte_read_ant_infor_cmpl.max_cte_len;
break;
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
case BTA_BLE_CTE_CONNLESS_IQ_REPORT_EVT:
msg.act = ESP_BLE_CTE_CONNLESS_IQ_REPORT_EVT;
param.connless_iq_rpt.sync_handle = params->cte_connless_iq_rpt.sync_handle;
param.connless_iq_rpt.channel_idx = params->cte_connless_iq_rpt.channel_idx;
param.connless_iq_rpt.rssi = params->cte_connless_iq_rpt.rssi;
param.connless_iq_rpt.rssi_ant_id = params->cte_connless_iq_rpt.rssi_ant_id;
param.connless_iq_rpt.cte_type = params->cte_connless_iq_rpt.cte_type;
param.connless_iq_rpt.slot_dur = params->cte_connless_iq_rpt.slot_dur;
param.connless_iq_rpt.pkt_status = params->cte_connless_iq_rpt.pkt_status;
param.connless_iq_rpt.periodic_evt_counter = params->cte_connless_iq_rpt.periodic_evt_counter;
param.connless_iq_rpt.sample_count = params->cte_connless_iq_rpt.sample_count;
param.connless_iq_rpt.i_sample = &(params->cte_connless_iq_rpt.i_sample[0]);
param.connless_iq_rpt.q_sample = &(params->cte_connless_iq_rpt.q_sample[0]);
break;
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
case BTA_BLE_CTE_CONN_IQ_REPORT_EVT:
msg.act = ESP_BLE_CTE_CONN_IQ_REPORT_EVT;
param.conn_iq_rpt.conn_handle = params->cte_conn_iq_rpt.conn_handle;
param.conn_iq_rpt.data_channel_idx = params->cte_conn_iq_rpt.data_channel_idx;
param.conn_iq_rpt.rssi = params->cte_conn_iq_rpt.rssi;
param.conn_iq_rpt.rssi_ant_id = params->cte_conn_iq_rpt.rssi_ant_id;
param.conn_iq_rpt.cte_type = params->cte_conn_iq_rpt.cte_type;
param.conn_iq_rpt.slot_dur = params->cte_conn_iq_rpt.slot_dur;
param.conn_iq_rpt.pkt_status = params->cte_conn_iq_rpt.pkt_status;
param.conn_iq_rpt.conn_evt_counter = params->cte_conn_iq_rpt.conn_evt_counter;
param.conn_iq_rpt.sample_count = params->cte_conn_iq_rpt.sample_count;
param.conn_iq_rpt.i_sample = &params->cte_conn_iq_rpt.i_sample[0];
param.conn_iq_rpt.q_sample = &params->cte_conn_iq_rpt.q_sample[0];
break;
case BTA_BLE_CTE_REQUEST_FAILED_EVT:
msg.act = ESP_BLE_CTE_REQUEST_FAILED_EVT;
param.req_failed_evt.reason = btc_btm_status_to_esp_status(params->cte_req_failed.status);
param.req_failed_evt.conn_handle = params->cte_req_failed.conn_handle;
break;
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
default:
break;
}
ret = btc_transfer_context(&msg, &param,
sizeof(esp_ble_cte_cb_param_t), btc_ble_cte_cb_deep_copy, btc_ble_cte_cb_deep_free);
if (ret != BT_STATUS_SUCCESS) {
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
}
}
void btc_ble_cte_cb_handler(btc_msg_t *msg)
{
BTC_TRACE_DEBUG("%s act %d \n", __func__, msg->act);
esp_ble_cte_cb_param_t *param = (esp_ble_cte_cb_param_t *)msg->arg;
if (msg->act < ESP_BLE_CTE_EVT_MAX) {
btc_cte_ble_cb_to_app(msg->act, param);
} else {
BTC_TRACE_ERROR("%s, unknown msg->act = %d", __func__, msg->act);
}
btc_ble_cte_cb_deep_free(msg);
}
void btc_ble_cte_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
{
#if ((BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE) || (BLE_FEAT_CTE_CONNECTION_EN == TRUE))
btc_ble_cte_args_t *src = (btc_ble_cte_args_t *)p_src;
btc_ble_cte_args_t *dst = (btc_ble_cte_args_t *)p_dest;
#endif // #if ((BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE) || (BLE_FEAT_CTE_CONNECTION_EN == TRUE))
switch (msg->act) {
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
case BTC_CTE_ACT_SET_TRANS_PARAMS:
if (src->cte_trans_params.switching_pattern_len && src->cte_trans_params.antenna_ids) {
dst->cte_trans_params.antenna_ids = osi_malloc(src->cte_trans_params.switching_pattern_len);
if (dst->cte_trans_params.antenna_ids) {
memcpy(dst->cte_trans_params.antenna_ids, src->cte_trans_params.antenna_ids, src->cte_trans_params.switching_pattern_len);
} else {
BTC_TRACE_ERROR("%s %d no mem\n",__func__, msg->act);
}
}
break;
case BTC_CTE_ACT_SET_IQ_SAMPLING_EN:
if (src->cte_iq_sampling_en.switching_pattern_len && src->cte_iq_sampling_en.antenna_ids) {
dst->cte_iq_sampling_en.antenna_ids = osi_malloc(src->cte_iq_sampling_en.switching_pattern_len);
if (dst->cte_iq_sampling_en.antenna_ids) {
memcpy(dst->cte_iq_sampling_en.antenna_ids, src->cte_iq_sampling_en.antenna_ids, src->cte_iq_sampling_en.switching_pattern_len);
} else {
BTC_TRACE_ERROR("%s %d no mem\n",__func__, msg->act);
}
}
break;
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
case BTC_CTE_ACT_SET_CONN_CTE_RECV_PARAMS:
if (src->cte_recv_params.switching_pattern_len && src->cte_recv_params.antenna_ids) {
dst->cte_recv_params.antenna_ids = osi_malloc(src->cte_recv_params.switching_pattern_len);
if (dst->cte_recv_params.antenna_ids) {
memcpy(dst->cte_recv_params.antenna_ids, src->cte_recv_params.antenna_ids, src->cte_recv_params.switching_pattern_len);
} else {
BTC_TRACE_ERROR("%s %d no mem\n",__func__, msg->act);
}
}
break;
case BTC_CTE_ACT_SET_CONN_CTE_TRANS_PARAMS:
if (src->cte_conn_trans_params.switching_pattern_len && src->cte_conn_trans_params.antenna_ids) {
dst->cte_conn_trans_params.antenna_ids = osi_malloc(src->cte_conn_trans_params.switching_pattern_len);
if (dst->cte_conn_trans_params.antenna_ids) {
memcpy(dst->cte_conn_trans_params.antenna_ids, src->cte_conn_trans_params.antenna_ids, src->cte_conn_trans_params.switching_pattern_len);
} else {
BTC_TRACE_ERROR("%s %d no mem\n",__func__, msg->act);
}
}
break;
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
default:
BTC_TRACE_ERROR("Unhandled deep copy %d\n", msg->act);
break;
}
}
void btc_ble_cte_arg_deep_free(btc_msg_t *msg)
{
BTC_TRACE_DEBUG("%s \n", __func__);
switch (msg->act) {
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
case BTC_CTE_ACT_SET_TRANS_PARAMS: {
uint8_t *antenna_ids = ((btc_ble_cte_args_t *)msg->arg)->cte_trans_params.antenna_ids;
if (antenna_ids) {
osi_free(antenna_ids);
}
break;
}
case BTC_CTE_ACT_SET_IQ_SAMPLING_EN: {
uint8_t *antenna_ids = ((btc_ble_cte_args_t *)msg->arg)->cte_iq_sampling_en.antenna_ids;
if (antenna_ids) {
osi_free(antenna_ids);
}
break;
}
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
case BTC_CTE_ACT_SET_CONN_CTE_RECV_PARAMS: {
uint8_t *antenna_ids = ((btc_ble_cte_args_t *)msg->arg)->cte_recv_params.antenna_ids;
if (antenna_ids) {
osi_free(antenna_ids);
}
break;
}
case BTC_CTE_ACT_SET_CONN_CTE_TRANS_PARAMS: {
uint8_t *antenna_ids = ((btc_ble_cte_args_t *)msg->arg)->cte_conn_trans_params.antenna_ids;
if (antenna_ids) {
osi_free(antenna_ids);
}
break;
}
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
default:
BTC_TRACE_DEBUG("Unhandled deep free %d\n", msg->act);
break;
}
}
void btc_ble_cte_cb_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
{
esp_ble_cte_cb_param_t *src = (esp_ble_cte_cb_param_t *)p_src;
esp_ble_cte_cb_param_t *dst = (esp_ble_cte_cb_param_t *) p_dest;
switch (msg->act) {
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
case ESP_BLE_CTE_CONNLESS_IQ_REPORT_EVT:
if (src->connless_iq_rpt.sample_count) {
dst->connless_iq_rpt.i_sample = osi_malloc(src->connless_iq_rpt.sample_count);
if (dst->connless_iq_rpt.i_sample) {
memcpy(dst->connless_iq_rpt.i_sample, &(src->connless_iq_rpt.i_sample[0]),
src->connless_iq_rpt.sample_count);
} else {
BTC_TRACE_ERROR("%s, i_sample malloc failed\n", __func__);
}
dst->connless_iq_rpt.q_sample = osi_malloc(src->connless_iq_rpt.sample_count);
if (dst->connless_iq_rpt.q_sample) {
memcpy(dst->connless_iq_rpt.q_sample, &(src->connless_iq_rpt.q_sample[0]),
src->connless_iq_rpt.sample_count);
} else {
BTC_TRACE_ERROR("%s, q_sample malloc failed\n", __func__);
}
}
break;
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
case ESP_BLE_CTE_CONN_IQ_REPORT_EVT:
if (src->conn_iq_rpt.sample_count) {
dst->conn_iq_rpt.i_sample = osi_malloc(src->conn_iq_rpt.sample_count);
if (dst->conn_iq_rpt.i_sample) {
memcpy(dst->conn_iq_rpt.i_sample, src->conn_iq_rpt.i_sample,
src->conn_iq_rpt.sample_count);
} else {
BTC_TRACE_ERROR("%s, i_sample malloc failed\n", __func__);
}
dst->conn_iq_rpt.q_sample = osi_malloc(src->conn_iq_rpt.sample_count);
if (dst->conn_iq_rpt.q_sample) {
memcpy(dst->conn_iq_rpt.q_sample, src->conn_iq_rpt.q_sample,
src->conn_iq_rpt.sample_count);
} else {
BTC_TRACE_ERROR("%s, q_sample malloc failed\n", __func__);
}
}
break;
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
default:
BTC_TRACE_DEBUG("%s, Unhandled deep copy %d\n", __func__, msg->act);
break;
}
}
void btc_ble_cte_cb_deep_free(btc_msg_t *msg)
{
BTC_TRACE_DEBUG("%s", __func__);
switch (msg->act) {
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
case ESP_BLE_CTE_CONNLESS_IQ_REPORT_EVT: {
esp_ble_cte_cb_param_t *params = (esp_ble_cte_cb_param_t *)msg->arg;
uint8_t *i_sample = &(params->connless_iq_rpt.i_sample[0]);
uint8_t *q_sample = &(params->connless_iq_rpt.q_sample[0]);
if (i_sample) {
osi_free(i_sample);
}
if (q_sample) {
osi_free(q_sample);
}
break;
}
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
case ESP_BLE_CTE_CONN_IQ_REPORT_EVT: {
esp_ble_cte_cb_param_t *params = (esp_ble_cte_cb_param_t *)msg->arg;
uint8_t *i_sample = params->conn_iq_rpt.i_sample;
uint8_t *q_sample = params->conn_iq_rpt.q_sample;
if (i_sample) {
osi_free(i_sample);
}
if (q_sample) {
osi_free(q_sample);
}
break;
}
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
default:
BTC_TRACE_DEBUG("Unhandled deep free %d", msg->act);
break;
}
}
void btc_ble_cte_call_handler(btc_msg_t *msg)
{
#if ((BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE) || (BLE_FEAT_CTE_CONNECTION_EN == TRUE))
btc_ble_cte_args_t *arg = (btc_ble_cte_args_t *)msg->arg;
#endif // #if ((BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE) || (BLE_FEAT_CTE_CONNECTION_EN == TRUE))
BTC_TRACE_DEBUG("%s act %d\n", __FUNCTION__, msg->act);
switch (msg->act) {
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
case BTC_CTE_ACT_SET_TRANS_PARAMS:
struct cte_set_trans_params_arg *cte_trans_params = &arg->cte_trans_params;
BTA_DmBleCteSetConnectionlessTransParams(cte_trans_params->adv_handle, cte_trans_params->cte_len, cte_trans_params->cte_type,
cte_trans_params->cte_count, cte_trans_params->switching_pattern_len, cte_trans_params->antenna_ids);
break;
case BTC_CTE_ACT_SET_TRANS_ENABLE:
BTA_DmBleCteSetConnectionlessTransEnable(arg->cte_trans_enable.adv_handle, arg->cte_trans_enable.cte_enable);
break;
case BTC_CTE_ACT_SET_IQ_SAMPLING_EN:
struct cte_iq_sampling_en_arg *iq_sampling_en = &arg->cte_iq_sampling_en;
BTA_DmBleCteSetConnectionlessIqSamplingEnable(iq_sampling_en->sync_handle, iq_sampling_en->sampling_en, iq_sampling_en->slot_dur,
iq_sampling_en->max_sampled_ctes, iq_sampling_en->switching_pattern_len, iq_sampling_en->antenna_ids);
break;
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
case BTC_CTE_ACT_SET_CONN_CTE_RECV_PARAMS:
struct cte_recv_params_arg *recv_params = &arg->cte_recv_params;
BTA_DmBleCteSetConnectionReceiveParams(recv_params->conn_handle, recv_params->sampling_en, recv_params->slot_dur,
recv_params->switching_pattern_len, recv_params->antenna_ids);
break;
case BTC_CTE_ACT_SET_CONN_CTE_TRANS_PARAMS:
struct cte_set_conn_trans_params_arg *trans_params = &arg->cte_conn_trans_params;
BTA_DmBleCteSetConnectionTransParams(trans_params->conn_handle, trans_params->cte_types, trans_params->switching_pattern_len, trans_params->antenna_ids);
break;
case BTC_CTE_ACT_SET_CONN_CTE_REQUEST_EN:
struct cte_req_en_arg *cte_req_en = &arg->cte_req_en;
BTA_DmBleCteSetConnectionRequestEnable(cte_req_en->conn_handle, cte_req_en->enable, cte_req_en->cte_req_interval,
cte_req_en->req_cte_len, cte_req_en->req_cte_Type);
break;
case BTC_CTE_ACT_SET_CONN_CTE_RESPONSE_EN:
BTA_DmBleCteSetConnectionRspEnable(arg->cte_rsp_en.conn_handle, arg->cte_rsp_en.enable);
break;
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
case BTC_CTE_ACT_READ_ANTENNA_INFOR:
BTA_DmBleCteReadAntInfor();
break;
default:
break;
}
btc_ble_cte_arg_deep_free(msg);
}
//register connection parameter update callback
void btc_cte_callback_init(void)
{
BTM_BleCteRegisterCallback(btc_ble_cte_callback);
}
#endif ///BLE_FEAT_CTE_EN == TRUE

View File

@ -1206,6 +1206,76 @@ static void btc_ble_5_gap_callback(tBTA_DM_BLE_5_GAP_EVENT event,
param.past_received.adv_clk_accuracy = params->past_recv.adv_clk_accuracy;
break;
#endif
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
case BTA_BLE_GAP_ENH_READ_TRANS_POWER_LEVEL_EVT:
msg.act = ESP_GAP_BLE_ENH_READ_TRANS_PWR_LEVEL_EVT;
param.enh_trans_pwr_level_cmpl.status = btc_btm_status_to_esp_status(params->enh_trans_pwr_level_cmpl.status);
param.enh_trans_pwr_level_cmpl.conn_handle = params->enh_trans_pwr_level_cmpl.conn_handle;
param.enh_trans_pwr_level_cmpl.phy = params->enh_trans_pwr_level_cmpl.phy;
param.enh_trans_pwr_level_cmpl.cur_tx_pwr_level = params->enh_trans_pwr_level_cmpl.cur_tx_pwr_level;
param.enh_trans_pwr_level_cmpl.max_tx_pwr_level = params->enh_trans_pwr_level_cmpl.max_tx_pwr_level;
break;
case BTA_BLE_GAP_READ_REMOTE_TRANS_POWER_LEVEL_EVT:
msg.act = ESP_GAP_BLE_READ_REMOTE_TRANS_PWR_LEVEL_EVT;
param.read_remote_trans_pwr_level_cmpl.status = btc_btm_status_to_esp_status(params->remote_pwr_level_cmpl.status);
break;
case BTA_BLE_GAP_SET_PATH_LOSS_REPORTING_PARAMS_EVT:
msg.act = ESP_GAP_BLE_SET_PATH_LOSS_RPTING_PARAMS_EVT;
param.set_path_loss_rpting_params.status = btc_btm_status_to_esp_status(params->path_loss_rpting_params.status);
param.set_path_loss_rpting_params.conn_handle = params->path_loss_rpting_params.conn_handle;
break;
case BTA_BLE_GAP_SET_PATH_LOSS_REPORTING_ENABLE_EVT:
msg.act = ESP_GAP_BLE_SET_PATH_LOSS_RPTING_ENABLE_EVT;
param.set_path_loss_rpting_enable.status = btc_btm_status_to_esp_status(params->path_loss_rpting_enable.status);
param.set_path_loss_rpting_enable.conn_handle = params->path_loss_rpting_enable.conn_handle;
break;
case BTA_BLE_GAP_SET_TRANS_POWER_REPORTING_ENABLE_EVT:
msg.act = ESP_GAP_BLE_SET_TRANS_PWR_RPTING_ENABLE_EVT;
param.set_trans_pwr_rpting_enable.status = btc_btm_status_to_esp_status(params->trans_pwr_rpting_enable.status);
param.set_trans_pwr_rpting_enable.conn_handle = params->trans_pwr_rpting_enable.conn_handle;
break;
case BTA_BLE_GAP_PATH_LOSS_THRESHOLD_EVT:
msg.act = ESP_GAP_BLE_PATH_LOSS_THRESHOLD_EVT;
param.path_loss_thres_evt.conn_handle = params->path_loss_thres_evt.conn_handle;
param.path_loss_thres_evt.cur_path_loss = params->path_loss_thres_evt.cur_path_loss;
param.path_loss_thres_evt.zone_entered = params->path_loss_thres_evt.zone_entered;
break;
case BTA_BLE_GAP_TRANMIT_POWER_REPORTING_EVT:
msg.act = ESP_GAP_BLE_TRANS_PWR_RPTING_EVT;
param.trans_power_report_evt.status = btc_btm_status_to_esp_status(params->trans_pwr_report_evt.status);
param.trans_power_report_evt.conn_handle = params->trans_pwr_report_evt.conn_handle;
param.trans_power_report_evt.reason = params->trans_pwr_report_evt.reason;
param.trans_power_report_evt.phy = params->trans_pwr_report_evt.phy;
param.trans_power_report_evt.tx_power_level = params->trans_pwr_report_evt.tx_power_level;
param.trans_power_report_evt.tx_power_level_flag = params->trans_pwr_report_evt.tx_power_level_flag;
param.trans_power_report_evt.delta = params->trans_pwr_report_evt.delta;
break;
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
case BTA_BLE_GAP_SET_DEFAULT_SUBRATE_EVT:
msg.act = ESP_GAP_BLE_SET_DEFAULT_SUBRATE_COMPLETE_EVT;
param.set_default_subrate_evt.status = btc_btm_status_to_esp_status(params->status);
break;
case BTA_BLE_GAP_SUBRATE_REQUEST_EVT:
msg.act = ESP_GAP_BLE_SUBRATE_REQUEST_COMPLETE_EVT;
param.subrate_req_cmpl_evt.status = btc_btm_status_to_esp_status(params->status);
break;
case BTA_BLE_GAP_SUBRATE_CHANGE_EVT:
msg.act = ESP_GAP_BLE_SUBRATE_CHANGE_EVT;
param.subrate_change_evt.status = btc_btm_status_to_esp_status(params->subrate_change_evt.status);
param.subrate_change_evt.conn_handle = params->subrate_change_evt.conn_handle;
param.subrate_change_evt.subrate_factor = params->subrate_change_evt.subrate_factor;
param.subrate_change_evt.peripheral_latency = params->subrate_change_evt.peripheral_latency;
param.subrate_change_evt.continuation_number = params->subrate_change_evt.continuation_number;
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;
}
@ -2529,6 +2599,39 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
case BTC_GAP_BLE_ACT_SET_VENDOR_EVT_MASK:
BTA_DmBleGapSetVendorEventMask(arg->set_vendor_evt_mask.evt_mask, btc_ble_set_vendor_evt_mask_callback);
break;
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
case BTC_GAP_BLE_ENH_READ_TRANS_POWER_LEVEL:
BTA_DmBleGapEnhReadTransPwrLevel(arg_5->enh_read_trans_pwr_level.conn_handle, arg_5->enh_read_trans_pwr_level.phy);
break;
case BTC_GAP_BLE_READ_REM_TRANS_POWER_LEVEL:
BTA_DmBleGapReadRemoteTransPwrLevel(arg_5->read_rem_trans_pwr_level.conn_handle, arg_5->read_rem_trans_pwr_level.phy);
break;
case BTC_GAP_BLE_SET_PATH_LOSS_REPORT_PARAMS:
BTA_DmBleGapSetPathLossRptParams(arg_5->set_path_loss_rpt_params.conn_handle, arg_5->set_path_loss_rpt_params.high_threshold, arg_5->set_path_loss_rpt_params.high_hysteresis,
arg_5->set_path_loss_rpt_params.low_threshold, arg_5->set_path_loss_rpt_params.low_hysteresis, arg_5->set_path_loss_rpt_params.min_time_spent);
break;
case BTC_GAP_BLE_SET_PATH_LOSS_REPORTING_EN:
BTA_DmBleGapSetPathLossRptEnable(arg_5->set_path_loss_rpt_en.conn_handle, arg_5->set_path_loss_rpt_en.enable);
break;
case BTC_GAP_BLE_SET_TRANS_POWER_REPORTING_EN:
BTA_DmBleGapSetTransPwrRptEnable(arg_5->set_trans_pwr_rpting_en.conn_handle, arg_5->set_trans_pwr_rpting_en.local_enable, arg_5->set_trans_pwr_rpting_en.remote_enable);
break;
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
case BTC_GAP_BLE_SET_DEFALT_SUBRATE:
BTA_DmBleGapSetDefaultSubrate(arg_5->default_subrate_param.subrate_min, arg_5->default_subrate_param.subrate_max, arg_5->default_subrate_param.max_latency,
arg_5->default_subrate_param.continuation_number, arg_5->default_subrate_param.supervision_timeout);
break;
case BTC_GAP_BLE_SUBRATE_REQUEST:
BTA_DmBleGapSubrateReqest(arg_5->subrate_req_param.conn_handle, arg_5->subrate_req_param.subrate_min, arg_5->subrate_req_param.subrate_max,
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;
}

View File

@ -0,0 +1,98 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __BTC_CTE_BLE_H__
#define __BTC_CTE_BLE_H__
#if (BLE_FEAT_CTE_EN == TRUE)
#include "esp_bt_defs.h"
#include "esp_ble_cte_api.h"
#include "btc/btc_manage.h"
typedef enum {
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
BTC_CTE_ACT_SET_TRANS_PARAMS,
BTC_CTE_ACT_SET_TRANS_ENABLE,
BTC_CTE_ACT_SET_IQ_SAMPLING_EN,
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
BTC_CTE_ACT_SET_CONN_CTE_RECV_PARAMS,
BTC_CTE_ACT_SET_CONN_CTE_TRANS_PARAMS,
BTC_CTE_ACT_SET_CONN_CTE_REQUEST_EN,
BTC_CTE_ACT_SET_CONN_CTE_RESPONSE_EN,
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
BTC_CTE_ACT_READ_ANTENNA_INFOR,
} btc_cte_ble_act_t;
/* btc_ble_cte_args_t */
typedef union {
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
struct cte_set_trans_params_arg {
uint8_t adv_handle;
uint8_t cte_len;
uint8_t cte_type;
uint8_t cte_count;
uint8_t switching_pattern_len;
uint8_t *antenna_ids;
} cte_trans_params;
struct cte_set_trans_enable_arg {
uint8_t adv_handle;
uint8_t cte_enable;
} cte_trans_enable;
struct cte_iq_sampling_en_arg {
uint16_t sync_handle;
uint8_t sampling_en;
uint8_t slot_dur;
uint8_t max_sampled_ctes;
uint8_t switching_pattern_len;
uint8_t *antenna_ids;
} cte_iq_sampling_en;
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
struct cte_recv_params_arg {
uint16_t conn_handle;
uint8_t sampling_en;
uint8_t slot_dur;
uint8_t switching_pattern_len;
uint8_t *antenna_ids;
} cte_recv_params;
struct cte_set_conn_trans_params_arg {
uint16_t conn_handle;
uint8_t cte_types;
uint8_t switching_pattern_len;
uint8_t *antenna_ids;
} cte_conn_trans_params;
struct cte_req_en_arg {
uint16_t conn_handle;
uint8_t enable;
uint16_t cte_req_interval;
uint8_t req_cte_len;
uint8_t req_cte_Type;
} cte_req_en;
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
struct cte_rsp_en_arg {
uint16_t conn_handle;
uint8_t enable;
} cte_rsp_en;
} btc_ble_cte_args_t;
void btc_ble_cte_call_handler(btc_msg_t *msg);
void btc_ble_cte_cb_handler(btc_msg_t *msg);
void btc_ble_cte_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
void btc_ble_cte_arg_deep_free(btc_msg_t *msg);
void btc_ble_cte_cb_deep_free(btc_msg_t *msg);
void btc_ble_cte_cb_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
void btc_cte_callback_init(void);
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
#endif /* __BTC_CTE_BLE_H__ */

View File

@ -122,6 +122,20 @@ typedef enum {
BTC_GAP_BLE_SET_PRIVACY_MODE,
BTC_GAP_BLE_SET_CSA_SUPPORT,
BTC_GAP_BLE_ACT_SET_VENDOR_EVT_MASK,
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
BTC_GAP_BLE_ENH_READ_TRANS_POWER_LEVEL,
BTC_GAP_BLE_READ_REM_TRANS_POWER_LEVEL,
BTC_GAP_BLE_SET_PATH_LOSS_REPORT_PARAMS,
BTC_GAP_BLE_SET_PATH_LOSS_REPORTING_EN,
BTC_GAP_BLE_SET_TRANS_POWER_REPORTING_EN,
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
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 */
@ -457,6 +471,61 @@ typedef union {
uint8_t phy;
uint8_t modulation_index;
} dtm_enh_rx_start;
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
// BTC_GAP_BLE_ENH_READ_TRANS_POWER_LEVEL
struct enh_read_trans_pwr_level_args {
uint8_t conn_handle;
uint8_t phy;
} enh_read_trans_pwr_level;
// BTC_GAP_BLE_READ_REM_TRANS_POWER_LEVEL
struct read_rem_trans_pwr_level_args {
uint8_t conn_handle;
uint8_t phy;
} read_rem_trans_pwr_level;
// BTC_GAP_BLE_SET_PATH_LOSS_REPORT_PARAMS
struct set_path_loss_rpt_params_args {
uint16_t conn_handle;
uint8_t high_threshold;
uint8_t high_hysteresis;
uint8_t low_threshold;
uint8_t low_hysteresis;
uint16_t min_time_spent;
} set_path_loss_rpt_params;
// BTC_GAP_BLE_SET_PATH_LOSS_REPORTING_EN
struct set_path_loss_rpt_en_args {
uint16_t conn_handle;
uint8_t enable;
} set_path_loss_rpt_en;
// BTC_GAP_BLE_SET_TRANS_POWER_REPORTING_EN
struct set_trans_pwr_rpting_en_args {
uint16_t conn_handle;
uint8_t local_enable;
uint8_t remote_enable;
} set_trans_pwr_rpting_en;
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
// BTC_GAP_BLE_SET_DEFALT_SUBRATE
struct default_subrate_param_args {
uint16_t subrate_min;
uint16_t subrate_max;
uint16_t max_latency;
uint16_t continuation_number;
uint16_t supervision_timeout;
} default_subrate_param;
// BTC_GAP_BLE_SUBRATE_REQUEST
struct subrate_req_param_args {
uint16_t conn_handle;
uint16_t subrate_min;
uint16_t subrate_max;
uint16_t max_latency;
uint16_t continuation_number;
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)

View File

@ -0,0 +1,222 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __BTC_ISO_BLE_H__
#define __BTC_ISO_BLE_H__
#if (BLE_FEAT_ISO_EN == TRUE)
#include "esp_bt_defs.h"
#include "esp_ble_iso_api.h"
#include "btc/btc_manage.h"
struct btc_iso_cis_params {
uint8_t cis_id;
uint16_t max_sdu_c_to_p;
uint16_t max_sdu_p_to_c;
uint8_t phy_c_to_p;
uint8_t phy_p_to_c;
uint8_t rtn_c_to_p;
uint8_t rtn_p_to_c;
} __attribute__((packed));
struct btc_iso_cis_params_test {
uint8_t cis_id;
uint8_t nse;
uint16_t max_sdu_c_to_p;
uint16_t max_sdu_p_to_c;
uint16_t max_pdu_c_to_p;
uint16_t max_pdu_p_to_c;
uint8_t phy_c_to_p;
uint8_t phy_p_to_c;
uint8_t bn_c_to_p;
uint8_t bn_p_to_c;
} __attribute__((packed));
struct btc_iso_cis_hdls {
uint16_t cis_hdl;
uint16_t acl_hdl;
}__attribute__((packed));
typedef enum {
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
BTC_ISO_ACT_BIG_CREATE,
BTC_ISO_ACT_BIG_CREATE_TEST,
BTC_ISO_ACT_BIG_TERMINATE,
#endif // #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
BTC_ISO_ACT_BIG_SYNC_CREATE,
BTC_ISO_ACT_BIG_SYNC_TERMINATE,
#endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
BTC_ISO_ACT_SET_DATA_PATH,
BTC_ISO_ACT_REMOVE_DATA_PATH,
BTC_ISO_ACT_READ_ISO_TX_SYNC,
BTC_ISO_ACT_READ_ISO_LINK_QUALITY,
#if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
BTC_ISO_ACT_SET_CIG_PARAMS,
BTC_ISO_ACT_SET_CIG_PARAMS_TEST,
BTC_ISO_ACT_CREATE_CIS,
BTC_ISO_ACT_REMOVE_CIG,
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
BTC_ISO_ACT_ACCEPT_CIS_REQ,
BTC_ISO_ACT_REJECT_CIS_REQ,
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_EN == TRUE)
BTC_ISO_ACT_DISCON_CIS,
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)
} btc_iso_ble_act_t;
/* btc_ble_iso_args_t */
typedef union {
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
struct iso_big_create_args {
uint8_t big_handle;
uint8_t adv_handle;
uint8_t num_bis;
uint32_t sdu_interval;
uint16_t max_sdu;
uint16_t max_transport_latency;
uint8_t rtn;
uint8_t phy;
uint8_t packing;
uint8_t framing;
uint8_t encryption;
uint8_t broadcast_code[16];
} iso_big_creat_params;
struct iso_big_create_test_args {
uint8_t big_handle;
uint8_t adv_handle;
uint8_t num_bis;
uint32_t sdu_interval;
uint16_t iso_interval;
uint8_t nse;
uint16_t max_sdu;
uint16_t max_pdu;
uint8_t phy;
uint8_t packing;
uint8_t framing;
uint8_t bn;
uint8_t irc;
uint8_t pto;
uint8_t encryption;
uint8_t broadcast_code[16];
} iso_big_creat_test_params;
struct iso_big_terminate_args {
uint8_t big_handle;
uint8_t reason;
} iso_big_terminate_params;
#endif // #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
struct iso_big_sync_creat_arg {
uint8_t big_handle;
uint16_t sync_handle;
uint8_t encryption;
uint8_t bc_code[16];
uint8_t mse;
uint16_t big_sync_timeout;
uint8_t num_bis;
uint8_t bis[BLE_ISO_BIS_MAX_COUNT];
} iso_big_sync_creat_params;
struct iso_big_sync_terminate_arg {
uint8_t big_handle;
} iso_big_sync_terminate_params;
#endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
struct iso_set_data_path_arg {
uint16_t conn_handle;
uint8_t data_path_dir;
uint8_t data_path_id;
uint8_t coding_fmt;
uint16_t company_id;
uint16_t vs_codec_id;
uint32_t controller_delay;
uint8_t codec_cfg_len;
uint8_t *codec_cfg;
} iso_set_data_path_params;
struct iso_remove_data_path_arg {
uint16_t conn_handle;
uint8_t data_path_dir;
} iso_remove_data_path_params;
struct iso_read_tx_sync_arg {
uint16_t iso_handle;
} iso_read_tx_sync_params;
struct iso_read_link_quality_arg {
uint16_t iso_handle;
} iso_read_link_quality_params;
#if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
struct set_cig_params_arg {
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;
uint8_t framing;
uint16_t mtl_c_to_p;
uint16_t mtl_p_to_c;
uint8_t cis_cnt;
struct btc_iso_cis_params cis_params[BLE_ISO_CIS_MAX_COUNT];
} set_cig_params;
struct set_cig_params_test_arg {
uint8_t cig_id;
uint32_t sdu_int_c_to_p;
uint32_t sdu_int_p_to_c;
uint8_t ft_c_to_p;
uint8_t ft_p_to_c;
uint16_t iso_interval;
uint8_t worse_case_SCA;
uint8_t packing;
uint8_t framing;
uint8_t cis_cnt;
struct btc_iso_cis_params_test cis_params_test[ESP_BLE_MAX_CIS_NUM];
} set_cig_params_test;
struct creat_cis_arg {
uint8_t cis_count;
struct btc_iso_cis_hdls cis_hdls[BLE_ISO_CIS_MAX_COUNT];
} creat_cis_params;
struct remove_cig_arg {
uint8_t cig_id;
} remove_cig_params;
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
struct accept_cis_req_arg {
uint16_t cis_handle;
} accept_cis_req_params;
struct reject_cis_req_arg {
uint16_t cis_handle;
uint8_t reason;
} reject_cis_req_params;
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_EN == TRUE)
struct discon_cis_arg {
uint16_t cis_handle;
uint8_t reason;
} discon_cis_params;
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)
} btc_ble_iso_args_t;
void btc_iso_ble_call_handler(btc_msg_t *msg);
void btc_iso_ble_cb_handler(btc_msg_t *msg);
void btc_iso_ble_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
void btc_iso_ble_arg_deep_free(btc_msg_t *msg);
void btc_iso_ble_cb_deep_free(btc_msg_t *msg);
void btc_iso_ble_cb_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
void btc_iso_callback_init(void);
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#endif /* __BTC_ISO_BLE_H__ */

View File

@ -0,0 +1,384 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <string.h>
#include "osi/allocator.h"
#include "bta/bta_api.h"
#include "bta/bta_dm_co.h"
#include "btc/btc_task.h"
#include "btc/btc_util.h"
#if (BLE_FEAT_ISO_EN == TRUE)
#include "btc_iso_ble.h"
#include "esp_ble_iso_api.h"
static inline void btc_iso_ble_cb_to_app(esp_ble_iso_cb_event_t event, esp_ble_iso_cb_param_t *param)
{
esp_ble_iso_cb_t btc_iso_ble_cb = (esp_ble_iso_cb_t)btc_profile_cb_get(BTC_PID_ISO_BLE);
if (btc_iso_ble_cb) {
btc_iso_ble_cb(event, param);
}
}
static void btc_ble_iso_callback(tBTM_BLE_ISO_EVENT event,
tBTM_BLE_ISO_CB_PARAMS *params)
{
esp_ble_iso_cb_param_t param;
bt_status_t ret;
btc_msg_t msg;
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_ISO_BLE;
switch(event) {
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
case BTA_BLE_ISO_BIG_CREATE_COMPLETE_EVT:
msg.act = ESP_BLE_ISO_BIG_CREATE_CMPL_EVT;
param.create_big_cmpl.status = btc_btm_status_to_esp_status(params->btm_big_cmpl.status);
param.create_big_cmpl.big_handle = params->btm_big_cmpl.big_handle;
param.create_big_cmpl.big_sync_delay = params->btm_big_cmpl.big_sync_delay;
param.create_big_cmpl.transport_latency = params->btm_big_cmpl.transport_latency;
param.create_big_cmpl.phy = params->btm_big_cmpl.phy;
param.create_big_cmpl.nse = params->btm_big_cmpl.nse;
param.create_big_cmpl.bn = params->btm_big_cmpl.bn;
param.create_big_cmpl.pto = params->btm_big_cmpl.pto;
param.create_big_cmpl.irc = params->btm_big_cmpl.irc;
param.create_big_cmpl.max_pdu = params->btm_big_cmpl.max_pdu;
param.create_big_cmpl.iso_interval = params->btm_big_cmpl.iso_interval;
param.create_big_cmpl.num_bis = params->btm_big_cmpl.num_bis;
for (uint8_t i = 0; i < params->btm_big_cmpl.num_bis; i++)
{
param.create_big_cmpl.bis_handle[i] = params->btm_big_cmpl.bis_handle[i];
}
break;
case BTA_BLE_ISO_BIG_TERMINATE_COMPLETE_EVT:
msg.act = ESP_BLE_ISO_BIG_TERMINATE_CMPL_EVT;
param.term_big_cmpl.status = btc_btm_status_to_esp_status(params->btm_big_term.status);
param.term_big_cmpl.big_handle = params->btm_big_term.big_handle;
param.term_big_cmpl.reason = params->btm_big_term.reason;
break;
#endif // #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
case BTA_BLE_ISO_BIG_SYNC_ESTABLISHED_EVT:
msg.act = ESP_BLE_ISO_BIG_SYNC_ESTABLISHED_EVT;
param.big_sync_estab.status = btc_btm_status_to_esp_status(params->btm_big_sync_estab.status);
param.big_sync_estab.big_handle = params->btm_big_sync_estab.big_handle;
param.big_sync_estab.transport_latency = params->btm_big_sync_estab.transport_latency_big;
param.big_sync_estab.nse = params->btm_big_sync_estab.nse;
param.big_sync_estab.bn = params->btm_big_sync_estab.bn;
param.big_sync_estab.pto = params->btm_big_sync_estab.pto;
param.big_sync_estab.irc = params->btm_big_sync_estab.irc;
param.big_sync_estab.max_pdu = params->btm_big_sync_estab.max_pdu;
param.big_sync_estab.iso_interval = params->btm_big_sync_estab.iso_interval;
param.big_sync_estab.num_bis = params->btm_big_sync_estab.num_bis;
for (uint8_t i = 0; i < params->btm_big_sync_estab.num_bis; i++)
{
param.big_sync_estab.bis_handle[i] = params->btm_big_sync_estab.bis_handle[i];
}
break;
case BTA_BLE_ISO_BIG_SYNC_LOST_EVT:
msg.act = ESP_BLE_ISO_BIG_SYNC_LOST_EVT;
param.big_sync_lost.big_handle = params->btm_big_sync_lost.big_handle;
param.big_sync_lost.reason = params->btm_big_sync_lost.reason;
break;
case BTA_BLE_ISO_BIG_SYNC_TERMINATE_COMPLETE_EVT:
msg.act = ESP_BLE_ISO_BIG_SYNC_TERMINATE_CMPL_EVT;
param.term_big_sync.status = btc_btm_status_to_esp_status(params->btm_big_sync_ter.status);
param.term_big_sync.big_handle = params->btm_big_sync_ter.big_hdl;
break;
case BTA_BLE_ISO_BIGINFO_ADV_REPORT_EVT:
msg.act = ESP_BLE_ISO_BIGINFO_ADV_REPORT_EVT;
param.biginfo_report.sync_handle = params->btm_biginfo_report.sync_handle;
param.biginfo_report.num_bis = params->btm_biginfo_report.num_bis;
param.biginfo_report.nse = params->btm_biginfo_report.nse;
param.biginfo_report.iso_interval = params->btm_biginfo_report.iso_interval;
param.biginfo_report.bn = params->btm_biginfo_report.bn;
param.biginfo_report.pto = params->btm_biginfo_report.pto;
param.biginfo_report.irc = params->btm_biginfo_report.irc;
param.biginfo_report.max_pdu = params->btm_biginfo_report.max_pdu;
param.biginfo_report.sdu_interval = params->btm_biginfo_report.sdu_interval;
param.biginfo_report.max_sdu = params->btm_biginfo_report.max_sdu;
param.biginfo_report.phy = params->btm_biginfo_report.phy;
param.biginfo_report.framing = params->btm_biginfo_report.framing;
param.biginfo_report.encryption = params->btm_biginfo_report.encryption;
break;
#endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
case BTA_BLE_ISO_DATA_PATH_UPFATE_EVT:
msg.act = ESP_BLE_ISO_ISO_DATA_PATH_UPDATE_EVT;
param.data_path.op_type = params->btm_data_path_update.op_type;
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_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);
param.read_tx_sync.iso_hdl = params->btm_read_tx_sync.conn_hdl;
param.read_tx_sync.pkt_seq_num = params->btm_read_tx_sync.pkt_seq_num;
param.read_tx_sync.tx_time_stamp = params->btm_read_tx_sync.tx_time_stamp;
param.read_tx_sync.time_offset = params->btm_read_tx_sync.time_offset;
break;
case BTA_BLE_ISO_READ_LINK_QUALITY_EVT:
msg.act = ESP_BLE_ISO_READ_LINK_QUALITY_CMPL_EVT;
param.read_link_quality.status = btc_btm_status_to_esp_status(params->btm_read_link_quality.status);
param.read_link_quality.iso_hdl = params->btm_read_link_quality.conn_hdl;
param.read_link_quality.tx_unacked_pkts = params->btm_read_link_quality.tx_unacked_pkts;
param.read_link_quality.tx_flushed_pkts = params->btm_read_link_quality.tx_flushed_pkts;
param.read_link_quality.tx_last_subevt_pkts = params->btm_read_link_quality.tx_last_subevt_pkts;
param.read_link_quality.retransmitted_pkts = params->btm_read_link_quality.retransmitted_pkts;
param.read_link_quality.crc_error_pkts = params->btm_read_link_quality.crc_error_pkts;
param.read_link_quality.rx_unreceived_pkts = params->btm_read_link_quality.rx_unreceived_pkts;
param.read_link_quality.duplicate_pkts = params->btm_read_link_quality.duplicate_pkts;
break;
#if (BLE_FEAT_ISO_CIG_EN == TRUE)
case BTA_BLE_ISO_CIS_ESTABLISHED_EVT:
msg.act = ESP_BLE_ISO_CIS_ESTABLISHED_EVT;
param.cis_estab.status = btc_btm_status_to_esp_status(params->btm_cis_established_evt.status);
param.cis_estab.cis_handle = params->btm_cis_established_evt.conn_handle;
param.cis_estab.cig_sync_delay = params->btm_cis_established_evt.cig_sync_delay;
param.cis_estab.cis_sync_delay = params->btm_cis_established_evt.cis_sync_delay;
param.cis_estab.trans_lat_c_to_p = params->btm_cis_established_evt.trans_lat_c_to_p;
param.cis_estab.trans_lat_p_to_c = params->btm_cis_established_evt.trans_lat_p_to_c;
param.cis_estab.phy_c_to_p = params->btm_cis_established_evt.phy_c_to_p;
param.cis_estab.phy_p_to_c = params->btm_cis_established_evt.phy_p_to_c;
param.cis_estab.nse = params->btm_cis_established_evt.nse;
param.cis_estab.bn_c_to_p = params->btm_cis_established_evt.bn_c_to_p;
param.cis_estab.bn_p_to_c = params->btm_cis_established_evt.bn_p_to_c;
param.cis_estab.ft_c_to_p = params->btm_cis_established_evt.ft_c_to_p;
param.cis_estab.ft_p_to_c = params->btm_cis_established_evt.ft_p_to_c;
param.cis_estab.max_pdu_c_to_p = params->btm_cis_established_evt.max_pdu_c_to_p;
param.cis_estab.max_pdu_p_to_c = params->btm_cis_established_evt.max_pdu_p_to_c;
param.cis_estab.iso_interval = params->btm_cis_established_evt.iso_interval;
#if (BLE_FEAT_ISO_60_EN == TRUE)
param.cis_estab.sub_interval = params->btm_cis_established_evt.sub_interval;
param.cis_estab.max_sdu_c_to_p = params->btm_cis_established_evt.max_sdu_c_to_p;
param.cis_estab.max_sdu_p_to_c = params->btm_cis_established_evt.max_sdu_p_to_c;
param.cis_estab.sdu_int_c_to_p = params->btm_cis_established_evt.sdu_int_c_to_p;
param.cis_estab.sdu_int_p_to_c = params->btm_cis_established_evt.sdu_int_p_to_c;
param.cis_estab.framing = params->btm_cis_established_evt.framing;
#endif // #if (BLE_FEAT_ISO_60_EN == TRUE)
break;
case BTA_BLE_ISO_CIS_DISCONNECTED_EVT:
msg.act = ESP_BLE_ISO_CIS_DISCONNECTED_EVT;
param.cis_disconnected.cis_handle = params->btm_cis_disconnectd_evt.cis_handle;
param.cis_disconnected.reason = params->btm_cis_disconnectd_evt.reason;
break;
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
case BTM_BLE_ISO_CIS_REQUEST_EVT:
msg.act = ESP_BLE_ISO_CIS_REQUEST_EVT;
param.cis_request.acl_handle = params->btm_cis_request_evt.acl_handle;
param.cis_request.cis_handle = params->btm_cis_request_evt.cis_handle;
param.cis_request.cig_id = params->btm_cis_request_evt.cig_id;
param.cis_request.cis_id = params->btm_cis_request_evt.cis_id;
break;
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
case BTA_BLE_ISO_SET_CIG_PARAMS_EVT:
msg.act = ESP_BLE_ISO_SET_CIG_PARAMS_CMPL_EVT;
param.set_cig_params.status = btc_btm_status_to_esp_status(params->btm_set_cig_params.status);
param.set_cig_params.cig_id = params->btm_set_cig_params.cig_id;
param.set_cig_params.cis_count = params->btm_set_cig_params.cis_count;
memcpy(&param.set_cig_params.cis_hdl[0], &params->btm_set_cig_params.conn_hdl[0], params->btm_set_cig_params.cis_count * 2);
break;
case BTA_BLE_ISO_CREATE_CIS_EVT:
msg.act = ESP_BLE_ISO_CREATE_CIS_CMPL_EVT;
param.create_cis.status = btc_btm_status_to_esp_status(params->status);
break;
case BTA_BLE_ISO_REMOVE_CIG_EVT:
msg.act = ESP_BLE_ISO_REMOVE_CIG_CMPL_EVT;
param.remove_cig.status = btc_btm_status_to_esp_status(params->btm_remove_cig.status);
param.remove_cig.cig_id = params->btm_remove_cig.cig_id;
break;
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
case BTA_BLE_ISO_ACCEPT_CIS_REQ_EVT:
msg.act = ESP_BLE_ISO_ACCEPT_CIS_REQ_CMPL_EVT;
param.accept_req.status = btc_btm_status_to_esp_status(params->status);
break;
case BTA_BLE_ISO_REJECT_CIS_REQ_EVT:
msg.act = ESP_BLE_ISO_REJECT_CIS_REQ_CMPL_EVT;
param.reject_req.status = btc_btm_status_to_esp_status(params->btm_reject_cis_req.status);
param.reject_req.cis_handle = params->btm_reject_cis_req.cis_handle;
break;
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
default:
break;
}
ret = btc_transfer_context(&msg, &param,
sizeof(esp_ble_iso_cb_param_t), NULL, NULL);
if (ret != BT_STATUS_SUCCESS) {
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
}
}
void btc_iso_ble_cb_handler(btc_msg_t *msg)
{
BTC_TRACE_DEBUG("%s act %d \n", __func__, msg->act);
esp_ble_iso_cb_param_t *param = (esp_ble_iso_cb_param_t *)msg->arg;
if (msg->act < ESP_BLE_ISO_EVT_MAX) {
btc_iso_ble_cb_to_app(msg->act, param);
} else {
BTC_TRACE_ERROR("%s, unknown msg->act = %d", __func__, msg->act);
}
btc_iso_ble_cb_deep_free(msg);
}
void btc_iso_ble_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
{
btc_ble_iso_args_t *src = (btc_ble_iso_args_t *)p_src;
btc_ble_iso_args_t *dst = (btc_ble_iso_args_t *)p_dest;
switch (msg->act) {
case BTC_ISO_ACT_SET_DATA_PATH: {
if (src->iso_set_data_path_params.codec_cfg_len && src->iso_set_data_path_params.codec_cfg) {
dst->iso_set_data_path_params.codec_cfg = osi_malloc(src->iso_set_data_path_params.codec_cfg_len);
if (dst->iso_set_data_path_params.codec_cfg) {
memcpy(dst->iso_set_data_path_params.codec_cfg, src->iso_set_data_path_params.codec_cfg, src->iso_set_data_path_params.codec_cfg_len);
} else {
BTC_TRACE_ERROR("%s %d no mem\n",__func__, msg->act);
}
}
break;
}
default:
BTC_TRACE_ERROR("Unhandled deep copy %d\n", msg->act);
break;
}
}
void btc_iso_ble_cb_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
{
// esp_ble_iso_cb_param_t *src = (esp_ble_iso_cb_param_t *)p_src;
// esp_ble_iso_cb_param_t *dst = (esp_ble_iso_cb_param_t *) p_dest;
switch (msg->act) {
default:
BTC_TRACE_ERROR("%s, Unhandled deep copy %d\n", __func__, msg->act);
break;
}
}
void btc_iso_ble_arg_deep_free(btc_msg_t *msg)
{
BTC_TRACE_DEBUG("%s \n", __func__);
switch (msg->act) {
case BTC_ISO_ACT_SET_DATA_PATH: {
uint8_t *p_codec_cfg = ((btc_ble_iso_args_t *)msg->arg)->iso_set_data_path_params.codec_cfg;
if (p_codec_cfg) {
osi_free(p_codec_cfg);
}
break;
}
default:
BTC_TRACE_DEBUG("Unhandled deep free %d\n", msg->act);
break;
}
}
void btc_iso_ble_cb_deep_free(btc_msg_t *msg)
{
BTC_TRACE_DEBUG("%s", __func__);
switch (msg->act) {
default:
BTC_TRACE_DEBUG("Unhandled deep free %d", msg->act);
break;
}
}
void btc_iso_ble_call_handler(btc_msg_t *msg)
{
btc_ble_iso_args_t *arg = (btc_ble_iso_args_t *)msg->arg;
BTC_TRACE_DEBUG("%s act %d\n", __FUNCTION__, msg->act);
switch (msg->act) {
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
case BTC_ISO_ACT_BIG_CREATE:
BTA_DmBleGapIsoBigCreate((tBTA_DM_BLE_BIG_CREATE_PARAMS *)&arg->iso_big_creat_params);
break;
case BTC_ISO_ACT_BIG_CREATE_TEST:
BTA_DmBleGapIsoBigCreateTest((tBTA_DM_BLE_BIG_CREATE_TEST_PARAMS *)&arg->iso_big_creat_test_params);
break;
case BTC_ISO_ACT_BIG_TERMINATE:
BTA_DmBleGapIsoBigTerminate((tBTA_DM_BLE_BIG_TERMINATE_PARAMS *)&arg->iso_big_terminate_params);
break;
#endif // #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
case BTC_ISO_ACT_BIG_SYNC_CREATE:
BTA_DmBleGapIsoBigSyncCreate((tBTA_DM_BLE_BIG_SYNC_CREATE_PARAMS *)&arg->iso_big_sync_creat_params);
break;
case BTC_ISO_ACT_BIG_SYNC_TERMINATE:
BTA_DmBleGapIsoBigSyncTerminate((tBTA_DM_BLE_BIG_SYNC_TERMINATE_PARAMS *)&arg->iso_big_sync_terminate_params);
break;
#endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
case BTC_ISO_ACT_SET_DATA_PATH:
BTA_DmBleGapIsoDataPathSet((tBTA_DM_BLE_ISO_SET_DATA_PATH_PARAMS *)&arg->iso_set_data_path_params);
break;
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_READ_ISO_TX_SYNC:
BTA_DmBleGapIsoReadTxSync(arg->iso_read_tx_sync_params.iso_handle);
break;
case BTC_ISO_ACT_READ_ISO_LINK_QUALITY:
break;
#if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
case BTC_ISO_ACT_SET_CIG_PARAMS: {
struct set_cig_params_arg *set_cig_params = (struct set_cig_params_arg *)arg;
BTA_DmBleIsoSetCigParams(set_cig_params->cig_id, set_cig_params->sdu_int_c_to_p, set_cig_params->sdu_int_p_to_c,
set_cig_params->worse_case_SCA, set_cig_params->packing, set_cig_params->framing,
set_cig_params->mtl_c_to_p, set_cig_params->mtl_p_to_c, set_cig_params->cis_cnt,
(uint8_t *)&set_cig_params->cis_params[0]);
break;
}
case BTC_ISO_ACT_SET_CIG_PARAMS_TEST:
struct set_cig_params_test_arg *set_cig_params_test = (struct set_cig_params_test_arg *)arg;
BTA_DmBleIsoSetCigParamsTest(set_cig_params_test->cig_id, set_cig_params_test->sdu_int_c_to_p, set_cig_params_test->sdu_int_p_to_c,
set_cig_params_test->ft_c_to_p, set_cig_params_test->ft_p_to_c, set_cig_params_test->iso_interval,
set_cig_params_test->worse_case_SCA, set_cig_params_test->packing, set_cig_params_test->framing,
set_cig_params_test->cis_cnt, (uint8_t *)&set_cig_params_test->cis_params_test[0]);
break;
case BTC_ISO_ACT_CREATE_CIS: {
struct creat_cis_arg * create_cis = (struct creat_cis_arg *)arg;
BTA_DmBleIsoCreateCis(create_cis->cis_count, (uint8_t *)&create_cis->cis_hdls[0]);
break;
}
case BTC_ISO_ACT_REMOVE_CIG:
BTA_DmBleIsoRemoveCig(arg->remove_cig_params.cig_id);
break;
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
case BTC_ISO_ACT_ACCEPT_CIS_REQ:
BTA_DmBleIsoAcceptCisReq(arg->accept_cis_req_params.cis_handle);
break;
case BTC_ISO_ACT_REJECT_CIS_REQ:
BTA_DmBleIsoRejectCisReq(arg->reject_cis_req_params.cis_handle, arg->reject_cis_req_params.reason);
break;
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_EN == TRUE)
case BTC_ISO_ACT_DISCON_CIS:
BTA_DmBleIsoDisconCis(arg->discon_cis_params.cis_handle, arg->discon_cis_params.reason);
break;
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)
default:
break;
}
btc_iso_ble_arg_deep_free(msg);
}
//register connection parameter update callback
void btc_iso_callback_init(void)
{
BTM_BleIsoRegisterCallback(btc_ble_iso_callback);
}
#endif ///BLE_FEAT_ISO_EN == TRUE

View File

@ -247,6 +247,92 @@
#define UC_BT_BLE_FEAT_CREATE_SYNC_ENH FALSE
#endif
#ifdef CONFIG_BT_BLE_FEAT_ISO_EN
#define UC_BT_BLE_FEAT_ISO_EN CONFIG_BT_BLE_FEAT_ISO_EN
#else
#define UC_BT_BLE_FEAT_ISO_EN FALSE
#endif
#if CONFIG_BT_BLE_FEAT_ISO_60_EN
#define UC_BT_BLE_FEAT_ISO_60_EN CONFIG_BT_BLE_FEAT_ISO_60_EN
#else
#define UC_BT_BLE_FEAT_ISO_60_EN FALSE
#endif
#ifdef CONFIG_BT_BLE_FEAT_ISO_BIG_SYNCER
#define UC_BT_BLE_FEAT_ISO_BIG_SYNCER CONFIG_BT_BLE_FEAT_ISO_BIG_SYNCER
#else
#define UC_BT_BLE_FEAT_ISO_BIG_SYNCER FALSE
#endif
#ifdef CONFIG_BT_BLE_FEAT_ISO_BIG_BROCASTER
#define UC_BT_BLE_FEAT_ISO_BIG_BROCASTER CONFIG_BT_BLE_FEAT_ISO_BIG_BROCASTER
#else
#define UC_BT_BLE_FEAT_ISO_BIG_BROCASTER FALSE
#endif
#ifdef CONFIG_BT_BLE_FEAT_ISO_CIG_CENTRAL
#define UC_BT_BLE_FEAT_ISO_CIG_CENTRAL CONFIG_BT_BLE_FEAT_ISO_CIG_CENTRAL
#else
#define UC_BT_BLE_FEAT_ISO_CIG_CENTRAL FALSE
#endif
#ifdef CONFIG_BT_BLE_FEAT_ISO_CIG_PERIPHERAL
#define UC_BT_BLE_FEAT_ISO_CIG_PERIPHERAL CONFIG_BT_BLE_FEAT_ISO_CIG_PERIPHERAL
#else
#define UC_BT_BLE_FEAT_ISO_CIG_PERIPHERAL FALSE
#endif
#ifdef CONFIG_BT_BLE_ISO_CIS_MAX_COUNT
#define UC_BT_BLE_ISO_CIS_MAX_COUNT CONFIG_BT_BLE_ISO_CIS_MAX_COUNT
#else
#define UC_BT_BLE_ISO_CIS_MAX_COUNT (0)
#endif
#ifdef CONFIG_BT_BLE_ISO_BIS_MAX_COUNT
#define UC_BT_BLE_ISO_BIS_MAX_COUNT CONFIG_BT_BLE_ISO_BIS_MAX_COUNT
#else
#define UC_BT_BLE_ISO_BIS_MAX_COUNT (0)
#endif
#ifdef CONFIG_BT_BLE_ISO_STD_FLOW_CTRL
#define UC_BT_BLE_ISO_STD_FLOW_CTRL CONFIG_BT_BLE_ISO_STD_FLOW_CTRL
#endif
#ifdef CONFIG_BT_BLE_ISO_NON_STD_FLOW_CTRL
#define UC_BT_BLE_ISO_NON_STD_FLOW_CTRL CONFIG_BT_BLE_ISO_NON_STD_FLOW_CTRL
#endif
#ifdef CONFIG_BT_BLE_FEAT_CTE_EN
#define UC_BT_BLE_FEAT_CTE_EN CONFIG_BT_BLE_FEAT_CTE_EN
#else
#define UC_BT_BLE_FEAT_CTE_EN FALSE
#endif
#ifdef CONFIG_BT_BLE_FEAT_CTE_CONNECTIONLESS_EN
#define UC_BT_BLE_FEAT_CTE_CONNECTIONLESS_EN CONFIG_BT_BLE_FEAT_CTE_CONNECTIONLESS_EN
#else
#define UC_BT_BLE_FEAT_CTE_CONNECTIONLESS_EN FALSE
#endif
#ifdef CONFIG_BT_BLE_FEAT_CTE_CONNECTION_EN
#define UC_BT_BLE_FEAT_CTE_CONNECTION_EN CONFIG_BT_BLE_FEAT_CTE_CONNECTION_EN
#else
#define UC_BT_BLE_FEAT_CTE_CONNECTION_EN FALSE
#endif
#ifdef CONFIG_BT_BLE_FEAT_POWER_CONTROL
#define UC_BT_BLE_FEAT_POWER_CONTROL CONFIG_BT_BLE_FEAT_POWER_CONTROL
#else
#define UC_BT_BLE_FEAT_POWER_CONTROL FALSE
#endif
#ifdef CONFIG_BT_BLE_FEAT_CONN_SUBRATING
#define UC_BT_BLE_FEAT_CONN_SUBRATING CONFIG_BT_BLE_FEAT_CONN_SUBRATING
#else
#define UC_BT_BLE_FEAT_CONN_SUBRATING FALSE
#endif
#ifdef CONFIG_BT_BLE_HIGH_DUTY_ADV_INTERVAL
#define UC_BT_BLE_HIGH_DUTY_ADV_INTERVAL CONFIG_BT_BLE_HIGH_DUTY_ADV_INTERVAL
#else

View File

@ -296,6 +296,102 @@
#define BLE_FEAT_CREATE_SYNC_ENH FALSE
#endif
#if (UC_BT_BLE_FEAT_ISO_EN == TRUE)
#define BLE_FEAT_ISO_EN TRUE
#else
#define BLE_FEAT_ISO_EN FALSE
#endif
#if (UC_BT_BLE_FEAT_ISO_60_EN == TRUE)
#define BLE_FEAT_ISO_60_EN TRUE
#else
#define BLE_FEAT_ISO_60_EN FALSE
#endif
#if (UC_BT_BLE_FEAT_ISO_BIG_BROCASTER == TRUE)
#define BLE_FEAT_ISO_BIG_BROCASTER_EN TRUE
#else
#define BLE_FEAT_ISO_BIG_BROCASTER_EN FALSE
#endif
#if (UC_BT_BLE_FEAT_ISO_BIG_SYNCER == TRUE)
#define BLE_FEAT_ISO_BIG_SYNCER_EN TRUE
#else
#define BLE_FEAT_ISO_BIG_SYNCER_EN FALSE
#endif
#if (UC_BT_BLE_FEAT_ISO_CIG_CENTRAL == TRUE)
#define BLE_FEAT_ISO_CIG_CENTRAL_EN TRUE
#else
#define BLE_FEAT_ISO_CIG_CENTRAL_EN FALSE
#endif
#if (UC_BT_BLE_FEAT_ISO_CIG_PERIPHERAL == TRUE)
#define BLE_FEAT_ISO_CIG_PERIPHERAL_EN TRUE
#else
#define BLE_FEAT_ISO_CIG_PERIPHERAL_EN FALSE
#endif
#if ((BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE) || (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE))
#define BLE_FEAT_ISO_CIG_EN TRUE
#else
#define BLE_FEAT_ISO_CIG_EN FALSE
#endif
#ifdef UC_BT_BLE_ISO_CIS_MAX_COUNT
#define BLE_ISO_CIS_MAX_COUNT UC_BT_BLE_ISO_CIS_MAX_COUNT
#else
#define BLE_ISO_CIS_MAX_COUNT (0)
#endif
#ifdef CONFIG_BT_BLE_ISO_BIS_MAX_COUNT
#define BLE_ISO_BIS_MAX_COUNT CONFIG_BT_BLE_ISO_BIS_MAX_COUNT
#else
#define BLE_ISO_BIS_MAX_COUNT (0)
#endif
#ifdef UC_BT_BLE_ISO_STD_FLOW_CTRL
#define BLE_ISO_STD_FLOW_CTRL TRUE
#endif
#ifdef UC_BT_BLE_ISO_NON_STD_FLOW_CTRL
#define BLE_ISO_NON_STD_FLOW_CTRL TRUE
#endif
#if ((UC_BT_BLE_ISO_STD_FLOW_CTRL == TRUE) && (UC_BT_BLE_ISO_NON_STD_FLOW_CTRL == TRUE))
#error "Only one of standard or non-standard can be enabled"
#endif
#if (UC_BT_BLE_FEAT_CTE_EN == TRUE)
#define BLE_FEAT_CTE_EN TRUE
#else
#define BLE_FEAT_CTE_EN FALSE
#endif
#if (UC_BT_BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#define BLE_FEAT_CTE_CONNECTIONLESS_EN TRUE
#else
#define BLE_FEAT_CTE_CONNECTIONLESS_EN FALSE
#endif
#if (UC_BT_BLE_FEAT_CTE_CONNECTION_EN == TRUE)
#define BLE_FEAT_CTE_CONNECTION_EN TRUE
#else
#define BLE_FEAT_CTE_CONNECTION_EN FALSE
#endif
#if (UC_BT_BLE_FEAT_POWER_CONTROL == TRUE)
#define BLE_FEAT_POWER_CONTROL_EN TRUE
#else
#define BLE_FEAT_POWER_CONTROL_EN FALSE
#endif
#if (UC_BT_BLE_FEAT_CONN_SUBRATING == TRUE)
#define BLE_FEAT_CONN_SUBRATING TRUE
#else
#define BLE_FEAT_CONN_SUBRATING FALSE
#endif
#if (UC_BT_BLE_HIGH_DUTY_ADV_INTERVAL == TRUE)
#define BLE_HIGH_DUTY_ADV_INTERVAL TRUE
#else

View File

@ -31,10 +31,10 @@
#include "osi/future.h"
#include "config/stack_config.h"
#if (BLE_50_FEATURE_SUPPORT == TRUE)
const bt_event_mask_t BLE_EVENT_MASK = { "\x00\x00\x00\x00\x00\xff\xff\xff" };
const bt_event_mask_t BLE_EVENT_MASK = { "\x00\x00\x00\x07\xff\xff\xff\xff" };
#else
const bt_event_mask_t BLE_EVENT_MASK = { "\x00\x00\x00\x00\x00\x00\x06\x7f" };
#endif
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_INCLUDED)
const bt_event_mask_t CLASSIC_EVENT_MASK = { HCI_DUMO_EVENT_MASK_EXT };
@ -106,6 +106,10 @@ static controller_local_param_t *controller_param_ptr;
static void start_up(void)
{
BT_HDR *response;
#if (BLE_FEAT_ISO_EN == TRUE)
uint16_t iso_pktlen = 0;
uint8_t iso_max_pkts = 0;
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
// Send the initial reset command
response = AWAIT_COMMAND(controller_param.packet_factory->make_reset());
@ -244,7 +248,19 @@ static void start_up(void)
&controller_param.acl_data_size_ble,
&controller_param.acl_buffer_count_ble
);
#if (BLE_FEAT_ISO_EN == TRUE)
// Request the ble buffer size next
response = AWAIT_COMMAND(controller_param.packet_factory->make_ble_read_buffer_size_v2());
controller_param.packet_parser->parse_ble_read_buffer_size_response_v2(
response,
&controller_param.acl_data_size_ble,
&controller_param.acl_buffer_count_ble,
&iso_pktlen,
&iso_max_pkts
);
extern int ble_hci_set_iso_buf_sz(uint16_t pktlen, uint8_t max_pkts);
ble_hci_set_iso_buf_sz(iso_pktlen, iso_max_pkts);
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
// Response of 0 indicates ble has the same buffer size as classic
if (controller_param.acl_data_size_ble == 0) {
controller_param.acl_data_size_ble = controller_param.acl_data_size_classic;

View File

@ -0,0 +1,346 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#include <string.h>
#include <assert.h>
#include "hci/ble_hci_iso.h"
#include "common/bt_target.h"
#include "osi/mutex.h"
#if (BLE_FEAT_ISO_EN == TRUE)
#define BLE_HCI_ISO_PB_FIRST_FRAG 0
#define BLE_HCI_ISO_PB_CONT_FRAG 1
#define BLE_HCI_ISO_PB_COMP_SDU 2
#define BLE_HCI_ISO_PB_LAST_FRAG 3
#define BLE_HCI_ISO_DATA_HDR_SZ 4
#define BLE_HCI_ISO_DATA_LOAD_TS_SZ 4
#define BLE_HCI_ISO_DATA_LOAD_HDR_SZ 4
#ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif
static uint16_t ble_hs_iso_buf_sz;
static uint8_t ble_hs_iso_max_pkts;
#if (BLE_ISO_STD_FLOW_CTRL == TRUE)
/* Number of available ISO transmit buffers on the controller.
* It must only be accessed while the host mutex is locked.
*/
static uint16_t ble_hs_iso_avail_pkts;
#endif // #if (BLE_ISO_STD_FLOW_CTRL == TRUE)
static struct ble_hci_iso_conn g_iso_conn[BLE_ISO_BIS_MAX_COUNT + BLE_ISO_CIS_MAX_COUNT];
int
ble_hci_set_iso_buf_sz(uint16_t pktlen, uint8_t max_pkts)
{
if (pktlen == 0 || max_pkts == 0) {
return 3;
}
ble_hs_iso_buf_sz = pktlen;
ble_hs_iso_max_pkts = max_pkts;
#if (BLE_ISO_STD_FLOW_CTRL == TRUE)
ble_hs_iso_avail_pkts = max_pkts;
#endif /* (BLE_ISO_STD_FLOW_CTRL) */
HCI_TRACE_WARNING("ISO Flow Control:\n");
HCI_TRACE_WARNING(" Length: %u\n", pktlen);
HCI_TRACE_WARNING(" Count: %u\n", max_pkts);
HCI_TRACE_WARNING(" Status: ");
#if (BLE_ISO_STD_FLOW_CTRL == TRUE)
HCI_TRACE_WARNING("%s\n", "Standard");
#elif (BLE_ISO_NON_STD_FLOW_CTRL == TRUE)
HCI_TRACE_WARNING("%s\n", "Non-standard");
#else
HCI_TRACE_WARNING("%s\n", "Not support");
#endif
return 0;
}
void
ble_hci_get_iso_buf_size(uint16_t *pktlen, uint8_t *max_pkts)
{
assert(pktlen && max_pkts);
*pktlen = ble_hs_iso_buf_sz;
*max_pkts = ble_hs_iso_max_pkts;
}
#if (BLE_ISO_STD_FLOW_CTRL == TRUE)
void
ble_hci_add_iso_avail_pkts(uint16_t delta)
{
osi_mutex_global_lock();
if (ble_hs_iso_avail_pkts + delta > ble_hs_iso_max_pkts) {
HCI_TRACE_ERROR("ISO_HS_RESET %u %u %u\n", ble_hs_iso_avail_pkts, delta, ble_hs_iso_max_pkts);
// ble_hs_sched_reset(BLE_HS_ECONTROLLER);
assert(0);
} else {
ble_hs_iso_avail_pkts += delta;
}
osi_mutex_global_unlock();
}
#endif /* (BLE_ISO_STD_FLOW_CTRL) */
#define BLE_ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
struct ble_hci_iso_conn *
ble_hci_iso_conn_find(uint16_t conn_handle)
{
for (size_t i = 0; i < BLE_ARRAY_SIZE(g_iso_conn); i++) {
struct ble_hci_iso_conn *conn = &g_iso_conn[i];
if (conn->enabled &&
conn->conn_handle == conn_handle) {
return conn;
}
}
return NULL;
}
int ble_hci_iso_conn_free(uint16_t conn_handle)
{
for (size_t i = 0; i < BLE_ARRAY_SIZE(g_iso_conn); i++) {
struct ble_hci_iso_conn *conn = &g_iso_conn[i];
if (conn->enabled &&
conn->conn_handle == conn_handle) {
conn->enabled = 0;
conn->conn_handle = 0;
return 0;
}
}
return 1;
}
static struct ble_hci_iso_conn *
ble_hci_iso_alloc_conn(uint16_t conn_handle)
{
for (size_t i = 0; i < BLE_ARRAY_SIZE(g_iso_conn); i++) {
struct ble_hci_iso_conn *conn = &g_iso_conn[i];
if (!conn->enabled) {
conn->enabled = 1;
conn->conn_handle = conn_handle;
conn->pkt_seq_num = 0; /* Initialize to 0 */
return conn;
}
}
return NULL;
}
#if (BLE_ISO_STD_FLOW_CTRL == TRUE)
static uint8_t
ble_hci_iso_buf_needed(struct ble_hs_iso_conn *conn)
{
uint16_t sdu_offset;
uint16_t dl_len;
uint8_t dlh_len;
uint8_t count;
dlh_len = (conn->ts_flag ? BLE_HCI_ISO_DATA_LOAD_TS_SZ : 0) + BLE_HCI_ISO_DATA_LOAD_HDR_SZ;
sdu_offset = 0;
count = 1; /* 1 extra since framed pdu may be used */
while (1) {
dl_len = min(dlh_len + conn->sdu_len - sdu_offset, ble_hs_iso_buf_sz);
count += 1;
sdu_offset += dl_len - dlh_len;
assert(sdu_offset <= conn->sdu_len);
if (sdu_offset == conn->sdu_len) {
break;
}
/* No data load header for continuation/last segment */
dlh_len = 0;
}
return count;
}
#endif /* (BLE_ISO_STD_FLOW_CTRL) */
static void
ble_hci_iso_hdr_append(struct ble_hci_iso_conn *conn,
uint8_t *frag,
uint8_t pb_flag, uint16_t dl_len)
{
uint32_t pkt_hdr;
uint32_t dl_hdr;
pkt_hdr = conn->conn_handle;
pkt_hdr |= (pb_flag << 12);
if (pb_flag == BLE_HCI_ISO_PB_FIRST_FRAG ||
pb_flag == BLE_HCI_ISO_PB_COMP_SDU) {
pkt_hdr |= (conn->ts_flag << 14);
}
pkt_hdr |= (dl_len << 16);
memcpy(frag, &pkt_hdr, BLE_HCI_ISO_DATA_HDR_SZ);
/* No data load header for continuation/last segment */
if (pb_flag == BLE_HCI_ISO_PB_CONT_FRAG ||
pb_flag == BLE_HCI_ISO_PB_LAST_FRAG) {
return;
}
if (conn->ts_flag) {
memcpy(frag + BLE_HCI_ISO_DATA_HDR_SZ, &conn->time_stamp, BLE_HCI_ISO_DATA_LOAD_TS_SZ);
}
dl_hdr = (conn->sdu_len << 16) | conn->pkt_seq_num;
memcpy(frag + BLE_HCI_ISO_DATA_HDR_SZ + (conn->ts_flag ? BLE_HCI_ISO_DATA_LOAD_TS_SZ : 0),
&dl_hdr, BLE_HCI_ISO_DATA_LOAD_HDR_SZ);
}
int
ble_hci_tx_iso_data(const uint8_t *data, uint16_t len, void *arg)
{
int rc = 1;
#if CONFIG_BT_LE_ISO_SUPPORT
// return ble_transport_to_ll_iso(data, len, arg);
extern int ble_hci_trans_hs_iso_tx(const uint8_t *data, uint16_t length, void *arg);
rc = ble_hci_trans_hs_iso_tx(data, len, arg);
#endif // #if CONFIG_BT_LE_ISO_SUPPORT
return rc;
}
static int
ble_hci_iso_tx_now(struct ble_hci_iso_conn *conn, const uint8_t *sdu,
uint32_t time_stamp, uint16_t pkt_seq_num)
{
uint8_t dlh_len;
uint8_t *frag;
int rc;
#if (BLE_ISO_STD_FLOW_CTRL == TRUE)
/* Get the Controller ISO buffer needed for the SDU */
uint8_t count = ble_hs_hci_iso_buf_needed(conn);
/* Make sure the Controller ISO buffer can accommodate the SDU completely */
if (count > ble_hs_iso_avail_pkts) {
HCI_TRACE_ERROR("ISO flow control(%u/%u)!\n", count, ble_hs_iso_avail_pkts);
return 1;
}
#elif (BLE_ISO_NON_STD_FLOW_CTRL == TRUE)
extern uint16_t ble_ll_iso_free_buf_num_get(uint16_t conn_handle);
if (ble_ll_iso_free_buf_num_get(conn->conn_handle) == 0) {
HCI_TRACE_ERROR("ISO flow control!\n");
return 1;
}
#endif
dlh_len = (conn->ts_flag ? BLE_HCI_ISO_DATA_LOAD_TS_SZ : 0) + BLE_HCI_ISO_DATA_LOAD_HDR_SZ;
frag = malloc(BLE_HCI_ISO_DATA_HDR_SZ + dlh_len + conn->sdu_len);
if (frag == NULL) {
HCI_TRACE_ERROR("frag is null\n");
return 6;
}
ble_hci_iso_hdr_append(conn,
frag,
BLE_HCI_ISO_PB_COMP_SDU,
dlh_len + conn->sdu_len);
memcpy(frag + BLE_HCI_ISO_DATA_HDR_SZ + dlh_len,
sdu,
conn->sdu_len);
rc = ble_hci_tx_iso_data(frag, BLE_HCI_ISO_DATA_HDR_SZ + dlh_len + conn->sdu_len, NULL);
if (rc) {
HCI_TRACE_ERROR("iso tx failed\n");
return 14;
}
#if (BLE_ISO_STD_FLOW_CTRL == TRUE)
/* If an ISO SDU is fragmented into fragments, flow control is not supported.
*
* Currently even if an SDU is larger than the ISO buffer size, fragmentation
* will not happen here, the SDU will be posted to Controller completely.
*/
ble_hs_iso_avail_pkts -= 1;
#endif /* (BLE_ISO_STD_FLOW_CTRL) */
return 0;
}
int
esp_ble_hci_iso_tx(uint16_t conn_handle, const uint8_t *sdu, uint16_t sdu_len,
bool ts_flag, uint32_t time_stamp, uint16_t pkt_seq_num)
{
struct ble_hci_iso_conn *conn;
uint16_t max_sdu;
int rc;
osi_mutex_global_lock();
/* For sending empty SDU, we could use an SDU with zero length. */
if (sdu == NULL && sdu_len != 0) {
HCI_TRACE_ERROR("Invalid iso sdu\n");
rc = 3;
goto end;
}
/* TODO:
* Use Host functions to replace the above LL implementation.
*/
max_sdu = 0x0FFF;
if (sdu_len > max_sdu) {
HCI_TRACE_ERROR("Too large iso sdu %d, max_sdu %d\n", sdu_len, max_sdu);
rc = 8;
goto end;
}
conn = ble_hci_iso_conn_find(conn_handle);
if (!conn) {
conn = ble_hci_iso_alloc_conn(conn_handle);
}
if (!conn) {
rc = 7;
goto end;
}
conn->ts_flag = ts_flag;
conn->time_stamp = time_stamp;
conn->pkt_seq_num = pkt_seq_num;
conn->sdu_len = sdu_len;
rc = ble_hci_iso_tx_now(conn, sdu, time_stamp, pkt_seq_num);
end:
osi_mutex_global_unlock();
return rc;
}
#endif // #if (BLE_FEAT_ISO_EN == TRUE)

View File

@ -135,6 +135,7 @@ static bool hci_hal_env_init(const hci_hal_callbacks_t *upper_callbacks, osi_thr
hci_hal_env.adv_rpt_q = pkt_queue_create();
assert(hci_hal_env.adv_rpt_q != NULL);
#endif // #if (BLE_42_SCAN_EN == TRUE)
struct osi_event *event = osi_event_create(hci_upstream_data_handler, NULL);
assert(event != NULL);
hci_hal_env.upstream_data_ready = event;
@ -156,7 +157,6 @@ static void hci_hal_env_deinit(void)
hci_hal_env.adv_rpt_q = NULL;
#endif // #if (BLE_42_SCAN_EN == TRUE)
hci_hal_env.upstream_data_ready = NULL;
fixed_queue_free(rx_q, osi_free_func);
#if (BLE_42_SCAN_EN == TRUE)
pkt_queue_destroy(adv_rpt_q, NULL);
@ -231,6 +231,30 @@ static uint16_t transmit_data(serial_data_type_t type,
return length - 1;
}
#if (BLE_FEAT_ISO_EN == TRUE)
typedef void ble_host_rx_iso_data_fn(uint8_t *data, uint16_t len);
static ble_host_rx_iso_data_fn *ble_host_iso_rx_cb = NULL;
void ble_host_register_rx_iso_data_cb(void *cb)
{
/* If the iso rx cb is already registered, we will give
* a warning log here, and the cb will still be updated.
*/
if (ble_host_iso_rx_cb) {
HCI_TRACE_WARNING("iso rx cb %p already registered\n", ble_host_iso_rx_cb);
}
ble_host_iso_rx_cb = cb;
}
void ble_hci_register_rx_iso_data_cb(void *cb)
{
ble_host_register_rx_iso_data_cb(cb);
}
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
// Internal functions
static void hci_upstream_data_handler(void *arg)
{
@ -563,7 +587,12 @@ void bt_record_hci_data(uint8_t *data, uint16_t len)
)) {
bt_hci_log_record_hci_adv(HCI_LOG_DATA_TYPE_ADV, &data[2], len - 2);
} else {
uint8_t data_type = ((data[0] == 2) ? HCI_LOG_DATA_TYPE_C2H_ACL : data[0]);
uint8_t data_type;
if (data[0] == HCI_LOG_DATA_TYPE_ISO_DATA) {
data_type = HCI_LOG_DATA_TYPE_ISO_DATA;
} else {
data_type = ((data[0] == 2) ? HCI_LOG_DATA_TYPE_C2H_ACL : data[0]);
}
bt_hci_log_record_hci_data(data_type, &data[1], len - 1);
}
#endif // (BT_HCI_LOG_INCLUDED == TRUE)
@ -581,12 +610,23 @@ static int host_recv_pkt_cb(uint8_t *data, uint16_t len)
#endif // #if (BLE_42_SCAN_EN == TRUE)
size_t pkt_size;
if (hci_hal_env.rx_q == NULL) {
if ((hci_hal_env.rx_q == NULL) || (data == NULL)) {
return 0;
}
bt_record_hci_data(data, len);
#if (BLE_FEAT_ISO_EN == TRUE)
if (data[0] == DATA_TYPE_ISO) {
if (ble_host_iso_rx_cb) {
ble_host_iso_rx_cb(&data[1], len -1);
}
free(data);
return 0;
}
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
bool is_adv_rpt = host_recv_adv_packet(data);
if (!is_adv_rpt) {
@ -601,7 +641,9 @@ static int host_recv_pkt_cb(uint8_t *data, uint16_t len)
pkt->len = len;
pkt->layer_specific = 0;
memcpy(pkt->data, data, len);
{
fixed_queue_enqueue(hci_hal_env.rx_q, pkt, FIXED_QUEUE_MAX_TIMEOUT);
}
} else {
#if (BLE_42_SCAN_EN == TRUE)
#if !BLE_ADV_REPORT_FLOW_CONTROL

View File

@ -159,6 +159,13 @@ static BT_HDR *make_ble_read_buffer_size(void)
return make_command_no_params(HCI_BLE_READ_BUFFER_SIZE);
}
#if (BLE_FEAT_ISO_EN == TRUE)
static BT_HDR *make_ble_read_buffer_size_v2(void)
{
return make_command_no_params(HCI_BLE_READ_BUFFER_SZIE_V2);
}
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
static BT_HDR *make_ble_read_supported_states(void)
{
return make_command_no_params(HCI_BLE_READ_SUPPORTED_STATES);
@ -276,6 +283,9 @@ static const hci_packet_factory_t interface = {
make_ble_write_host_support,
make_ble_read_white_list_size,
make_ble_read_buffer_size,
#if (BLE_FEAT_ISO_EN == TRUE)
make_ble_read_buffer_size_v2,
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
make_ble_read_supported_states,
make_ble_read_local_supported_features,
make_ble_read_resolving_list_size,

View File

@ -155,6 +155,26 @@ static void parse_ble_read_buffer_size_response(
osi_free(response);
}
#if (BLE_FEAT_ISO_EN == TRUE)
static void parse_ble_read_buffer_size_response_v2 (
BT_HDR *response,
uint16_t *data_size_ptr,
uint8_t *acl_buffer_count_ptr,
uint16_t *iso_pkt_len_ptr,
uint8_t *iso_pkt_num_ptr)
{
uint8_t *stream = read_command_complete_header(response, HCI_BLE_READ_BUFFER_SZIE_V2, 3 /* bytes after */);
assert(stream != NULL);
STREAM_TO_UINT16(*data_size_ptr, stream);
STREAM_TO_UINT8(*acl_buffer_count_ptr, stream);
STREAM_TO_UINT16(*iso_pkt_len_ptr, stream);
STREAM_TO_UINT8(*iso_pkt_num_ptr, stream);
osi_free(response);
}
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
static void parse_ble_read_supported_states_response(
BT_HDR *response,
uint8_t *supported_states,
@ -294,6 +314,9 @@ static const hci_packet_parser_t interface = {
parse_read_local_extended_features_response,
parse_ble_read_white_list_size_response,
parse_ble_read_buffer_size_response,
#if (BLE_FEAT_ISO_EN == TRUE)
parse_ble_read_buffer_size_response_v2,
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
parse_ble_read_supported_states_response,
parse_ble_read_local_supported_features_response,
parse_ble_read_resolving_list_size_response,

View File

@ -0,0 +1,85 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#ifndef H_BLE_HCI_ISO_
#define H_BLE_HCI_ISO_
#include <stdint.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
struct ble_hci_iso_pkt_hdr {
uint16_t conn_handle : 12,
pb_flag : 2,
ts_flag : 1;
uint16_t data_load_len;
} __attribute__((packed));
struct ble_hci_iso_pkt {
/* ISO header */
uint16_t conn_handle; /* CIS or BIS handle. */
uint8_t pb_flag : 2, /* Packet boundary flag. */
ts_flag : 1; /* Timestamp flag. */
uint16_t iso_data_load_len; /* ISO Data Load length. */
/* ISO Data Load */
uint32_t time_stamp; /* Timestamp. */
uint16_t packet_seq; /* Packet sequence number. */
uint16_t iso_sdu_len; /* SDU length. */
uint8_t ps_flag; /* Packet status. */
const uint8_t *sdu; /* First byte of ISO SDU. */
};
struct ble_hci_iso_tx {
struct ble_hci_iso_pkt pkt;
};
struct ble_hci_iso_rx {
struct ble_hci_iso_pkt pkt;
};
struct ble_hci_iso_conn {
uint16_t conn_handle;
uint8_t enabled : 1,
pb_flag : 2,
ts_flag : 1;
uint32_t time_stamp;
uint16_t pkt_seq_num;
uint16_t sdu_len;
};
int ble_hci_set_iso_buf_sz(uint16_t pktlen, uint8_t max_pkts);
void ble_hci_get_iso_buf_size(uint16_t *pktlen, uint8_t *max_pkts);
void ble_hci_add_iso_avail_pkts(uint16_t delta);
struct ble_hci_iso_conn *ble_hci_iso_conn_find(uint16_t conn_handle);
int esp_ble_hci_iso_tx(uint16_t conn_handle, const uint8_t *sdu, uint16_t sdu_len,
bool ts_flag, uint32_t time_stamp, uint16_t pkt_seq_num);
#ifdef __cplusplus
}
#endif
#endif /* H_BLE_HCI_ISO_ */

View File

@ -31,7 +31,8 @@ typedef enum {
DATA_TYPE_COMMAND = 1,
DATA_TYPE_ACL = 2,
DATA_TYPE_SCO = 3,
DATA_TYPE_EVENT = 4
DATA_TYPE_EVENT = 4,
DATA_TYPE_ISO = 5,
} serial_data_type_t;
typedef void (*packet_ready_cb)(BT_HDR *packet);

View File

@ -41,6 +41,9 @@ typedef struct {
BT_HDR *(*make_ble_write_host_support)(uint8_t supported_host, uint8_t simultaneous_host);
BT_HDR *(*make_ble_read_white_list_size)(void);
BT_HDR *(*make_ble_read_buffer_size)(void);
#if (BLE_FEAT_ISO_EN == TRUE)
BT_HDR *(*make_ble_read_buffer_size_v2)(void);
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
BT_HDR *(*make_ble_read_supported_states)(void);
BT_HDR *(*make_ble_read_local_supported_features)(void);
BT_HDR *(*make_ble_read_resolving_list_size)(void);

View File

@ -79,6 +79,16 @@ typedef struct {
uint8_t *acl_buffer_count_ptr
);
#if (BLE_FEAT_ISO_EN == TRUE)
void (*parse_ble_read_buffer_size_response_v2) (
BT_HDR *response,
uint16_t *data_size_ptr,
uint8_t *acl_buffer_count_ptr,
uint16_t *iso_pkt_len_ptr,
uint8_t *iso_pkt_num_ptr
);
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
void (*parse_ble_read_supported_states_response)(
BT_HDR *response,
uint8_t *supported_states,

View File

@ -2744,9 +2744,10 @@ void btm_acl_connected(BD_ADDR bda, UINT16 handle, UINT8 link_type, UINT8 enc_mo
** Description Handle ACL disconnection complete event
**
*******************************************************************************/
void btm_acl_disconnected(UINT16 handle, UINT8 reason)
BOOLEAN btm_acl_disconnected(UINT16 handle, UINT8 reason)
{
BOOLEAN status = FALSE;
BOOLEAN dis_status;
/* Report BR/EDR ACL disconnection result to upper layer */
tACL_CONN *conn = btm_handle_to_acl(handle);
if (conn) {
@ -2754,6 +2755,7 @@ void btm_acl_disconnected(UINT16 handle, UINT8 reason)
if (conn->transport == BT_TRANSPORT_BR_EDR)
#endif
{
status = TRUE;
tBTM_ACL_LINK_STAT_EVENT_DATA evt_data = {
.event = BTM_ACL_DISCONN_CMPL_EVT,
.link_act.disconn_cmpl.reason = reason,
@ -2765,16 +2767,29 @@ void btm_acl_disconnected(UINT16 handle, UINT8 reason)
}
#if BTM_SCO_INCLUDED == TRUE
dis_status = l2c_link_hci_disc_comp (handle, reason);
/* If L2CAP doesn't know about it, send it to SCO */
if (!l2c_link_hci_disc_comp (handle, reason)) {
btm_sco_removed (handle, reason);
if (!dis_status) {
dis_status = btm_sco_removed (handle, reason);
} else {
status = TRUE;
}
#else
l2c_link_hci_disc_comp(handle, reason);
dis_status = l2c_link_hci_disc_comp(handle, reason);
#endif /* BTM_SCO_INCLUDED */
if (dis_status) {
// find tL2C_LCB
status = TRUE;
}
#if (SMP_INCLUDED == TRUE)
/* Notify security manager */
btm_sec_disconnected(handle, reason);
if (btm_sec_disconnected(handle, reason)) {
// find tBTM_SEC_DEV_REC
status = TRUE;
}
#endif /* SMP_INCLUDED == TRUE */
return status;
}

View File

@ -1539,3 +1539,192 @@ void btm_ble_periodic_adv_sync_trans_recv_evt(tBTM_BLE_PERIOD_ADV_SYNC_TRANS_REC
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_PERIODIC_ADV_SYNC_TRANS_RECV_EVT, &cb_params);
}
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
void BTM_BleEnhReadTransPowerLevel(uint16_t conn_handle, uint8_t phy)
{
btsnd_hcic_ble_enh_read_trans_power_level(conn_handle, phy);
}
void BTM_BleReadRemoteTransPwrLevel(uint16_t conn_handle, uint8_t phy)
{
btsnd_hcic_ble_read_remote_trans_power_level(conn_handle, phy);
}
void BTM_BleSetPathLossRptParams(uint16_t conn_handle, uint8_t high_threshold, uint8_t high_hysteresis,
uint8_t low_threshold, uint8_t low_hysteresis, uint16_t min_time_spent)
{
tBTM_STATUS status = BTM_SUCCESS;
tHCI_STATUS err = HCI_SUCCESS;
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
if ((err = btsnd_hcic_ble_set_path_loss_rpt_params(conn_handle, high_threshold, high_hysteresis, low_threshold, low_hysteresis, min_time_spent)) != HCI_SUCCESS) {
BTM_TRACE_ERROR("%s cmd err=0x%x", __func__, err);
status = BTM_HCI_ERROR | err;
}
cb_params.path_loss_rpting_params.status = status;
cb_params.path_loss_rpting_params.conn_handle = conn_handle;
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_SET_PATH_LOSS_REPORTING_PARAMS_EVT, &cb_params);
}
void BTM_BleSetPathLossRptEnable(uint16_t conn_handle, uint8_t enable)
{
tBTM_STATUS status = BTM_SUCCESS;
tHCI_STATUS err = HCI_SUCCESS;
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
if ((err = btsnd_hcic_ble_set_path_loss_rpt_enable(conn_handle, enable)) != HCI_SUCCESS) {
BTM_TRACE_ERROR("%s cmd err=0x%x", __func__, err);
status = BTM_HCI_ERROR | err;
}
cb_params.path_loss_rpting_enable.status = status;
cb_params.path_loss_rpting_enable.conn_handle = conn_handle;
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_SET_PATH_LOSS_REPORTING_ENABLE_EVT, &cb_params);
}
void BTM_BleSetTransPwrRptEnable(uint16_t conn_handle, uint8_t local_enable, uint8_t remote_enable)
{
tBTM_STATUS status = BTM_SUCCESS;
tHCI_STATUS err = HCI_SUCCESS;
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
if ((err = btsnd_hcic_ble_set_trans_pwr_rpt_enable(conn_handle, local_enable, remote_enable)) != HCI_SUCCESS) {
BTM_TRACE_ERROR("%s cmd err=0x%x", __func__, err);
status = BTM_HCI_ERROR | err;
}
cb_params.trans_pwr_rpting_enable.status = status;
cb_params.trans_pwr_rpting_enable.conn_handle = conn_handle;
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_SET_TRANS_POWER_REPORTING_ENABLE_EVT, &cb_params);
}
void btm_enh_read_trans_pwr_level_cmpl_evt(uint8_t *p)
{
uint8_t hci_status;
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
STREAM_TO_UINT8(hci_status, p);
STREAM_TO_UINT16(cb_params.enh_trans_pwr_level_cmpl.conn_handle, p);
STREAM_TO_UINT8(cb_params.enh_trans_pwr_level_cmpl.phy, p);
STREAM_TO_UINT8(cb_params.enh_trans_pwr_level_cmpl.cur_tx_pwr_level, p);
STREAM_TO_UINT8(cb_params.enh_trans_pwr_level_cmpl.max_tx_pwr_level, p);
if(hci_status != HCI_SUCCESS) {
hci_status = BTM_HCI_ERROR | hci_status;
BTM_TRACE_ERROR("%s error status %d", __func__, hci_status);
}
cb_params.enh_trans_pwr_level_cmpl.status = hci_status;
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_ENH_READ_TRANS_POWER_LEVEL_EVT, &cb_params);
}
void btm_read_remote_trans_pwr_level_cmpl(UINT8 status)
{
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
if (status != HCI_SUCCESS) {
status = (status | BTM_HCI_ERROR);
}
cb_params.remote_pwr_level_cmpl.status = status;
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_READ_REMOTE_TRANS_POWER_LEVEL_EVT, &cb_params);
}
void btm_ble_path_loss_threshold_evt(tBTM_BLE_PATH_LOSS_THRESHOLD_EVT *params)
{
if (!params) {
BTM_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
// If the user has register the callback function, should callback it to the application.
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_PATH_LOSS_THRESHOLD_EVT, (tBTM_BLE_5_GAP_CB_PARAMS *)params);
}
void btm_ble_transmit_power_report_evt(tBTM_BLE_TRANS_POWER_REPORT_EVT *params)
{
if (!params) {
BTM_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
if (params->status != HCI_SUCCESS) {
params->status = (params->status | BTM_HCI_ERROR);
}
// If the user has register the callback function, should callback it to the application.
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_TRANMIT_POWER_REPORTING_EVT, (tBTM_BLE_5_GAP_CB_PARAMS *)params);
}
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
void BTM_BleSetDefaultSubrate(UINT16 subrate_min, UINT16 subrate_max, UINT16 max_latency, UINT16 continuation_number, UINT16 supervision_timeout)
{
tBTM_STATUS status = BTM_SUCCESS;
tHCI_STATUS err = HCI_SUCCESS;
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
if ((err = btsnd_hcic_ble_set_default_subrate(subrate_min, subrate_max, max_latency, continuation_number, supervision_timeout)) != HCI_SUCCESS) {
BTM_TRACE_ERROR("%s cmd err=0x%x", __func__, err);
status = BTM_HCI_ERROR | err;
}
cb_params.status = status;
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_SET_DEFAULT_SUBRATE_EVT, &cb_params);
}
void BTM_BleSubrateRequest(UINT16 conn_handle, UINT16 subrate_min, UINT16 subrate_max, UINT16 max_latency, UINT16 continuation_number, UINT16 supervision_timeout)
{
btsnd_hcic_ble_subrate_request(conn_handle, subrate_min, subrate_max, max_latency, continuation_number, supervision_timeout);
}
void btm_subrate_req_cmd_status(UINT8 status)
{
tBTM_BLE_5_GAP_CB_PARAMS cb_params = {0};
if (status != HCI_SUCCESS) {
status = (status | BTM_HCI_ERROR);
}
cb_params.status = status;
BTM_ExtBleCallbackTrigger(BTM_BLE_GAP_SUBRATE_REQUEST_EVT, &cb_params);
}
void btm_ble_subrate_change_evt(tBTM_BLE_SUBRATE_CHANGE_EVT *params)
{
if (params->status != HCI_SUCCESS) {
params->status = (params->status | BTM_HCI_ERROR);
}
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)

View File

@ -0,0 +1,237 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "btm_int.h"
#include "stack/hcimsgs.h"
#include "osi/allocator.h"
#include "device/controller.h"
#include <string.h>
#include "l2c_int.h"
tBTM_BLE_CTE_CBACK ble_cte_cb;
extern void btm_ble_inter_set(bool extble_inter);
void BTM_BleCteRegisterCallback(tBTM_BLE_CTE_CBACK cb)
{
if (cb) {
ble_cte_cb = cb;
} else {
BTM_TRACE_ERROR("%s, register fail, the cb function is NULL.", __func__);
}
}
void BTM_CteBleCallbackTrigger(tBTM_BLE_5_GAP_EVENT event, tBTM_BLE_CTE_CB_PARAMS *params)
{
BTM_TRACE_DEBUG("%s event %x", __func__, event);
if(params && params->status == BTM_SUCCESS) {
btm_ble_inter_set(true);
}
if (ble_cte_cb) {
ble_cte_cb(event, params);
}
}
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
tBTM_STATUS BTM_BleSetCteTransParams(uint8_t adv_handle, uint8_t cte_len, uint8_t cte_type, uint8_t cte_count, uint8_t switching_pattern_len, uint8_t *antenna_ids)
{
tHCI_STATUS err = HCI_SUCCESS;
tBTM_STATUS status = BTM_SUCCESS;
tBTM_BLE_CTE_CB_PARAMS cb_params = {0};
if ((err = btsnd_hcic_ble_set_connless_cte_trans_params(adv_handle, cte_len, cte_type, cte_count, switching_pattern_len, antenna_ids)) != HCI_SUCCESS) {
BTM_TRACE_ERROR("cte set trans params, cmd err=0x%x", err);
status = BTM_HCI_ERROR | err;
}
cb_params.cte_trans_params_cmpl.status = status;
BTM_CteBleCallbackTrigger(BTM_BLE_CTE_SET_TRANS_PARAMS_EVT, &cb_params);
return status;
}
tBTM_STATUS BTM_BleCteSetConnectionlessTransEnable(uint8_t adv_handle, uint8_t cte_en)
{
tHCI_STATUS err = HCI_SUCCESS;
tBTM_STATUS status = BTM_SUCCESS;
tBTM_BLE_CTE_CB_PARAMS cb_params = {0};
if ((err = btsnd_hcic_ble_set_connless_cte_enable(adv_handle, cte_en)) != HCI_SUCCESS) {
BTM_TRACE_ERROR("cte set trans enable, cmd err=0x%x", err);
status = BTM_HCI_ERROR | err;
}
cb_params.cte_trans_en_cmpl.status = status;
BTM_CteBleCallbackTrigger(BTM_BLE_CTE_SET_TRANS_ENABLE_EVT, &cb_params);
return status;
}
tBTM_STATUS BTM_BleCteSetConnectionlessIqSamplingEnable(uint16_t sync_handle, uint8_t sampling_en, uint8_t slot_dur,
uint8_t max_sampled_ctes, uint8_t switching_pattern_len, uint8_t *ant_ids)
{
tHCI_STATUS err = HCI_SUCCESS;
tBTM_STATUS status = BTM_SUCCESS;
tBTM_BLE_CTE_CB_PARAMS cb_params = {0};
if ((err = btsnd_hcic_ble_set_connless_iq_sampling_enable(sync_handle, sampling_en, slot_dur, max_sampled_ctes, switching_pattern_len, ant_ids)) != HCI_SUCCESS) {
BTM_TRACE_ERROR("cte set trans enable, cmd err=0x%x", err);
status = BTM_HCI_ERROR | err;
}
cb_params.cte_iq_samp_en_cmpl.status = status;
cb_params.cte_iq_samp_en_cmpl.sync_handle = sync_handle;
BTM_CteBleCallbackTrigger(BTM_BLE_CTE_SET_IQ_SAMP_ENABLE_EVT, &cb_params);
return status;
}
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
tBTM_STATUS BTM_BleCteSetConnectionReceiveParams(uint16_t conn_handle, uint8_t sampling_en, uint8_t slot_dur,
uint8_t switching_pattern_len, uint8_t *ant_ids)
{
tHCI_STATUS err = HCI_SUCCESS;
tBTM_STATUS status = BTM_SUCCESS;
tBTM_BLE_CTE_CB_PARAMS cb_params = {0};
if ((err = btsnd_hcic_ble_set_conn_cte_receive_params(conn_handle, sampling_en, slot_dur, switching_pattern_len, ant_ids)) != HCI_SUCCESS) {
BTM_TRACE_ERROR("cte set conn recv params, cmd err=0x%x", err);
status = BTM_HCI_ERROR | err;
}
cb_params.cte_recv_params_cmpl.status = status;
cb_params.cte_recv_params_cmpl.conn_handle = conn_handle;
BTM_CteBleCallbackTrigger(BTM_BLE_CTE_SET_CONN_RECV_PARAMS_EVT, &cb_params);
return status;
}
tBTM_STATUS BTM_BleCteSetConnectionTransParams(uint16_t conn_handle, uint8_t cte_types, uint8_t switching_pattern_len, uint8_t *ant_ids)
{
tHCI_STATUS err = HCI_SUCCESS;
tBTM_STATUS status = BTM_SUCCESS;
tBTM_BLE_CTE_CB_PARAMS cb_params = {0};
if ((err = btsnd_hcic_ble_set_conn_cte_trans_params(conn_handle, cte_types, switching_pattern_len, ant_ids)) != HCI_SUCCESS) {
BTM_TRACE_ERROR("cte set conn trans params, cmd err=0x%x", err);
status = BTM_HCI_ERROR | err;
}
cb_params.cte_conn_trans_params_cmpl.status = status;
cb_params.cte_conn_trans_params_cmpl.conn_handle = conn_handle;
BTM_CteBleCallbackTrigger(BTM_BLE_CTE_SET_CONN_TRANS_PARAMS_EVT, &cb_params);
return status;
}
tBTM_STATUS BTM_BleCteSetConnectionRequestEnable(uint16_t conn_handle, uint8_t enable, uint16_t cte_req_int,
uint8_t req_cte_len, uint8_t req_cte_type)
{
tHCI_STATUS err = HCI_SUCCESS;
tBTM_STATUS status = BTM_SUCCESS;
tBTM_BLE_CTE_CB_PARAMS cb_params = {0};
if ((err = btsnd_hcic_ble_conn_cte_req_enable(conn_handle, enable, cte_req_int, req_cte_len, req_cte_type)) != HCI_SUCCESS) {
BTM_TRACE_ERROR("cte set conn req en, cmd err=0x%x", err);
status = BTM_HCI_ERROR | err;
}
cb_params.cte_conn_req_en_cmpl.status = status;
cb_params.cte_conn_req_en_cmpl.conn_handle = conn_handle;
BTM_CteBleCallbackTrigger(BTM_BLE_CTE_SET_CONN_REQ_ENABLE_EVT, &cb_params);
return status;
}
tBTM_STATUS BTM_BleCteSetConnectionRspEnable(uint16_t conn_handle, uint8_t enable)
{
tHCI_STATUS err = HCI_SUCCESS;
tBTM_STATUS status = BTM_SUCCESS;
tBTM_BLE_CTE_CB_PARAMS cb_params = {0};
if ((err = btsnd_hcic_ble_conn_cte_rsp_enable(conn_handle, enable)) != HCI_SUCCESS) {
BTM_TRACE_ERROR("cte set conn rsp en, cmd err=0x%x", err);
status = BTM_HCI_ERROR | err;
}
cb_params.cte_conn_rsp_en_cmpl.status = status;
cb_params.cte_conn_rsp_en_cmpl.conn_handle = conn_handle;
BTM_CteBleCallbackTrigger(BTM_BLE_CTE_SET_CONN_RSP_ENABLE_EVT, &cb_params);
return status;
}
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
tBTM_STATUS BTM_BleCteReadAntInfor(void)
{
tHCI_STATUS err = HCI_SUCCESS;
tBTM_STATUS status = BTM_SUCCESS;
if ((err = btsnd_hcic_ble_read_antenna_info()) != HCI_SUCCESS) {
BTM_TRACE_ERROR("cte read ant information, cmd err=0x%x", err);
status = BTM_HCI_ERROR | err;
}
return status;
}
void btm_ble_cte_read_ant_infor_complete(UINT8 *p)
{
tBTM_BLE_CTE_CB_PARAMS cb_params = {0};
STREAM_TO_UINT8(cb_params.cte_read_ant_infor_cmpl.status, p);
STREAM_TO_UINT8(cb_params.cte_read_ant_infor_cmpl.supported_switching_sampling_rates, p);
STREAM_TO_UINT8(cb_params.cte_read_ant_infor_cmpl.num_ant, p);
STREAM_TO_UINT8(cb_params.cte_read_ant_infor_cmpl.max_switching_pattern_len, p);
STREAM_TO_UINT8(cb_params.cte_read_ant_infor_cmpl.max_cte_len, p);
if (cb_params.cte_read_ant_infor_cmpl.status != HCI_SUCCESS) {
cb_params.cte_read_ant_infor_cmpl.status = (BTM_HCI_ERROR | cb_params.cte_read_ant_infor_cmpl.status);
}
BTM_CteBleCallbackTrigger(BTM_BLE_CTE_READ_ANT_INFOR_EVT, &cb_params);
}
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
void btm_ble_connless_iq_report_evt(tBTM_BLE_CTE_CONNLESS_IQ_REPORT_EVT *params)
{
if (!params) {
BTM_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
BTM_CteBleCallbackTrigger(BTM_BLE_CTE_CONNLESS_IQ_REPORT_EVT, (tBTM_BLE_CTE_CB_PARAMS *)params);
}
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
void btm_ble_conn_iq_report_evt(tBTM_BLE_CTE_CONN_IQ_REPORT_EVT *params)
{
if (!params) {
BTM_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
BTM_CteBleCallbackTrigger(BTM_BLE_CTE_CONN_IQ_REPORT_EVT, (tBTM_BLE_CTE_CB_PARAMS *)params);
}
void btm_ble_cte_req_failed_evt(tBTM_BLE_CTE_REQ_FAILED_EVT *params)
{
if (!params) {
BTM_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
if (params->status != HCI_SUCCESS) {
params->status = (params->status | BTM_HCI_ERROR);
}
BTM_CteBleCallbackTrigger(BTM_BLE_CTE_REQUEST_FAILED_EVT, (tBTM_BLE_CTE_CB_PARAMS *)params);
}
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)

View File

@ -0,0 +1,525 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "btm_int.h"
#include "stack/hcimsgs.h"
#include "osi/allocator.h"
#include "device/controller.h"
#include <string.h>
#include "l2c_int.h"
tBTM_BLE_ISO_CBACK ble_iso_cb;
extern void btm_ble_inter_set(bool extble_inter);
void BTM_BleIsoRegisterCallback(tBTM_BLE_ISO_CBACK cb)
{
if (cb) {
ble_iso_cb = cb;
} else {
BTM_TRACE_ERROR("%s, register fail, the cb function is NULL.", __func__);
}
}
void BTM_IsoBleCallbackTrigger(tBTM_BLE_5_GAP_EVENT event, tBTM_BLE_ISO_CB_PARAMS *params)
{
if(params && params->status == BTM_SUCCESS) {
btm_ble_inter_set(true);
}
if (ble_iso_cb) {
ble_iso_cb(event, params);
}
}
void btm_ble_iso_read_iso_tx_sync_complete(UINT8 *p)
{
tBTM_BLE_ISO_CB_PARAMS cb_params = {0};
STREAM_TO_UINT8(cb_params.btm_read_tx_sync.status, p);
STREAM_TO_UINT16(cb_params.btm_read_tx_sync.conn_hdl, p);
STREAM_TO_UINT16(cb_params.btm_read_tx_sync.pkt_seq_num, p);
STREAM_TO_UINT32(cb_params.btm_read_tx_sync.tx_time_stamp, p);
STREAM_TO_UINT24(cb_params.btm_read_tx_sync.time_offset, p);
if (cb_params.btm_read_tx_sync.status != HCI_SUCCESS) {
cb_params.btm_read_tx_sync.status = (BTM_HCI_ERROR | cb_params.btm_read_tx_sync.status);
}
cb_params.btm_read_tx_sync.conn_hdl = (cb_params.btm_read_tx_sync.conn_hdl & 0xEFF);
cb_params.btm_read_tx_sync.time_offset = (cb_params.btm_read_tx_sync.time_offset & 0xFFFFFF);
BTM_TRACE_DEBUG("read tx sync cmpl, status 0x%x conn_hdl 0x%x pkt_seq_num %d tx_time_stamp %ld time_offset %ld\n",
cb_params.btm_read_tx_sync.status, cb_params.btm_read_tx_sync.conn_hdl, cb_params.btm_read_tx_sync.pkt_seq_num,
cb_params.btm_read_tx_sync.tx_time_stamp, cb_params.btm_read_tx_sync.time_offset);
BTM_IsoBleCallbackTrigger(BTM_BLE_ISO_READ_TX_SYNC_EVT, &cb_params);
}
void btm_ble_iso_read_iso_link_quality_complete(UINT8 *p)
{
tBTM_BLE_ISO_CB_PARAMS cb_params = {0};
STREAM_TO_UINT8(cb_params.btm_read_link_quality.status, p);
STREAM_TO_UINT16(cb_params.btm_read_link_quality.conn_hdl, p);
STREAM_TO_UINT32(cb_params.btm_read_link_quality.tx_unacked_pkts, p);
STREAM_TO_UINT32(cb_params.btm_read_link_quality.tx_flushed_pkts, p);
STREAM_TO_UINT32(cb_params.btm_read_link_quality.tx_last_subevt_pkts, p);
STREAM_TO_UINT32(cb_params.btm_read_link_quality.retransmitted_pkts, p);
STREAM_TO_UINT32(cb_params.btm_read_link_quality.crc_error_pkts, p);
STREAM_TO_UINT32(cb_params.btm_read_link_quality.rx_unreceived_pkts, p);
STREAM_TO_UINT32(cb_params.btm_read_link_quality.duplicate_pkts, p);
if (cb_params.btm_read_link_quality.status != HCI_SUCCESS) {
cb_params.btm_read_link_quality.status = (BTM_HCI_ERROR | cb_params.btm_read_link_quality.status);
}
BTM_TRACE_DEBUG("read link quality cmpl, status 0x%x conn_hdl 0x%x tx_unacked_pkts %d tx_flushed_pkts %ld tx_last_subevt_pkts %ld retransmitted_pkts %d\
crc_error_pkts %d rx_unreceived_pkts %d duplicate_pkts %d\n",
cb_params.btm_read_link_quality.status, cb_params.btm_read_link_quality.conn_hdl, cb_params.btm_read_link_quality.tx_unacked_pkts,
cb_params.btm_read_link_quality.tx_flushed_pkts, cb_params.btm_read_link_quality.tx_last_subevt_pkts, cb_params.btm_read_link_quality.retransmitted_pkts,
cb_params.btm_read_link_quality.crc_error_pkts, cb_params.btm_read_link_quality.rx_unreceived_pkts, cb_params.btm_read_link_quality.duplicate_pkts);
BTM_IsoBleCallbackTrigger(BTM_BLE_ISO_READ_LINK_QUALITY_EVT, &cb_params);
}
#if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
void btm_ble_iso_set_cig_params_complete(UINT8 *p)
{
tBTM_BLE_ISO_CB_PARAMS cb_params = {0};
STREAM_TO_UINT8(cb_params.btm_set_cig_params.status, p);
STREAM_TO_UINT8(cb_params.btm_set_cig_params.cig_id, p);
STREAM_TO_UINT8(cb_params.btm_set_cig_params.cis_count, p);
for (uint8_t i = 0; i < cb_params.btm_set_cig_params.cis_count; i++)
{
STREAM_TO_UINT16(cb_params.btm_set_cig_params.conn_hdl[i], p);
BTM_TRACE_DEBUG("i = %d, conn_hdl = %d", i, cb_params.btm_set_cig_params.conn_hdl[i]);
}
if (cb_params.btm_set_cig_params.status != HCI_SUCCESS) {
cb_params.btm_set_cig_params.status = (BTM_HCI_ERROR | cb_params.btm_set_cig_params.status);
}
BTM_TRACE_DEBUG("set cig params, status 0x%x cig_id %d cis_count %d\n",
cb_params.btm_set_cig_params.status, cb_params.btm_set_cig_params.cig_id, cb_params.btm_set_cig_params.cis_count);
BTM_IsoBleCallbackTrigger(BTM_BLE_ISO_SET_CIG_PARAMS_EVT, &cb_params);
}
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_EN == TRUE)
void btm_ble_cis_disconnected_evt(tBTM_BLE_CIS_DISCON_CMPL *params)
{
tBTM_BLE_ISO_CB_PARAMS cb_params = {0};
if (!params) {
BTM_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
cb_params.btm_cis_disconnectd_evt.cis_handle = params->cis_handle;
cb_params.btm_cis_disconnectd_evt.reason = params->reason;
BTM_TRACE_DEBUG("btm cis disconnect, cis_handle %d reason 0x%x\n", params->cis_handle, params->reason);
BTM_IsoBleCallbackTrigger(BTM_BLE_ISO_CIS_DISCONNECTED_EVT, &cb_params);
}
void btm_ble_cis_established_evt(tBTM_BLE_CIS_ESTABLISHED_CMPL *params)
{
tBTM_BLE_ISO_CB_PARAMS cb_params = {0};
if (!params) {
BTM_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
if (params->status != HCI_SUCCESS) {
params->status = (params->status | BTM_HCI_ERROR);
}
memcpy(&cb_params.btm_cis_established_evt, params, sizeof(tBTM_BLE_CIS_ESTABLISHED_CMPL));
BTM_IsoBleCallbackTrigger(BTM_BLE_ISO_CIS_ESTABLISHED_EVT, &cb_params);
}
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
void btm_ble_cis_request_evt(tBTM_BLE_CIS_REQUEST_CMPL *params)
{
tBTM_BLE_ISO_CB_PARAMS cb_params = {0};
if (!params) {
BTM_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
memcpy(&cb_params.btm_cis_request_evt, params, sizeof(tBTM_BLE_CIS_REQUEST_CMPL));
BTM_IsoBleCallbackTrigger(BTM_BLE_ISO_CIS_REQUEST_EVT, &cb_params);
}
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
void btm_ble_big_create_cmpl_evt(tBTM_BLE_BIG_CREATE_CMPL *params)
{
BTM_TRACE_DEBUG("%s", __func__);
tBTM_BLE_ISO_CB_PARAMS cb_params = {0};
if (!params) {
BTM_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
if (params->status != HCI_SUCCESS) {
params->status = (params->status | BTM_HCI_ERROR);
}
cb_params.btm_big_cmpl.status = params->status;
cb_params.btm_big_cmpl.big_handle = params->big_handle;
cb_params.btm_big_cmpl.big_sync_delay = params->big_sync_delay;
cb_params.btm_big_cmpl.transport_latency = params->transport_latency;
cb_params.btm_big_cmpl.phy = params->phy;
cb_params.btm_big_cmpl.nse = params->nse;
cb_params.btm_big_cmpl.bn = params->bn;
cb_params.btm_big_cmpl.pto = params->pto;
cb_params.btm_big_cmpl.irc = params->irc;
cb_params.btm_big_cmpl.max_pdu = params->max_pdu;
cb_params.btm_big_cmpl.iso_interval = params->iso_interval;
cb_params.btm_big_cmpl.num_bis = params->num_bis;
// for (uint8_t i = 0; i < params->num_bis; i++)
// {
// cb_params.btm_big_cmpl.bis_handle[i] = params->bis_handle[i];
// }
memcpy(&cb_params.btm_big_cmpl.bis_handle[0], &params->bis_handle[0], params->num_bis * 2);
//memcpy(&cb_params.btm_big_cmpl, params, sizeof(tBTM_BLE_BIG_CREATE_CMPL));
BTM_IsoBleCallbackTrigger(BTM_BLE_ISO_BIG_CREATE_COMPLETE_EVT, &cb_params);
}
void btm_ble_big_terminate_cmpl_evt(tBTM_BLE_BIG_TERMINATE_CMPL *params)
{
tBTM_BLE_ISO_CB_PARAMS cb_params = {0};
if (!params) {
BTM_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
memcpy(&cb_params.btm_big_term, params, sizeof(tBTM_BLE_BIG_TERMINATE_CMPL));
BTM_IsoBleCallbackTrigger(BTM_BLE_ISO_BIG_TERMINATE_COMPLETE_EVT, &cb_params);
}
#endif // #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
void btm_ble_big_sync_estab_evt(tBTM_BLE_BIG_SYNC_ESTAB_CMPL *params)
{
tBTM_BLE_ISO_CB_PARAMS cb_params = {0};
if (!params) {
BTM_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
if (params->status != HCI_SUCCESS) {
params->status = (params->status | BTM_HCI_ERROR);
}
memcpy(&cb_params.btm_big_sync_estab, params, sizeof(tBTM_BLE_BIG_SYNC_ESTAB_CMPL));
BTM_IsoBleCallbackTrigger(BTM_BLE_ISO_BIG_SYNC_ESTABLISHED_EVT, &cb_params);
}
void btm_ble_big_sync_terminate_complete(UINT8 hci_status, UINT8 big_handle)
{
BTM_TRACE_DEBUG("%s hci_status 0x%x big_handle %d\n", __func__, hci_status, big_handle);
tBTM_BLE_ISO_CB_PARAMS cb_params = {0};
if (hci_status != HCI_SUCCESS) {
hci_status = (hci_status | BTM_HCI_ERROR);
}
cb_params.status = hci_status;
cb_params.btm_big_sync_ter.big_hdl = big_handle;
BTM_IsoBleCallbackTrigger(BTM_BLE_ISO_BIG_SYNC_TERMINATE_COMPLETE_EVT, &cb_params);
}
void btm_ble_big_sync_lost_evt(tBTM_BLE_BIG_SYNC_LOST_EVT *params)
{
tBTM_BLE_ISO_CB_PARAMS cb_params = {0};
if (!params) {
BTM_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
memcpy(&cb_params.btm_big_sync_lost, params, sizeof(tBTM_BLE_BIG_SYNC_LOST_EVT));
BTM_IsoBleCallbackTrigger(BTM_BLE_ISO_BIG_SYNC_LOST_EVT, &cb_params);
}
void btm_ble_biginfo_adv_report_evt(tBTM_BLE_BIGINFO_ADV_REPORT_EVT *params)
{
tBTM_BLE_ISO_CB_PARAMS cb_params = {0};
if (!params) {
BTM_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
memcpy(&cb_params.btm_biginfo_report, params, sizeof(tBTM_BLE_BIGINFO_ADV_REPORT_EVT));
BTM_IsoBleCallbackTrigger(BTM_BLE_ISO_BIGINFO_ADV_REPORT_EVT, &cb_params);
}
#endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
void btm_ble_iso_data_path_update_complete(UINT16 opcode, UINT8 hci_status, UINT16 conn_handle)
{
tBTM_BLE_ISO_CB_PARAMS cb_params = {0};
BTM_TRACE_DEBUG("data path update cmpl, opcode 0x%x status 0x%x conn_hdl %d\n", opcode, hci_status, conn_handle);
if (hci_status != HCI_SUCCESS) {
hci_status = (BTM_HCI_ERROR | hci_status);
}
cb_params.status = hci_status;
cb_params.btm_data_path_update.op_type = ((opcode == HCI_BLE_ISO_SET_DATA_PATH) ? BTM_BLE_ISO_DATA_PATH_SETUP : BTM_BLE_ISO_DATA_PATH_REMOVE);
cb_params.btm_data_path_update.conn_hdl = conn_handle;
BTM_IsoBleCallbackTrigger(BTM_BLE_ISO_DATA_PATH_UPFATE_EVT, &cb_params);
}
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
tBTM_STATUS BTM_BleBigCreate(uint8_t big_handle, uint8_t adv_handle, uint8_t num_bis,
uint32_t sdu_interval, uint16_t max_sdu, uint16_t max_transport_latency,
uint8_t rtn, uint8_t phy, uint8_t packing, uint8_t framing,
uint8_t encryption, uint8_t *broadcast_code)
{
BTM_TRACE_API("big_handle %d adv_handle %d num_bis %d sdu_interval %d max_sdu %d max_transport_latency %d \
rtn %d phy %d packing %d framing %d encryption %d broadcast_code %d", big_handle, adv_handle, num_bis, sdu_interval, max_sdu, max_transport_latency,\
rtn, phy, packing, framing, encryption, broadcast_code);
btsnd_hcic_ble_big_create(big_handle, adv_handle, num_bis, sdu_interval, max_sdu, max_transport_latency,
rtn, phy, packing, framing, encryption, broadcast_code);
return BTM_SUCCESS;
}
tBTM_STATUS BTM_BleBigCreateTest(uint8_t big_handle, uint8_t adv_handle, uint8_t num_bis,
uint32_t sdu_interval, uint16_t iso_interval, uint8_t nse,
uint16_t max_sdu, uint16_t max_pdu, uint8_t phy,
uint8_t packing, uint8_t framing, uint8_t bn, uint8_t irc,
uint8_t pto, uint8_t encryption, uint8_t *broadcast_code)
{
btsnd_hcic_ble_big_create_test(big_handle, adv_handle, num_bis, sdu_interval, iso_interval, nse,
max_sdu, max_pdu, phy, packing, framing, bn, irc, pto, encryption,
broadcast_code);
return BTM_SUCCESS;
}
tBTM_STATUS BTM_BleBigTerminate(UINT8 big_handle, UINT8 reason)
{
tHCI_STATUS err = HCI_SUCCESS;
tBTM_STATUS status = BTM_SUCCESS;
tBTM_BLE_ISO_CB_PARAMS cb_params = {0};
if ((err = btsnd_hcic_ble_big_terminate(big_handle, reason)) != TRUE) {
BTM_TRACE_ERROR("LE PA SyncCancel, cmd err=0x%x", err);
status = BTM_HCI_ERROR | err;
}
if (status != BTM_SUCCESS) {
cb_params.status = status;
BTM_IsoBleCallbackTrigger(BTM_BLE_ISO_BIG_TERMINATE_COMPLETE_EVT, &cb_params);
}
return status;
}
#endif // #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
tBTM_STATUS BTM_BleBigSyncCreate(uint8_t big_handle, uint16_t sync_handle,
uint8_t encryption, uint8_t *bc_code,
uint8_t mse, uint16_t big_sync_timeout,
uint8_t num_bis, uint8_t *bis)
{
btsnd_hcic_ble_big_sync_create(big_handle, sync_handle, encryption, bc_code,
mse, big_sync_timeout, num_bis, bis);
return BTM_SUCCESS;
}
tBTM_STATUS BTM_BleBigSyncTerminate(uint8_t big_handle)
{
tHCI_STATUS err = HCI_SUCCESS;
tBTM_STATUS status = BTM_SUCCESS;
if ((err = btsnd_hcic_ble_big_sync_terminate(big_handle)) != HCI_SUCCESS) {
BTM_TRACE_ERROR("LE big sync terminate, cmd err=0x%x", err);
status = BTM_HCI_ERROR | err;
}
return status;
}
#endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
tBTM_STATUS BTM_BleIsoSetDataPath(uint16_t conn_handle, uint8_t data_path_dir, uint8_t data_path_id, uint8_t coding_fmt,
uint16_t company_id, uint16_t vs_codec_id, uint32_t controller_delay, uint8_t codec_len,
uint8_t *codec_cfg)
{
tHCI_STATUS err = HCI_SUCCESS;
tBTM_STATUS status = BTM_SUCCESS;
if (codec_len && (codec_cfg == NULL)) {
tBTM_BLE_ISO_CB_PARAMS cb_params = {0};
status = BTM_ILLEGAL_VALUE;
cb_params.btm_data_path_update.op_type = BTM_BLE_ISO_DATA_PATH_SETUP;
cb_params.status = status;
cb_params.btm_data_path_update.conn_hdl = conn_handle;
BTM_TRACE_ERROR("codec_cfg is NULL, set data path error");
BTM_IsoBleCallbackTrigger(BTM_BLE_ISO_DATA_PATH_UPFATE_EVT, &cb_params);
return status;
}
BTM_TRACE_DEBUG("BTM_BleIsoSetDataPath conn_handle %d data_path_dir %d\n", conn_handle, data_path_dir);
if ((err = btsnd_hcic_ble_iso_set_data_path(conn_handle, data_path_dir, data_path_id, coding_fmt, company_id, vs_codec_id,
controller_delay, codec_len, codec_cfg)) != HCI_SUCCESS) {
BTM_TRACE_ERROR("iso data path update, cmd err=0x%x", err);
return BTM_HCI_ERROR | err;
}
return status;
}
tBTM_STATUS BTM_BleIsoRemoveDataPath(uint16_t conn_handle, uint8_t data_path_dir)
{
tHCI_STATUS err = HCI_SUCCESS;
BTM_TRACE_DEBUG("BTM_BleIsoRemoveDataPath conn_handle %d data_path_dir %d\n", conn_handle, data_path_dir);
if ((err = btsnd_hcic_ble_iso_remove_data_path(conn_handle, data_path_dir)) != HCI_SUCCESS) {
BTM_TRACE_ERROR("iso data path remove, cmd err=0x%x", err);
return BTM_HCI_ERROR | err;
}
return BTM_SUCCESS;
}
tBTM_STATUS BTM_BleIsoReadTxSync(uint16_t iso_hdl)
{
tHCI_STATUS err = HCI_SUCCESS;
tBTM_STATUS status = BTM_SUCCESS;
BTM_TRACE_DEBUG("BTM_BleIsoReadTxSync iso_hdl %d\n", iso_hdl);
if ((err = btsnd_hcic_ble_iso_read_tx_sync(iso_hdl)) != HCI_SUCCESS) {
BTM_TRACE_ERROR("iso read tx sync, cmd err=0x%x", err);
status = BTM_HCI_ERROR | err;
}
return status;
}
tBTM_STATUS BTM_BleIsoReadLinkQuality(uint16_t iso_hdl)
{
tHCI_STATUS err = HCI_SUCCESS;
tBTM_STATUS status = BTM_SUCCESS;
BTM_TRACE_DEBUG("BTM_BleIsoReadLinkQuality iso_hdl %d\n", iso_hdl);
if ((err = btsnd_hcic_ble_iso_read_iso_link_quality(iso_hdl)) != HCI_SUCCESS) {
BTM_TRACE_ERROR("iso read link quality, cmd err=0x%x", err);
status = BTM_HCI_ERROR | err;
}
return status;
}
#if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
tBTM_STATUS BTM_BleSetCigParams(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,
uint8_t framing, uint16_t mtl_c_to_p, uint16_t mtl_p_to_c, uint8_t cis_cnt, uint8_t *cis_params)
{
tHCI_STATUS err = HCI_SUCCESS;
tBTM_STATUS status = BTM_SUCCESS;
if ((err = btsnd_hcic_ble_iso_set_cig_params(cig_id, sdu_int_c_to_p, sdu_int_p_to_c, worse_case_SCA, packing,
framing, mtl_c_to_p, mtl_p_to_c, cis_cnt, (struct ble_hci_le_cis_params *)cis_params)) != HCI_SUCCESS) {
BTM_TRACE_ERROR("iso set cig params, cmd err=0x%x", err);
status = BTM_HCI_ERROR | err;
}
return status;
}
tBTM_STATUS BTM_BleSetCigParamsTest(uint8_t cig_id, uint32_t sdu_int_c_to_p, uint32_t sdu_int_p_to_c, uint8_t ft_c_to_p, uint8_t ft_p_to_c, uint16_t iso_interval,
uint8_t worse_case_SCA, uint8_t packing, uint8_t framing, uint8_t cis_cnt, uint8_t *cis_params)
{
tHCI_STATUS err = HCI_SUCCESS;
tBTM_STATUS status = BTM_SUCCESS;
if ((err = btsnd_hcic_ble_iso_set_cig_params_test(cig_id, sdu_int_c_to_p, sdu_int_p_to_c,ft_c_to_p, ft_p_to_c, iso_interval,
worse_case_SCA, packing, framing, cis_cnt, (struct ble_hci_le_cis_params_test *)cis_params)) != HCI_SUCCESS) {
BTM_TRACE_ERROR("iso set cig params test, cmd err=0x%x", err);
status = BTM_HCI_ERROR | err;
}
return status;
}
void btm_ble_create_cis_cmd_status(tBTM_BLE_ISO_CB_PARAMS *cb_params)
{
BTM_IsoBleCallbackTrigger(BTM_BLE_ISO_CREATE_CIS_EVT, cb_params);
}
tBTM_STATUS BTM_BleCreateCis(uint8_t cis_count, uint8_t *cis_hdls)
{
btsnd_hcic_ble_iso_create_cis(cis_count, (struct ble_hci_cis_hdls *)cis_hdls);
return BTM_SUCCESS;
}
tBTM_STATUS BTM_BleRemoveCig(uint8_t cig_id)
{
tHCI_STATUS err = HCI_SUCCESS;
tBTM_STATUS status = BTM_SUCCESS;
tBTM_BLE_ISO_CB_PARAMS cb_params = {0};
if ((err = btsnd_hcic_ble_iso_remove_cig(cig_id)) != HCI_SUCCESS) {
BTM_TRACE_ERROR("iso remove cig, cmd err=0x%x", err);
status = BTM_HCI_ERROR | err;
}
cb_params.btm_remove_cig.status = status;
cb_params.btm_remove_cig.cig_id = cig_id;
BTM_IsoBleCallbackTrigger(BTM_BLE_ISO_REMOVE_CIG_EVT, &cb_params);
return status;
}
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
void btm_ble_accept_cis_req_cmd_status(tBTM_BLE_ISO_CB_PARAMS *cb_params)
{
BTM_IsoBleCallbackTrigger(BTM_BLE_ISO_ACCEPT_CIS_REQ_EVT, cb_params);
}
tBTM_STATUS BTM_BleAcceptCisReq(uint16_t cis_handle)
{
btsnd_hcic_ble_iso_accept_cis_req(cis_handle);
return BTM_SUCCESS;
}
tBTM_STATUS BTM_BleRejectCisReq(uint16_t cis_handle, uint8_t reason)
{
tHCI_STATUS err = HCI_SUCCESS;
tBTM_STATUS status = BTM_SUCCESS;
tBTM_BLE_ISO_CB_PARAMS cb_params = {0};
if ((err = btsnd_hcic_ble_iso_reject_cis_req(cis_handle, reason)) != HCI_SUCCESS) {
BTM_TRACE_ERROR("iso reject cis req, cmd err=0x%x", err);
status = BTM_HCI_ERROR | err;
}
cb_params.btm_reject_cis_req.status = status;
cb_params.btm_reject_cis_req.cis_handle = cis_handle;
BTM_IsoBleCallbackTrigger(BTM_BLE_ISO_REJECT_CIS_REQ_EVT, &cb_params);
return status;
}
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_EN == TRUE)
tBTM_STATUS BTM_BleDisconCis(uint16_t cis_handle, uint8_t reason)
{
btsnd_hcic_disconnect(cis_handle, reason);
return BTM_SUCCESS;
}
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)

View File

@ -1216,7 +1216,7 @@ void btm_remove_sco_links (BD_ADDR bda)
** Returns void
**
*******************************************************************************/
void btm_sco_removed (UINT16 hci_handle, UINT8 reason)
BOOLEAN btm_sco_removed (UINT16 hci_handle, UINT8 reason)
{
#if (BTM_MAX_SCO_LINKS>0)
tSCO_CONN *p = &btm_cb.sco_cb.sco_db[0];
@ -1240,10 +1240,11 @@ void btm_sco_removed (UINT16 hci_handle, UINT8 reason)
p->esco.p_esco_cback = NULL; /* Deregister eSCO callback */
(*p->p_disc_cb)(xx);
return;
return TRUE;
}
}
#endif
return FALSE;
}

View File

@ -4594,10 +4594,10 @@ tBTM_STATUS btm_sec_disconnect (UINT16 handle, UINT8 reason)
** Description This function is when a connection to the peer device is
** dropped
**
** Returns void
** Returns tBTM_SEC_DEV_REC is not NULL
**
*******************************************************************************/
void btm_sec_disconnected (UINT16 handle, UINT8 reason)
BOOLEAN btm_sec_disconnected (UINT16 handle, UINT8 reason)
{
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev_by_handle (handle);
UINT8 old_pairing_flags = btm_cb.pairing_flags;
@ -4613,7 +4613,7 @@ void btm_sec_disconnected (UINT16 handle, UINT8 reason)
#endif
if (!p_dev_rec) {
return;
return FALSE;
}
p_dev_rec->enc_init_by_we = FALSE;
transport = (handle == p_dev_rec->hci_handle) ? BT_TRANSPORT_BR_EDR : BT_TRANSPORT_LE;
@ -4654,7 +4654,7 @@ void btm_sec_disconnected (UINT16 handle, UINT8 reason)
if (p_dev_rec->sec_state == BTM_SEC_STATE_DISCONNECTING_BOTH) {
p_dev_rec->sec_state = (transport == BT_TRANSPORT_LE) ?
BTM_SEC_STATE_DISCONNECTING : BTM_SEC_STATE_DISCONNECTING_BLE;
return;
return TRUE;
}
#endif
p_dev_rec->sec_state = BTM_SEC_STATE_IDLE;
@ -4690,6 +4690,7 @@ void btm_sec_disconnected (UINT16 handle, UINT8 reason)
p_dev_rec->sec_bd_name, result);
}
}
return TRUE;
}
/*******************************************************************************

View File

@ -565,6 +565,48 @@ void btm_ble_periodic_adv_list_init(UINT8 periodic_adv_size);
void btm_ble_periodic_adv_sync_trans_recv_evt(tBTM_BLE_PERIOD_ADV_SYNC_TRANS_RECV *params);
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_EN == TRUE)
void btm_ble_cis_established_evt(tBTM_BLE_CIS_ESTABLISHED_CMPL *params);
void btm_ble_cis_disconnected_evt(tBTM_BLE_CIS_DISCON_CMPL *params);
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)
void btm_ble_iso_read_iso_tx_sync_complete(UINT8 *p);
void btm_ble_iso_read_iso_link_quality_complete(UINT8 *p);
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
void btm_ble_cis_request_evt(tBTM_BLE_CIS_REQUEST_CMPL *params);
void btm_ble_accept_cis_req_cmd_status(tBTM_BLE_ISO_CB_PARAMS *cb_params);
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
void btm_ble_create_cis_cmd_status(tBTM_BLE_ISO_CB_PARAMS *cb_params);
void btm_ble_iso_set_cig_params_complete(UINT8 *p);
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
void btm_ble_big_create_cmpl_evt(tBTM_BLE_BIG_CREATE_CMPL *param);
void btm_ble_big_terminate_cmpl_evt(tBTM_BLE_BIG_TERMINATE_CMPL *params);
#endif // #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
void btm_ble_big_sync_estab_evt(tBTM_BLE_BIG_SYNC_ESTAB_CMPL *params);
void btm_ble_big_sync_lost_evt(tBTM_BLE_BIG_SYNC_LOST_EVT *params);
void btm_ble_biginfo_adv_report_evt(tBTM_BLE_BIGINFO_ADV_REPORT_EVT *params);
#endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
void btm_ble_iso_data_path_update_complete(UINT16 opcode, UINT8 hci_status, UINT16 conn_handle);
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
void btm_ble_cte_read_ant_infor_complete(UINT8 *p);
void btm_ble_connless_iq_report_evt(tBTM_BLE_CTE_CONNLESS_IQ_REPORT_EVT *params);
void btm_ble_conn_iq_report_evt(tBTM_BLE_CTE_CONN_IQ_REPORT_EVT *params);
void btm_ble_cte_req_failed_evt(tBTM_BLE_CTE_REQ_FAILED_EVT *params);
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
void btm_ble_path_loss_threshold_evt(tBTM_BLE_PATH_LOSS_THRESHOLD_EVT *params);
void btm_ble_transmit_power_report_evt(tBTM_BLE_TRANS_POWER_REPORT_EVT *params);
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
void btm_ble_subrate_change_evt(tBTM_BLE_SUBRATE_CHANGE_EVT *params);
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
/*
#ifdef __cplusplus
}

View File

@ -1118,6 +1118,17 @@ void btm_read_phy_callback(uint8_t hci_status, uint16_t conn_handle, uint8_t tx_
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
void btm_ble_periodic_adv_sync_trans_complete(UINT16 op_code, UINT8 hci_status, UINT16 conn_handle);
#endif
void btm_ble_big_sync_terminate_complete(UINT8 hci_status, UINT8 big_handle);
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
void btm_enh_read_trans_pwr_level_cmpl_evt(uint8_t *p);
void btm_read_remote_trans_pwr_level_cmpl(UINT8 status);
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
void btm_subrate_req_cmd_status(UINT8 status);
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
/* Internal functions provided by btm_sco.c
********************************************
*/
@ -1129,7 +1140,7 @@ void btm_esco_proc_conn_chg (UINT8 status, UINT16 handle, UINT8 tx_interval,
UINT8 retrans_window, UINT16 rx_pkt_len,
UINT16 tx_pkt_len);
void btm_sco_conn_req (BD_ADDR bda, DEV_CLASS dev_class, UINT8 link_type);
void btm_sco_removed (UINT16 hci_handle, UINT8 reason);
BOOLEAN btm_sco_removed (UINT16 hci_handle, UINT8 reason);
void btm_sco_acl_removed (BD_ADDR bda);
void btm_route_sco_data (BT_HDR *p_msg);
BOOLEAN btm_is_sco_active (UINT16 handle);
@ -1209,7 +1220,7 @@ void btm_sec_auth_complete (UINT16 handle, UINT8 status);
void btm_sec_encrypt_change (UINT16 handle, UINT8 status, UINT8 encr_enable);
void btm_sec_connected (UINT8 *bda, UINT16 handle, UINT8 status, UINT8 enc_mode);
tBTM_STATUS btm_sec_disconnect (UINT16 handle, UINT8 reason);
void btm_sec_disconnected (UINT16 handle, UINT8 reason);
BOOLEAN btm_sec_disconnected (UINT16 handle, UINT8 reason);
void btm_sec_rmt_name_request_complete (UINT8 *bd_addr, UINT8 *bd_name, UINT8 status);
void btm_sec_rmt_host_support_feat_evt (UINT8 *p);
void btm_io_capabilities_req (UINT8 *p);

View File

@ -174,10 +174,60 @@ static void btu_ble_scan_req_received_evt(UINT8 *p);
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
static void btu_ble_channel_select_alg_evt(UINT8 *p);
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
static void btu_ble_periodic_adv_sync_trans_recv(UINT8 *p);
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
void btu_ble_create_big_cmd_status(UINT8 status);
static void btu_ble_big_create_complete_evt(UINT8 *p);
void btu_ble_big_terminate_cmd_status(UINT8 status);
static void btu_ble_big_terminate_complete_evt(UINT8 *p);
#endif // #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
static void btu_ble_create_big_sync_cmd_status(UINT8 status);
static void btu_ble_big_sync_establish_evt(UINT8 *p);
static void btu_ble_big_sync_lost_evt(UINT8 *p);
static void btu_ble_biginfo_adv_report_evt(UINT8 *p);
#endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
static void btu_ble_create_cis_cmd_status(UINT8 status);
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
static void btu_ble_accept_cis_req_cmd_status(UINT8 status);
static void btu_ble_cis_request_evt(UINT8 *p);
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_EN == TRUE)
static void btu_ble_cis_established_evt(UINT8 *p);
static void btu_ble_cis_disconnected(UINT16 handle, UINT8 reason);
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
static void btu_ble_cte_connless_iq_report_evt(UINT8 *p);
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
static void btu_ble_cte_conn_iq_report_evt(UINT8 *p);
static void btu_ble_cte_req_failed_evt(UINT8 *p);
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
static void btu_ble_path_loss_threshold_evt(UINT8 *p);
static void btu_ble_transmit_power_report_evt(UINT8 *p);
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
static void btu_ble_subrate_change_evt(UINT8 *p);
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
#if (BLE_42_ADV_EN == TRUE)
extern osi_sem_t adv_enable_sem;
extern osi_sem_t adv_data_sem;
@ -474,6 +524,68 @@ void btu_hcif_process_event (UNUSED_ATTR UINT8 controller_id, BT_HDR *p_msg)
btu_ble_periodic_adv_sync_trans_recv(p);
break;
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_EN == TRUE)
case HCI_BLE_CIS_ESTABLISHED_V1_EVT:
case HCI_BLE_CIS_ESTABLISHED_V2_EVT:
btu_ble_cis_established_evt(p);
break;
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
case HCI_BLE_CIS_REQUEST_EVT:
btu_ble_cis_request_evt(p);
break;
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
case HCI_BLE_BIG_CREATE_COMPLETE_EVT:
btu_ble_big_create_complete_evt(p);
break;
case HCI_BLE_BIG_TERMINATE_COMPLETE_EVT:
btu_ble_big_terminate_complete_evt(p);
break;
#endif // #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
case HCI_BLE_BIG_SYNC_ESTABLISHED_EVT:
btu_ble_big_sync_establish_evt(p);
break;
case HCI_BLE_BIG_SYNC_LOST_EVT:
btu_ble_big_sync_lost_evt(p);
break;
case HCI_BLE_BIGINFO_ADV_REPORT_EVT:
btu_ble_biginfo_adv_report_evt(p);
break;
#endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
case HCI_BLE_CONNLESS_IQ_REPORT_EVT:
btu_ble_cte_connless_iq_report_evt(p);
break;
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
case HCI_BLE_CONN_IQ_REPORT_EVT:
btu_ble_cte_conn_iq_report_evt(p);
break;
case HCI_BLE_CTE_REQUEST_FAILED_EVT:
btu_ble_cte_req_failed_evt(p);
break;
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
case HCI_BLE_PATH_LOSS_THRESHOLD_EVT:
btu_ble_path_loss_threshold_evt(p);
break;
case HCI_BLE_TRANS_POWER_REPORTING_EVT:
btu_ble_transmit_power_report_evt(p);
break;
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
case HCI_BLE_SUBRATE_CHANGE_EVT:
btu_ble_subrate_change_evt(p);
break;
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
}
break;
#endif /* BLE_INCLUDED */
@ -758,6 +870,7 @@ static void btu_hcif_disconnection_comp_evt (UINT8 *p)
{
UINT16 handle;
UINT8 reason;
BOOLEAN dev_find = FALSE;
++p;
STREAM_TO_UINT16 (handle, p);
@ -765,9 +878,18 @@ static void btu_hcif_disconnection_comp_evt (UINT8 *p)
handle = HCID_GET_HANDLE (handle);
btm_acl_disconnected(handle, reason);
dev_find = btm_acl_disconnected(handle, reason);
HCI_TRACE_WARNING("hcif disc complete: hdl 0x%x, rsn 0x%x", handle, reason);
#if (BLE_FEAT_ISO_CIG_EN == TRUE)
// Not find device. it is iso handle
if (!dev_find) {
btu_ble_cis_disconnected(handle, reason);
}
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)
HCI_TRACE_WARNING("hcif disc complete: hdl 0x%x, rsn 0x%x dev_find %d", handle, reason, dev_find);
UNUSED(dev_find);
}
/*******************************************************************************
@ -1212,6 +1334,59 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
break;
}
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
case HCI_BLE_BIG_TERMINATE_SYNC:
UINT16 big_handle;
STREAM_TO_UINT8(status, p);
STREAM_TO_UINT8(big_handle, p);
btm_ble_big_sync_terminate_complete(status, big_handle);
break;
#endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
case HCI_BLE_ISO_SET_DATA_PATH:
case HCI_BLE_ISO_REMOVE_DATA_PATH:
UINT16 conn_handle;
STREAM_TO_UINT8(status, p);
STREAM_TO_UINT16(conn_handle, p);
btm_ble_iso_data_path_update_complete(opcode, status, conn_handle);
break;
case HCI_BLE_ISO_READ_TX_SYNC:
btm_ble_iso_read_iso_tx_sync_complete(p);
break;
case HCI_BLE_ISO_READ_ISO_LINK_QUALITY:
btm_ble_iso_read_iso_link_quality_complete(p);
break;
#if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
case HCI_BLE_ISO_SET_CIG_PARAMS:
case HCI_BLE_ISO_SET_CIG_PARAMS_TEST:
btm_ble_iso_set_cig_params_complete(p);
break;
case HCI_BLE_ISO_REMOVE_CIG:
// do nothing
break;
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
case HCI_BLE_ISO_ACCEPT_CIS_REQ:
case HCI_BLE_ISO_REJECT_CIS_REQ:
// do nothing
break;
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
case HCI_BLE_READ_ANT_INFOR:
btm_ble_cte_read_ant_infor_complete(p);
break;
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
case HCI_BLE_ENH_READ_TRANS_POWER_LEVEL:
btm_enh_read_trans_pwr_level_cmpl_evt(p);
break;
#endif //#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#endif /* (BLE_INCLUDED == TRUE) */
default: {
@ -1383,6 +1558,42 @@ static void btu_hcif_hdl_command_status (UINT16 opcode, UINT8 status, UINT8 *p_c
break;
}
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
case HCI_BLE_CREATE_BIG:
case HCI_BLE_CREATE_BIG_TEST:
btu_ble_create_big_cmd_status(status);
break;
case HCI_BLE_TERMINATE_BIG:
btu_ble_big_terminate_cmd_status(status);
break;
#endif // #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
case HCI_BLE_BIG_CREATE_SYNC:
btu_ble_create_big_sync_cmd_status(status);
break;
#endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
case HCI_BLE_ISO_CREATE_CIS:
btu_ble_create_cis_cmd_status(status);
break;
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
case HCI_BLE_ISO_ACCEPT_CIS_REQ:
btu_ble_accept_cis_req_cmd_status(status);
break;
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
case HCI_BLE_READ_REMOTE_TRANS_POWER_LEVEL:
btm_read_remote_trans_pwr_level_cmpl(status);
break;
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
case HCI_BLE_SUBRATE_REQUEST:
btm_subrate_req_cmd_status(status);
break;
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
default:
/* If command failed to start, we may need to tell BTM */
if (status != HCI_SUCCESS) {
@ -2491,6 +2702,384 @@ static void btu_ble_periodic_adv_sync_trans_recv(UINT8 *p)
}
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
static void btu_ble_create_cis_cmd_status(UINT8 status)
{
tBTM_BLE_ISO_CB_PARAMS cb_params = {0};
if (status != HCI_SUCCESS) {
status = (BTM_HCI_ERROR | status);
}
cb_params.status = status;
btm_ble_create_cis_cmd_status(&cb_params);
}
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
static void btu_ble_accept_cis_req_cmd_status(UINT8 status)
{
tBTM_BLE_ISO_CB_PARAMS cb_params = {0};
if (status != HCI_SUCCESS) {
status = (BTM_HCI_ERROR | status);
}
cb_params.status = status;
btm_ble_accept_cis_req_cmd_status(&cb_params);
}
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_EN == TRUE)
static void btu_ble_cis_disconnected(UINT16 handle, UINT8 reason)
{
tBTM_BLE_CIS_DISCON_CMPL cis_disconnected_evt = {0};
cis_disconnected_evt.cis_handle = handle;
cis_disconnected_evt.reason = reason;
btm_ble_cis_disconnected_evt(&cis_disconnected_evt);
}
static void btu_ble_cis_established_evt(UINT8 *p)
{
HCI_TRACE_DEBUG("%s", __func__);
tBTM_BLE_CIS_ESTABLISHED_CMPL cis_estab_evt = {0};
if (!p) {
HCI_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
STREAM_TO_UINT8(cis_estab_evt.status, p);
STREAM_TO_UINT16(cis_estab_evt.conn_handle, p);
STREAM_TO_UINT24(cis_estab_evt.cig_sync_delay, p);
STREAM_TO_UINT24(cis_estab_evt.cis_sync_delay, p);
STREAM_TO_UINT24(cis_estab_evt.trans_lat_c_to_p, p);
STREAM_TO_UINT24(cis_estab_evt.trans_lat_p_to_c, p);
STREAM_TO_UINT8(cis_estab_evt.phy_c_to_p, p);
STREAM_TO_UINT8(cis_estab_evt.phy_p_to_c, p);
STREAM_TO_UINT8(cis_estab_evt.nse, p);
STREAM_TO_UINT8(cis_estab_evt.bn_c_to_p, p);
STREAM_TO_UINT8(cis_estab_evt.bn_p_to_c, p);
STREAM_TO_UINT8(cis_estab_evt.ft_c_to_p, p);
STREAM_TO_UINT8(cis_estab_evt.ft_p_to_c, p);
STREAM_TO_UINT16(cis_estab_evt.max_pdu_c_to_p, p);
STREAM_TO_UINT16(cis_estab_evt.max_pdu_p_to_c, p);
STREAM_TO_UINT16(cis_estab_evt.iso_interval, p);
#if (BLE_FEAT_ISO_60_EN == TRUE)
STREAM_TO_UINT24(cis_estab_evt.sub_interval, p);
STREAM_TO_UINT16(cis_estab_evt.max_sdu_c_to_p, p);
STREAM_TO_UINT16(cis_estab_evt.max_sdu_p_to_c, p);
STREAM_TO_UINT24(cis_estab_evt.sdu_int_c_to_p, p);
STREAM_TO_UINT24(cis_estab_evt.sdu_int_p_to_c, p);
STREAM_TO_UINT8(cis_estab_evt.framing, p);
#endif // #if (BLE_FEAT_ISO_60_EN == TRUE)
btm_ble_cis_established_evt(&cis_estab_evt);
}
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
static void btu_ble_cis_request_evt(UINT8 *p)
{
HCI_TRACE_DEBUG("%s", __func__);
tBTM_BLE_CIS_REQUEST_CMPL cis_req_evt = {0};
if (!p) {
HCI_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
STREAM_TO_UINT16(cis_req_evt.acl_handle, p);
STREAM_TO_UINT16(cis_req_evt.cis_handle, p);
STREAM_TO_UINT8(cis_req_evt.cig_id, p);
STREAM_TO_UINT8(cis_req_evt.cis_id, p);
btm_ble_cis_request_evt(&cis_req_evt);
}
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
void btu_ble_create_big_cmd_status(UINT8 status)
{
if (status != HCI_SUCCESS) {
tBTM_BLE_BIG_CREATE_CMPL big_cmpl = {0};
btm_ble_big_create_cmpl_evt(&big_cmpl);
}
}
static void btu_ble_big_create_complete_evt(UINT8 *p)
{
HCI_TRACE_DEBUG("%s", __func__);
tBTM_BLE_BIG_CREATE_CMPL big_cmpl = {0};
if (!p) {
HCI_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
STREAM_TO_UINT8(big_cmpl.status, p);
STREAM_TO_UINT8(big_cmpl.big_handle, p);
STREAM_TO_UINT24(big_cmpl.big_sync_delay, p);
STREAM_TO_UINT24(big_cmpl.transport_latency, p);
STREAM_TO_UINT8(big_cmpl.phy, p);
STREAM_TO_UINT8(big_cmpl.nse, p);
STREAM_TO_UINT8(big_cmpl.bn, p);
STREAM_TO_UINT8(big_cmpl.pto, p);
STREAM_TO_UINT8(big_cmpl.irc, p);
STREAM_TO_UINT16(big_cmpl.max_pdu, p);
STREAM_TO_UINT16(big_cmpl.iso_interval, p);
STREAM_TO_UINT8(big_cmpl.num_bis, p);
for (uint8_t i = 0; i < big_cmpl.num_bis; i++)
{
STREAM_TO_UINT16(big_cmpl.bis_handle[i], p);
// only 12 bits meaningful
big_cmpl.bis_handle[i] = (big_cmpl.bis_handle[i] & 0x0FFF);
}
btm_ble_big_create_cmpl_evt(&big_cmpl);
}
void btu_ble_big_terminate_cmd_status(UINT8 status)
{
if (status != HCI_SUCCESS) {
tBTM_BLE_BIG_TERMINATE_CMPL big_term = {0};
big_term.status = (status | BTM_HCI_ERROR);
btm_ble_big_terminate_cmpl_evt(&big_term);
}
}
static void btu_ble_big_terminate_complete_evt(UINT8 *p)
{
tBTM_BLE_BIG_TERMINATE_CMPL big_term = {0};
if (!p) {
HCI_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
STREAM_TO_UINT8(big_term.big_handle, p);
STREAM_TO_UINT8(big_term.reason, p);
big_term.status = HCI_SUCCESS;
btm_ble_big_terminate_cmpl_evt(&big_term);
}
#endif // #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
void btu_ble_create_big_sync_cmd_status(UINT8 status)
{
if (status != HCI_SUCCESS) {
tBTM_BLE_BIG_SYNC_ESTAB_CMPL big_estb = {0};
big_estb.status = status;
btm_ble_big_sync_estab_evt(&big_estb);
}
}
static void btu_ble_big_sync_establish_evt(UINT8 *p)
{
tBTM_BLE_BIG_SYNC_ESTAB_CMPL big_estb = {0};
if (!p) {
HCI_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
STREAM_TO_UINT8(big_estb.status, p);
STREAM_TO_UINT8(big_estb.big_handle, p);
STREAM_TO_UINT24(big_estb.transport_latency_big, p);
STREAM_TO_UINT8(big_estb.nse, p);
STREAM_TO_UINT8(big_estb.bn, p);
STREAM_TO_UINT8(big_estb.pto, p);
STREAM_TO_UINT8(big_estb.irc, p);
STREAM_TO_UINT16(big_estb.max_pdu, p);
STREAM_TO_UINT16(big_estb.iso_interval, p);
STREAM_TO_UINT8(big_estb.num_bis, p);
for (uint8_t i = 0; i < big_estb.num_bis; i++)
{
STREAM_TO_UINT16(big_estb.bis_handle[i], p);
}
btm_ble_big_sync_estab_evt(&big_estb);
}
static void btu_ble_big_sync_lost_evt(UINT8 *p)
{
tBTM_BLE_BIG_SYNC_LOST_EVT big_sync_lost = {0};
if (!p) {
HCI_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
STREAM_TO_UINT8(big_sync_lost.big_handle, p);
STREAM_TO_UINT8(big_sync_lost.reason, p);
btm_ble_big_sync_lost_evt(&big_sync_lost);
}
static void btu_ble_biginfo_adv_report_evt(UINT8 *p)
{
tBTM_BLE_BIGINFO_ADV_REPORT_EVT biginfo_report = {0};
if (!p) {
HCI_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
STREAM_TO_UINT16(biginfo_report.sync_handle, p);
STREAM_TO_UINT8(biginfo_report.num_bis, p);
STREAM_TO_UINT8(biginfo_report.nse, p);
STREAM_TO_UINT16(biginfo_report.iso_interval, p);
STREAM_TO_UINT8(biginfo_report.bn, p);
STREAM_TO_UINT8(biginfo_report.pto, p);
STREAM_TO_UINT8(biginfo_report.irc, p);
STREAM_TO_UINT16(biginfo_report.max_pdu, p);
STREAM_TO_UINT24(biginfo_report.sdu_interval, p);
STREAM_TO_UINT16(biginfo_report.max_sdu, p);
STREAM_TO_UINT8(biginfo_report.phy, p);
STREAM_TO_UINT8(biginfo_report.framing, p);
STREAM_TO_UINT8(biginfo_report.encryption, p);
btm_ble_biginfo_adv_report_evt(&biginfo_report);
}
#endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
static void btu_ble_cte_connless_iq_report_evt(UINT8 *p)
{
tBTM_BLE_CTE_CONNLESS_IQ_REPORT_EVT connless_iq_rpt = {0};
if (!p) {
HCI_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
STREAM_TO_UINT16(connless_iq_rpt.sync_handle, p);
STREAM_TO_UINT8(connless_iq_rpt.channel_idx, p);
STREAM_TO_UINT16(connless_iq_rpt.rssi, p);
STREAM_TO_UINT8(connless_iq_rpt.rssi_ant_id, p);
STREAM_TO_UINT8(connless_iq_rpt.cte_type, p);
STREAM_TO_UINT8(connless_iq_rpt.slot_dur, p);
STREAM_TO_UINT8(connless_iq_rpt.pkt_status, p);
STREAM_TO_UINT16(connless_iq_rpt.periodic_evt_counter, p);
STREAM_TO_UINT8(connless_iq_rpt.sample_count, p);
for (uint8_t i = 0; i < connless_iq_rpt.sample_count; i++)
{
STREAM_TO_UINT8(connless_iq_rpt.i_sample[i], p);
STREAM_TO_UINT8(connless_iq_rpt.q_sample[i], p);
}
btm_ble_connless_iq_report_evt(&connless_iq_rpt);
}
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
static void btu_ble_cte_conn_iq_report_evt(UINT8 *p)
{
tBTM_BLE_CTE_CONN_IQ_REPORT_EVT conn_iq_rpt = {0};
if (!p) {
HCI_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
STREAM_TO_UINT16(conn_iq_rpt.conn_handle, p);
STREAM_TO_UINT8(conn_iq_rpt.rx_phy, p);
STREAM_TO_UINT8(conn_iq_rpt.data_channel_idx, p);
STREAM_TO_UINT16(conn_iq_rpt.rssi, p);
STREAM_TO_UINT8(conn_iq_rpt.rssi_ant_id, p);
STREAM_TO_UINT8(conn_iq_rpt.cte_type, p);
STREAM_TO_UINT8(conn_iq_rpt.slot_dur, p);
STREAM_TO_UINT8(conn_iq_rpt.pkt_status, p);
STREAM_TO_UINT16(conn_iq_rpt.conn_evt_counter, p);
STREAM_TO_UINT8(conn_iq_rpt.sample_count, p);
for (uint8_t i = 0; i < conn_iq_rpt.sample_count; i++)
{
STREAM_TO_UINT8(conn_iq_rpt.i_sample[i], p);
STREAM_TO_UINT8(conn_iq_rpt.q_sample[i], p);
}
btm_ble_conn_iq_report_evt(&conn_iq_rpt);
}
static void btu_ble_cte_req_failed_evt(UINT8 *p)
{
tBTM_BLE_CTE_REQ_FAILED_EVT cte_req_failed = {0};
if (!p) {
HCI_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
STREAM_TO_UINT8(cte_req_failed.status, p);
STREAM_TO_UINT16(cte_req_failed.conn_handle, p);
btm_ble_cte_req_failed_evt(&cte_req_failed);
}
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
static void btu_ble_path_loss_threshold_evt(UINT8 *p)
{
tBTM_BLE_PATH_LOSS_THRESHOLD_EVT path_loss_thres_evt = {0};
if (!p) {
HCI_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
STREAM_TO_UINT16(path_loss_thres_evt.conn_handle, p);
STREAM_TO_UINT8(path_loss_thres_evt.cur_path_loss, p);
STREAM_TO_UINT8(path_loss_thres_evt.zone_entered, p);
btm_ble_path_loss_threshold_evt(&path_loss_thres_evt);
}
static void btu_ble_transmit_power_report_evt(UINT8 *p)
{
tBTM_BLE_TRANS_POWER_REPORT_EVT trans_pwr_report_evt = {0};
if (!p) {
HCI_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
STREAM_TO_UINT8(trans_pwr_report_evt.status, p);
STREAM_TO_UINT16(trans_pwr_report_evt.conn_handle, p);
STREAM_TO_UINT8(trans_pwr_report_evt.reason, p);
STREAM_TO_UINT8(trans_pwr_report_evt.phy, p);
STREAM_TO_UINT8(trans_pwr_report_evt.tx_power_level, p);
STREAM_TO_UINT8(trans_pwr_report_evt.tx_power_level_flag, p);
STREAM_TO_UINT8(trans_pwr_report_evt.delta, p);
btm_ble_transmit_power_report_evt(&trans_pwr_report_evt);
}
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
static void btu_ble_subrate_change_evt(UINT8 *p)
{
tBTM_BLE_SUBRATE_CHANGE_EVT subrate_change_evt = {0};
if (!p) {
HCI_TRACE_ERROR("%s, Invalid params.", __func__);
return;
}
STREAM_TO_UINT8(subrate_change_evt.status, p);
STREAM_TO_UINT16(subrate_change_evt.conn_handle, p);
STREAM_TO_UINT16(subrate_change_evt.subrate_factor, p);
STREAM_TO_UINT16(subrate_change_evt.peripheral_latency, p);
STREAM_TO_UINT16(subrate_change_evt.continuation_number, p);
STREAM_TO_UINT16(subrate_change_evt.supervision_timeout, p);
btm_ble_subrate_change_evt(&subrate_change_evt);
}
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
/**********************************************
** End of BLE Events Handler
***********************************************/

View File

@ -1992,3 +1992,817 @@ BOOLEAN btsnd_hcic_ble_set_vendor_evt_mask (UINT32 evt_mask)
return TRUE;
}
#endif
#if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
UINT8 btsnd_hcic_ble_big_create(uint8_t big_handle, uint8_t adv_handle, uint8_t num_bis,
uint32_t sdu_interval, uint16_t max_sdu, uint16_t max_transport_latency,
uint8_t rtn, uint8_t phy, uint8_t packing, uint8_t framing,
uint8_t encryption, uint8_t *broadcast_code)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("hci big create: big_handle %d, adv_handle %d, num_bis %d sdu_interval %d max_sdu %d max_transport_latency %d \
rtn %d phy %d packing %d framing %d encryption %d", big_handle, adv_handle, num_bis, sdu_interval, max_sdu,\
max_transport_latency, rtn, phy, packing, framing, encryption);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_BIG_CREATE_PARAMS);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_CREATE_BIG);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_BIG_CREATE_PARAMS);
UINT8_TO_STREAM(pp, big_handle);
UINT8_TO_STREAM(pp, adv_handle);
UINT8_TO_STREAM(pp, num_bis);
UINT24_TO_STREAM(pp, sdu_interval);
UINT16_TO_STREAM(pp, max_sdu);
UINT16_TO_STREAM(pp, max_transport_latency);
UINT8_TO_STREAM(pp, rtn);
UINT8_TO_STREAM(pp, phy);
UINT8_TO_STREAM(pp, packing);
UINT8_TO_STREAM(pp, framing);
UINT8_TO_STREAM(pp, encryption);
ARRAY_TO_STREAM(pp, broadcast_code, 16);
btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
return TRUE;
}
UINT8 btsnd_hcic_ble_big_create_test(uint8_t big_handle, uint8_t adv_handle, uint8_t num_bis,
uint32_t sdu_interval, uint16_t iso_interval, uint8_t nse,
uint16_t max_sdu, uint16_t max_pdu, uint8_t phy,
uint8_t packing, uint8_t framing, uint8_t bn, uint8_t irc,
uint8_t pto, uint8_t encryption, uint8_t *broadcast_code)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("%s big_handle %d, adv_handle %d, num_bis %d sdu_interval %d max_sdu %d max_pdu %d iso_interval %d \
nse %d phy %d packing %d framing %d bn %d irc %dencryption %d", __func__, big_handle, adv_handle, num_bis, sdu_interval, max_sdu, max_pdu, \
iso_interval, nse, phy, packing, framing, bn, irc, encryption);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_BIG_CREATE_TEST_PARAMS);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_CREATE_BIG_TEST);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_BIG_CREATE_TEST_PARAMS);
UINT8_TO_STREAM(pp, big_handle);
UINT8_TO_STREAM(pp, adv_handle);
UINT8_TO_STREAM(pp, num_bis);
UINT24_TO_STREAM(pp, sdu_interval);
UINT16_TO_STREAM(pp, iso_interval);
UINT8_TO_STREAM(pp, nse);
UINT16_TO_STREAM(pp, max_sdu);
UINT16_TO_STREAM(pp, max_pdu);
UINT8_TO_STREAM(pp, phy);
UINT8_TO_STREAM(pp, packing);
UINT8_TO_STREAM(pp, framing);
UINT8_TO_STREAM(pp, bn);
UINT8_TO_STREAM(pp, irc);
UINT8_TO_STREAM(pp, pto);
UINT8_TO_STREAM(pp, encryption);
ARRAY_TO_STREAM(pp, broadcast_code, 16);
btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
return TRUE;
}
UINT8 btsnd_hcic_ble_big_terminate(uint8_t big_handle, uint8_t reason)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("%s big_handle %d reason 0x%x", __func__, big_handle, reason);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_BIG_TERMINATE_PARAMS);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_TERMINATE_BIG);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_BIG_TERMINATE_PARAMS);
UINT8_TO_STREAM(pp, big_handle);
UINT8_TO_STREAM(pp, reason);
btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
return TRUE;
}
#endif // #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
UINT8 btsnd_hcic_ble_big_sync_create(uint8_t big_handle, uint16_t sync_handle,
uint8_t encryption, uint8_t *bc_code,
uint8_t mse, uint16_t big_sync_timeout,
uint8_t num_bis, uint8_t *bis)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("big sync create: big_handle %d sync_handle %d encryption %d mse %d big_sync_timeout %d", big_handle, sync_handle, encryption, mse, big_sync_timeout);
// for (uint8_t i = 0; i < num_bis; i++)
// {
// HCI_TRACE_ERROR("i %d bis %d", bis[i]);
// }
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_BIG_SYNC_CREATE_PARAMS);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_BIG_CREATE_SYNC);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_BIG_SYNC_CREATE_PARAMS);
UINT8_TO_STREAM(pp, big_handle);
UINT16_TO_STREAM(pp, sync_handle);
UINT8_TO_STREAM(pp, encryption);
ARRAY_TO_STREAM(pp, bc_code, 16);
UINT8_TO_STREAM(pp, mse);
UINT16_TO_STREAM(pp, big_sync_timeout);
UINT8_TO_STREAM(pp, num_bis);
ARRAY_TO_STREAM(pp, bis, num_bis);
btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
return TRUE;
}
UINT8 btsnd_hcic_ble_big_sync_terminate(uint8_t big_handle)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("%s big_handle %d", __func__, big_handle);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_BIG_SYNC_TERMINATE_PARAMS);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_BIG_TERMINATE_SYNC);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_BIG_SYNC_TERMINATE_PARAMS);
UINT8_TO_STREAM(pp, big_handle);
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
#endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
UINT8 btsnd_hcic_ble_iso_set_data_path(uint16_t conn_handle, uint8_t data_path_dir, uint8_t data_path_id, uint8_t coding_fmt,
uint16_t company_id, uint16_t vs_codec_id, uint32_t controller_delay, uint8_t codec_len,
uint8_t *codec_cfg)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("hci set data path: conn_handle %d data_path_dir %d data_path_id %d coding_fmt %d company_id 0x%x vs_codec_id %d controller_delay %ld codec_len %d",
conn_handle, data_path_dir, data_path_id, coding_fmt, company_id, vs_codec_id, controller_delay, codec_len);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_ISO_SET_DATA_PATH_PARAMS + codec_len);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_ISO_SET_DATA_PATH);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_ISO_SET_DATA_PATH_PARAMS + codec_len);
UINT16_TO_STREAM(pp, conn_handle);
UINT8_TO_STREAM(pp, data_path_dir);
UINT8_TO_STREAM(pp, data_path_id);
UINT8_TO_STREAM(pp, coding_fmt);
UINT16_TO_STREAM(pp, company_id);
UINT16_TO_STREAM(pp, vs_codec_id);
UINT24_TO_STREAM(pp, controller_delay);
UINT8_TO_STREAM(pp, codec_len);
if (codec_len && codec_cfg) {
ARRAY_TO_STREAM(pp, codec_cfg, codec_len);
}
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
UINT8 btsnd_hcic_ble_iso_remove_data_path(uint16_t conn_handle, uint8_t data_path_dir)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("hci remove data path: conn_handle %d data_path_dir %d", conn_handle, data_path_dir);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_ISO_REMOVE_DATA_PATH_PARAMS);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_ISO_REMOVE_DATA_PATH);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_ISO_REMOVE_DATA_PATH_PARAMS);
UINT16_TO_STREAM(pp, conn_handle);
UINT8_TO_STREAM(pp, data_path_dir);
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;
UINT8 *pp;
HCI_TRACE_DEBUG("hci read iso tx sync: iso_hdl %d", iso_hdl);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_ISO_READ_TX_SYNC_PARAMS);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_ISO_READ_TX_SYNC);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_ISO_READ_TX_SYNC_PARAMS);
// Bit_Number V1
UINT16_TO_STREAM(pp, iso_hdl);
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
#if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
UINT8 btsnd_hcic_ble_iso_set_cig_params(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,
uint8_t framing, uint16_t mtl_c_to_p, uint16_t mtl_p_to_c, uint8_t cis_cnt, struct ble_hci_le_cis_params *cis_params)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("hci set cig params: cig_id %d sdu_int_c_to_p %d sdu_int_p_to_c %d worse_case_SCA %d packing %d framing %d mtl_c_to_p %d mtl_p_to_c %d cis_cnt %d",
cig_id, sdu_int_c_to_p, sdu_int_p_to_c, worse_case_SCA, packing, framing, mtl_c_to_p, mtl_p_to_c, cis_cnt);
UINT8 cis_param_len = cis_cnt * 9;
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_ISO_SET_CIG_PARAMS + cis_param_len);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_ISO_SET_CIG_PARAMS);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_ISO_SET_CIG_PARAMS + cis_param_len);
UINT8_TO_STREAM(pp, cig_id);
UINT24_TO_STREAM(pp, sdu_int_c_to_p);
UINT24_TO_STREAM(pp, sdu_int_p_to_c);
UINT8_TO_STREAM(pp, worse_case_SCA);
UINT8_TO_STREAM(pp, packing);
UINT8_TO_STREAM(pp, framing);
UINT16_TO_STREAM(pp, mtl_c_to_p);
UINT16_TO_STREAM(pp, mtl_p_to_c);
UINT8_TO_STREAM(pp, cis_cnt);
for (uint8_t i = 0; i < cis_cnt; i++)
{
UINT8_TO_STREAM(pp, cis_params[i].cis_id);
UINT16_TO_STREAM(pp, cis_params[i].max_sdu_c_to_p);
UINT16_TO_STREAM(pp, cis_params[i].max_sdu_p_to_c);
UINT8_TO_STREAM(pp, cis_params[i].phy_c_to_p);
UINT8_TO_STREAM(pp, cis_params[i].phy_p_to_c);
UINT8_TO_STREAM(pp, cis_params[i].rtn_c_to_p);
UINT8_TO_STREAM(pp, cis_params[i].rtn_p_to_c);
}
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
UINT8 btsnd_hcic_ble_iso_set_cig_params_test(uint8_t cig_id, uint32_t sdu_int_c_to_p, uint32_t sdu_int_p_to_c, uint8_t ft_c_to_p, uint8_t ft_p_to_c,
uint16_t iso_interval, uint8_t worse_case_SCA, uint8_t packing, uint8_t framing, uint8_t cis_cnt,
struct ble_hci_le_cis_params_test *cis_params_test)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("hci set cig params test: cig_id %d sdu_int_c_to_p %d sdu_int_p_to_c %d ft_c_to_p %d ft_p_to_c %d iso_interval %d worse_case_SCA %d packing %d framing %d cis_cnt %d",
cig_id, sdu_int_c_to_p, sdu_int_p_to_c, ft_c_to_p, ft_p_to_c, iso_interval, worse_case_SCA, packing, framing, cis_cnt);
UINT8 cis_param_len = cis_cnt * 14;
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_ISO_SET_CIG_TEST_PARAMS + cis_param_len);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_ISO_SET_CIG_PARAMS_TEST);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_ISO_SET_CIG_TEST_PARAMS + cis_param_len);
UINT8_TO_STREAM(pp, cig_id);
UINT24_TO_STREAM(pp, sdu_int_c_to_p);
UINT24_TO_STREAM(pp, sdu_int_p_to_c);
UINT8_TO_STREAM(pp, ft_c_to_p);
UINT8_TO_STREAM(pp, ft_p_to_c);
UINT16_TO_STREAM(pp, iso_interval);
UINT8_TO_STREAM(pp, worse_case_SCA);
UINT8_TO_STREAM(pp, packing);
UINT8_TO_STREAM(pp, framing);
UINT8_TO_STREAM(pp, cis_cnt);
for (uint8_t i = 0; i < cis_cnt; i++)
{
UINT8_TO_STREAM(pp, cis_params_test[i].cis_id);
UINT8_TO_STREAM(pp, cis_params_test[i].nse);
UINT16_TO_STREAM(pp, cis_params_test[i].max_sdu_c_to_p);
UINT16_TO_STREAM(pp, cis_params_test[i].max_sdu_p_to_c);
UINT16_TO_STREAM(pp, cis_params_test[i].max_pdu_c_to_p);
UINT16_TO_STREAM(pp, cis_params_test[i].max_pdu_p_to_c);
UINT8_TO_STREAM(pp, cis_params_test[i].phy_c_to_p);
UINT8_TO_STREAM(pp, cis_params_test[i].phy_p_to_c);
UINT8_TO_STREAM(pp, cis_params_test[i].bn_c_to_p);
UINT8_TO_STREAM(pp, cis_params_test[i].bn_p_to_c);
}
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
UINT8 btsnd_hcic_ble_iso_create_cis(uint8_t cis_count, struct ble_hci_cis_hdls *cis_hdls)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("hci create cis: cig_id ", cis_count);
// for (uint8_t i = 0; i < cis_count; i++)
// {
// HCI_TRACE_ERROR("i %d cis_hdl %d acl_hdl %d", i, cis_hdls[i].cis_hdl, cis_hdls[i].acl_hdl);
// }
UINT8 cis_param_len = cis_count * 4;
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_ISO_CREATE_CIS_PARAMS + cis_param_len);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_ISO_CREATE_CIS);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_ISO_CREATE_CIS_PARAMS + cis_param_len);
UINT8_TO_STREAM(pp, cis_count);
for (uint8_t i = 0; i < cis_count; i++)
{
UINT16_TO_STREAM(pp, cis_hdls[i].cis_hdl);
UINT16_TO_STREAM(pp, cis_hdls[i].acl_hdl);
}
btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
return TRUE;
}
UINT8 btsnd_hcic_ble_iso_remove_cig(uint8_t cig_id)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("hci remove cig: cig_id %d", cig_id);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_ISO_REMOVE_CIG_PARAMS);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_ISO_REMOVE_CIG);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_ISO_REMOVE_CIG_PARAMS);
UINT8_TO_STREAM(pp, cig_id);
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
UINT8 btsnd_hcic_ble_iso_accept_cis_req(uint16_t cis_handle)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("hci accept cis req: cis_handle %d", cis_handle);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_ISO_ACCEPT_CIS_REQ_PARAMS);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_ISO_ACCEPT_CIS_REQ);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_ISO_ACCEPT_CIS_REQ_PARAMS);
UINT16_TO_STREAM(pp, cis_handle);
btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
return TRUE;
}
UINT8 btsnd_hcic_ble_iso_reject_cis_req(uint16_t cis_handle, uint8_t reason)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("hci reject cis req: cis_handle %d reason %d", cis_handle, reason);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_ISO_REJECT_CIS_REQ_PARAMS);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_ISO_REJECT_CIS_REQ);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_ISO_REJECT_CIS_REQ_PARAMS);
UINT16_TO_STREAM(pp, cis_handle);
UINT8_TO_STREAM(pp, reason);
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
UINT8 btsnd_hcic_ble_iso_read_iso_link_quality(uint16_t iso_handle)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("hci read iso link quality: cis_handle %d", iso_handle);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_ISO_READ_LINK_QUALITY_PARAMS);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_ISO_READ_ISO_LINK_QUALITY);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_ISO_READ_LINK_QUALITY_PARAMS);
UINT16_TO_STREAM(pp, iso_handle);
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
UINT8 btsnd_hcic_ble_set_connless_cte_trans_params(uint8_t adv_hdl, uint8_t cte_len, uint8_t cte_type,
uint8_t cte_cnt, uint8_t switching_pattern_len, uint8_t *antenna_ids)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("hci set connless cte trans: adv_hdl %d cte_len %d cte_type %d cte_cnt %d", adv_hdl, cte_len, cte_type, cte_cnt);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_SET_CONNLESS_CTE_TRANS_PARAMS + switching_pattern_len);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_SET_CONNLESS_CTE_TRANS_PARAMS);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_SET_CONNLESS_CTE_TRANS_PARAMS + switching_pattern_len);
UINT8_TO_STREAM(pp, adv_hdl);
UINT8_TO_STREAM(pp, cte_len);
UINT8_TO_STREAM(pp, cte_type);
UINT8_TO_STREAM(pp, cte_cnt);
UINT8_TO_STREAM(pp, switching_pattern_len);
for (uint8_t i = 0; i < switching_pattern_len; i++)
{
UINT8_TO_STREAM(pp, antenna_ids[i]);
}
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
UINT8 btsnd_hcic_ble_set_connless_cte_enable(uint8_t adv_hdl, uint8_t cte_en)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("hci set connect cte enable: adv_hdl %d cte_en %d", adv_hdl, cte_en);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_SET_CONNLESS_CTE_TRANS_ENABLE);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_SET_CONNLESS_CTE_TRANS_ENABLE);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_SET_CONNLESS_CTE_TRANS_ENABLE);
UINT8_TO_STREAM(pp, adv_hdl);
UINT8_TO_STREAM(pp, cte_en);
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
UINT8 btsnd_hcic_ble_set_connless_iq_sampling_enable(uint16_t sync_hdl, uint8_t sampling_en, uint8_t slot_dur,
uint8_t max_sampled_ctes, uint8_t switching_pattern_len, uint8_t *antenna_ids)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("hci enable IQ sampling: sync_hdl %d sampling_en %d slot_dur %d", sync_hdl, sampling_en, slot_dur);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_SET_CONNLESS_IQ_SAMPLING_ENABLE + switching_pattern_len);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_SET_CONNLESS_IQ_SAMPLING_ENABLE);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_SET_CONNLESS_IQ_SAMPLING_ENABLE + switching_pattern_len);
UINT16_TO_STREAM(pp, sync_hdl);
UINT8_TO_STREAM(pp, sampling_en);
UINT8_TO_STREAM(pp, slot_dur);
UINT8_TO_STREAM(pp, max_sampled_ctes);
UINT8_TO_STREAM(pp, switching_pattern_len);
for (uint8_t i = 0; i < switching_pattern_len; i++)
{
UINT8_TO_STREAM(pp, antenna_ids[i]);
}
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
UINT8 btsnd_hcic_ble_set_conn_cte_receive_params(uint16_t conn_hdl, uint8_t sampling_en, uint8_t slot_dur,
uint8_t switching_pattern_len, uint8_t *antenna_ids)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("hci set connection cte receive params: conn_hdl %d sampling_en %d slot_dur %d", conn_hdl, sampling_en, slot_dur);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_SET_CONN_CTE_RECEIVE_PARAMS + switching_pattern_len);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_SET_CONN_CTE_RECEIVE_PARAMS);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_SET_CONN_CTE_RECEIVE_PARAMS + switching_pattern_len);
UINT16_TO_STREAM(pp, conn_hdl);
UINT8_TO_STREAM(pp, sampling_en);
UINT8_TO_STREAM(pp, slot_dur);
UINT8_TO_STREAM(pp, switching_pattern_len);
for (uint8_t i = 0; i < switching_pattern_len; i++)
{
UINT8_TO_STREAM(pp, antenna_ids[i]);
}
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
UINT8 btsnd_hcic_ble_set_conn_cte_trans_params(uint16_t conn_hdl, uint8_t cte_type, uint8_t switching_pattern_len, uint8_t *antenna_ids)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("hci set connection cte trans params: conn_hdl %d cte_type %d len %d", conn_hdl, cte_type, switching_pattern_len);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_SET_CONN_CTE_TRANS_PARAMS + switching_pattern_len);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_SET_CONN_CTE_TRANS_PARAMS);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_SET_CONN_CTE_TRANS_PARAMS + switching_pattern_len);
UINT16_TO_STREAM(pp, conn_hdl);
UINT8_TO_STREAM(pp, cte_type);
UINT8_TO_STREAM(pp, switching_pattern_len);
for (uint8_t i = 0; i < switching_pattern_len; i++)
{
UINT8_TO_STREAM(pp, antenna_ids[i]);
}
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
UINT8 btsnd_hcic_ble_conn_cte_req_enable(uint16_t conn_hdl, uint8_t enable, uint16_t cte_req_int, uint8_t req_cte_len, uint8_t req_cte_type)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("hci set connect cte request enable: conn_hdl %d enable %d cte_req_int %d req_cte_len %d req_cte_type %d", conn_hdl, enable, cte_req_int, req_cte_len, req_cte_type);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_CONN_CTE_REQ_ENABLE);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_SET_CONN_CTE_REQ_ENABLE);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_CONN_CTE_REQ_ENABLE);
UINT16_TO_STREAM(pp, conn_hdl);
UINT8_TO_STREAM(pp, enable);
UINT16_TO_STREAM(pp, cte_req_int);
UINT8_TO_STREAM(pp, req_cte_len);
UINT8_TO_STREAM(pp, req_cte_type);
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
UINT8 btsnd_hcic_ble_conn_cte_rsp_enable(uint16_t conn_hdl, uint8_t enable)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("hci set connect cte response enable: conn_hdl %d enable %d", conn_hdl, enable);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_CONN_CTE_RSP_ENABLE);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_SET_CONN_CTE_RSP_ENABLE);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_CONN_CTE_RSP_ENABLE);
UINT16_TO_STREAM(pp, conn_hdl);
UINT8_TO_STREAM(pp, enable);
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
UINT8 btsnd_hcic_ble_read_antenna_info(void)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("hci read antenna information");
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_READ_ANT_INFO);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_READ_ANT_INFOR);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_READ_ANT_INFO);
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
UINT8 btsnd_hcic_ble_enh_read_trans_power_level(uint16_t conn_handle, uint8_t phy)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("hci enh read trans power level, conn_handle %d phy %d", conn_handle, phy);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_ENH_READ_TRANS_PWR_LEVEL);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_ENH_READ_TRANS_POWER_LEVEL);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_ENH_READ_TRANS_PWR_LEVEL);
UINT16_TO_STREAM(pp, conn_handle);
UINT8_TO_STREAM(pp, phy);
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
UINT8 btsnd_hcic_ble_read_remote_trans_power_level(uint16_t conn_handle, uint8_t phy)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("hci read remote trans power level, conn_handle %d phy %d", conn_handle, phy);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_READ_REMOTE_TRANS_PWR_LEVEL);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_READ_REMOTE_TRANS_POWER_LEVEL);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_READ_REMOTE_TRANS_PWR_LEVEL);
UINT16_TO_STREAM(pp, conn_handle);
UINT8_TO_STREAM(pp, phy);
btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
return TRUE;
}
UINT8 btsnd_hcic_ble_set_path_loss_rpt_params(uint16_t conn_handle, uint8_t high_threshold, uint8_t high_hysteresis,
uint8_t low_threshold, uint8_t low_hysteresis, uint16_t min_time_spent)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("hci set path loss rpt params, conn_handle %d high_threshold %d high_hysteresis %d low_threshold %d low_hysteresis %d min_time_spent %d",
conn_handle, high_threshold, high_hysteresis, low_threshold,
low_hysteresis, min_time_spent);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_SET_PATH_LOSS_REPORTING_PARAMS);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_SET_PATH_LOSS_REPORTING_PARAMS);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_SET_PATH_LOSS_REPORTING_PARAMS);
UINT16_TO_STREAM(pp, conn_handle);
UINT8_TO_STREAM(pp, high_threshold);
UINT8_TO_STREAM(pp, high_hysteresis);
UINT8_TO_STREAM(pp, low_threshold);
UINT8_TO_STREAM(pp, low_hysteresis);
UINT16_TO_STREAM(pp, min_time_spent);
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
UINT8 btsnd_hcic_ble_set_path_loss_rpt_enable(uint16_t conn_handle, uint8_t enable)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("hci set path loss rpt en, conn_handle %d enable %d", conn_handle, enable);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_SET_PATH_LOSS_REPORTING_ENABLE);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_SET_PATH_LOSS_REPORTING_ENABLE);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_SET_PATH_LOSS_REPORTING_ENABLE);
UINT16_TO_STREAM(pp, conn_handle);
UINT8_TO_STREAM(pp, enable);
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
UINT8 btsnd_hcic_ble_set_trans_pwr_rpt_enable(uint16_t conn_handle, uint8_t local_enable, uint8_t remote_enable)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("hci set trans power rpt en, conn_handle %d local_enable %d remote_enable %d", conn_handle, local_enable, remote_enable);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_SET_TRANS_PWR_REPORTING_ENABLE);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_SET_TRANS_POWER_REPORTING_ENABLE);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_SET_TRANS_PWR_REPORTING_ENABLE);
UINT16_TO_STREAM(pp, conn_handle);
UINT8_TO_STREAM(pp, local_enable);
UINT8_TO_STREAM(pp, remote_enable);
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
UINT8 btsnd_hcic_ble_set_default_subrate(UINT16 subrate_min, UINT16 subrate_max, UINT16 max_latency,
UINT16 continuation_number, UINT16 supervision_timeout)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("hci set default subrate, subrate_min %d subrate_max %d max_latency %d continuation_number %d supervision_timeout %d",
subrate_min, subrate_max, max_latency, continuation_number, supervision_timeout);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_SET_DEFAULT_SUBRATE_PARAMS_LEN);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_SET_DEFAULT_SUBRATE);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_SET_DEFAULT_SUBRATE_PARAMS_LEN);
UINT16_TO_STREAM(pp, subrate_min);
UINT16_TO_STREAM(pp, subrate_max);
UINT16_TO_STREAM(pp, max_latency);
UINT16_TO_STREAM(pp, continuation_number);
UINT16_TO_STREAM(pp, supervision_timeout);
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
}
UINT8 btsnd_hcic_ble_subrate_request(UINT16 conn_handle, UINT16 subrate_min, UINT16 subrate_max, UINT16 max_latency,
UINT16 continuation_number, UINT16 supervision_timeout)
{
BT_HDR *p;
UINT8 *pp;
HCI_TRACE_DEBUG("hci subrate req, conn_handle %d subrate_min %d subrate_max %d max_latency %d continuation_number %d supervision_timeout %d",
conn_handle, subrate_min, subrate_max, max_latency, continuation_number, supervision_timeout);
HCIC_BLE_CMD_CREATED(p, pp, HCIC_PARAM_SIZE_SUBRATE_REQ_LENGTH_PARAMS_LEN);
pp = (UINT8 *)(p + 1);
UINT16_TO_STREAM(pp, HCI_BLE_SUBRATE_REQUEST);
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_SUBRATE_REQ_LENGTH_PARAMS_LEN);
UINT16_TO_STREAM(pp, conn_handle);
UINT16_TO_STREAM(pp, subrate_min);
UINT16_TO_STREAM(pp, subrate_max);
UINT16_TO_STREAM(pp, max_latency);
UINT16_TO_STREAM(pp, continuation_number);
UINT16_TO_STREAM(pp, supervision_timeout);
btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
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)

View File

@ -10,6 +10,6 @@
#include "bt_common.h"
void btm_acl_connected(BD_ADDR bda, UINT16 handle, UINT8 link_type, UINT8 enc_mode, UINT8 status);
void btm_acl_disconnected(UINT16 handle, UINT8 reason);
BOOLEAN btm_acl_disconnected(UINT16 handle, UINT8 reason);
#endif /* ACL_HCI_LINK_INTERFACE_H */

View File

@ -1072,9 +1072,76 @@ typedef void (tBTM_SET_VENDOR_EVT_MASK_CBACK) (tBTM_STATUS status);
#define BTM_BLE_GAP_PERIODIC_ADV_SYNC_TRANS_RECV_EVT 39
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#define BTM_BLE_GAP_SET_PRIVACY_MODE_COMPLETE_EVT 40
#define BTM_BLE_5_GAP_UNKNOWN_EVT 41
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#define BTM_BLE_GAP_ENH_READ_TRANS_POWER_LEVEL_EVT 41
#define BTM_BLE_GAP_READ_REMOTE_TRANS_POWER_LEVEL_EVT 42
#define BTM_BLE_GAP_SET_PATH_LOSS_REPORTING_PARAMS_EVT 43
#define BTM_BLE_GAP_SET_PATH_LOSS_REPORTING_ENABLE_EVT 44
#define BTM_BLE_GAP_SET_TRANS_POWER_REPORTING_ENABLE_EVT 45
#define BTM_BLE_GAP_PATH_LOSS_THRESHOLD_EVT 46
#define BTM_BLE_GAP_TRANMIT_POWER_REPORTING_EVT 47
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
#define BTM_BLE_GAP_SET_DEFAULT_SUBRATE_EVT 48
#define BTM_BLE_GAP_SUBRATE_REQUEST_EVT 49
#define BTM_BLE_GAP_SUBRATE_CHANGE_EVT 50
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
#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)
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#define BTM_BLE_ISO_BIG_CREATE_COMPLETE_EVT 1
#define BTM_BLE_ISO_BIG_TERMINATE_COMPLETE_EVT 2
#endif // #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
#define BTM_BLE_ISO_BIG_SYNC_ESTABLISHED_EVT 3
#define BTM_BLE_ISO_BIG_SYNC_LOST_EVT 4
#define BTM_BLE_ISO_BIG_SYNC_TERMINATE_COMPLETE_EVT 5
#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_READ_TX_SYNC_EVT 9
#define BTM_BLE_ISO_READ_LINK_QUALITY_EVT 10
#if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#define BTM_BLE_ISO_SET_CIG_PARAMS_EVT 11
#define BTM_BLE_ISO_CREATE_CIS_EVT 12
#define BTM_BLE_ISO_REMOVE_CIG_EVT 13
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#define BTM_BLE_ISO_ACCEPT_CIS_REQ_EVT 14
#define BTM_BLE_ISO_REJECT_CIS_REQ_EVT 15
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#define BTM_BLE_ISO_CIS_ESTABLISHED_EVT 16
#define BTM_BLE_ISO_CIS_REQUEST_EVT 17
#define BTM_BLE_ISO_CIS_DISCONNECTED_EVT 18
#define BTM_BLE_ISO_UNKNOWN_EVT 19
typedef UINT8 tBTM_BLE_ISO_EVENT;
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#define BTM_BLE_CTE_SET_TRANS_PARAMS_EVT 1
#define BTM_BLE_CTE_SET_TRANS_ENABLE_EVT 2
#define BTM_BLE_CTE_SET_IQ_SAMP_ENABLE_EVT 3
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
#define BTM_BLE_CTE_SET_CONN_RECV_PARAMS_EVT 4
#define BTM_BLE_CTE_SET_CONN_TRANS_PARAMS_EVT 5
#define BTM_BLE_CTE_SET_CONN_REQ_ENABLE_EVT 6
#define BTM_BLE_CTE_SET_CONN_RSP_ENABLE_EVT 7
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
#define BTM_BLE_CTE_READ_ANT_INFOR_EVT 8
#define BTM_BLE_CTE_CONNLESS_IQ_REPORT_EVT 9
#define BTM_BLE_CTE_CONN_IQ_REPORT_EVT 10
#define BTM_BLE_CTE_REQUEST_FAILED_EVT 11
typedef UINT8 tBTM_BLE_CTE_EVENT;
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
#define BTM_BLE_EXT_ADV_DATA_COMPLETE 0x00
#define BTM_BLE_EXT_ADV_DATA_INCOMPLETE 0x01
#define BTM_BLE_EXT_ADV_DATA_TRUNCATED 0x02
@ -1328,6 +1395,362 @@ typedef struct {
} tBTM_BLE_PERIOD_ADV_SYNC_TRANS_RECV;
#endif //#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
typedef struct {
UINT8 status;
UINT16 conn_handle;
UINT8 phy;
INT8 cur_tx_pwr_level;
INT8 max_tx_pwr_level;
} __attribute__((packed)) tBTM_BLE_ENH_TRANS_PWR_LEVEL_CMPL;
typedef struct {
UINT8 status;
} __attribute__((packed)) tBTM_BLE_REMOTE_TRANS_PWR_LEVEL_CMPL;
typedef struct {
UINT8 status;
UINT16 conn_handle;
} __attribute__((packed)) tBTM_BLE_SET_PATH_LOSS_RPTING_PARAMS;
typedef struct {
UINT8 status;
UINT16 conn_handle;
} __attribute__((packed)) tBTM_BLE_SET_PATH_LOSS_RPTING_ENABLE;
typedef struct {
UINT8 status;
UINT16 conn_handle;
} __attribute__((packed)) tBTM_BLE_SET_TRANS_POWER_RPTING_ENABLE;
typedef struct {
UINT16 conn_handle;
UINT8 cur_path_loss;
UINT8 zone_entered;
} __attribute__((packed)) tBTM_BLE_PATH_LOSS_THRESHOLD_EVT;
typedef struct {
UINT8 status;
UINT16 conn_handle;
UINT8 reason;
UINT8 phy;
INT8 tx_power_level;
UINT8 tx_power_level_flag;
INT8 delta;
} __attribute__((packed)) tBTM_BLE_TRANS_POWER_REPORT_EVT;
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
typedef struct {
UINT8 status;
UINT16 conn_handle;
UINT16 subrate_factor;
UINT16 peripheral_latency;
UINT16 continuation_number;
UINT16 supervision_timeout;
} __attribute__((packed)) tBTM_BLE_SUBRATE_CHANGE_EVT;
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
#if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
typedef struct {
UINT8 status;
UINT8 big_handle;
UINT32 big_sync_delay;
UINT32 transport_latency;
UINT8 phy;
UINT8 nse;
UINT8 bn;
UINT8 pto;
UINT8 irc;
UINT16 max_pdu;
UINT16 iso_interval;
UINT8 num_bis;
UINT16 bis_handle[BLE_ISO_BIS_MAX_COUNT];
} tBTM_BLE_BIG_CREATE_CMPL;
typedef struct {
UINT8 status;
UINT8 big_handle;
UINT8 reason;
} tBTM_BLE_BIG_TERMINATE_CMPL;
#endif // #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
typedef struct {
UINT8 status;
UINT8 big_handle;
UINT32 transport_latency_big;
UINT8 nse;
UINT8 bn;
UINT8 pto;
UINT8 irc;
UINT16 max_pdu;
UINT16 iso_interval;
uint8_t num_bis;
uint16_t bis_handle[BLE_ISO_BIS_MAX_COUNT];
} tBTM_BLE_BIG_SYNC_ESTAB_CMPL;
typedef struct {
UINT8 big_handle;
UINT8 reason;
} tBTM_BLE_BIG_SYNC_LOST_EVT;
typedef struct {
UINT16 sync_handle;
UINT8 num_bis;
UINT8 nse;
UINT16 iso_interval;
UINT8 bn;
UINT8 pto;
UINT8 irc;
UINT16 max_pdu;
UINT32 sdu_interval;
UINT32 max_sdu;
UINT8 phy;
UINT8 framing;
UINT8 encryption;
} tBTM_BLE_BIGINFO_ADV_REPORT_EVT;
typedef struct {
UINT8 status;
UINT16 big_hdl;
} tBTM_BLE_BIG_SYNC_TERMINATE_EVT;
#endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_EN == TRUE)
typedef struct {
UINT8 status;
UINT16 conn_handle;
UINT32 cig_sync_delay;
UINT32 cis_sync_delay;
UINT32 trans_lat_c_to_p;
UINT32 trans_lat_p_to_c;
UINT8 phy_c_to_p;
UINT8 phy_p_to_c;
UINT8 nse;
UINT8 bn_c_to_p;
UINT8 bn_p_to_c;
UINT8 ft_c_to_p;
UINT8 ft_p_to_c;
UINT16 max_pdu_c_to_p;
UINT16 max_pdu_p_to_c;
UINT16 iso_interval;
#if (BLE_FEAT_ISO_60_EN == TRUE)
UINT32 sub_interval;
UINT16 max_sdu_c_to_p;
UINT16 max_sdu_p_to_c;
UINT32 sdu_int_c_to_p;
UINT32 sdu_int_p_to_c;
UINT8 framing;
#endif // #if (BLE_FEAT_ISO_60_EN == TRUE)
} tBTM_BLE_CIS_ESTABLISHED_CMPL;
typedef struct {
UINT16 cis_handle;
UINT8 reason;
} tBTM_BLE_CIS_DISCON_CMPL;
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
typedef struct {
UINT8 status;
UINT16 cis_handle;
} tBTM_BLE_ISO_REJECT_CIS_REQ_EVT;
typedef struct {
UINT16 acl_handle;
UINT16 cis_handle;
UINT8 cig_id;
UINT8 cis_id;
} tBTM_BLE_CIS_REQUEST_CMPL;
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
typedef enum {
BTM_BLE_ISO_DATA_PATH_UNKNOWN = 0,
BTM_BLE_ISO_DATA_PATH_SETUP = 1,
BTM_BLE_ISO_DATA_PATH_REMOVE = 2,
BTM_BLE_ISO_DATA_PATH_MAX,
} tBTM_BLE_ISO_DATA_PATH_UPDATE_TYPE;
typedef struct {
UINT8 status;
tBTM_BLE_ISO_DATA_PATH_UPDATE_TYPE op_type;
UINT16 conn_hdl;
} tBTM_BLE_ISO_DATA_PATH_UPDATE_EVT;
typedef struct {
UINT8 status;
UINT16 conn_hdl;
UINT16 pkt_seq_num;
UINT32 tx_time_stamp;
UINT32 time_offset;
} tBTM_BLE_ISO_READ_TX_SYNC_EVT;
typedef struct {
UINT8 status;
UINT16 conn_hdl;
UINT32 tx_unacked_pkts;
UINT32 tx_flushed_pkts;
UINT32 tx_last_subevt_pkts;
UINT32 retransmitted_pkts;
UINT32 crc_error_pkts;
UINT32 rx_unreceived_pkts;
UINT32 duplicate_pkts;
} tBTM_BLE_ISO_READ_LINK_QUALITY_EVT;
#if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
typedef struct {
UINT8 status;
UINT8 cig_id;
UINT8 cis_count;
UINT16 conn_hdl[BLE_ISO_CIS_MAX_COUNT];
} tBTM_BLE_ISO_SET_CIG_PARAMS_EVT;
typedef struct {
UINT8 status;
UINT8 cig_id;
} tBTM_BLE_ISO_REMOVE_CIG_EVT;
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
typedef union {
UINT8 status;
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
tBTM_BLE_BIG_CREATE_CMPL btm_big_cmpl;
tBTM_BLE_BIG_TERMINATE_CMPL btm_big_term;
#endif // #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
tBTM_BLE_BIG_SYNC_ESTAB_CMPL btm_big_sync_estab;
tBTM_BLE_BIG_SYNC_LOST_EVT btm_big_sync_lost;
tBTM_BLE_BIGINFO_ADV_REPORT_EVT btm_biginfo_report;
tBTM_BLE_BIG_SYNC_TERMINATE_EVT btm_big_sync_ter;
#endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
tBTM_BLE_ISO_DATA_PATH_UPDATE_EVT btm_data_path_update;
tBTM_BLE_ISO_READ_TX_SYNC_EVT btm_read_tx_sync;
tBTM_BLE_ISO_READ_LINK_QUALITY_EVT btm_read_link_quality;
#if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
tBTM_BLE_ISO_SET_CIG_PARAMS_EVT btm_set_cig_params;
tBTM_BLE_ISO_REMOVE_CIG_EVT btm_remove_cig;
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
tBTM_BLE_ISO_REJECT_CIS_REQ_EVT btm_reject_cis_req;
tBTM_BLE_CIS_REQUEST_CMPL btm_cis_request_evt;
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_EN == TRUE)
tBTM_BLE_CIS_ESTABLISHED_CMPL btm_cis_established_evt;
tBTM_BLE_CIS_DISCON_CMPL btm_cis_disconnectd_evt;
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)
} tBTM_BLE_ISO_CB_PARAMS;
typedef void (*tBTM_BLE_ISO_CBACK)(tBTM_BLE_ISO_EVENT event, tBTM_BLE_ISO_CB_PARAMS *params);
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
typedef struct {
UINT8 status;
} __attribute__((packed)) tBTM_BLE_CTE_SET_TRANS_PARAMS_CMPL;
typedef struct {
UINT8 status;
} __attribute__((packed)) tBTM_BLE_CTE_SET_TRANS_EN_CMPL;
typedef struct {
UINT8 status;
UINT16 sync_handle;
} __attribute__((packed)) tBTM_BLE_CTE_IQ_SAMP_EN_CMPL;
typedef struct {
UINT8 status;
UINT16 conn_handle;
} __attribute__((packed)) tBTM_BLE_CTE_CONN_RECV_PARAMS_CMPL;
typedef struct {
UINT8 status;
UINT16 conn_handle;
} __attribute__((packed)) tBTM_BLE_CTE_CONN_TRANS_PARAMS_CMPL;
typedef struct {
UINT8 status;
UINT16 conn_handle;
} __attribute__((packed)) tBTM_BLE_CTE_CONN_REQ_ENABLE_CMPL;
typedef struct {
UINT8 status;
UINT16 conn_handle;
} __attribute__((packed)) tBTM_BLE_CTE_CONN_RSP_ENABLE_CMPL;
typedef struct {
UINT8 status;
UINT8 supported_switching_sampling_rates;
UINT8 num_ant;
UINT8 max_switching_pattern_len;
UINT8 max_cte_len;
} __attribute__((packed)) tBTM_BLE_CTE_READ_ANT_INFOR_CMPL;
typedef struct {
UINT16 sync_handle;
UINT8 channel_idx;
INT16 rssi;
UINT8 rssi_ant_id;
UINT8 cte_type;
UINT8 slot_dur;
UINT8 pkt_status;
UINT16 periodic_evt_counter;
UINT8 sample_count;
UINT8 i_sample[0x52];
UINT8 q_sample[0x52];
} __attribute__((packed)) tBTM_BLE_CTE_CONNLESS_IQ_REPORT_EVT;
typedef struct {
UINT16 conn_handle;
UINT8 rx_phy;
UINT8 data_channel_idx;
INT16 rssi;
UINT8 rssi_ant_id;
UINT8 cte_type;
UINT8 slot_dur;
UINT8 pkt_status;
UINT16 conn_evt_counter;
UINT8 sample_count;
UINT8 i_sample[0x52];
UINT8 q_sample[0x52];
} __attribute__((packed)) tBTM_BLE_CTE_CONN_IQ_REPORT_EVT;
typedef struct {
UINT8 status;
UINT16 conn_handle;
} __attribute__((packed)) tBTM_BLE_CTE_REQ_FAILED_EVT;
typedef union {
UINT8 status;
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
tBTM_BLE_CTE_SET_TRANS_PARAMS_CMPL cte_trans_params_cmpl;
tBTM_BLE_CTE_SET_TRANS_EN_CMPL cte_trans_en_cmpl;
tBTM_BLE_CTE_IQ_SAMP_EN_CMPL cte_iq_samp_en_cmpl;
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
tBTM_BLE_CTE_CONN_RECV_PARAMS_CMPL cte_recv_params_cmpl;
tBTM_BLE_CTE_CONN_TRANS_PARAMS_CMPL cte_conn_trans_params_cmpl;
tBTM_BLE_CTE_CONN_REQ_ENABLE_CMPL cte_conn_req_en_cmpl;
tBTM_BLE_CTE_CONN_RSP_ENABLE_CMPL cte_conn_rsp_en_cmpl;
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
tBTM_BLE_CTE_READ_ANT_INFOR_CMPL cte_read_ant_infor_cmpl;
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
tBTM_BLE_CTE_CONNLESS_IQ_REPORT_EVT cte_connless_iq_rpt;
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
tBTM_BLE_CTE_CONN_IQ_REPORT_EVT cte_conn_iq_rpt;
tBTM_BLE_CTE_REQ_FAILED_EVT cte_req_failed;
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
} tBTM_BLE_CTE_CB_PARAMS;
typedef void (*tBTM_BLE_CTE_CBACK)(tBTM_BLE_CTE_EVENT event, tBTM_BLE_CTE_CB_PARAMS *params);
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
typedef union {
UINT8 status;
tBTM_BLE_READ_PHY_CMPL read_phy;
@ -1382,6 +1805,18 @@ typedef union {
tBTM_BLE_SET_PERIOD_ADV_SYNC_TRANS_PARAMS_CMPL set_past_params;
tBTM_BLE_PERIOD_ADV_SYNC_TRANS_RECV past_recv;
#endif //#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
tBTM_BLE_ENH_TRANS_PWR_LEVEL_CMPL enh_trans_pwr_level_cmpl;
tBTM_BLE_REMOTE_TRANS_PWR_LEVEL_CMPL remote_pwr_level_cmpl;
tBTM_BLE_SET_PATH_LOSS_RPTING_PARAMS path_loss_rpting_params;
tBTM_BLE_SET_PATH_LOSS_RPTING_ENABLE path_loss_rpting_enable;
tBTM_BLE_SET_TRANS_POWER_RPTING_ENABLE trans_pwr_rpting_enable;
tBTM_BLE_PATH_LOSS_THRESHOLD_EVT path_loss_thres_evt;
tBTM_BLE_TRANS_POWER_REPORT_EVT trans_pwr_report_evt;
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
tBTM_BLE_SUBRATE_CHANGE_EVT subrate_change_evt;
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
} tBTM_BLE_5_GAP_CB_PARAMS;
typedef struct {
@ -2834,4 +3269,93 @@ void BTM_BlePeriodicAdvSetInfoTrans(BD_ADDR bd_addr, UINT16 service_data, UINT8
void BTM_BleSetPeriodicAdvSyncTransParams(BD_ADDR bd_addr, UINT8 mode, UINT16 skip, UINT16 sync_timeout, UINT8 cte_type);
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#if (BLE_FEAT_ISO_EN == TRUE)
void BTM_BleIsoRegisterCallback(tBTM_BLE_ISO_CBACK cb);
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
tBTM_STATUS BTM_BleBigCreate(uint8_t big_handle, uint8_t adv_handle, uint8_t num_bis,
uint32_t sdu_interval, uint16_t max_sdu, uint16_t max_transport_latency,
uint8_t rtn, uint8_t phy, uint8_t packing, uint8_t framing,
uint8_t encryption, uint8_t *broadcast_code);
tBTM_STATUS BTM_BleBigCreateTest(uint8_t big_handle, uint8_t adv_handle, uint8_t num_bis,
uint32_t sdu_interval, uint16_t iso_interval, uint8_t nse,
uint16_t max_sdu, uint16_t max_pdu, uint8_t phy,
uint8_t packing, uint8_t framing, uint8_t bn, uint8_t irc,
uint8_t pto, uint8_t encryption, uint8_t *broadcast_code);
tBTM_STATUS BTM_BleBigTerminate(UINT8 big_handle, UINT8 reason);
#endif // #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
tBTM_STATUS BTM_BleBigSyncCreate(uint8_t big_handle, uint16_t sync_handle,
uint8_t encryption, uint8_t *bc_code,
uint8_t mse, uint16_t big_sync_timeout,
uint8_t num_bis, uint8_t *bis);
tBTM_STATUS BTM_BleBigSyncTerminate(uint8_t big_handle);
#endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
tBTM_STATUS BTM_BleIsoSetDataPath(uint16_t conn_handle, uint8_t data_path_dir, uint8_t data_path_id, uint8_t coding_fmt,
uint16_t company_id, uint16_t vs_codec_id, uint32_t controller_delay, uint8_t codec_len,
uint8_t *codec_cfg);
tBTM_STATUS BTM_BleIsoRemoveDataPath(uint16_t conn_handle, uint8_t data_path_dir);
tBTM_STATUS BTM_BleIsoReadTxSync(uint16_t iso_hdl);
tBTM_STATUS BTM_BleIsoReadLinkQuality(uint16_t iso_hdl);
#if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
tBTM_STATUS BTM_BleSetCigParams(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,
uint8_t framing, uint16_t mtl_c_to_p, uint16_t mtl_p_to_c, uint8_t cis_cnt, uint8_t *cis_params);
tBTM_STATUS BTM_BleSetCigParamsTest(uint8_t cig_id, uint32_t sdu_int_c_to_p, uint32_t sdu_int_p_to_c, uint8_t ft_c_to_p, uint8_t ft_p_to_c, uint16_t iso_interval,
uint8_t worse_case_SCA, uint8_t packing, uint8_t framing, uint8_t cis_cnt, uint8_t *cis_params);
tBTM_STATUS BTM_BleCreateCis(uint8_t cis_count, uint8_t *cis_hdls);
tBTM_STATUS BTM_BleRemoveCig(uint8_t cig_id);
#endif // #if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
tBTM_STATUS BTM_BleAcceptCisReq(uint16_t cis_handle);
tBTM_STATUS BTM_BleRejectCisReq(uint16_t cis_handle, uint8_t reason);
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_EN == TRUE)
tBTM_STATUS BTM_BleDisconCis(uint16_t cis_handle, uint8_t reason);
#endif // #if (BLE_FEAT_ISO_CIG_EN == TRUE)
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
void BTM_BleCteRegisterCallback(tBTM_BLE_CTE_CBACK cb);
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
tBTM_STATUS BTM_BleSetCteTransParams(uint8_t adv_handle, uint8_t cte_len, uint8_t cte_type, uint8_t cte_count, uint8_t switching_pattern_len, uint8_t *antenna_ids);
tBTM_STATUS BTM_BleCteSetConnectionlessTransEnable(uint8_t adv_handle, uint8_t cte_en);
tBTM_STATUS BTM_BleCteSetConnectionlessIqSamplingEnable(uint16_t sync_handle, uint8_t sampling_en, uint8_t slot_dur,
uint8_t max_sampled_ctes, uint8_t switching_pattern_len, uint8_t *ant_ids);
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
tBTM_STATUS BTM_BleCteSetConnectionReceiveParams(uint16_t conn_handle, uint8_t sampling_en, uint8_t slot_dur,
uint8_t switching_pattern_len, uint8_t *ant_ids);
tBTM_STATUS BTM_BleCteSetConnectionTransParams(uint16_t conn_handle, uint8_t cte_types, uint8_t switching_pattern_len, uint8_t *ant_ids);
tBTM_STATUS BTM_BleCteSetConnectionRequestEnable(uint16_t conn_handle, uint8_t enable, uint16_t cte_req_int,
uint8_t req_cte_len, uint8_t req_cte_type);
tBTM_STATUS BTM_BleCteSetConnectionRspEnable(uint16_t conn_handle, uint8_t enable);
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
tBTM_STATUS BTM_BleCteReadAntInfor(void);
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
void BTM_BleEnhReadTransPowerLevel(uint16_t conn_handle, uint8_t phy);
void BTM_BleReadRemoteTransPwrLevel(uint16_t conn_handle, uint8_t phy);
void BTM_BleSetPathLossRptParams(uint16_t conn_handle, uint8_t high_threshold, uint8_t high_hysteresis,
uint8_t low_threshold, uint8_t low_hysteresis, uint16_t min_time_spent);
void BTM_BleSetPathLossRptEnable(uint16_t conn_handle, uint8_t enable);
void BTM_BleSetTransPwrRptEnable(uint16_t conn_handle, uint8_t local_enable, uint8_t remote_enable);
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
void BTM_BleSetDefaultSubrate(UINT16 subrate_min, UINT16 subrate_max, UINT16 max_latency,
UINT16 continuation_number, UINT16 supervision_timeout);
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

View File

@ -390,6 +390,20 @@
#define HCI_BLE_WR_RF_PATH_COMPENSATION (0x004D | HCI_GRP_BLE_CMDS)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
#define HCI_BLE_SET_PRIVACY_MODE (0x004E | HCI_GRP_BLE_CMDS)
#if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#define HCI_BLE_SET_CONNLESS_CTE_TRANS_PARAMS (0x0051 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_CONNLESS_CTE_TRANS_ENABLE (0x0052 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_CONNLESS_IQ_SAMPLING_ENABLE (0x0053 | HCI_GRP_BLE_CMDS)
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
#define HCI_BLE_SET_CONN_CTE_RECEIVE_PARAMS (0x0054 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_CONN_CTE_TRANS_PARAMS (0x0055 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_CONN_CTE_REQ_ENABLE (0x0056 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_CONN_CTE_RSP_ENABLE (0x0057 | HCI_GRP_BLE_CMDS)
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
#define HCI_BLE_READ_ANT_INFOR (0x0058 | HCI_GRP_BLE_CMDS)
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#define HCI_BLE_SET_PERIOD_ADV_RECV_ENABLE (0x0059 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_PERIOD_ADV_SYNC_TRANS (0x005A | HCI_GRP_BLE_CMDS)
@ -397,6 +411,38 @@
#define HCI_BLE_SET_PAST_PARAMS (0x005C | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_DEFAULT_PAST_PARAMS (0x005D | HCI_GRP_BLE_CMDS)
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#define HCI_BLE_READ_BUFFER_SZIE_V2 (0x0060 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_ISO_READ_TX_SYNC (0x0061 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_ISO_SET_CIG_PARAMS (0x0062 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_ISO_SET_CIG_PARAMS_TEST (0x0063 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_ISO_CREATE_CIS (0x0064 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_ISO_REMOVE_CIG (0x0065 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_ISO_ACCEPT_CIS_REQ (0x0066 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_ISO_REJECT_CIS_REQ (0x0067 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_CREATE_BIG (0x0068 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_CREATE_BIG_TEST (0x0069 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_TERMINATE_BIG (0x006A | HCI_GRP_BLE_CMDS)
#define HCI_BLE_BIG_CREATE_SYNC (0x006B | HCI_GRP_BLE_CMDS)
#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_SET_HOST_FEATURE (0x0074 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_ISO_READ_ISO_LINK_QUALITY (0x0075 | 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)
#define HCI_BLE_READ_REMOTE_TRANS_POWER_LEVEL (0x0077 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_PATH_LOSS_REPORTING_PARAMS (0x0078 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_PATH_LOSS_REPORTING_ENABLE (0x0079 | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SET_TRANS_POWER_REPORTING_ENABLE (0x007A | HCI_GRP_BLE_CMDS)
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
#define HCI_BLE_SET_DEFAULT_SUBRATE (0x007D | HCI_GRP_BLE_CMDS)
#define HCI_BLE_SUBRATE_REQUEST (0x007E | HCI_GRP_BLE_CMDS)
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
// Vendor OGF define
#define HCI_VENDOR_OGF 0x3F
@ -842,6 +888,36 @@
#define HCI_BLE_PERIOD_ADV_SYNC_TRANS_RECV_EVT 0x18
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
#define HCI_BLE_CONNLESS_IQ_REPORT_EVT 0x15
#define HCI_BLE_CONN_IQ_REPORT_EVT 0x16
#define HCI_BLE_CTE_REQUEST_FAILED_EVT 0x17
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_ISO_EN == TRUE)
#define HCI_BLE_CIS_ESTABLISHED_V1_EVT 0x19
#define HCI_BLE_CIS_REQUEST_EVT 0x1A
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#define HCI_BLE_BIG_CREATE_COMPLETE_EVT 0x1B
#define HCI_BLE_BIG_TERMINATE_COMPLETE_EVT 0x1C
#endif // #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
#define HCI_BLE_BIG_SYNC_ESTABLISHED_EVT 0x1D
#define HCI_BLE_BIG_SYNC_LOST_EVT 0x1E
#endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
#define HCI_BLE_BIGINFO_ADV_REPORT_EVT 0x22
#define HCI_BLE_CIS_ESTABLISHED_V2_EVT 0x2A
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#define HCI_BLE_PATH_LOSS_THRESHOLD_EVT 0x20
#define HCI_BLE_TRANS_POWER_REPORTING_EVT 0x21
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
#define HCI_BLE_SUBRATE_CHANGE_EVT 0x23
#endif // #if (BLE_FEAT_CONN_SUBRATING == TRUE)
/* Definitions for LE Channel Map */
#define HCI_BLE_CHNL_MAP_SIZE 5

View File

@ -1083,4 +1083,164 @@ BOOLEAN btsnd_hcic_ble_set_periodic_adv_sync_trans_params(UINT16 conn_handle, UI
UINT8 btsnd_hcic_ble_set_default_periodic_adv_sync_trans_params(UINT8 mode, UINT16 skip, UINT16 sync_timeout, UINT8 cte_type);
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
#if (BLE_FEAT_ISO_EN == TRUE)
#define HCIC_PARAM_SIZE_ISO_READ_TX_SYNC_PARAMS 2
#define HCIC_PARAM_SIZE_ISO_SET_CIG_PARAMS 15
#define HCIC_PARAM_SIZE_ISO_SET_CIG_TEST_PARAMS 15
#define HCIC_PARAM_SIZE_ISO_CREATE_CIS_PARAMS 1
#define HCIC_PARAM_SIZE_ISO_REMOVE_CIG_PARAMS 1
#define HCIC_PARAM_SIZE_ISO_ACCEPT_CIS_REQ_PARAMS 2
#define HCIC_PARAM_SIZE_ISO_REJECT_CIS_REQ_PARAMS 3
#define HCIC_PARAM_SIZE_ISO_READ_LINK_QUALITY_PARAMS 2
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#define HCIC_PARAM_SIZE_BIG_CREATE_PARAMS 31
#define HCIC_PARAM_SIZE_BIG_CREATE_TEST_PARAMS 36
#define HCIC_PARAM_SIZE_BIG_TERMINATE_PARAMS 2
#endif // #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
#define HCIC_PARAM_SIZE_BIG_SYNC_CREATE_PARAMS 55
#define HCIC_PARAM_SIZE_BIG_SYNC_TERMINATE_PARAMS 1
#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
#if (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
struct ble_hci_le_cis_params {
uint8_t cis_id;
uint16_t max_sdu_c_to_p;
uint16_t max_sdu_p_to_c;
uint8_t phy_c_to_p;
uint8_t phy_p_to_c;
uint8_t rtn_c_to_p;
uint8_t rtn_p_to_c;
} __attribute__((packed));
struct ble_hci_le_cis_params_test {
uint8_t cis_id;
uint8_t nse;
uint16_t max_sdu_c_to_p;
uint16_t max_sdu_p_to_c;
uint16_t max_pdu_c_to_p;
uint16_t max_pdu_p_to_c;
uint8_t phy_c_to_p;
uint8_t phy_p_to_c;
uint8_t bn_c_to_p;
uint8_t bn_p_to_c;
} __attribute__((packed));
struct ble_hci_cis_hdls {
uint16_t cis_hdl;
uint16_t acl_hdl;
}__attribute__((packed));
UINT8 btsnd_hcic_ble_iso_set_cig_params(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,
uint8_t framing, uint16_t mtl_c_to_p, uint16_t mtl_p_to_c, uint8_t cis_cnt, struct ble_hci_le_cis_params *cis_params);
UINT8 btsnd_hcic_ble_iso_set_cig_params_test(uint8_t cig_id, uint32_t sdu_int_c_to_p, uint32_t sdu_int_p_to_c, uint8_t ft_c_to_p, uint8_t ft_p_to_c,
uint16_t iso_interval, uint8_t worse_case_SCA, uint8_t packing, uint8_t framing, uint8_t cis_cnt,
struct ble_hci_le_cis_params_test *cis_params_test);
UINT8 btsnd_hcic_ble_iso_create_cis(uint8_t cis_count, struct ble_hci_cis_hdls *cis_hdls);
UINT8 btsnd_hcic_ble_iso_remove_cig(uint8_t cig_id);
#endif // (BLE_FEAT_ISO_CIG_CENTRAL_EN == TRUE)
#if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
UINT8 btsnd_hcic_ble_iso_accept_cis_req(uint16_t cis_handle);
UINT8 btsnd_hcic_ble_iso_reject_cis_req(uint16_t cis_handle, uint8_t reason);
#endif // #if (BLE_FEAT_ISO_CIG_PERIPHERAL_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
UINT8 btsnd_hcic_ble_big_create(uint8_t big_handle, uint8_t adv_handle, uint8_t num_bis,
uint32_t sdu_interval, uint16_t max_sdu, uint16_t max_transport_latency,
uint8_t rtn, uint8_t phy, uint8_t packing, uint8_t framing,
uint8_t encryption, uint8_t *broadcast_code);
UINT8 btsnd_hcic_ble_big_create_test(uint8_t big_handle, uint8_t adv_handle, uint8_t num_bis,
uint32_t sdu_interval, uint16_t iso_interval, uint8_t nse,
uint16_t max_sdu, uint16_t max_pdu, uint8_t phy,
uint8_t packing, uint8_t framing, uint8_t bn, uint8_t irc,
uint8_t pto, uint8_t encryption, uint8_t *broadcast_code);
UINT8 btsnd_hcic_ble_big_terminate(uint8_t big_handle, uint8_t reason);
#endif // #if (BLE_FEAT_ISO_BIG_BROCASTER_EN == TRUE)
#if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
UINT8 btsnd_hcic_ble_big_sync_create(uint8_t big_handle, uint16_t sync_handle,
uint8_t encryption, uint8_t *bc_code,
uint8_t mse, uint16_t big_sync_timeout,
uint8_t num_bis, uint8_t *bis);
UINT8 btsnd_hcic_ble_big_sync_terminate(uint8_t big_handle);
#endif // #if (BLE_FEAT_ISO_BIG_SYNCER_EN == TRUE)
UINT8 btsnd_hcic_ble_iso_set_data_path(uint16_t conn_handle, uint8_t data_path_dir, uint8_t data_path_id, uint8_t coding_fmt,
uint16_t company_id, uint16_t vs_codec_id, uint32_t controller_delay, uint8_t codec_len,
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_read_tx_sync(uint16_t iso_hdl);
UINT8 btsnd_hcic_ble_iso_read_iso_link_quality(uint16_t iso_hdl);
#endif // #if (BLE_FEAT_ISO_EN == TRUE)
#if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#define HCIC_PARAM_SIZE_SET_CONNLESS_CTE_TRANS_PARAMS 5
#define HCIC_PARAM_SIZE_SET_CONNLESS_CTE_TRANS_ENABLE 2
#define HCIC_PARAM_SIZE_SET_CONNLESS_IQ_SAMPLING_ENABLE 6
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
#define HCIC_PARAM_SIZE_SET_CONN_CTE_RECEIVE_PARAMS 5
#define HCIC_PARAM_SIZE_SET_CONN_CTE_TRANS_PARAMS 4
#define HCIC_PARAM_SIZE_CONN_CTE_REQ_ENABLE 7
#define HCIC_PARAM_SIZE_CONN_CTE_RSP_ENABLE 3
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
#define HCIC_PARAM_SIZE_READ_ANT_INFO 0
#if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
UINT8 btsnd_hcic_ble_set_connless_cte_trans_params(uint8_t adv_hdl, uint8_t cte_len, uint8_t cte_type,
uint8_t cte_cnt, uint8_t switching_pattern_len, uint8_t *antenna_ids);
UINT8 btsnd_hcic_ble_set_connless_cte_enable(uint8_t adv_hdl, uint8_t cte_en);
UINT8 btsnd_hcic_ble_set_connless_iq_sampling_enable(uint16_t sync_hdl, uint8_t sampling_en, uint8_t slot_dur,
uint8_t max_sampled_ctes, uint8_t switching_pattern_len, uint8_t *antenna_ids);
#endif // #if (BLE_FEAT_CTE_CONNECTIONLESS_EN == TRUE)
#if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
UINT8 btsnd_hcic_ble_set_conn_cte_receive_params(uint16_t conn_hdl, uint8_t sampling_en, uint8_t slot_dur,
uint8_t switching_pattern_len, uint8_t *antenna_ids);
UINT8 btsnd_hcic_ble_set_conn_cte_trans_params(uint16_t conn_hdl, uint8_t cte_type, uint8_t switching_pattern_len, uint8_t *antenna_ids);
UINT8 btsnd_hcic_ble_conn_cte_req_enable(uint16_t conn_hdl, uint8_t enable, uint16_t cte_req_int, uint8_t req_cte_len, uint8_t req_cte_type);
UINT8 btsnd_hcic_ble_conn_cte_rsp_enable(uint16_t conn_hdl, uint8_t enable);
#endif // #if (BLE_FEAT_CTE_CONNECTION_EN == TRUE)
UINT8 btsnd_hcic_ble_read_antenna_info(void);
#endif // #if (BLE_FEAT_CTE_EN == TRUE)
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#define HCIC_PARAM_SIZE_ENH_READ_TRANS_PWR_LEVEL 3
#define HCIC_PARAM_SIZE_READ_REMOTE_TRANS_PWR_LEVEL 3
#define HCIC_PARAM_SIZE_SET_PATH_LOSS_REPORTING_PARAMS 8
#define HCIC_PARAM_SIZE_SET_PATH_LOSS_REPORTING_ENABLE 3
#define HCIC_PARAM_SIZE_SET_TRANS_PWR_REPORTING_ENABLE 4
UINT8 btsnd_hcic_ble_enh_read_trans_power_level(uint16_t conn_handle, uint8_t phy);
UINT8 btsnd_hcic_ble_read_remote_trans_power_level(uint16_t conn_handle, uint8_t phy);
UINT8 btsnd_hcic_ble_set_path_loss_rpt_params(uint16_t conn_handle, uint8_t high_threshold, uint8_t high_hysteresis,
uint8_t low_threshold, uint8_t low_hysteresis, uint16_t min_time_spent);
UINT8 btsnd_hcic_ble_set_path_loss_rpt_enable(uint16_t conn_handle, uint8_t enable);
UINT8 btsnd_hcic_ble_set_trans_pwr_rpt_enable(uint16_t conn_handle, uint8_t local_enable, uint8_t remote_enable);
#endif // #if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
#if (BLE_FEAT_CONN_SUBRATING == TRUE)
#define HCIC_PARAM_SIZE_SET_DEFAULT_SUBRATE_PARAMS_LEN 10
#define HCIC_PARAM_SIZE_SUBRATE_REQ_LENGTH_PARAMS_LEN 12
UINT8 btsnd_hcic_ble_set_default_subrate(UINT16 subrate_min, UINT16 subrate_max, UINT16 max_latency,
UINT16 continuation_number, UINT16 supervision_timeout);
UINT8 btsnd_hcic_ble_subrate_request(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)
#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

View File

@ -209,7 +209,12 @@ void bt_record_hci_data(uint8_t *data, uint16_t len)
|| (data[3] == BLE_HCI_LE_SUBEV_EXT_ADV_RPT) || (data[3] == BLE_HCI_LE_SUBEV_PERIODIC_ADV_RPT))) {
bt_hci_log_record_hci_adv(HCI_LOG_DATA_TYPE_ADV, &data[2], len - 2);
} else {
uint8_t data_type = ((data[0] == 2) ? HCI_LOG_DATA_TYPE_C2H_ACL : data[0]);
uint8_t data_type;
if (data[0] == HCI_LOG_DATA_TYPE_ISO_DATA) {
data_type = HCI_LOG_DATA_TYPE_ISO_DATA;
} else {
data_type = ((data[0] == 2) ? HCI_LOG_DATA_TYPE_C2H_ACL : data[0]);
}
bt_hci_log_record_hci_data(data_type, &data[1], len - 1);
}
#endif // (BT_HCI_LOG_INCLUDED == TRUE)

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -43,6 +43,14 @@ hci_driver_vhci_controller_tx(hci_driver_data_type_t data_type, uint8_t *data, u
buf[0] = HCI_DRIVER_TYPE_EVT;
memcpy(&buf[1], data, length);
r_ble_hci_trans_buf_free(data);
} else if (data_type == HCI_DRIVER_TYPE_ISO) {
buf_len = length + 1;
buf = malloc(buf_len);
/* TODO: If there is no memory, should handle it in the controller. */
assert(buf);
buf[0] = HCI_DRIVER_TYPE_ISO;
memcpy(&buf[1], data, length);
free(data);
}
rc = s_hci_driver_vhci_env.forward_cb(data_type, buf, buf_len, HCI_DRIVER_DIR_C2H);