mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-29 18:27:20 +02:00
Merge branch 'feat/support_ble_vendor_evt_report_with_param' into 'master'
feat(bt/bluedroid): Support BLE vendor event reporting with params Closes BLERP-1624 See merge request espressif/esp-idf!37539
This commit is contained in:
@ -1493,6 +1493,13 @@ config BT_BLE_FEAT_CONN_SUBRATING
|
||||
help
|
||||
Enable BLE connection subrating feature
|
||||
|
||||
config BT_BLE_VENDOR_HCI_EN
|
||||
bool "Enable BLE Vendor HCI command and event"
|
||||
depends on BT_BLE_ENABLED
|
||||
default y
|
||||
help
|
||||
This enables BLE vendor HCI command and event
|
||||
|
||||
config BT_BLE_HIGH_DUTY_ADV_INTERVAL
|
||||
bool "Enable BLE high duty advertising interval feature"
|
||||
depends on BT_BLE_ENABLED
|
||||
|
@ -131,19 +131,6 @@ esp_err_t esp_ble_gap_stop_advertising(void)
|
||||
|
||||
return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_gap_clear_advertising(void)
|
||||
{
|
||||
btc_msg_t msg;
|
||||
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_ACT_CLEAR_ADV;
|
||||
|
||||
return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
#endif // #if (BLE_42_ADV_EN == TRUE)
|
||||
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
@ -1013,23 +1000,6 @@ esp_err_t esp_ble_gap_set_privacy_mode(esp_ble_addr_type_t addr_type, esp_bd_add
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_gap_set_csa_support(uint8_t csa_select)
|
||||
{
|
||||
btc_msg_t msg;
|
||||
btc_ble_gap_args_t arg;
|
||||
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_SET_CSA_SUPPORT;
|
||||
|
||||
arg.set_csa_support.csa_select = csa_select;
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
esp_err_t esp_ble_gap_read_phy(esp_bd_addr_t bd_addr)
|
||||
@ -1713,6 +1683,7 @@ esp_err_t esp_ble_gap_set_periodic_adv_sync_trans_params(esp_bd_addr_t addr, con
|
||||
}
|
||||
#endif //#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
|
||||
|
||||
#if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
esp_err_t esp_ble_gap_vendor_command_send(esp_ble_vendor_cmd_params_t *vendor_cmd_param)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
@ -1741,7 +1712,7 @@ esp_err_t esp_ble_gap_vendor_command_send(esp_ble_vendor_cmd_params_t *vendor_cm
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_gap_set_vendor_event_mask(uint32_t event_mask)
|
||||
esp_err_t esp_ble_gap_set_vendor_event_mask(esp_ble_vendor_evt_mask_t event_mask)
|
||||
{
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_gap_args_t arg;
|
||||
@ -1759,6 +1730,37 @@ esp_err_t esp_ble_gap_set_vendor_event_mask(uint32_t event_mask)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_gap_clear_advertising(void)
|
||||
{
|
||||
btc_msg_t msg;
|
||||
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_ACT_CLEAR_ADV;
|
||||
|
||||
return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_gap_set_csa_support(uint8_t csa_select)
|
||||
{
|
||||
btc_msg_t msg;
|
||||
btc_ble_gap_args_t arg;
|
||||
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_SET_CSA_SUPPORT;
|
||||
|
||||
arg.set_csa_support.csa_select = csa_select;
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
#endif // (BLE_VENDOR_HCI_EN == TRUE)
|
||||
|
||||
#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)
|
||||
{
|
||||
|
@ -1102,11 +1102,58 @@ typedef struct {
|
||||
} esp_ble_gap_past_params_t;
|
||||
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
|
||||
|
||||
typedef enum{
|
||||
typedef enum {
|
||||
ESP_BLE_NETWORK_PRIVACY_MODE = 0X00, /*!< Network Privacy Mode for peer device (default) */
|
||||
ESP_BLE_DEVICE_PRIVACY_MODE = 0X01, /*!< Device Privacy Mode for peer device */
|
||||
} esp_ble_privacy_mode_t;
|
||||
|
||||
#define ESP_BLE_VENDOR_SCAN_REQ_RECV_EVT_MASK BIT(0) /*!< Vendor BLE legacy SCAN_REQ received event mask */
|
||||
#define ESP_BLE_VENDOR_CHMAP_UPDATE_EVT_MASK BIT(1) /*!< Vendor BLE channel map update event mask */
|
||||
#define ESP_BLE_VENDOR_SLEEP_WAKEUP_EVT_MASK BIT(3) /*!< Vendor BLE sleep wakeup event mask */
|
||||
#define ESP_BLE_VENDOR_CONN_REQ_RECV_EVT_MASK BIT(4) /*!< Vendor BLE CONNECT_IND and AUX_CONNECT_REQ received event mask */
|
||||
#define ESP_BLE_VENDOR_CONN_RSP_RECV_EVT_MASK BIT(5) /*!< Vendor BLE AUX_CONNECT_RSP received event mask */
|
||||
typedef uint32_t esp_ble_vendor_evt_mask_t;
|
||||
|
||||
#define ESP_BLE_VENDOR_PDU_RECV_EVT (0) /*!< Vendor BLE specify PDU received event */
|
||||
#define ESP_BLE_VENDOR_CHAN_MAP_UPDATE_EVT (1) /*!< Vendor BLE channel map update complete event */
|
||||
#define ESP_BLE_VENDOR_SLEEP_WAKEUP_EVT (2) /*!< Vendor BLE sleep wakeup event */
|
||||
typedef uint8_t esp_ble_vendor_evt_t;
|
||||
|
||||
typedef enum {
|
||||
ESP_BLE_VENDOR_PDU_SCAN_REQ = 0, /*!< SCAN_REQ PDU type */
|
||||
ESP_BLE_VENDOR_PDU_CONN_REQ, /*!< CONNECT_IND and AUX_CONNECT_REQ PDU type */
|
||||
ESP_BLE_VENDOR_PDU_CONN_RSP, /*!< AUX_CONNECT_RSP PDU type */
|
||||
} esp_ble_vendor_pdu_t;
|
||||
|
||||
/**
|
||||
* @brief BLE vendor event parameters union
|
||||
*/
|
||||
typedef union {
|
||||
/**
|
||||
* @brief ESP_BLE_VENDOR_PDU_RECV_EVT
|
||||
*/
|
||||
struct ble_pdu_recv_evt_param {
|
||||
esp_ble_vendor_pdu_t type; /*!< The type of LE PDU */
|
||||
uint8_t handle; /*!< The handle of advertising set */
|
||||
esp_ble_addr_type_t addr_type; /*!< The address type of peer device */
|
||||
esp_bd_addr_t peer_addr; /*!< The address of peer device */
|
||||
} pdu_recv; /*!< Event parameter of ESP_BLE_VENDOR_PDU_RECV_EVT */
|
||||
/**
|
||||
* @brief ESP_BLE_VENDOR_CHAN_MAP_UPDATE_EVT
|
||||
*/
|
||||
struct ble_chan_map_update_evt_param {
|
||||
uint8_t status; /*!< Indicate the channel map update status (HCI error code) */
|
||||
uint16_t conn_handle; /*!< The connection handle */
|
||||
esp_gap_ble_channels ch_map; /*!< The channel map after updated */
|
||||
} chan_map_update; /*!< Event parameter of ESP_BLE_VENDOR_CHAN_MAP_UPDATE_EVT */
|
||||
/**
|
||||
* @brief ESP_BLE_VENDOR_SLEEP_WAKEUP_EVT
|
||||
*/
|
||||
struct ble_sleep_wakeup_evt_param {
|
||||
// No parameters
|
||||
} sleep_wakeup; /*!< Event parameter of ESP_BLE_VENDOR_SLEEP_WAKEUP_EVT */
|
||||
} esp_ble_vendor_evt_param_t;
|
||||
|
||||
/**
|
||||
* @brief path loss report parameters
|
||||
*/
|
||||
@ -1258,12 +1305,6 @@ typedef union {
|
||||
struct ble_adv_stop_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate adv stop operation success status */
|
||||
} adv_stop_cmpl; /*!< Event parameter of ESP_GAP_BLE_ADV_STOP_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_ADV_CLEAR_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_adv_clear_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate adv clear operation success status */
|
||||
} adv_clear_cmpl; /*!< Event parameter of ESP_GAP_BLE_ADV_CLEAR_COMPLETE_EVT */
|
||||
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_SET_STATIC_RAND_ADDR_EVT
|
||||
@ -1665,6 +1706,19 @@ typedef union {
|
||||
esp_ble_dtm_update_evt_t update_evt; /*!< DTM state change event, 0x00: DTM TX start, 0x01: DTM RX start, 0x02:DTM end */
|
||||
uint16_t num_of_pkt; /*!< number of packets received, only valid if update_evt is DTM_TEST_STOP_EVT and shall be reported as 0 for a transmitter */
|
||||
} dtm_state_update; /*!< Event parameter of ESP_GAP_BLE_DTM_TEST_UPDATE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_SET_PRIVACY_MODE_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_set_privacy_mode_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate privacy mode set operation success status */
|
||||
} set_privacy_mode_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_PRIVACY_MODE_COMPLETE_EVT */
|
||||
#if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_ADV_CLEAR_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_adv_clear_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate adv clear operation success status */
|
||||
} adv_clear_cmpl; /*!< Event parameter of ESP_GAP_BLE_ADV_CLEAR_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_VENDOR_CMD_COMPLETE_EVT
|
||||
*/
|
||||
@ -1673,12 +1727,6 @@ typedef union {
|
||||
uint16_t param_len; /*!< The length of parameter buffer */
|
||||
uint8_t *p_param_buf; /*!< The point of parameter buffer */
|
||||
} vendor_cmd_cmpl; /*!< Event parameter of ESP_GAP_BLE_VENDOR_CMD_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_SET_PRIVACY_MODE_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_set_privacy_mode_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate privacy mode set operation success status */
|
||||
} set_privacy_mode_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_PRIVACY_MODE_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_SET_CSA_SUPPORT_COMPLETE_EVT
|
||||
*/
|
||||
@ -1695,10 +1743,12 @@ typedef union {
|
||||
* @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_vendor_evt_t subevt_code; /*!< Subevent code for BLE vendor HCI event */
|
||||
esp_ble_vendor_evt_param_t param; /*!< Event parameter of BLE vendor HCI subevent */
|
||||
uint8_t param_len; /*!< The length of the event parameter buffer (for internal use only) */
|
||||
uint8_t *param_buf; /*!< The pointer of the event parameter buffer (for internal use only) */
|
||||
} vendor_hci_evt; /*!< Event parameter of ESP_GAP_BLE_VENDOR_HCI_EVT */
|
||||
#endif // #if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_ENH_READ_TRANS_PWR_LEVEL_EVT
|
||||
@ -3032,14 +3082,13 @@ 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
|
||||
* @param[in] event_mask: The BLE vendor HCI event mask
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : success
|
||||
* - other : failed
|
||||
*/
|
||||
esp_err_t esp_ble_gap_set_vendor_event_mask(uint32_t event_mask);
|
||||
esp_err_t esp_ble_gap_set_vendor_event_mask(esp_ble_vendor_evt_mask_t event_mask);
|
||||
|
||||
/**
|
||||
* @brief This function is used to read the current and maximum transmit power levels of the local Controller.
|
||||
|
@ -733,6 +733,7 @@ void bta_dm_cfg_coex_status (tBTA_DM_MSG *p_data)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
void bta_dm_send_vendor_hci(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
BTM_VendorSpecificCommand(p_data->vendor_hci_cmd.opcode,
|
||||
@ -741,6 +742,28 @@ void bta_dm_send_vendor_hci(tBTA_DM_MSG *p_data)
|
||||
p_data->vendor_hci_cmd.vendor_hci_cb);
|
||||
}
|
||||
|
||||
void bta_dm_ble_gap_clear_adv(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
if (BTM_BleClearAdv(p_data->ble_clear_adv.p_clear_adv_cback) == FALSE) {
|
||||
if (p_data->ble_clear_adv.p_clear_adv_cback) {
|
||||
(*p_data->ble_clear_adv.p_clear_adv_cback)(BTA_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void bta_dm_ble_gap_set_csa_support(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
APPL_TRACE_API("%s, csa_select = %d", __func__, p_data->ble_set_csa_support.csa_select);
|
||||
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);
|
||||
}
|
||||
#endif // #if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_dm_set_afh_channels
|
||||
@ -5822,15 +5845,6 @@ void bta_dm_ble_gap_dtm_stop(tBTA_DM_MSG *p_data)
|
||||
}
|
||||
#endif // #if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
|
||||
|
||||
void bta_dm_ble_gap_clear_adv(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
if (BTM_BleClearAdv(p_data->ble_clear_adv.p_clear_adv_cback) == FALSE) {
|
||||
if (p_data->ble_clear_adv.p_clear_adv_cback) {
|
||||
(*p_data->ble_clear_adv.p_clear_adv_cback)(BTA_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void bta_dm_ble_gap_set_rpa_timeout(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
APPL_TRACE_API("%s, rpa_timeout = %d", __func__, p_data->set_rpa_timeout.rpa_timeout);
|
||||
@ -5853,18 +5867,6 @@ void bta_dm_ble_gap_set_privacy_mode(tBTA_DM_MSG *p_data)
|
||||
p_data->ble_set_privacy_mode.privacy_mode, p_data->ble_set_privacy_mode.p_cback);
|
||||
}
|
||||
|
||||
void bta_dm_ble_gap_set_csa_support(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
APPL_TRACE_API("%s, csa_select = %d", __func__, p_data->ble_set_csa_support.csa_select);
|
||||
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);
|
||||
}
|
||||
|
||||
void bta_dm_read_ble_channel_map(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
if (p_data && p_data->ch_map.read_ch_map_cb) {
|
||||
|
@ -231,6 +231,7 @@ void BTA_DmCfgCoexStatus(UINT8 op, UINT8 type, UINT8 status)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
void BTA_DmsendVendorHciCmd(UINT16 opcode, UINT8 param_len, UINT8 *p_param_buf, tBTA_SEND_VENDOR_HCI_CMPL_CBACK p_vendor_cmd_complete_cback)
|
||||
{
|
||||
tBTA_DM_API_SEND_VENDOR_HCI_CMD *p_msg;
|
||||
@ -246,6 +247,57 @@ void BTA_DmsendVendorHciCmd(UINT16 opcode, UINT8 param_len, UINT8 *p_param_buf,
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleClearAdv
|
||||
**
|
||||
** Description This function is called to clear Advertising
|
||||
**
|
||||
** Parameters p_adv_data_cback : clear adv complete callback.
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_DmBleClearAdv (tBTA_CLEAR_ADV_CMPL_CBACK *p_clear_adv_cback)
|
||||
{
|
||||
tBTA_DM_API_CLEAR_ADV *p_msg;
|
||||
|
||||
if ((p_msg = (tBTA_DM_API_CLEAR_ADV *)
|
||||
osi_malloc(sizeof(tBTA_DM_API_CLEAR_ADV))) != NULL) {
|
||||
p_msg->hdr.event = BTA_DM_API_BLE_CLEAR_ADV_EVT;
|
||||
p_msg->p_clear_adv_cback = p_clear_adv_cback;
|
||||
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
|
||||
void BTA_DmBleGapSetCsaSupport(uint8_t csa_select, tBTA_SET_CSA_SUPPORT_CMPL_CBACK *p_callback)
|
||||
{
|
||||
tBTA_DM_API_BLE_SET_CSA_SUPPORT *p_msg;
|
||||
|
||||
if ((p_msg = (tBTA_DM_API_BLE_SET_CSA_SUPPORT *)osi_malloc(sizeof(tBTA_DM_API_BLE_SET_CSA_SUPPORT)))
|
||||
!= NULL) {
|
||||
p_msg->hdr.event = BTA_DM_API_BLE_SET_CSA_SUPPORT_EVT;
|
||||
p_msg->csa_select = csa_select;
|
||||
p_msg->p_cback = p_callback;
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
#endif // #if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
void BTA_DmConfigEir(tBTA_DM_EIR_CONF *eir_config)
|
||||
@ -1896,30 +1948,6 @@ extern void BTA_DmBleBroadcast (BOOLEAN start, tBTA_START_STOP_ADV_CMPL_CBACK *p
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleClearAdv
|
||||
**
|
||||
** Description This function is called to clear Advertising
|
||||
**
|
||||
** Parameters p_adv_data_cback : clear adv complete callback.
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_DmBleClearAdv (tBTA_CLEAR_ADV_CMPL_CBACK *p_clear_adv_cback)
|
||||
{
|
||||
tBTA_DM_API_CLEAR_ADV *p_msg;
|
||||
|
||||
if ((p_msg = (tBTA_DM_API_CLEAR_ADV *)
|
||||
osi_malloc(sizeof(tBTA_DM_API_CLEAR_ADV))) != NULL) {
|
||||
p_msg->hdr.event = BTA_DM_API_BLE_CLEAR_ADV_EVT;
|
||||
p_msg->p_clear_adv_cback = p_clear_adv_cback;
|
||||
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
#endif // #if (BLE_42_ADV_EN == TRUE)
|
||||
|
||||
#endif
|
||||
@ -3014,32 +3042,6 @@ void BTA_DmClearRandAddress(void)
|
||||
}
|
||||
}
|
||||
|
||||
void BTA_DmBleGapSetCsaSupport(uint8_t csa_select, tBTA_SET_CSA_SUPPORT_CMPL_CBACK *p_callback)
|
||||
{
|
||||
tBTA_DM_API_BLE_SET_CSA_SUPPORT *p_msg;
|
||||
|
||||
if ((p_msg = (tBTA_DM_API_BLE_SET_CSA_SUPPORT *)osi_malloc(sizeof(tBTA_DM_API_BLE_SET_CSA_SUPPORT)))
|
||||
!= NULL) {
|
||||
p_msg->hdr.event = BTA_DM_API_BLE_SET_CSA_SUPPORT_EVT;
|
||||
p_msg->csa_select = csa_select;
|
||||
p_msg->p_cback = p_callback;
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
|
||||
void BTA_DmBleGapEnhReadTransPwrLevel(uint16_t conn_handle, uint8_t phy)
|
||||
{
|
||||
|
@ -67,7 +67,12 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
|
||||
#if (ESP_COEX_VSC_INCLUDED == TRUE)
|
||||
bta_dm_cfg_coex_status, /* BTA_DM_API_CFG_COEX_ST_EVT */
|
||||
#endif
|
||||
#if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
bta_dm_send_vendor_hci, /* BTA_DM_API_SEND_VENDOR_HCI_CMD_EVT */
|
||||
bta_dm_ble_gap_clear_adv, /* BTA_DM_API_BLE_CLEAR_ADV_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_VENDOR_HCI_EN == TRUE)
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
bta_dm_config_eir, /* BTA_DM_API_CONFIG_EIR_EVT */
|
||||
bta_dm_set_page_timeout, /* BTA_DM_API_PAGE_TO_SET_EVT */
|
||||
@ -278,14 +283,9 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
|
||||
#if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
|
||||
bta_dm_ble_gap_dtm_stop, /* BTA_DM_API_DTM_STOP_EVT */
|
||||
#endif // #if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
|
||||
#if (BLE_42_ADV_EN == TRUE)
|
||||
bta_dm_ble_gap_clear_adv, /* BTA_DM_API_BLE_CLEAR_ADV_EVT */
|
||||
#endif // #if (BLE_42_ADV_EN == TRUE)
|
||||
bta_dm_ble_gap_set_rpa_timeout, /* BTA_DM_API_SET_RPA_TIMEOUT_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_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 */
|
||||
bta_dm_read_ble_channel_map, /* BTA_DM_API_BLE_READ_CH_MAP_EVT */
|
||||
#endif
|
||||
#if (BLE_FEAT_ISO_EN == TRUE)
|
||||
|
@ -57,7 +57,12 @@ enum {
|
||||
#if (ESP_COEX_VSC_INCLUDED == TRUE)
|
||||
BTA_DM_API_CFG_COEX_ST_EVT,
|
||||
#endif
|
||||
#if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
BTA_DM_API_SEND_VENDOR_HCI_CMD_EVT,
|
||||
BTA_DM_API_BLE_CLEAR_ADV_EVT,
|
||||
BTA_DM_API_BLE_SET_CSA_SUPPORT_EVT,
|
||||
BTA_DM_API_BLE_SET_VENDOR_EVT_MASK_EVT,
|
||||
#endif // #if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
BTA_DM_API_CONFIG_EIR_EVT,
|
||||
BTA_DM_API_PAGE_TO_SET_EVT,
|
||||
@ -269,14 +274,9 @@ enum {
|
||||
#if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
|
||||
BTA_DM_API_DTM_STOP_EVT,
|
||||
#endif // #if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
|
||||
#if (BLE_42_ADV_EN == TRUE)
|
||||
BTA_DM_API_BLE_CLEAR_ADV_EVT,
|
||||
#endif // #if (BLE_42_ADV_EN == TRUE)
|
||||
BTA_DM_API_SET_RPA_TIMEOUT_EVT,
|
||||
BTA_DM_API_ADD_DEV_TO_RESOLVING_LIST_EVT,
|
||||
BTA_DM_API_SET_PRIVACY_MODE_EVT,
|
||||
BTA_DM_API_BLE_SET_CSA_SUPPORT_EVT,
|
||||
BTA_DM_API_BLE_SET_VENDOR_EVT_MASK_EVT,
|
||||
BTA_DM_API_BLE_READ_CH_MAP_EVT,
|
||||
#endif
|
||||
#if (BLE_FEAT_ISO_EN == TRUE)
|
||||
|
@ -467,25 +467,6 @@ static void btc_stop_adv_callback(uint8_t status)
|
||||
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
|
||||
}
|
||||
}
|
||||
|
||||
static void btc_clear_adv_callback(uint8_t 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_ADV_CLEAR_COMPLETE_EVT;
|
||||
param.adv_clear_cmpl.status = btc_hci_to_esp_status(status);
|
||||
|
||||
ret = btc_transfer_context(&msg, ¶m,
|
||||
sizeof(esp_ble_gap_cb_param_t), NULL, NULL);
|
||||
|
||||
if (ret != BT_STATUS_SUCCESS) {
|
||||
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
|
||||
}
|
||||
}
|
||||
#endif // #if (BLE_42_ADV_EN == TRUE)
|
||||
|
||||
void btc_update_duplicate_exceptional_list_callback(tBTA_STATUS status, uint8_t subcode, uint32_t length, uint8_t *device_info)
|
||||
@ -1406,6 +1387,45 @@ void btc_dtm_stop_callback(void *p1)
|
||||
}
|
||||
#endif // #if ((BLE_42_DTM_TEST_EN == TRUE) || (BLE_50_DTM_TEST_EN == TRUE))
|
||||
|
||||
static void btc_ble_set_privacy_mode_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_PRIVACY_MODE_COMPLETE_EVT;
|
||||
|
||||
param.set_privacy_mode_cmpl.status = btc_btm_status_to_esp_status(status);
|
||||
|
||||
ret = btc_transfer_context(&msg, ¶m, sizeof(esp_ble_gap_cb_param_t), NULL, NULL);
|
||||
|
||||
if (ret != BT_STATUS_SUCCESS) {
|
||||
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
|
||||
}
|
||||
}
|
||||
|
||||
#if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
static void btc_clear_adv_callback(uint8_t 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_ADV_CLEAR_COMPLETE_EVT;
|
||||
param.adv_clear_cmpl.status = btc_hci_to_esp_status(status);
|
||||
|
||||
ret = btc_transfer_context(&msg, ¶m,
|
||||
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_cmd_complete_callback(tBTA_VSC_CMPL *p_param)
|
||||
{
|
||||
bool param_invalid = false;
|
||||
@ -1442,25 +1462,6 @@ static void btc_ble_vendor_hci_cmd_complete_callback(tBTA_VSC_CMPL *p_param)
|
||||
}
|
||||
}
|
||||
|
||||
static void btc_ble_set_privacy_mode_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_PRIVACY_MODE_COMPLETE_EVT;
|
||||
|
||||
param.set_privacy_mode_cmpl.status = btc_btm_status_to_esp_status(status);
|
||||
|
||||
ret = btc_transfer_context(&msg, ¶m, 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_set_csa_support_callback(UINT8 status)
|
||||
{
|
||||
esp_ble_gap_cb_param_t param;
|
||||
@ -1490,7 +1491,7 @@ static void btc_ble_set_vendor_evt_mask_callback(UINT8 status)
|
||||
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);
|
||||
param.set_vendor_evt_mask_cmpl.status = btc_btm_status_to_esp_status(status);
|
||||
|
||||
ret = btc_transfer_context(&msg, ¶m, sizeof(esp_ble_gap_cb_param_t), NULL, NULL);
|
||||
|
||||
@ -1504,20 +1505,52 @@ static void btc_ble_vendor_hci_event_callback(UINT8 subevt_code, UINT8 param_len
|
||||
esp_ble_gap_cb_param_t param = {0};
|
||||
bt_status_t ret;
|
||||
btc_msg_t msg = {0};
|
||||
esp_ble_vendor_evt_param_t *evt_param = ¶m.vendor_hci_evt.param;
|
||||
bool copy_param = false;
|
||||
|
||||
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, ¶m, sizeof(esp_ble_gap_cb_param_t), btc_gap_ble_cb_deep_copy, btc_gap_ble_cb_deep_free);
|
||||
param.vendor_hci_evt.param_len = 0;
|
||||
param.vendor_hci_evt.param_buf = NULL;
|
||||
switch (subevt_code) {
|
||||
case BLE_VENDOR_PDU_RECV_EVT:
|
||||
param.vendor_hci_evt.subevt_code = ESP_BLE_VENDOR_PDU_RECV_EVT;
|
||||
STREAM_TO_UINT8(evt_param->pdu_recv.type, params);
|
||||
STREAM_TO_UINT8(evt_param->pdu_recv.handle, params);
|
||||
STREAM_TO_UINT8(evt_param->pdu_recv.addr_type, params);
|
||||
STREAM_TO_BDADDR(evt_param->pdu_recv.peer_addr, params);
|
||||
break;
|
||||
case BLE_VENDOR_CHMAP_UPDATE_EVT:
|
||||
param.vendor_hci_evt.subevt_code = ESP_BLE_VENDOR_CHAN_MAP_UPDATE_EVT;
|
||||
STREAM_TO_UINT8(evt_param->chan_map_update.status, params);
|
||||
STREAM_TO_UINT16(evt_param->chan_map_update.conn_handle, params);
|
||||
REVERSE_STREAM_TO_ARRAY(evt_param->chan_map_update.ch_map, params, ESP_GAP_BLE_CHANNELS_LEN);
|
||||
break;
|
||||
case BLE_VENDOR_SLEEP_WAKEUP_EVT:
|
||||
param.vendor_hci_evt.subevt_code = ESP_BLE_VENDOR_SLEEP_WAKEUP_EVT;
|
||||
// No parameters
|
||||
break;
|
||||
default:
|
||||
copy_param = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (copy_param) {
|
||||
param.vendor_hci_evt.param_len = param_len;
|
||||
param.vendor_hci_evt.param_buf = (param_len) ? params : NULL;
|
||||
ret = btc_transfer_context(&msg, ¶m, sizeof(esp_ble_gap_cb_param_t), btc_gap_ble_cb_deep_copy, btc_gap_ble_cb_deep_free);
|
||||
} else {
|
||||
ret = btc_transfer_context(&msg, ¶m, sizeof(esp_ble_gap_cb_param_t), NULL, NULL);
|
||||
}
|
||||
|
||||
if (ret != BT_STATUS_SUCCESS) {
|
||||
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
|
||||
}
|
||||
}
|
||||
#endif // #if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
|
||||
void btc_get_whitelist_size(uint16_t *length)
|
||||
{
|
||||
@ -1552,11 +1585,6 @@ static void btc_ble_stop_advertising(tBTA_START_STOP_ADV_CMPL_CBACK *stop_adv_cb
|
||||
|
||||
BTA_DmBleBroadcast(stop_adv, stop_adv_cb);
|
||||
}
|
||||
|
||||
static void btc_ble_clear_advertising(tBTA_CLEAR_ADV_CMPL_CBACK *clear_adv_cb)
|
||||
{
|
||||
BTA_DmBleClearAdv(clear_adv_cb);
|
||||
}
|
||||
#endif // #if (BLE_42_ADV_EN == TRUE)
|
||||
|
||||
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
@ -1899,6 +1927,7 @@ void btc_gap_ble_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
|
||||
}
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
case BTC_GAP_BLE_ACT_VENDOR_HCI_CMD_EVT: {
|
||||
btc_ble_gap_args_t *src = (btc_ble_gap_args_t *)p_src;
|
||||
btc_ble_gap_args_t *dst = (btc_ble_gap_args_t *)p_dest;
|
||||
@ -1912,6 +1941,7 @@ void btc_gap_ble_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif // #if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
case BTC_GAP_BLE_ACT_SET_DEV_NAME:{
|
||||
btc_ble_gap_args_t *src = (btc_ble_gap_args_t *)p_src;
|
||||
btc_ble_gap_args_t *dst = (btc_ble_gap_args_t *)p_dest;
|
||||
@ -2065,6 +2095,7 @@ void btc_gap_ble_arg_deep_free(btc_msg_t *msg)
|
||||
}
|
||||
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
case BTC_GAP_BLE_ACT_VENDOR_HCI_CMD_EVT: {
|
||||
uint8_t *p_param_buf = ((btc_ble_gap_args_t *)msg->arg)->vendor_cmd_send.p_param_buf;
|
||||
if (p_param_buf) {
|
||||
@ -2072,6 +2103,7 @@ void btc_gap_ble_arg_deep_free(btc_msg_t *msg)
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif // #if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
case BTC_GAP_BLE_ACT_SET_DEV_NAME:{
|
||||
char *p_name = ((btc_ble_gap_args_t *)msg->arg)->set_dev_name.device_name;
|
||||
if (p_name) {
|
||||
@ -2156,9 +2188,6 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
|
||||
case BTC_GAP_BLE_ACT_STOP_ADV:
|
||||
btc_ble_stop_advertising(btc_stop_adv_callback);
|
||||
break;
|
||||
case BTC_GAP_BLE_ACT_CLEAR_ADV:
|
||||
btc_ble_clear_advertising(btc_clear_adv_callback);
|
||||
break;
|
||||
#endif // #if (BLE_42_ADV_EN == TRUE)
|
||||
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
case BTC_GAP_BLE_ACT_UPDATE_CONN_PARAM:
|
||||
@ -2618,22 +2647,27 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
|
||||
btc_ble_dtm_enhance_rx_start(arg_5->dtm_enh_rx_start.rx_channel, arg_5->dtm_enh_rx_start.phy, arg_5->dtm_enh_rx_start.modulation_index, btc_dtm_rx_start_callback);
|
||||
break;
|
||||
#endif // #if (BLE_50_DTM_TEST_EN == TRUE)
|
||||
case BTC_GAP_BLE_SET_PRIVACY_MODE:
|
||||
btc_ble_set_privacy_mode(arg->set_privacy_mode.addr_type, arg->set_privacy_mode.addr,
|
||||
arg->set_privacy_mode.privacy_mode, btc_ble_set_privacy_mode_callback);
|
||||
break;
|
||||
#if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
case BTC_GAP_BLE_ACT_CLEAR_ADV:
|
||||
BTA_DmBleClearAdv(btc_clear_adv_callback);
|
||||
break;
|
||||
case BTC_GAP_BLE_ACT_VENDOR_HCI_CMD_EVT:
|
||||
BTA_DmsendVendorHciCmd(arg->vendor_cmd_send.opcode,
|
||||
arg->vendor_cmd_send.param_len,
|
||||
arg->vendor_cmd_send.p_param_buf,
|
||||
btc_ble_vendor_hci_cmd_complete_callback);
|
||||
break;
|
||||
case BTC_GAP_BLE_SET_PRIVACY_MODE:
|
||||
btc_ble_set_privacy_mode(arg->set_privacy_mode.addr_type, arg->set_privacy_mode.addr,
|
||||
arg->set_privacy_mode.privacy_mode, btc_ble_set_privacy_mode_callback);
|
||||
break;
|
||||
case BTC_GAP_BLE_SET_CSA_SUPPORT:
|
||||
BTA_DmBleGapSetCsaSupport(arg->set_csa_support.csa_select, btc_ble_set_csa_support_callback);
|
||||
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;
|
||||
#endif // #if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
#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);
|
||||
@ -2682,7 +2716,9 @@ void btc_gap_callback_init(void)
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
BTM_BleGapRegisterCallback(btc_ble_5_gap_callback);
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
BTM_BleRegisterVendorHciEventCallback(btc_ble_vendor_hci_event_callback);
|
||||
#endif // #if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
}
|
||||
|
||||
bool btc_gap_ble_init(void)
|
||||
|
@ -24,6 +24,10 @@ extern tBTA_BLE_ADV_DATA *gl_bta_scan_rsp_data_ptr;
|
||||
|
||||
#define BLE_ISVALID_PARAM(x, min, max) (((x) >= (min) && (x) <= (max)))
|
||||
|
||||
#define BLE_VENDOR_PDU_RECV_EVT (0xC0)
|
||||
#define BLE_VENDOR_CHMAP_UPDATE_EVT (0xC1)
|
||||
#define BLE_VENDOR_SLEEP_WAKEUP_EVT (0xC3)
|
||||
|
||||
typedef enum {
|
||||
#if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
BTC_GAP_BLE_ACT_CFG_ADV_DATA = 0,
|
||||
@ -113,15 +117,15 @@ typedef enum {
|
||||
BTC_GAP_BLE_DTM_RX_START,
|
||||
#endif // #if (BLE_42_DTM_TEST_EN == TRUE)
|
||||
BTC_GAP_BLE_DTM_STOP,
|
||||
#if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
#if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
BTC_GAP_BLE_ACT_CLEAR_ADV,
|
||||
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
BTC_GAP_BLE_ACT_SET_RESOLVABLE_PRIVATE_ADDRESS_TIMEOUT,
|
||||
BTC_GAP_BLE_ACT_ADD_DEVICE_TO_RESOLVING_LIST,
|
||||
BTC_GAP_BLE_ACT_VENDOR_HCI_CMD_EVT,
|
||||
BTC_GAP_BLE_SET_PRIVACY_MODE,
|
||||
BTC_GAP_BLE_SET_CSA_SUPPORT,
|
||||
BTC_GAP_BLE_ACT_SET_VENDOR_EVT_MASK,
|
||||
#endif // #if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
BTC_GAP_BLE_ACT_SET_RESOLVABLE_PRIVATE_ADDRESS_TIMEOUT,
|
||||
BTC_GAP_BLE_ACT_ADD_DEVICE_TO_RESOLVING_LIST,
|
||||
BTC_GAP_BLE_SET_PRIVACY_MODE,
|
||||
#if (BLE_FEAT_POWER_CONTROL_EN == TRUE)
|
||||
BTC_GAP_BLE_ENH_READ_TRANS_POWER_LEVEL,
|
||||
BTC_GAP_BLE_READ_REM_TRANS_POWER_LEVEL,
|
||||
|
@ -364,6 +364,12 @@
|
||||
#define UC_BT_BLE_FEAT_CONN_SUBRATING FALSE
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_BLE_VENDOR_HCI_EN
|
||||
#define UC_BT_BLE_VENDOR_HCI_EN CONFIG_BT_BLE_VENDOR_HCI_EN
|
||||
#else
|
||||
#define UC_BT_BLE_VENDOR_HCI_EN 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
|
||||
|
@ -415,6 +415,12 @@
|
||||
#define BLE_FEAT_CONN_SUBRATING FALSE
|
||||
#endif
|
||||
|
||||
#if (UC_BT_BLE_VENDOR_HCI_EN == TRUE)
|
||||
#define BLE_VENDOR_HCI_EN TRUE
|
||||
#else
|
||||
#define BLE_VENDOR_HCI_EN FALSE
|
||||
#endif
|
||||
|
||||
#if (UC_BT_BLE_HIGH_DUTY_ADV_INTERVAL == TRUE)
|
||||
#define BLE_HIGH_DUTY_ADV_INTERVAL TRUE
|
||||
#else
|
||||
|
@ -72,7 +72,9 @@ static tBTM_BLE_CTRL_FEATURES_CBACK *p_ctrl_le_feature_rd_cmpl_cback = NULL;
|
||||
|
||||
tBTM_CallbackFunc conn_callback_func;
|
||||
// BLE vendor HCI event callback
|
||||
#if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
static tBTM_BLE_VENDOR_HCI_EVT_CBACK *ble_vs_evt_callback = NULL;
|
||||
#endif // #if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
/*******************************************************************************
|
||||
** Local functions
|
||||
*******************************************************************************/
|
||||
@ -353,10 +355,12 @@ void BTM_BleRegiseterPktLengthChangeCallback(tBTM_SET_PKT_DATA_LENGTH_CBACK *ptk
|
||||
conn_callback_func.set_pkt_data_length_cb = ptk_len_chane_cb;
|
||||
}
|
||||
|
||||
#if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
void BTM_BleRegisterVendorHciEventCallback(tBTM_BLE_VENDOR_HCI_EVT_CBACK *vendor_hci_evt_cb)
|
||||
{
|
||||
ble_vs_evt_callback = vendor_hci_evt_cb;
|
||||
}
|
||||
#endif // #if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -4548,6 +4552,7 @@ BOOLEAN btm_ble_update_mode_operation(UINT8 link_role, BD_ADDR bd_addr, UINT8 st
|
||||
return bg_con;
|
||||
}
|
||||
|
||||
#if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
static void btm_ble_vs_evt_callback(UINT8 len, UINT8 *p)
|
||||
{
|
||||
UINT8 sub_event;
|
||||
@ -4559,7 +4564,7 @@ static void btm_ble_vs_evt_callback(UINT8 len, UINT8 *p)
|
||||
STREAM_TO_UINT8(sub_event, p);
|
||||
len--;
|
||||
|
||||
if (sub_event < HCI_VSE_LE_LEGACY_SCAN_REQ_RECEIVED_EVT) {
|
||||
if (sub_event < HCI_VSE_LE_SUBEVT_BASE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4567,6 +4572,7 @@ static void btm_ble_vs_evt_callback(UINT8 len, UINT8 *p)
|
||||
ble_vs_evt_callback(sub_event, len, p);
|
||||
}
|
||||
}
|
||||
#endif // #if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@ -4626,8 +4632,9 @@ void btm_ble_init (void)
|
||||
btm_ble_adv_filter_init();
|
||||
#endif // #if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
|
||||
#endif
|
||||
|
||||
#if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
BTM_RegisterForVSEvents(btm_ble_vs_evt_callback, TRUE);
|
||||
#endif // #if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@ -4754,6 +4761,7 @@ BOOLEAN BTM_Ble_Authorization(BD_ADDR bd_addr, BOOLEAN authorize)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_BleClearAdv
|
||||
@ -4775,6 +4783,30 @@ BOOLEAN BTM_BleClearAdv(tBTM_CLEAR_ADV_CMPL_CBACK *p_clear_adv_cback)
|
||||
p_cb->inq_var.p_clear_adv_cb = p_clear_adv_cback;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOLEAN BTM_BleSetCsaSupport(UINT8 csa_select, tBTM_SET_CSA_SUPPORT_CMPL_CBACK *p_callback)
|
||||
{
|
||||
if (btsnd_hcic_ble_set_csa_support(csa_select) != TRUE) {
|
||||
BTM_TRACE_ERROR("LE SetCsaSupport csa_select=%d: error", csa_select);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
btm_cb.ble_ctr_cb.set_csa_support_cmpl_cb = p_callback;
|
||||
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;
|
||||
}
|
||||
#endif // #if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
|
||||
BOOLEAN BTM_BleSetRpaTimeout(uint16_t rpa_timeout,tBTM_SET_RPA_TIMEOUT_CMPL_CBACK *p_set_rpa_timeout_cback)
|
||||
{
|
||||
if ((btsnd_hcic_ble_set_rand_priv_addr_timeout(rpa_timeout)) != TRUE) {
|
||||
@ -4810,28 +4842,6 @@ BOOLEAN BTM_BleSetPrivacyMode(UINT8 addr_type, BD_ADDR bd_addr, UINT8 privacy_mo
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOLEAN BTM_BleSetCsaSupport(UINT8 csa_select, tBTM_SET_CSA_SUPPORT_CMPL_CBACK *p_callback)
|
||||
{
|
||||
if (btsnd_hcic_ble_set_csa_support(csa_select) != TRUE) {
|
||||
BTM_TRACE_ERROR("LE SetCsaSupport csa_select=%d: error", csa_select);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
btm_cb.ble_ctr_cb.set_csa_support_cmpl_cb = p_callback;
|
||||
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)
|
||||
bool btm_ble_adv_pkt_ready(void)
|
||||
{
|
||||
|
@ -1088,27 +1088,6 @@ BOOLEAN btsnd_hcic_ble_set_channels (BLE_CHANNELS channels)
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_clear_adv (void)
|
||||
{
|
||||
BT_HDR *p;
|
||||
UINT8 *pp;
|
||||
|
||||
if ((p = HCI_GET_CMD_BUF (HCIC_PARAM_SIZE_BLE_CLEAR_ADV)) == NULL) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
pp = (UINT8 *)(p + 1);
|
||||
|
||||
p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_CLEAR_ADV;
|
||||
p->offset = 0;
|
||||
|
||||
UINT16_TO_STREAM (pp, HCI_VENDOR_BLE_CLEAR_ADV);
|
||||
UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_BLE_CLEAR_ADV);
|
||||
|
||||
btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#define HCIC_BLE_CMD_CREATED(p, pp, size) do{\
|
||||
if ((p = HCI_GET_CMD_BUF(size)) == NULL) { \
|
||||
return FALSE; \
|
||||
@ -1948,6 +1927,28 @@ BOOLEAN btsnd_hcic_ble_set_privacy_mode(UINT8 addr_type, BD_ADDR addr, UINT8 pri
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
#if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
BOOLEAN btsnd_hcic_ble_clear_adv (void)
|
||||
{
|
||||
BT_HDR *p;
|
||||
UINT8 *pp;
|
||||
|
||||
if ((p = HCI_GET_CMD_BUF (HCIC_PARAM_SIZE_BLE_CLEAR_ADV)) == NULL) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
pp = (UINT8 *)(p + 1);
|
||||
|
||||
p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_CLEAR_ADV;
|
||||
p->offset = 0;
|
||||
|
||||
UINT16_TO_STREAM (pp, HCI_VENDOR_BLE_CLEAR_ADV);
|
||||
UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_BLE_CLEAR_ADV);
|
||||
|
||||
btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOLEAN btsnd_hcic_ble_set_csa_support (UINT8 csa_select)
|
||||
{
|
||||
BT_HDR *p;
|
||||
@ -1991,6 +1992,7 @@ BOOLEAN btsnd_hcic_ble_set_vendor_evt_mask (UINT32 evt_mask)
|
||||
btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
|
||||
return TRUE;
|
||||
}
|
||||
#endif // #if (BLE_VENDOR_HCI_EN == TRUE)
|
||||
#endif
|
||||
|
||||
#if (BLE_FEAT_ISO_EN == TRUE)
|
||||
|
@ -927,9 +927,9 @@
|
||||
#define HCI_VENDOR_CH_CLASSIFICATION_EVT_SUBCODE 0x06
|
||||
#define HCI_VENDOR_CH_CLASSIFICATION_REPORTING_MODE_EVT_SUBCODE 0x07
|
||||
|
||||
#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_VENDOR_SPECIFIC_EVT 0xFF /* Vendor specific events */
|
||||
#define HCI_VSE_LE_SUBEVT_BASE 0xC0 /* BLE vendor event code base */
|
||||
#define HCI_VSE_LE_EVT_MAX 0xFF /* BLE vendor event code max */
|
||||
#define HCI_NAP_TRACE_EVT 0xFF /* was define 0xFE, 0xFD, change to 0xFF
|
||||
because conflict w/ TCI_EVT and per
|
||||
specification compliant */
|
||||
|
Reference in New Issue
Block a user