Merge branch 'feat/support_ble_vendor_hci_event_report' into 'master'

feat(bt/bluedroid): Support BLE vendor hci event reporting

Closes BLERP-1542

See merge request espressif/esp-idf!36800
This commit is contained in:
Island 2025-02-19 17:18:24 +08:00
commit 8ad16fd58d
17 changed files with 244 additions and 2 deletions

View File

@ -1774,3 +1774,21 @@ esp_err_t esp_ble_gap_vendor_command_send(esp_ble_vendor_cmd_params_t *vendor_cm
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), btc_gap_ble_arg_deep_copy, btc_gap_ble_arg_deep_free) return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), btc_gap_ble_arg_deep_copy, btc_gap_ble_arg_deep_free)
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
} }
esp_err_t esp_ble_gap_set_vendor_event_mask(uint32_t event_mask)
{
btc_msg_t msg = {0};
btc_ble_gap_args_t arg;
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
return ESP_ERR_INVALID_STATE;
}
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GAP_BLE;
msg.act = BTC_GAP_BLE_ACT_SET_VENDOR_EVT_MASK;
arg.set_vendor_evt_mask.evt_mask = event_mask;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL)
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}

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 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -230,6 +230,8 @@ typedef enum {
ESP_GAP_BLE_VENDOR_CMD_COMPLETE_EVT, /*!< When vendor hci command complete, the event comes */ ESP_GAP_BLE_VENDOR_CMD_COMPLETE_EVT, /*!< When vendor hci command complete, the event comes */
ESP_GAP_BLE_SET_PRIVACY_MODE_COMPLETE_EVT, /*!< When set privacy mode complete, the event comes */ ESP_GAP_BLE_SET_PRIVACY_MODE_COMPLETE_EVT, /*!< When set privacy mode complete, the event comes */
ESP_GAP_BLE_SET_CSA_SUPPORT_COMPLETE_EVT, /*!< When set CSA support complete, the event comes */ 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 */
ESP_GAP_BLE_EVT_MAX, /*!< when maximum advertising event complete, the event comes */ ESP_GAP_BLE_EVT_MAX, /*!< when maximum advertising event complete, the event comes */
} esp_gap_ble_cb_event_t; } esp_gap_ble_cb_event_t;
@ -1580,7 +1582,21 @@ typedef union {
*/ */
struct ble_set_csa_support_cmpl_evt_param { struct ble_set_csa_support_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate CSA support set operation success status */ esp_bt_status_t status; /*!< Indicate CSA support set operation success status */
} set_csa_support_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_CSA_SUPPORT_COMPLETE_EVT */ } set_csa_support_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_CSA_SUPPORT_COMPLETE_EVT */
/**
* @brief ESP_GAP_BLE_SET_VENDOR_EVT_MASK_COMPLETE_EVT
*/
struct ble_set_vendor_evt_mask_cmpl_evt_param {
esp_bt_status_t status; /*!< Indicate set vendor event mask operation success status */
} set_vendor_evt_mask_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_VENDOR_EVT_MASK_COMPLETE_EVT */
/**
* @brief ESP_GAP_BLE_VENDOR_HCI_EVT
*/
struct ble_vendor_hci_event_evt_param {
uint8_t subevt_code; /*!< Subevent code for vendor HCI event, the range is 0xC0 to 0xFF */
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 */
} esp_ble_gap_cb_param_t; } esp_ble_gap_cb_param_t;
/** /**
@ -2772,6 +2788,18 @@ esp_err_t esp_ble_gap_set_privacy_mode(esp_ble_addr_type_t addr_type, esp_bd_add
*/ */
esp_err_t esp_ble_gap_set_csa_support(uint8_t csa_select); esp_err_t esp_ble_gap_set_csa_support(uint8_t csa_select);
/**
* @brief This function is used to control which vendor events are generated by the HCI for the Host.
*
* @param[in] event_mask: Bit0: Legacy scan request received event
* Bit1: Vendor channel map update complete event
*
* @return
* - ESP_OK : success
* - other : failed
*/
esp_err_t esp_ble_gap_set_vendor_event_mask(uint32_t event_mask);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -5859,6 +5859,11 @@ void bta_dm_ble_gap_set_csa_support(tBTA_DM_MSG *p_data)
BTM_BleSetCsaSupport(p_data->ble_set_csa_support.csa_select, p_data->ble_set_csa_support.p_cback); BTM_BleSetCsaSupport(p_data->ble_set_csa_support.csa_select, p_data->ble_set_csa_support.p_cback);
} }
void bta_dm_ble_gap_set_vendor_evt_mask(tBTA_DM_MSG *p_data)
{
APPL_TRACE_API("%s, evt_mask = %d", __func__, p_data->ble_set_vendor_evt_mask.evt_mask);
BTM_BleSetVendorEventMask(p_data->ble_set_vendor_evt_mask.evt_mask, p_data->ble_set_vendor_evt_mask.p_cback);
}
#if (BLE_50_DTM_TEST_EN == TRUE) #if (BLE_50_DTM_TEST_EN == TRUE)
void bta_dm_ble_gap_dtm_enhance_tx_start(tBTA_DM_MSG *p_data) void bta_dm_ble_gap_dtm_enhance_tx_start(tBTA_DM_MSG *p_data)

View File

@ -3013,6 +3013,19 @@ void BTA_DmBleGapSetCsaSupport(uint8_t csa_select, tBTA_SET_CSA_SUPPORT_CMPL_CBA
} }
} }
void BTA_DmBleGapSetVendorEventMask(uint32_t evt_mask, tBTA_SET_VENDOR_EVT_MASK_CBACK *p_callback)
{
tBTA_DM_API_BLE_SET_VENDOR_EVT_MASK *p_msg;
if ((p_msg = (tBTA_DM_API_BLE_SET_VENDOR_EVT_MASK *)osi_malloc(sizeof(tBTA_DM_API_BLE_SET_VENDOR_EVT_MASK)))
!= NULL) {
p_msg->hdr.event = BTA_DM_API_BLE_SET_VENDOR_EVT_MASK_EVT;
p_msg->evt_mask = evt_mask;
p_msg->p_cback = p_callback;
bta_sys_sendmsg(p_msg);
}
}
/******************************************************************************* /*******************************************************************************
** **
** Function BTA_VendorInit ** Function BTA_VendorInit

View File

@ -285,6 +285,7 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
bta_dm_ble_gap_add_dev_to_resolving_list, /* BTA_DM_API_ADD_DEV_TO_RESOLVING_LIST_EVT */ bta_dm_ble_gap_add_dev_to_resolving_list, /* BTA_DM_API_ADD_DEV_TO_RESOLVING_LIST_EVT */
bta_dm_ble_gap_set_privacy_mode, /* BTA_DM_API_SET_PRIVACY_MODE_EVT */ bta_dm_ble_gap_set_privacy_mode, /* BTA_DM_API_SET_PRIVACY_MODE_EVT */
bta_dm_ble_gap_set_csa_support, /* BTA_DM_API_BLE_SET_CSA_SUPPORT_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 #endif
}; };

View File

@ -276,6 +276,7 @@ enum {
BTA_DM_API_ADD_DEV_TO_RESOLVING_LIST_EVT, BTA_DM_API_ADD_DEV_TO_RESOLVING_LIST_EVT,
BTA_DM_API_SET_PRIVACY_MODE_EVT, BTA_DM_API_SET_PRIVACY_MODE_EVT,
BTA_DM_API_BLE_SET_CSA_SUPPORT_EVT, BTA_DM_API_BLE_SET_CSA_SUPPORT_EVT,
BTA_DM_API_BLE_SET_VENDOR_EVT_MASK_EVT,
#endif #endif
BTA_DM_MAX_EVT BTA_DM_MAX_EVT
}; };
@ -1020,6 +1021,12 @@ typedef struct {
tBTA_SET_CSA_SUPPORT_CMPL_CBACK *p_cback; tBTA_SET_CSA_SUPPORT_CMPL_CBACK *p_cback;
} tBTA_DM_API_BLE_SET_CSA_SUPPORT; } tBTA_DM_API_BLE_SET_CSA_SUPPORT;
typedef struct {
BT_HDR hdr;
UINT32 evt_mask;
tBTA_SET_VENDOR_EVT_MASK_CBACK *p_cback;
} tBTA_DM_API_BLE_SET_VENDOR_EVT_MASK;
#endif /* BLE_INCLUDED */ #endif /* BLE_INCLUDED */
#if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE) #if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE)
@ -1463,6 +1470,7 @@ typedef union {
tBTA_DM_API_CLEAR_ADV ble_clear_adv; tBTA_DM_API_CLEAR_ADV ble_clear_adv;
tBTA_DM_API_SET_PRIVACY_MODE ble_set_privacy_mode; tBTA_DM_API_SET_PRIVACY_MODE ble_set_privacy_mode;
tBTA_DM_API_BLE_SET_CSA_SUPPORT ble_set_csa_support; tBTA_DM_API_BLE_SET_CSA_SUPPORT ble_set_csa_support;
tBTA_DM_API_BLE_SET_VENDOR_EVT_MASK ble_set_vendor_evt_mask;
#endif #endif
#if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE) #if (BLE_HOST_REMOVE_AN_ACL_EN == TRUE)
tBTA_DM_API_REMOVE_ACL remove_acl; tBTA_DM_API_REMOVE_ACL remove_acl;
@ -1929,6 +1937,7 @@ extern void bta_dm_ble_gap_set_rpa_timeout(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_gap_add_dev_to_resolving_list(tBTA_DM_MSG *p_data); extern void bta_dm_ble_gap_add_dev_to_resolving_list(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_gap_set_privacy_mode(tBTA_DM_MSG *p_data); extern void bta_dm_ble_gap_set_privacy_mode(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_gap_set_csa_support(tBTA_DM_MSG *p_data); extern void bta_dm_ble_gap_set_csa_support(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_gap_set_vendor_evt_mask(tBTA_DM_MSG *p_data);
#if (BLE_50_DTM_TEST_EN == TRUE) #if (BLE_50_DTM_TEST_EN == TRUE)
extern void bta_dm_ble_gap_dtm_enhance_tx_start(tBTA_DM_MSG *p_data); extern void bta_dm_ble_gap_dtm_enhance_tx_start(tBTA_DM_MSG *p_data);
extern void bta_dm_ble_gap_dtm_enhance_rx_start(tBTA_DM_MSG *p_data); extern void bta_dm_ble_gap_dtm_enhance_rx_start(tBTA_DM_MSG *p_data);

View File

@ -441,6 +441,8 @@ typedef tBTM_SET_PRIVACY_MODE_CMPL_CBACK tBTA_SET_PRIVACY_MODE_CMPL_CBACK;
typedef tBTM_SET_CSA_SUPPORT_CMPL_CBACK tBTA_SET_CSA_SUPPORT_CMPL_CBACK; typedef tBTM_SET_CSA_SUPPORT_CMPL_CBACK tBTA_SET_CSA_SUPPORT_CMPL_CBACK;
typedef tBTM_SET_VENDOR_EVT_MASK_CBACK tBTA_SET_VENDOR_EVT_MASK_CBACK;
typedef tBTM_CMPL_CB tBTA_CMPL_CB; typedef tBTM_CMPL_CB tBTA_CMPL_CB;
typedef tBTM_VSC_CMPL tBTA_VSC_CMPL; typedef tBTM_VSC_CMPL tBTA_VSC_CMPL;
@ -2921,6 +2923,8 @@ extern void BTA_DmBleSetPrivacyMode(uint8_t addr_type, BD_ADDR addr, uint8_t pri
extern void BTA_DmBleGapSetCsaSupport(uint8_t csa_select, tBTM_SET_CSA_SUPPORT_CMPL_CBACK *p_callback); extern void BTA_DmBleGapSetCsaSupport(uint8_t csa_select, tBTM_SET_CSA_SUPPORT_CMPL_CBACK *p_callback);
extern void BTA_DmBleGapSetVendorEventMask(uint32_t evt_mask, tBTA_SET_VENDOR_EVT_MASK_CBACK *p_callback);
/******************************************************************************* /*******************************************************************************
** **
** Function BTA_DmBleSetStorageParams ** Function BTA_DmBleSetStorageParams

View File

@ -1381,6 +1381,45 @@ static void btc_ble_set_csa_support_callback(UINT8 status)
} }
} }
static void btc_ble_set_vendor_evt_mask_callback(UINT8 status)
{
esp_ble_gap_cb_param_t param;
bt_status_t ret;
btc_msg_t msg = {0};
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_GAP_BLE;
msg.act = ESP_GAP_BLE_SET_VENDOR_EVT_MASK_COMPLETE_EVT;
param.set_csa_support_cmpl.status = btc_btm_status_to_esp_status(status);
ret = btc_transfer_context(&msg, &param, sizeof(esp_ble_gap_cb_param_t), NULL, NULL);
if (ret != BT_STATUS_SUCCESS) {
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
}
}
static void btc_ble_vendor_hci_event_callback(UINT8 subevt_code, UINT8 param_len, UINT8 *params)
{
esp_ble_gap_cb_param_t param = {0};
bt_status_t ret;
btc_msg_t msg = {0};
msg.sig = BTC_SIG_API_CB;
msg.pid = BTC_PID_GAP_BLE;
msg.act = ESP_GAP_BLE_VENDOR_HCI_EVT;
param.vendor_hci_evt.subevt_code = subevt_code;
param.vendor_hci_evt.param_len = param_len;
param.vendor_hci_evt.param_buf = params;
ret = btc_transfer_context(&msg, &param, sizeof(esp_ble_gap_cb_param_t), btc_gap_ble_cb_deep_copy, btc_gap_ble_cb_deep_free);
if (ret != BT_STATUS_SUCCESS) {
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
}
}
void btc_get_whitelist_size(uint16_t *length) void btc_get_whitelist_size(uint16_t *length)
{ {
BTM_BleGetWhiteListSize(length); BTM_BleGetWhiteListSize(length);
@ -1803,6 +1842,18 @@ void btc_gap_ble_cb_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
} }
break; break;
} }
case ESP_GAP_BLE_VENDOR_HCI_EVT: {
if (src->vendor_hci_evt.param_len) {
dst->vendor_hci_evt.param_buf = osi_malloc(src->vendor_hci_evt.param_len);
if (dst->vendor_hci_evt.param_buf) {
memcpy(dst->vendor_hci_evt.param_buf, src->vendor_hci_evt.param_buf,
src->vendor_hci_evt.param_len);
} else {
BTC_TRACE_ERROR("%s, malloc failed\n", __func__);
}
}
break;
}
default: default:
BTC_TRACE_ERROR("%s, Unhandled deep copy %d\n", __func__, msg->act); BTC_TRACE_ERROR("%s, Unhandled deep copy %d\n", __func__, msg->act);
break; break;
@ -1947,6 +1998,13 @@ void btc_gap_ble_cb_deep_free(btc_msg_t *msg)
} }
break; break;
} }
case ESP_GAP_BLE_VENDOR_HCI_EVT: {
void *value = ((esp_ble_gap_cb_param_t *)msg->arg)->vendor_hci_evt.param_buf;
if (value) {
osi_free(value);
}
break;
}
default: default:
BTC_TRACE_DEBUG("Unhandled deep free %d", msg->act); BTC_TRACE_DEBUG("Unhandled deep free %d", msg->act);
break; break;
@ -2461,6 +2519,9 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
case BTC_GAP_BLE_SET_CSA_SUPPORT: case BTC_GAP_BLE_SET_CSA_SUPPORT:
BTA_DmBleGapSetCsaSupport(arg->set_csa_support.csa_select, btc_ble_set_csa_support_callback); BTA_DmBleGapSetCsaSupport(arg->set_csa_support.csa_select, btc_ble_set_csa_support_callback);
break; break;
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;
default: default:
break; break;
} }
@ -2476,6 +2537,7 @@ void btc_gap_callback_init(void)
#if (BLE_50_FEATURE_SUPPORT == TRUE) #if (BLE_50_FEATURE_SUPPORT == TRUE)
BTM_BleGapRegisterCallback(btc_ble_5_gap_callback); BTM_BleGapRegisterCallback(btc_ble_5_gap_callback);
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE) #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
BTM_BleRegisterVendorHciEventCallback(btc_ble_vendor_hci_event_callback);
} }
bool btc_gap_ble_init(void) bool btc_gap_ble_init(void)

View File

@ -121,6 +121,7 @@ typedef enum {
BTC_GAP_BLE_ACT_VENDOR_HCI_CMD_EVT, BTC_GAP_BLE_ACT_VENDOR_HCI_CMD_EVT,
BTC_GAP_BLE_SET_PRIVACY_MODE, BTC_GAP_BLE_SET_PRIVACY_MODE,
BTC_GAP_BLE_SET_CSA_SUPPORT, BTC_GAP_BLE_SET_CSA_SUPPORT,
BTC_GAP_BLE_ACT_SET_VENDOR_EVT_MASK,
} btc_gap_ble_act_t; } btc_gap_ble_act_t;
/* btc_ble_gap_args_t */ /* btc_ble_gap_args_t */
@ -295,6 +296,10 @@ typedef union {
struct set_csa_support_args { struct set_csa_support_args {
uint8_t csa_select; uint8_t csa_select;
} set_csa_support; } set_csa_support;
// BTC_GAP_BLE_ACT_SET_VENDOR_EVT_MASK
struct set_vendor_evt_mask_args {
uint32_t evt_mask;
} set_vendor_evt_mask;
} btc_ble_gap_args_t; } btc_ble_gap_args_t;
#if (BLE_50_FEATURE_SUPPORT == TRUE) #if (BLE_50_FEATURE_SUPPORT == TRUE)

View File

@ -71,6 +71,8 @@ static tBTM_BLE_CTRL_FEATURES_CBACK *p_ctrl_le_feature_rd_cmpl_cback = NULL;
#endif #endif
tBTM_CallbackFunc conn_callback_func; tBTM_CallbackFunc conn_callback_func;
// BLE vendor HCI event callback
static tBTM_BLE_VENDOR_HCI_EVT_CBACK *ble_vs_evt_callback = NULL;
/******************************************************************************* /*******************************************************************************
** Local functions ** Local functions
*******************************************************************************/ *******************************************************************************/
@ -351,6 +353,11 @@ void BTM_BleRegiseterPktLengthChangeCallback(tBTM_SET_PKT_DATA_LENGTH_CBACK *ptk
conn_callback_func.set_pkt_data_length_cb = ptk_len_chane_cb; conn_callback_func.set_pkt_data_length_cb = ptk_len_chane_cb;
} }
void BTM_BleRegisterVendorHciEventCallback(tBTM_BLE_VENDOR_HCI_EVT_CBACK *vendor_hci_evt_cb)
{
ble_vs_evt_callback = vendor_hci_evt_cb;
}
/******************************************************************************* /*******************************************************************************
** **
** Function BTM_BleUpdateAdvWhitelist ** Function BTM_BleUpdateAdvWhitelist
@ -4542,6 +4549,26 @@ BOOLEAN btm_ble_update_mode_operation(UINT8 link_role, BD_ADDR bd_addr, UINT8 st
return bg_con; return bg_con;
} }
static void btm_ble_vs_evt_callback(UINT8 len, UINT8 *p)
{
UINT8 sub_event;
if (!len || !p) {
return;
}
STREAM_TO_UINT8(sub_event, p);
len--;
if (sub_event < HCI_VSE_LE_LEGACY_SCAN_REQ_RECEIVED_EVT) {
return;
}
if (ble_vs_evt_callback) {
ble_vs_evt_callback(sub_event, len, p);
}
}
/******************************************************************************* /*******************************************************************************
** **
** Function btm_ble_init ** Function btm_ble_init
@ -4600,6 +4627,8 @@ void btm_ble_init (void)
btm_ble_adv_filter_init(); btm_ble_adv_filter_init();
#endif // #if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE #endif // #if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
#endif #endif
BTM_RegisterForVSEvents(btm_ble_vs_evt_callback, TRUE);
} }
/******************************************************************************* /*******************************************************************************
@ -4793,6 +4822,17 @@ BOOLEAN BTM_BleSetCsaSupport(UINT8 csa_select, tBTM_SET_CSA_SUPPORT_CMPL_CBACK *
return TRUE; return TRUE;
} }
BOOLEAN BTM_BleSetVendorEventMask(UINT32 evt_mask, tBTM_SET_VENDOR_EVT_MASK_CBACK *p_callback)
{
if (btsnd_hcic_ble_set_vendor_evt_mask(evt_mask) != TRUE) {
BTM_TRACE_ERROR("LE SetVendorEventMask evt_mask=%x: error", evt_mask);
return FALSE;
}
btm_cb.ble_ctr_cb.set_vendor_evt_mask_cmpl_cb = p_callback;
return TRUE;
}
#if (BLE_42_SCAN_EN == TRUE) #if (BLE_42_SCAN_EN == TRUE)
bool btm_ble_adv_pkt_ready(void) bool btm_ble_adv_pkt_ready(void)
{ {

View File

@ -786,6 +786,14 @@ void btm_vsc_complete (UINT8 *p, UINT16 opcode, UINT16 evt_len,
} }
break; break;
} }
case HCI_VENDOR_BLE_SET_EVT_MASK: {
uint8_t status;
STREAM_TO_UINT8(status, p);
if (ble_cb && ble_cb->set_vendor_evt_mask_cmpl_cb) {
ble_cb->set_vendor_evt_mask_cmpl_cb(status);
}
break;
}
default: default:
break; break;
} }

View File

@ -381,6 +381,7 @@ typedef struct {
UINT8 link_count[2]; /* total link count master and slave*/ UINT8 link_count[2]; /* total link count master and slave*/
tBTM_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK *update_exceptional_list_cmp_cb; tBTM_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK *update_exceptional_list_cmp_cb;
tBTM_SET_CSA_SUPPORT_CMPL_CBACK *set_csa_support_cmpl_cb; tBTM_SET_CSA_SUPPORT_CMPL_CBACK *set_csa_support_cmpl_cb;
tBTM_SET_VENDOR_EVT_MASK_CBACK *set_vendor_evt_mask_cmpl_cb;
} tBTM_BLE_CB; } tBTM_BLE_CB;
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1969,4 +1969,26 @@ BOOLEAN btsnd_hcic_ble_set_csa_support (UINT8 csa_select)
btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
return TRUE; return TRUE;
} }
BOOLEAN btsnd_hcic_ble_set_vendor_evt_mask (UINT32 evt_mask)
{
BT_HDR *p;
UINT8 *pp;
if ((p = HCI_GET_CMD_BUF (HCIC_PARAM_SIZE_BLE_SET_VENDOR_EVT_MASK)) == NULL) {
return (FALSE);
}
pp = (UINT8 *)(p + 1);
p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_SET_VENDOR_EVT_MASK;
p->offset = 0;
UINT16_TO_STREAM (pp, HCI_VENDOR_BLE_SET_EVT_MASK);
UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_BLE_SET_VENDOR_EVT_MASK);
UINT32_TO_STREAM (pp, evt_mask);
btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
return TRUE;
}
#endif #endif

View File

@ -201,6 +201,8 @@ typedef void (tBTM_SET_LOCAL_PRIVACY_CBACK) (UINT8 status);
typedef void (tBTM_SET_RPA_TIMEOUT_CMPL_CBACK) (UINT8 status); typedef void (tBTM_SET_RPA_TIMEOUT_CMPL_CBACK) (UINT8 status);
typedef void (tBTM_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK) (UINT8 status); typedef void (tBTM_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK) (UINT8 status);
typedef void (tBTM_BLE_VENDOR_HCI_EVT_CBACK) (UINT8 subevt_code, UINT8 param_len, UINT8 *params);
/******************************* /*******************************
** Device Coexist status ** Device Coexist status
********************************/ ********************************/

View File

@ -1013,6 +1013,7 @@ typedef void (tBTM_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK) (tBTM_STATUS st
typedef void (tBTM_CLEAR_ADV_CMPL_CBACK) (UINT8 status); typedef void (tBTM_CLEAR_ADV_CMPL_CBACK) (UINT8 status);
typedef void (tBTM_SET_PRIVACY_MODE_CMPL_CBACK) (tBTM_STATUS status); typedef void (tBTM_SET_PRIVACY_MODE_CMPL_CBACK) (tBTM_STATUS status);
typedef void (tBTM_SET_CSA_SUPPORT_CMPL_CBACK) (tBTM_STATUS status); typedef void (tBTM_SET_CSA_SUPPORT_CMPL_CBACK) (tBTM_STATUS status);
typedef void (tBTM_SET_VENDOR_EVT_MASK_CBACK) (tBTM_STATUS status);
#if (BLE_50_FEATURE_SUPPORT == TRUE) #if (BLE_50_FEATURE_SUPPORT == TRUE)
#define BTM_BLE_5_GAP_READ_PHY_COMPLETE_EVT 1 #define BTM_BLE_5_GAP_READ_PHY_COMPLETE_EVT 1
@ -1416,6 +1417,7 @@ extern "C" {
*******************************************************************************/ *******************************************************************************/
void BTM_BleRegiseterConnParamCallback(tBTM_UPDATE_CONN_PARAM_CBACK *update_conn_param_cb); void BTM_BleRegiseterConnParamCallback(tBTM_UPDATE_CONN_PARAM_CBACK *update_conn_param_cb);
void BTM_BleRegiseterPktLengthChangeCallback(tBTM_SET_PKT_DATA_LENGTH_CBACK *ptk_len_chane_cb); void BTM_BleRegiseterPktLengthChangeCallback(tBTM_SET_PKT_DATA_LENGTH_CBACK *ptk_len_chane_cb);
void BTM_BleRegisterVendorHciEventCallback(tBTM_BLE_VENDOR_HCI_EVT_CBACK *vendor_hci_evt_cb);
/******************************************************************************* /*******************************************************************************
** **
@ -2751,6 +2753,19 @@ BOOLEAN BTM_BleSetPrivacyMode(UINT8 addr_type,
*******************************************************************************/ *******************************************************************************/
BOOLEAN BTM_BleSetCsaSupport (UINT8 csa_select, tBTM_SET_CSA_SUPPORT_CMPL_CBACK *p_callback); BOOLEAN BTM_BleSetCsaSupport (UINT8 csa_select, tBTM_SET_CSA_SUPPORT_CMPL_CBACK *p_callback);
/*******************************************************************************
**
** Function BTM_BleSetVendorEventMask
**
** Description This function is called to set the vendor HCI event mask
**
** Parameters evt_mask - vendor HCI event mask.
** p_callback - Callback function to be called when the operation is completed.
**
** Returns TRUE if the operation was successful, otherwise FALSE.
**
*******************************************************************************/
BOOLEAN BTM_BleSetVendorEventMask(UINT32 evt_mask, tBTM_SET_VENDOR_EVT_MASK_CBACK *p_callback);
/* /*
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -427,6 +427,7 @@
#define HCI_SUBCODE_BLE_RD_STATIC_ADDR 0x0B #define HCI_SUBCODE_BLE_RD_STATIC_ADDR 0x0B
#define HCI_SUBCODE_BLE_CLEAR_ADV 0x0C #define HCI_SUBCODE_BLE_CLEAR_ADV 0x0C
#define HCI_SUBCODE_BLE_SET_CSA_SUPPORT 0x12 #define HCI_SUBCODE_BLE_SET_CSA_SUPPORT 0x12
#define HCI_SUBCODE_BLE_SET_VENDOR_EVT_MASK 0x16
#define HCI_SUBCODE_BLE_MAX 0x7F #define HCI_SUBCODE_BLE_MAX 0x7F
//ESP BT subcode define //ESP BT subcode define
@ -473,6 +474,8 @@
#define HCI_VENDOR_BLE_CLEAR_ADV HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BLE, HCI_SUBCODE_BLE_CLEAR_ADV) #define HCI_VENDOR_BLE_CLEAR_ADV HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BLE, HCI_SUBCODE_BLE_CLEAR_ADV)
/* BLE set CSA support */ /* BLE set CSA support */
#define HCI_VENDOR_BLE_SET_CSA_SUPPORT HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BLE, HCI_SUBCODE_BLE_SET_CSA_SUPPORT) #define HCI_VENDOR_BLE_SET_CSA_SUPPORT HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BLE, HCI_SUBCODE_BLE_SET_CSA_SUPPORT)
/* BLE set vendor event mask */
#define HCI_VENDOR_BLE_SET_EVT_MASK HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BLE, HCI_SUBCODE_BLE_SET_VENDOR_EVT_MASK)
//ESP BT HCI CMD //ESP BT HCI CMD
#define HCI_VENDOR_BT_SET_MIN_ENC_KEY_SIZE HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BT, HCI_SUBCODE_BT_SET_MIN_ENC_KEY_SIZE) #define HCI_VENDOR_BT_SET_MIN_ENC_KEY_SIZE HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BT, HCI_SUBCODE_BT_SET_MIN_ENC_KEY_SIZE)
@ -829,6 +832,9 @@
#define HCI_BLE_CHNL_MAP_SIZE 5 #define HCI_BLE_CHNL_MAP_SIZE 5
#define HCI_VENDOR_SPECIFIC_EVT 0xFF /* Vendor specific events */ #define HCI_VENDOR_SPECIFIC_EVT 0xFF /* Vendor specific events */
#define HCI_VSE_LE_LEGACY_SCAN_REQ_RECEIVED_EVT 0xC0
#define HCI_VSE_LE_CHAN_MAP_UPDATE_CMPL_EVT 0xC1
#define HCI_VSE_LE_EVT_MAX 0xFF
#define HCI_NAP_TRACE_EVT 0xFF /* was define 0xFE, 0xFD, change to 0xFF #define HCI_NAP_TRACE_EVT 0xFF /* was define 0xFE, 0xFD, change to 0xFF
because conflict w/ TCI_EVT and per because conflict w/ TCI_EVT and per
specification compliant */ specification compliant */

View File

@ -760,6 +760,7 @@ void btsnd_hcic_vendor_spec_cmd (BT_HDR *buffer, UINT16 opcode,
#define HCIC_PARAM_SIZE_BLE_CLEAR_ADV 0 #define HCIC_PARAM_SIZE_BLE_CLEAR_ADV 0
#define HCIC_PARAM_SIZE_SET_PRIVACY_MODE 8 #define HCIC_PARAM_SIZE_SET_PRIVACY_MODE 8
#define HCIC_PARAM_SIZE_BLE_SET_CSA_SUPPORT 1 #define HCIC_PARAM_SIZE_BLE_SET_CSA_SUPPORT 1
#define HCIC_PARAM_SIZE_BLE_SET_VENDOR_EVT_MASK 4
#if (BLE_50_FEATURE_SUPPORT == TRUE) #if (BLE_50_FEATURE_SUPPORT == TRUE)
#define HCIC_PARAM_SIZE_BLE_READ_PHY 2 #define HCIC_PARAM_SIZE_BLE_READ_PHY 2
#define HCIC_PARAM_SIZE_BLE_SET_DEF_PHY 3 #define HCIC_PARAM_SIZE_BLE_SET_DEF_PHY 3
@ -923,6 +924,8 @@ BOOLEAN btsnd_hcic_ble_set_privacy_mode(UINT8 addr_type, BD_ADDR addr, UINT8 pri
BOOLEAN btsnd_hcic_ble_set_csa_support (UINT8 csa_select); BOOLEAN btsnd_hcic_ble_set_csa_support (UINT8 csa_select);
BOOLEAN btsnd_hcic_ble_set_vendor_evt_mask (UINT32 evt_mask);
#endif /* BLE_INCLUDED */ #endif /* BLE_INCLUDED */
#if (BLE_50_FEATURE_SUPPORT == TRUE) #if (BLE_50_FEATURE_SUPPORT == TRUE)