mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Component/bt: add update duplicate scan exceptional list APIs
This commit is contained in:
parent
783ff9c455
commit
dd3d89db49
@ -449,6 +449,69 @@ esp_err_t esp_ble_gap_config_scan_rsp_data_raw(uint8_t *raw_data, uint32_t raw_d
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
esp_err_t esp_ble_gap_add_duplicate_scan_exceptional_device(esp_ble_duplicate_exceptional_info_type_t type, esp_duplicate_info_t device_info)
|
||||||
|
{
|
||||||
|
btc_msg_t msg;
|
||||||
|
btc_ble_gap_args_t arg;
|
||||||
|
|
||||||
|
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||||
|
return ESP_ERR_INVALID_STATE;
|
||||||
|
}
|
||||||
|
if (!device_info){
|
||||||
|
return ESP_ERR_INVALID_SIZE;
|
||||||
|
}
|
||||||
|
msg.sig = BTC_SIG_API_CALL;
|
||||||
|
msg.pid = BTC_PID_GAP_BLE;
|
||||||
|
msg.act = BTC_GAP_BLE_UPDATE_DUPLICATE_SCAN_EXCEPTIONAL_LIST;
|
||||||
|
arg.update_duplicate_exceptional_list.subcode = ESP_BLE_DUPLICATE_EXCEPTIONAL_LIST_ADD;
|
||||||
|
arg.update_duplicate_exceptional_list.info_type = type;
|
||||||
|
memcpy(arg.update_duplicate_exceptional_list.device_info, device_info, sizeof(esp_bd_addr_t));
|
||||||
|
|
||||||
|
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL)
|
||||||
|
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_err_t esp_ble_gap_remove_duplicate_scan_exceptional_device(esp_ble_duplicate_exceptional_info_type_t type, esp_duplicate_info_t device_info)
|
||||||
|
{
|
||||||
|
btc_msg_t msg;
|
||||||
|
btc_ble_gap_args_t arg;
|
||||||
|
|
||||||
|
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||||
|
return ESP_ERR_INVALID_STATE;
|
||||||
|
}
|
||||||
|
if (!device_info){
|
||||||
|
return ESP_ERR_INVALID_SIZE;
|
||||||
|
}
|
||||||
|
msg.sig = BTC_SIG_API_CALL;
|
||||||
|
msg.pid = BTC_PID_GAP_BLE;
|
||||||
|
msg.act = BTC_GAP_BLE_UPDATE_DUPLICATE_SCAN_EXCEPTIONAL_LIST;
|
||||||
|
arg.update_duplicate_exceptional_list.subcode = ESP_BLE_DUPLICATE_EXCEPTIONAL_LIST_REMOVE;
|
||||||
|
arg.update_duplicate_exceptional_list.info_type = type;
|
||||||
|
memcpy(arg.update_duplicate_exceptional_list.device_info, device_info, sizeof(esp_bd_addr_t));
|
||||||
|
|
||||||
|
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL)
|
||||||
|
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_err_t esp_ble_gap_clean_duplicate_scan_exceptional_list(esp_duplicate_scan_exceptional_list_type_t list_type)
|
||||||
|
{
|
||||||
|
btc_msg_t msg;
|
||||||
|
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_UPDATE_DUPLICATE_SCAN_EXCEPTIONAL_LIST;
|
||||||
|
arg.update_duplicate_exceptional_list.subcode = ESP_BLE_DUPLICATE_EXCEPTIONAL_LIST_CLEAN;
|
||||||
|
arg.update_duplicate_exceptional_list.info_type = list_type;
|
||||||
|
|
||||||
|
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL)
|
||||||
|
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||||
|
}
|
||||||
|
|
||||||
#if (SMP_INCLUDED == TRUE)
|
#if (SMP_INCLUDED == TRUE)
|
||||||
esp_err_t esp_ble_gap_set_security_param(esp_ble_sm_param_t param_type,
|
esp_err_t esp_ble_gap_set_security_param(esp_ble_sm_param_t param_type,
|
||||||
void *value, uint8_t len)
|
void *value, uint8_t len)
|
||||||
|
@ -165,6 +165,7 @@ typedef enum {
|
|||||||
ESP_GAP_BLE_GET_BOND_DEV_COMPLETE_EVT, /*!< When get the bond device list complete, the event comes */
|
ESP_GAP_BLE_GET_BOND_DEV_COMPLETE_EVT, /*!< When get the bond device list complete, the event comes */
|
||||||
ESP_GAP_BLE_READ_RSSI_COMPLETE_EVT, /*!< When read the rssi complete, the event comes */
|
ESP_GAP_BLE_READ_RSSI_COMPLETE_EVT, /*!< When read the rssi complete, the event comes */
|
||||||
ESP_GAP_BLE_UPDATE_WHITELIST_COMPLETE_EVT, /*!< When add or remove whitelist complete, the event comes */
|
ESP_GAP_BLE_UPDATE_WHITELIST_COMPLETE_EVT, /*!< When add or remove whitelist complete, the event comes */
|
||||||
|
ESP_GAP_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_COMPLETE_EVT, /*!< When update duplicate exceptional list complete, the event comes */
|
||||||
ESP_GAP_BLE_EVT_MAX,
|
ESP_GAP_BLE_EVT_MAX,
|
||||||
} esp_gap_ble_cb_event_t;
|
} esp_gap_ble_cb_event_t;
|
||||||
/// This is the old name, just for backwards compatibility
|
/// This is the old name, just for backwards compatibility
|
||||||
@ -575,6 +576,28 @@ typedef enum{
|
|||||||
ESP_BLE_WHITELIST_REMOVE = 0X00, /*!< remove mac from whitelist */
|
ESP_BLE_WHITELIST_REMOVE = 0X00, /*!< remove mac from whitelist */
|
||||||
ESP_BLE_WHITELIST_ADD = 0X01, /*!< add address to whitelist */
|
ESP_BLE_WHITELIST_ADD = 0X01, /*!< add address to whitelist */
|
||||||
}esp_ble_wl_opration_t;
|
}esp_ble_wl_opration_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
ESP_BLE_DUPLICATE_EXCEPTIONAL_LIST_ADD = 0, /*!< Add device info into duplicate scan exceptional list */
|
||||||
|
ESP_BLE_DUPLICATE_EXCEPTIONAL_LIST_REMOVE, /*!< Remove device info from duplicate scan exceptional list */
|
||||||
|
ESP_BLE_DUPLICATE_EXCEPTIONAL_LIST_CLEAN, /*!< Clean duplicate scan exceptional list */
|
||||||
|
} esp_bt_duplicate_exceptional_subcode_type_t;
|
||||||
|
|
||||||
|
#define BLE_BIT(n) (1UL<<(n))
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_ADV_ADDR = 0, /*!< BLE advertising address , device info will be added into ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_ADDR_LIST */
|
||||||
|
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_LINK_ID, /*!< BLE mesh link ID, it is for BLE mesh, device info will be added into ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_LINK_ID_LIST */
|
||||||
|
} esp_ble_duplicate_exceptional_info_type_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_ADDR_LIST = BLE_BIT(0), /*!< duplicate scan exceptional addr list */
|
||||||
|
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_LINK_ID_LIST = BLE_BIT(1), /*!< duplicate scan exceptional mesh link ID list */
|
||||||
|
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_ALL_LIST = (BLE_BIT(0) | BLE_BIT(1)), /*!< duplicate scan exceptional all list */
|
||||||
|
} esp_duplicate_scan_exceptional_list_type_t;
|
||||||
|
|
||||||
|
typedef uint8_t esp_duplicate_info_t[ESP_BD_ADDR_LEN];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gap callback parameters union
|
* @brief Gap callback parameters union
|
||||||
*/
|
*/
|
||||||
@ -720,6 +743,15 @@ typedef union {
|
|||||||
esp_bt_status_t status; /*!< Indicate the add or remove whitelist operation success status */
|
esp_bt_status_t status; /*!< Indicate the add or remove whitelist operation success status */
|
||||||
esp_ble_wl_opration_t wl_opration; /*!< The value is ESP_BLE_WHITELIST_ADD if add address to whitelist operation success, ESP_BLE_WHITELIST_REMOVE if remove address from the whitelist operation success */
|
esp_ble_wl_opration_t wl_opration; /*!< The value is ESP_BLE_WHITELIST_ADD if add address to whitelist operation success, ESP_BLE_WHITELIST_REMOVE if remove address from the whitelist operation success */
|
||||||
} update_whitelist_cmpl; /*!< Event parameter of ESP_GAP_BLE_UPDATE_WHITELIST_COMPLETE_EVT */
|
} update_whitelist_cmpl; /*!< Event parameter of ESP_GAP_BLE_UPDATE_WHITELIST_COMPLETE_EVT */
|
||||||
|
/**
|
||||||
|
* @brief ESP_GAP_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_COMPLETE_EVT
|
||||||
|
*/
|
||||||
|
struct ble_update_duplicate_exceptional_list_cmpl_evt_param {
|
||||||
|
esp_bt_status_t status; /*!< Indicate update duplicate scan exceptional list operation success status */
|
||||||
|
uint8_t subcode; /*!< Define in esp_bt_duplicate_exceptional_subcode_type_t */
|
||||||
|
uint16_t length; /*!< The length of device_info */
|
||||||
|
esp_duplicate_info_t device_info; /*!< device information, when subcode is ESP_BLE_DUPLICATE_EXCEPTIONAL_LIST_CLEAN, the value is invalid */
|
||||||
|
} update_duplicate_exceptional_list_cmpl; /*!< Event parameter of ESP_GAP_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_COMPLETE_EVT */
|
||||||
} esp_ble_gap_cb_param_t;
|
} esp_ble_gap_cb_param_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1012,6 +1044,43 @@ esp_err_t esp_ble_gap_config_scan_rsp_data_raw(uint8_t *raw_data, uint32_t raw_d
|
|||||||
*/
|
*/
|
||||||
esp_err_t esp_ble_gap_read_rssi(esp_bd_addr_t remote_addr);
|
esp_err_t esp_ble_gap_read_rssi(esp_bd_addr_t remote_addr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function is called to add a device info into the duplicate scan exceptional list.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param[in] type: device info type, it is defined in esp_ble_duplicate_exceptional_info_type_t
|
||||||
|
* @param[in] device_info: the device information.
|
||||||
|
* @return
|
||||||
|
* - ESP_OK : success
|
||||||
|
* - other : failed
|
||||||
|
*/
|
||||||
|
esp_err_t esp_ble_gap_add_duplicate_scan_exceptional_device(esp_ble_duplicate_exceptional_info_type_t type, esp_duplicate_info_t device_info);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function is called to remove a device info from the duplicate scan exceptional list.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param[in] type: device info type, it is defined in esp_ble_duplicate_exceptional_info_type_t
|
||||||
|
* @param[in] device_info: the device information.
|
||||||
|
* @return
|
||||||
|
* - ESP_OK : success
|
||||||
|
* - other : failed
|
||||||
|
*/
|
||||||
|
esp_err_t esp_ble_gap_remove_duplicate_scan_exceptional_device(esp_ble_duplicate_exceptional_info_type_t type, esp_duplicate_info_t device_info);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function is called to clean the duplicate scan exceptional list.
|
||||||
|
* This API will delete all device information in the duplicate scan exceptional list.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param[in] list_type: duplicate scan exceptional list type, the value can be one or more of esp_duplicate_scan_exceptional_list_type_t.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - ESP_OK : success
|
||||||
|
* - other : failed
|
||||||
|
*/
|
||||||
|
esp_err_t esp_ble_gap_clean_duplicate_scan_exceptional_list(esp_duplicate_scan_exceptional_list_type_t list_type);
|
||||||
|
|
||||||
#if (SMP_INCLUDED == TRUE)
|
#if (SMP_INCLUDED == TRUE)
|
||||||
/**
|
/**
|
||||||
* @brief Set a GAP security parameter value. Overrides the default value.
|
* @brief Set a GAP security parameter value. Overrides the default value.
|
||||||
|
@ -4905,6 +4905,22 @@ void bta_dm_ble_set_adv_params_all (tBTA_DM_MSG *p_data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
** Function bta_dm_ble_update_duplicate_exceptional_list
|
||||||
|
**
|
||||||
|
** Description This function is to update duplicate scan exceptional list
|
||||||
|
**
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
void bta_dm_ble_update_duplicate_exceptional_list(tBTA_DM_MSG *p_data)
|
||||||
|
{
|
||||||
|
BTM_UpdateBleDuplicateExceptionalList(p_data->ble_duplicate_exceptional_list.subcode,
|
||||||
|
p_data->ble_duplicate_exceptional_list.type,
|
||||||
|
p_data->ble_duplicate_exceptional_list.device_info,
|
||||||
|
p_data->ble_duplicate_exceptional_list.exceptional_list_cb);
|
||||||
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
** Function bta_dm_ble_set_adv_config
|
** Function bta_dm_ble_set_adv_config
|
||||||
|
@ -1315,6 +1315,34 @@ void BTA_DmBleSetScanRspRaw (UINT8 *p_raw_scan_rsp, UINT32 raw_scan_rsp_len,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
** Function BTA_DmUpdateDuplicateExceptionalList
|
||||||
|
**
|
||||||
|
** Description This function is called to update duplicate scan exceptional list
|
||||||
|
**
|
||||||
|
** Parameters subcode : add, remove or clean duplicate scan exceptional list.
|
||||||
|
** type : device info type.
|
||||||
|
** device_info: device info
|
||||||
|
** p_update_duplicate_ignore_list_cback : update complete callback.
|
||||||
|
**
|
||||||
|
** Returns None
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
void BTA_DmUpdateDuplicateExceptionalList(UINT8 subcode, UINT32 type, BD_ADDR device_info, tBTA_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK p_update_duplicate_exceptional_list_cback)
|
||||||
|
{
|
||||||
|
tBTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST *p_msg;
|
||||||
|
if ((p_msg = (tBTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST *)osi_malloc(sizeof(tBTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST))) != NULL) {
|
||||||
|
p_msg->hdr.event = BTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_EVT;
|
||||||
|
p_msg->subcode = subcode;
|
||||||
|
p_msg->type = type;
|
||||||
|
p_msg->exceptional_list_cb = p_update_duplicate_exceptional_list_cback;
|
||||||
|
memcpy(p_msg->device_info, device_info, sizeof(BD_ADDR));
|
||||||
|
|
||||||
|
bta_sys_sendmsg(p_msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
** Function BTA_DmBleSetStorageParams
|
** Function BTA_DmBleSetStorageParams
|
||||||
|
@ -159,6 +159,7 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
|
|||||||
bta_dm_update_white_list, /* BTA_DM_API_UPDATE_WHITE_LIST_EVT */
|
bta_dm_update_white_list, /* BTA_DM_API_UPDATE_WHITE_LIST_EVT */
|
||||||
bta_dm_ble_read_adv_tx_power, /* BTA_DM_API_BLE_READ_ADV_TX_POWER_EVT */
|
bta_dm_ble_read_adv_tx_power, /* BTA_DM_API_BLE_READ_ADV_TX_POWER_EVT */
|
||||||
bta_dm_ble_read_rssi, /* BTA_DM_API_BLE_READ_RSSI_EVT */
|
bta_dm_ble_read_rssi, /* BTA_DM_API_BLE_READ_RSSI_EVT */
|
||||||
|
bta_dm_ble_update_duplicate_exceptional_list,/* BTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_EVT */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -156,6 +156,7 @@ enum {
|
|||||||
BTA_DM_API_UPDATE_WHITE_LIST_EVT,
|
BTA_DM_API_UPDATE_WHITE_LIST_EVT,
|
||||||
BTA_DM_API_BLE_READ_ADV_TX_POWER_EVT,
|
BTA_DM_API_BLE_READ_ADV_TX_POWER_EVT,
|
||||||
BTA_DM_API_BLE_READ_RSSI_EVT,
|
BTA_DM_API_BLE_READ_RSSI_EVT,
|
||||||
|
BTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_EVT,
|
||||||
BTA_DM_MAX_EVT
|
BTA_DM_MAX_EVT
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -194,6 +195,14 @@ typedef struct {
|
|||||||
tBTA_ADD_WHITELIST_CBACK *add_wl_cb;
|
tBTA_ADD_WHITELIST_CBACK *add_wl_cb;
|
||||||
}tBTA_DM_API_UPDATE_WHITE_LIST;
|
}tBTA_DM_API_UPDATE_WHITE_LIST;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
BT_HDR hdr;
|
||||||
|
UINT8 subcode;
|
||||||
|
UINT32 type;
|
||||||
|
BD_ADDR device_info;
|
||||||
|
tBTA_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK *exceptional_list_cb;
|
||||||
|
}tBTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
BT_HDR hdr;
|
BT_HDR hdr;
|
||||||
tBTA_CMPL_CB *read_tx_power_cb;
|
tBTA_CMPL_CB *read_tx_power_cb;
|
||||||
@ -865,6 +874,7 @@ typedef union {
|
|||||||
tBTA_DM_API_TRACK_ADVERTISER ble_track_advert;
|
tBTA_DM_API_TRACK_ADVERTISER ble_track_advert;
|
||||||
tBTA_DM_API_ENERGY_INFO ble_energy_info;
|
tBTA_DM_API_ENERGY_INFO ble_energy_info;
|
||||||
tBTA_DM_API_BLE_DISCONNECT ble_disconnect;
|
tBTA_DM_API_BLE_DISCONNECT ble_disconnect;
|
||||||
|
tBTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST ble_duplicate_exceptional_list;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tBTA_DM_API_REMOVE_ACL remove_acl;
|
tBTA_DM_API_REMOVE_ACL remove_acl;
|
||||||
@ -1261,7 +1271,7 @@ extern void bta_dm_ble_set_scan_rsp (tBTA_DM_MSG *p_data);
|
|||||||
extern void bta_dm_ble_set_scan_rsp_raw (tBTA_DM_MSG *p_data);
|
extern void bta_dm_ble_set_scan_rsp_raw (tBTA_DM_MSG *p_data);
|
||||||
extern void bta_dm_ble_broadcast (tBTA_DM_MSG *p_data);
|
extern void bta_dm_ble_broadcast (tBTA_DM_MSG *p_data);
|
||||||
extern void bta_dm_ble_set_data_length(tBTA_DM_MSG *p_data);
|
extern void bta_dm_ble_set_data_length(tBTA_DM_MSG *p_data);
|
||||||
|
extern void bta_dm_ble_update_duplicate_exceptional_list(tBTA_DM_MSG *p_data);
|
||||||
#if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
|
#if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
|
||||||
extern void bta_dm_cfg_filter_cond (tBTA_DM_MSG *p_data);
|
extern void bta_dm_cfg_filter_cond (tBTA_DM_MSG *p_data);
|
||||||
extern void bta_dm_scan_filter_param_setup (tBTA_DM_MSG *p_data);
|
extern void bta_dm_scan_filter_param_setup (tBTA_DM_MSG *p_data);
|
||||||
|
@ -399,6 +399,8 @@ typedef struct {
|
|||||||
UINT8 tx_power;
|
UINT8 tx_power;
|
||||||
} tBTA_BLE_ADV_DATA;
|
} tBTA_BLE_ADV_DATA;
|
||||||
|
|
||||||
|
typedef void (tBTA_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK) (tBTA_STATUS status, uint8_t subcode, uint32_t length, uint8_t *device_info);
|
||||||
|
|
||||||
typedef void (tBTA_SET_ADV_DATA_CMPL_CBACK) (tBTA_STATUS status);
|
typedef void (tBTA_SET_ADV_DATA_CMPL_CBACK) (tBTA_STATUS status);
|
||||||
|
|
||||||
typedef tBTM_START_ADV_CMPL_CBACK tBTA_START_ADV_CMPL_CBACK;
|
typedef tBTM_START_ADV_CMPL_CBACK tBTA_START_ADV_CMPL_CBACK;
|
||||||
@ -2268,6 +2270,24 @@ extern void BTA_DmBleSetScanRsp (tBTA_BLE_AD_MASK data_mask,
|
|||||||
extern void BTA_DmBleSetScanRspRaw (UINT8 *p_raw_scan_rsp, UINT32 raw_scan_rsp_len,
|
extern void BTA_DmBleSetScanRspRaw (UINT8 *p_raw_scan_rsp, UINT32 raw_scan_rsp_len,
|
||||||
tBTA_SET_ADV_DATA_CMPL_CBACK *p_scan_rsp_data_cback);
|
tBTA_SET_ADV_DATA_CMPL_CBACK *p_scan_rsp_data_cback);
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
** Function BTA_DmUpdateDuplicateExceptionalList
|
||||||
|
**
|
||||||
|
** Description This function is called to update duplicate scan exceptional list
|
||||||
|
**
|
||||||
|
** Parameters subcode : add, remove or clean duplicate scan exceptional list.
|
||||||
|
** type : device info type.
|
||||||
|
** device_info: device info
|
||||||
|
** p_update_duplicate_ignore_list_cback : update complete callback.
|
||||||
|
**
|
||||||
|
** Returns None
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
extern void BTA_DmUpdateDuplicateExceptionalList(UINT8 subcode, UINT32 type,
|
||||||
|
BD_ADDR device_info,
|
||||||
|
tBTA_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK p_update_duplicate_exceptional_list_cback);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
** Function BTA_DmBleBroadcast
|
** Function BTA_DmBleBroadcast
|
||||||
|
@ -426,6 +426,35 @@ static void btc_stop_adv_callback(uint8_t status)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void btc_update_duplicate_exceptional_list_callback(tBTA_STATUS status, uint8_t subcode, uint32_t length, uint8_t *device_info)
|
||||||
|
{
|
||||||
|
esp_ble_gap_cb_param_t param;
|
||||||
|
bt_status_t ret;
|
||||||
|
btc_msg_t msg;
|
||||||
|
|
||||||
|
msg.sig = BTC_SIG_API_CB;
|
||||||
|
msg.pid = BTC_PID_GAP_BLE;
|
||||||
|
msg.act = ESP_GAP_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_COMPLETE_EVT;
|
||||||
|
param.update_duplicate_exceptional_list_cmpl.status = status;
|
||||||
|
param.update_duplicate_exceptional_list_cmpl.subcode = subcode;
|
||||||
|
if(length > sizeof(param.update_duplicate_exceptional_list_cmpl.device_info)) {
|
||||||
|
length = sizeof(param.update_duplicate_exceptional_list_cmpl.device_info);
|
||||||
|
}
|
||||||
|
param.update_duplicate_exceptional_list_cmpl.length = length;
|
||||||
|
memcpy(param.update_duplicate_exceptional_list_cmpl.device_info, device_info, length);
|
||||||
|
ret = btc_transfer_context(&msg, ¶m, sizeof(esp_ble_gap_cb_param_t), NULL);
|
||||||
|
|
||||||
|
if (ret != BT_STATUS_SUCCESS) {
|
||||||
|
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void btc_ble_update_duplicate_exceptional_list(uint8_t subcode, uint32_t info_type, BD_ADDR device_info,
|
||||||
|
tBTA_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK p_update_duplicate_ignore_list_cback)
|
||||||
|
{
|
||||||
|
BTA_DmUpdateDuplicateExceptionalList(subcode, info_type, device_info, p_update_duplicate_ignore_list_cback);
|
||||||
|
}
|
||||||
|
|
||||||
static void btc_ble_start_advertising (esp_ble_adv_params_t *ble_adv_params, tBTA_START_ADV_CMPL_CBACK start_adv_cback)
|
static void btc_ble_start_advertising (esp_ble_adv_params_t *ble_adv_params, tBTA_START_ADV_CMPL_CBACK start_adv_cback)
|
||||||
{
|
{
|
||||||
tBLE_BD_ADDR peer_addr;
|
tBLE_BD_ADDR peer_addr;
|
||||||
@ -1108,6 +1137,12 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
|
|||||||
arg->cfg_scan_rsp_data_raw.raw_scan_rsp_len,
|
arg->cfg_scan_rsp_data_raw.raw_scan_rsp_len,
|
||||||
btc_scan_rsp_data_raw_callback);
|
btc_scan_rsp_data_raw_callback);
|
||||||
break;
|
break;
|
||||||
|
case BTC_GAP_BLE_UPDATE_DUPLICATE_SCAN_EXCEPTIONAL_LIST:
|
||||||
|
btc_ble_update_duplicate_exceptional_list(arg->update_duplicate_exceptional_list.subcode,
|
||||||
|
arg->update_duplicate_exceptional_list.info_type,
|
||||||
|
arg->update_duplicate_exceptional_list.device_info,
|
||||||
|
btc_update_duplicate_exceptional_list_callback);
|
||||||
|
break;
|
||||||
#if (SMP_INCLUDED == TRUE)
|
#if (SMP_INCLUDED == TRUE)
|
||||||
case BTC_GAP_BLE_SET_ENCRYPTION_EVT: {
|
case BTC_GAP_BLE_SET_ENCRYPTION_EVT: {
|
||||||
BD_ADDR bd_addr;
|
BD_ADDR bd_addr;
|
||||||
|
@ -47,6 +47,7 @@ typedef enum {
|
|||||||
BTC_GAP_BLE_DISCONNECT_EVT,
|
BTC_GAP_BLE_DISCONNECT_EVT,
|
||||||
BTC_GAP_BLE_REMOVE_BOND_DEV_EVT,
|
BTC_GAP_BLE_REMOVE_BOND_DEV_EVT,
|
||||||
BTC_GAP_BLE_OOB_REQ_REPLY_EVT,
|
BTC_GAP_BLE_OOB_REQ_REPLY_EVT,
|
||||||
|
BTC_GAP_BLE_UPDATE_DUPLICATE_SCAN_EXCEPTIONAL_LIST,
|
||||||
} btc_gap_ble_act_t;
|
} btc_gap_ble_act_t;
|
||||||
|
|
||||||
/* btc_ble_gap_args_t */
|
/* btc_ble_gap_args_t */
|
||||||
@ -95,6 +96,12 @@ typedef union {
|
|||||||
bool add_remove;
|
bool add_remove;
|
||||||
esp_bd_addr_t remote_bda;
|
esp_bd_addr_t remote_bda;
|
||||||
}update_white_list;
|
}update_white_list;
|
||||||
|
//BTC_GAP_BLE_UPDATE_DUPLICATE_SCAN_EXCEPTIONAL_LIST
|
||||||
|
struct update_duplicate_exceptional_list_args {
|
||||||
|
uint8_t subcode;
|
||||||
|
uint32_t info_type;
|
||||||
|
esp_duplicate_info_t device_info;
|
||||||
|
}update_duplicate_exceptional_list;
|
||||||
//BTC_GAP_BLE_ACT_SET_CONN_PARAMS
|
//BTC_GAP_BLE_ACT_SET_CONN_PARAMS
|
||||||
struct set_conn_params_args {
|
struct set_conn_params_args {
|
||||||
esp_bd_addr_t bd_addr;
|
esp_bd_addr_t bd_addr;
|
||||||
|
@ -1695,6 +1695,52 @@ tBTM_STATUS BTM_BleWriteScanRspRaw(UINT8 *p_raw_scan_rsp, UINT32 raw_scan_rsp_le
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
** Function BTM_UpdateBleDuplicateExceptionalList
|
||||||
|
**
|
||||||
|
** Description This function is called to update duplicate scan exceptional list.
|
||||||
|
**
|
||||||
|
** Parameters: subcode: add, remove or clean duplicate scan exceptional list.
|
||||||
|
** type: device info type
|
||||||
|
** device_info: device information
|
||||||
|
** update_exceptional_list_cmp_cb: complete callback
|
||||||
|
**
|
||||||
|
** Returns status
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
tBTM_STATUS BTM_UpdateBleDuplicateExceptionalList(uint8_t subcode, uint32_t type, BD_ADDR device_info,
|
||||||
|
tBTM_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK update_exceptional_list_cmp_cb)
|
||||||
|
{
|
||||||
|
tBTM_BLE_CB *ble_cb = &btm_cb.ble_ctr_cb;
|
||||||
|
ble_cb->update_exceptional_list_cmp_cb = update_exceptional_list_cmp_cb;
|
||||||
|
tBTM_STATUS status = BTM_NO_RESOURCES;
|
||||||
|
if (!controller_get_interface()->supports_ble()) {
|
||||||
|
return BTM_ILLEGAL_VALUE;
|
||||||
|
}
|
||||||
|
if(!device_info) {
|
||||||
|
return BTM_ILLEGAL_VALUE;
|
||||||
|
}
|
||||||
|
// subcoe + type + device info
|
||||||
|
uint8_t device_info_array[1 + 4 + BD_ADDR_LEN] = {0};
|
||||||
|
device_info_array[0] = subcode;
|
||||||
|
device_info_array[1] = type & 0xff;
|
||||||
|
device_info_array[2] = (type >> 8) & 0xff;
|
||||||
|
device_info_array[3] = (type >> 16) & 0xff;
|
||||||
|
device_info_array[4] = (type >> 24) & 0xff;
|
||||||
|
if(type == BTM_DUPLICATE_SCAN_EXCEPTIONAL_INFO_ADV_ADDR) {
|
||||||
|
bt_rcopy(&device_info_array[5], device_info, BD_ADDR_LEN);
|
||||||
|
} else {
|
||||||
|
memcpy(&device_info_array[5], device_info, 4);
|
||||||
|
}
|
||||||
|
status = BTM_VendorSpecificCommand(HCI_VENDOR_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST, 1 + 4 + BD_ADDR_LEN, device_info_array, NULL);
|
||||||
|
if(status == BTM_CMD_STARTED) {
|
||||||
|
status = BTM_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
** Function BTM_BleWriteAdvData
|
** Function BTM_BleWriteAdvData
|
||||||
|
@ -689,10 +689,21 @@ tBTM_STATUS BTM_VendorSpecificCommand(UINT16 opcode, UINT8 param_len,
|
|||||||
void btm_vsc_complete (UINT8 *p, UINT16 opcode, UINT16 evt_len,
|
void btm_vsc_complete (UINT8 *p, UINT16 opcode, UINT16 evt_len,
|
||||||
tBTM_CMPL_CB *p_vsc_cplt_cback)
|
tBTM_CMPL_CB *p_vsc_cplt_cback)
|
||||||
{
|
{
|
||||||
|
tBTM_BLE_CB *ble_cb = &btm_cb.ble_ctr_cb;
|
||||||
switch(opcode) {
|
switch(opcode) {
|
||||||
case HCI_VENDOR_BLE_LONG_ADV_DATA:
|
case HCI_VENDOR_BLE_LONG_ADV_DATA:
|
||||||
BTM_TRACE_EVENT("Set long adv data complete\n");
|
BTM_TRACE_EVENT("Set long adv data complete\n");
|
||||||
break;
|
break;
|
||||||
|
case HCI_VENDOR_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST: {
|
||||||
|
uint8_t subcode, status; uint32_t length;
|
||||||
|
STREAM_TO_UINT8(status, p);
|
||||||
|
STREAM_TO_UINT8(subcode, p);
|
||||||
|
STREAM_TO_UINT32(length, p);
|
||||||
|
if(ble_cb && ble_cb->update_exceptional_list_cmp_cb) {
|
||||||
|
(*ble_cb->update_exceptional_list_cmp_cb)(status, subcode, length, p);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -279,6 +279,9 @@ typedef UINT16 tBTM_BLE_STATE_MASK;
|
|||||||
#define BTM_LE_RESOLVING_LIST_MAX 0x20
|
#define BTM_LE_RESOLVING_LIST_MAX 0x20
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define BTM_DUPLICATE_SCAN_EXCEPTIONAL_INFO_ADV_ADDR 0
|
||||||
|
#define BTM_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_LINK_ID 1
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
BD_ADDR *resolve_q_random_pseudo;
|
BD_ADDR *resolve_q_random_pseudo;
|
||||||
UINT8 *resolve_q_action;
|
UINT8 *resolve_q_action;
|
||||||
@ -356,6 +359,7 @@ typedef struct {
|
|||||||
/* current BLE link state */
|
/* current BLE link state */
|
||||||
tBTM_BLE_STATE_MASK cur_states; /* bit mask of tBTM_BLE_STATE */
|
tBTM_BLE_STATE_MASK cur_states; /* bit mask of tBTM_BLE_STATE */
|
||||||
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_BLE_CB;
|
} tBTM_BLE_CB;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -790,4 +790,22 @@ static inline void bdsetany(BD_ADDR a)
|
|||||||
{
|
{
|
||||||
bdcpy(a, bd_addr_any);
|
bdcpy(a, bd_addr_any);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
** Function bt_rcopy
|
||||||
|
**
|
||||||
|
** Description memory reverse and copy.
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** Returns void
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
static inline void bt_rcopy(UINT8 *dst, UINT8 const *src, UINT16 len)
|
||||||
|
{
|
||||||
|
src += len;
|
||||||
|
while (len --) {
|
||||||
|
*dst++ = *--src;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -869,6 +869,7 @@ tBTM_BLE_SCAN_SETUP_CBACK bta_ble_scan_setup_cb;
|
|||||||
typedef void (tBTM_START_ADV_CMPL_CBACK) (UINT8 status);
|
typedef void (tBTM_START_ADV_CMPL_CBACK) (UINT8 status);
|
||||||
typedef void (tBTM_START_STOP_ADV_CMPL_CBACK) (UINT8 status);
|
typedef void (tBTM_START_STOP_ADV_CMPL_CBACK) (UINT8 status);
|
||||||
|
|
||||||
|
typedef void (tBTM_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK) (tBTM_STATUS status, uint8_t subcode, uint32_t length, uint8_t *device_info);
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
@ -2081,6 +2082,22 @@ tBTM_STATUS BTM_BleGetEnergyInfo(tBTM_BLE_ENERGY_INFO_CBACK *p_ener_cback);
|
|||||||
//extern
|
//extern
|
||||||
tBTM_STATUS BTM_SetBleDataLength(BD_ADDR bd_addr, UINT16 tx_pdu_length);
|
tBTM_STATUS BTM_SetBleDataLength(BD_ADDR bd_addr, UINT16 tx_pdu_length);
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
** Function BTM_UpdateBleDuplicateExceptionalList
|
||||||
|
**
|
||||||
|
** Description This function is called to update duplicate scan exceptional list.
|
||||||
|
**
|
||||||
|
** Parameters: subcode: add, remove or clean duplicate scan exceptional list.
|
||||||
|
** type: device info type
|
||||||
|
** device_info: device information
|
||||||
|
** update_exceptional_list_cmp_cb: complete callback
|
||||||
|
**
|
||||||
|
** Returns status
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
tBTM_STATUS BTM_UpdateBleDuplicateExceptionalList(uint8_t subcode, uint32_t type, BD_ADDR device_info, tBTM_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK update_exceptional_list_cmp_cb);
|
||||||
/*
|
/*
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -367,15 +367,16 @@
|
|||||||
#define HCI_SUBCODE_COMMON_MAX 0x7F
|
#define HCI_SUBCODE_COMMON_MAX 0x7F
|
||||||
|
|
||||||
//ESP BLE subcode define
|
//ESP BLE subcode define
|
||||||
#define HCI_SUBCODE_BLE_INIT 0x00
|
#define HCI_SUBCODE_BLE_INIT 0x00
|
||||||
#define HCI_SUBCODE_BLE_MULTI_ADV 0x01
|
#define HCI_SUBCODE_BLE_MULTI_ADV 0x01
|
||||||
#define HCI_SUBCODE_BLE_BATCH_SCAN 0x02
|
#define HCI_SUBCODE_BLE_BATCH_SCAN 0x02
|
||||||
#define HCI_SUBCODE_BLE_ADV_FILTER 0x03
|
#define HCI_SUBCODE_BLE_ADV_FILTER 0x03
|
||||||
#define HCI_SUBCODE_BLE_TRACK_ADV 0x04
|
#define HCI_SUBCODE_BLE_TRACK_ADV 0x04
|
||||||
#define HCI_SUBCODE_BLE_ENERGY_INFO 0x05
|
#define HCI_SUBCODE_BLE_ENERGY_INFO 0x05
|
||||||
#define HCI_SUBCODE_BLE_EXTENDED_SCAN_PARAMS 0x06
|
#define HCI_SUBCODE_BLE_EXTENDED_SCAN_PARAMS 0x06
|
||||||
#define HCI_SUBCODE_BLE_LONG_ADV 0x07
|
#define HCI_SUBCODE_BLE_LONG_ADV 0x07
|
||||||
#define HCI_SUBCODE_BLE_MAX 0x7F
|
#define HCI_SUBCODE_BLE_DUPLICATE_EXCEPTIONAL_LIST 0x08
|
||||||
|
#define HCI_SUBCODE_BLE_MAX 0x7F
|
||||||
|
|
||||||
//ESP BT subcode define
|
//ESP BT subcode define
|
||||||
#define HCI_SUBCODE_BT_INIT 0x00
|
#define HCI_SUBCODE_BT_INIT 0x00
|
||||||
@ -412,7 +413,8 @@
|
|||||||
#define HCI_BLE_EXTENDED_SCAN_PARAMS_OCF HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BLE, HCI_SUBCODE_BLE_EXTENDED_SCAN_PARAMS)
|
#define HCI_BLE_EXTENDED_SCAN_PARAMS_OCF HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BLE, HCI_SUBCODE_BLE_EXTENDED_SCAN_PARAMS)
|
||||||
/* Long BLE Adv data OCF */
|
/* Long BLE Adv data OCF */
|
||||||
#define HCI_VENDOR_BLE_LONG_ADV_DATA HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BLE, HCI_SUBCODE_BLE_LONG_ADV)
|
#define HCI_VENDOR_BLE_LONG_ADV_DATA HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BLE, HCI_SUBCODE_BLE_LONG_ADV)
|
||||||
|
/* BLE update duplicate scan exceptional list */
|
||||||
|
#define HCI_VENDOR_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST HCI_ESP_VENDOR_OPCODE_BUILD(HCI_VENDOR_OGF, HCI_ESP_GROUP_BLE, HCI_SUBCODE_BLE_DUPLICATE_EXCEPTIONAL_LIST)
|
||||||
//ESP BT HCI CMD
|
//ESP BT HCI CMD
|
||||||
|
|
||||||
/* subcode for multi adv feature */
|
/* subcode for multi adv feature */
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 50828eae8345f519a533199c09133966add936f6
|
Subproject commit 2b5420e7912a464a88e4fe6d300d947cc9ec7039
|
Loading…
x
Reference in New Issue
Block a user