mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
feat(ble/bluedroid): Support BLE add device to resolving list
This commit is contained in:
parent
c075708e0b
commit
af59333eb5
@ -223,6 +223,29 @@ esp_err_t esp_ble_gap_set_resolvable_private_address_timeout(uint16_t rpa_timeou
|
|||||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
esp_err_t esp_ble_gap_add_device_to_resolving_list(esp_bd_addr_t peer_addr, uint8_t addr_type, uint8_t *peer_irk)
|
||||||
|
{
|
||||||
|
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||||
|
|
||||||
|
if (addr_type > BLE_ADDR_TYPE_RANDOM ||!peer_addr || (addr_type && ((peer_addr[0] & 0xC0) != 0xC0))) {
|
||||||
|
return ESP_ERR_INVALID_ARG;
|
||||||
|
}
|
||||||
|
|
||||||
|
btc_msg_t msg = {0};
|
||||||
|
btc_ble_gap_args_t arg;
|
||||||
|
|
||||||
|
msg.sig = BTC_SIG_API_CALL;
|
||||||
|
msg.pid = BTC_PID_GAP_BLE;
|
||||||
|
msg.act = BTC_GAP_BLE_ACT_ADD_DEVICE_TO_RESOLVING_LIST;
|
||||||
|
|
||||||
|
memcpy(arg.add_dev_to_resolving_list.addr, peer_addr, ESP_BD_ADDR_LEN);
|
||||||
|
arg.add_dev_to_resolving_list.addr_type = addr_type;
|
||||||
|
memcpy(arg.add_dev_to_resolving_list.irk, peer_irk, ESP_PEER_IRK_LEN);
|
||||||
|
|
||||||
|
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||||
|
}
|
||||||
|
|
||||||
esp_err_t esp_ble_gap_clear_rand_addr(void)
|
esp_err_t esp_ble_gap_clear_rand_addr(void)
|
||||||
{
|
{
|
||||||
btc_msg_t msg;
|
btc_msg_t msg;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -19,7 +19,7 @@ extern "C" {
|
|||||||
return ESP_ERR_INVALID_STATE; \
|
return ESP_ERR_INVALID_STATE; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ESP_BT_STATUS_BASE_FOR_HCI_ERR 0X0100 /* base for coverting HCI error code to ESP status */
|
#define ESP_BT_STATUS_BASE_FOR_HCI_ERR 0X0100 /* base for converting HCI error code to ESP status */
|
||||||
|
|
||||||
/* relate to BT_STATUS_xxx in bt_def.h */
|
/* relate to BT_STATUS_xxx in bt_def.h */
|
||||||
/// Status Return Value
|
/// Status Return Value
|
||||||
@ -163,6 +163,9 @@ typedef enum {
|
|||||||
/// Bluetooth address length
|
/// Bluetooth address length
|
||||||
#define ESP_BD_ADDR_LEN 6
|
#define ESP_BD_ADDR_LEN 6
|
||||||
|
|
||||||
|
/// Bluetooth peer irk
|
||||||
|
#define ESP_PEER_IRK_LEN 16
|
||||||
|
|
||||||
/// Bluetooth device address
|
/// Bluetooth device address
|
||||||
typedef uint8_t esp_bd_addr_t[ESP_BD_ADDR_LEN];
|
typedef uint8_t esp_bd_addr_t[ESP_BD_ADDR_LEN];
|
||||||
|
|
||||||
|
@ -225,8 +225,9 @@ typedef enum {
|
|||||||
ESP_GAP_BLE_DTM_TEST_UPDATE_EVT, /*!< when direct test mode state changes, the event comes */
|
ESP_GAP_BLE_DTM_TEST_UPDATE_EVT, /*!< when direct test mode state changes, the event comes */
|
||||||
// BLE_INCLUDED
|
// BLE_INCLUDED
|
||||||
ESP_GAP_BLE_ADV_CLEAR_COMPLETE_EVT, /*!< When clear advertising complete, the event comes */
|
ESP_GAP_BLE_ADV_CLEAR_COMPLETE_EVT, /*!< When clear advertising complete, the event comes */
|
||||||
ESP_GAP_BLE_VENDOR_CMD_COMPLETE_EVT, /*!< When vendor hci command complete, the event comes */
|
|
||||||
ESP_GAP_BLE_SET_RPA_TIMEOUT_COMPLETE_EVT, /*!< When set the Resolvable Private Address (RPA) timeout completes, the event comes */
|
ESP_GAP_BLE_SET_RPA_TIMEOUT_COMPLETE_EVT, /*!< When set the Resolvable Private Address (RPA) timeout completes, the event comes */
|
||||||
|
ESP_GAP_BLE_ADD_DEV_TO_RESOLVING_LIST_COMPLETE_EVT, /*!< when add a device to the resolving list completes, the event comes*/
|
||||||
|
ESP_GAP_BLE_VENDOR_CMD_COMPLETE_EVT, /*!< When vendor hci command complete, 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;
|
||||||
|
|
||||||
@ -1160,6 +1161,13 @@ typedef union {
|
|||||||
struct ble_rpa_timeout_cmpl_evt_param {
|
struct ble_rpa_timeout_cmpl_evt_param {
|
||||||
esp_bt_status_t status; /*!< Indicate the set RPA timeout operation success status */
|
esp_bt_status_t status; /*!< Indicate the set RPA timeout operation success status */
|
||||||
} set_rpa_timeout_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_RPA_TIMEOUT_COMPLETE_EVT */
|
} set_rpa_timeout_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_RPA_TIMEOUT_COMPLETE_EVT */
|
||||||
|
/**
|
||||||
|
* @brief ESP_GAP_BLE_ADD_DEV_TO_RESOLVING_LIST_COMPLETE_EVT
|
||||||
|
*/
|
||||||
|
struct ble_add_dev_to_resolving_list_cmpl_evt_param {
|
||||||
|
esp_bt_status_t status; /*!< Indicates the success status of adding a device to the resolving list */
|
||||||
|
} add_dev_to_resolving_list_cmpl; /*!< Event parameter of ESP_GAP_BLE_ADD_DEV_TO_RESOLVING_LIST_COMPLETE_EVT */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ESP_GAP_BLE_REMOVE_BOND_DEV_COMPLETE_EVT
|
* @brief ESP_GAP_BLE_REMOVE_BOND_DEV_COMPLETE_EVT
|
||||||
*/
|
*/
|
||||||
@ -1668,6 +1676,27 @@ esp_err_t esp_ble_gap_set_rand_addr(esp_bd_addr_t rand_addr);
|
|||||||
*/
|
*/
|
||||||
esp_err_t esp_ble_gap_set_resolvable_private_address_timeout(uint16_t rpa_timeout);
|
esp_err_t esp_ble_gap_set_resolvable_private_address_timeout(uint16_t rpa_timeout);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function adds a device to the resolving list used to generate and resolve Resolvable Private Addresses
|
||||||
|
* in the Controller.
|
||||||
|
*
|
||||||
|
* @note Note: This function shall not be used when address resolution is enabled in the Controller and:
|
||||||
|
* - Advertising (other than periodic advertising) is enabled,
|
||||||
|
* - Scanning is enabled, or
|
||||||
|
* - an HCI_LE_Create_Connection, HCI_LE_Extended_Create_Connection, or HCI_LE_Periodic_Advertising_Create_Sync command is pending.
|
||||||
|
* This command may be used at any time when address resolution is disabled in the Controller.
|
||||||
|
* The added device shall be set to Network Privacy mode.
|
||||||
|
*
|
||||||
|
* @param[in] peer_addr: The peer identity address of the device to be added to the resolving list.
|
||||||
|
* @param[in] addr_type: The address type of the peer identity address (BLE_ADDR_TYPE_PUBLIC or BLE_ADDR_TYPE_RANDOM).
|
||||||
|
* @param[in] peer_irk: The Identity Resolving Key (IRK) of the device.
|
||||||
|
* @return
|
||||||
|
* - ESP_OK : success
|
||||||
|
* - other : failed
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
esp_err_t esp_ble_gap_add_device_to_resolving_list(esp_bd_addr_t peer_addr, uint8_t addr_type, uint8_t *peer_irk);
|
||||||
/**
|
/**
|
||||||
* @brief This function clears the random address for the application
|
* @brief This function clears the random address for the application
|
||||||
*
|
*
|
||||||
@ -1679,7 +1708,6 @@ esp_err_t esp_ble_gap_set_resolvable_private_address_timeout(uint16_t rpa_timeou
|
|||||||
esp_err_t esp_ble_gap_clear_rand_addr(void);
|
esp_err_t esp_ble_gap_clear_rand_addr(void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Enable/disable privacy (including address resolution) on the local device
|
* @brief Enable/disable privacy (including address resolution) on the local device
|
||||||
*
|
*
|
||||||
|
@ -5742,6 +5742,15 @@ void bta_dm_ble_gap_set_rpa_timeout(tBTA_DM_MSG *p_data)
|
|||||||
BTM_BleSetRpaTimeout(p_data->set_rpa_timeout.rpa_timeout,p_data->set_rpa_timeout.p_set_rpa_timeout_cback);
|
BTM_BleSetRpaTimeout(p_data->set_rpa_timeout.rpa_timeout,p_data->set_rpa_timeout.p_set_rpa_timeout_cback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bta_dm_ble_gap_add_dev_to_resolving_list(tBTA_DM_MSG *p_data)
|
||||||
|
{
|
||||||
|
APPL_TRACE_API("%s", __func__);
|
||||||
|
BTM_BleAddDevToResolvingList(p_data->add_dev_to_resolving_list.addr,
|
||||||
|
p_data->add_dev_to_resolving_list.addr_type,
|
||||||
|
p_data->add_dev_to_resolving_list.irk,
|
||||||
|
p_data->add_dev_to_resolving_list.p_add_dev_to_resolving_list_callback);
|
||||||
|
}
|
||||||
|
|
||||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
#if (BLE_50_FEATURE_SUPPORT == 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)
|
||||||
{
|
{
|
||||||
|
@ -2825,6 +2825,40 @@ void BTA_DmBleSetRpaTimeout(uint16_t rpa_timeout,tBTA_SET_RPA_TIMEOUT_CMPL_CBACK
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
** Function BTA_DmBleAddDevToResolvingList
|
||||||
|
**
|
||||||
|
** Description This function adds a device to the resolving list of the
|
||||||
|
** Bluetooth controller. The resolving list is used for resolving
|
||||||
|
** the identity of devices using resolvable private addresses (RPAs).
|
||||||
|
**
|
||||||
|
** Parameters addr: Bluetooth device address to be added to the resolving list
|
||||||
|
** addr_type: Type of the address (public or random)
|
||||||
|
** irk: Identity Resolving Key (IRK) of the device
|
||||||
|
** add_dev_to_resolving_list_callback: Callback function to be invoked
|
||||||
|
** upon completion of the operation
|
||||||
|
**
|
||||||
|
** Returns void
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
void BTA_DmBleAddDevToResolvingList(BD_ADDR addr,
|
||||||
|
uint8_t addr_type,
|
||||||
|
PEER_IRK irk,
|
||||||
|
tBTA_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK *add_dev_to_resolving_list_callback)
|
||||||
|
{
|
||||||
|
tBTA_DM_API_ADD_DEV_TO_RESOLVING_LIST *p_msg;
|
||||||
|
if ((p_msg = (tBTA_DM_API_ADD_DEV_TO_RESOLVING_LIST *) osi_malloc(sizeof(tBTA_DM_API_ADD_DEV_TO_RESOLVING_LIST))) != NULL) {
|
||||||
|
memset(p_msg, 0, sizeof(tBTA_DM_API_ADD_DEV_TO_RESOLVING_LIST));
|
||||||
|
p_msg->hdr.event = BTA_DM_API_ADD_DEV_TO_RESOLVING_LIST_EVT;
|
||||||
|
memcpy(p_msg->addr, addr, BD_ADDR_LEN); // Copy the device address to the message
|
||||||
|
p_msg->addr_type = addr_type; // Assign the address type to the message
|
||||||
|
memcpy(p_msg->irk, irk, PEER_IRK_LEN); // Copy the IRK to the message
|
||||||
|
p_msg->p_add_dev_to_resolving_list_callback = add_dev_to_resolving_list_callback;
|
||||||
|
bta_sys_sendmsg(p_msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void BTA_DmClearRandAddress(void)
|
void BTA_DmClearRandAddress(void)
|
||||||
{
|
{
|
||||||
tBTA_DM_APT_CLEAR_ADDR *p_msg;
|
tBTA_DM_APT_CLEAR_ADDR *p_msg;
|
||||||
|
@ -220,6 +220,7 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
|
|||||||
bta_dm_ble_gap_dtm_stop, /* BTA_DM_API_DTM_STOP_EVT */
|
bta_dm_ble_gap_dtm_stop, /* BTA_DM_API_DTM_STOP_EVT */
|
||||||
bta_dm_ble_gap_clear_adv, /* BTA_DM_API_BLE_CLEAR_ADV_EVT */
|
bta_dm_ble_gap_clear_adv, /* BTA_DM_API_BLE_CLEAR_ADV_EVT */
|
||||||
bta_dm_ble_gap_set_rpa_timeout, /* BTA_DM_API_SET_RPA_TIMEOUT_EVT */
|
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 */
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -216,6 +216,7 @@ enum {
|
|||||||
BTA_DM_API_DTM_STOP_EVT,
|
BTA_DM_API_DTM_STOP_EVT,
|
||||||
BTA_DM_API_BLE_CLEAR_ADV_EVT,
|
BTA_DM_API_BLE_CLEAR_ADV_EVT,
|
||||||
BTA_DM_API_SET_RPA_TIMEOUT_EVT,
|
BTA_DM_API_SET_RPA_TIMEOUT_EVT,
|
||||||
|
BTA_DM_API_ADD_DEV_TO_RESOLVING_LIST_EVT,
|
||||||
#endif
|
#endif
|
||||||
BTA_DM_MAX_EVT
|
BTA_DM_MAX_EVT
|
||||||
};
|
};
|
||||||
@ -750,6 +751,14 @@ typedef struct {
|
|||||||
tBTA_SET_RPA_TIMEOUT_CMPL_CBACK *p_set_rpa_timeout_cback;
|
tBTA_SET_RPA_TIMEOUT_CMPL_CBACK *p_set_rpa_timeout_cback;
|
||||||
} tBTA_DM_API_SET_RPA_TIMEOUT;
|
} tBTA_DM_API_SET_RPA_TIMEOUT;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
BT_HDR hdr; // Event header
|
||||||
|
esp_bd_addr_t addr; // Bluetooth device address
|
||||||
|
UINT8 addr_type; // Type of the address
|
||||||
|
UINT8 irk[PEER_IRK_LEN]; // Identity Resolving Key (IRK)
|
||||||
|
tBTA_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK *p_add_dev_to_resolving_list_callback; // Callback function pointer
|
||||||
|
} tBTA_DM_API_ADD_DEV_TO_RESOLVING_LIST;
|
||||||
|
|
||||||
/* set adv parameter for BLE advertising */
|
/* set adv parameter for BLE advertising */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
BT_HDR hdr;
|
BT_HDR hdr;
|
||||||
@ -1247,6 +1256,7 @@ typedef union {
|
|||||||
tBTA_DM_APT_SET_DEV_ADDR set_addr;
|
tBTA_DM_APT_SET_DEV_ADDR set_addr;
|
||||||
tBTA_DM_APT_CLEAR_ADDR clear_addr;
|
tBTA_DM_APT_CLEAR_ADDR clear_addr;
|
||||||
tBTA_DM_API_SET_RPA_TIMEOUT set_rpa_timeout;
|
tBTA_DM_API_SET_RPA_TIMEOUT set_rpa_timeout;
|
||||||
|
tBTA_DM_API_ADD_DEV_TO_RESOLVING_LIST add_dev_to_resolving_list;
|
||||||
tBTA_DM_API_BLE_MULTI_ADV_ENB ble_multi_adv_enb;
|
tBTA_DM_API_BLE_MULTI_ADV_ENB ble_multi_adv_enb;
|
||||||
tBTA_DM_API_BLE_MULTI_ADV_PARAM ble_multi_adv_param;
|
tBTA_DM_API_BLE_MULTI_ADV_PARAM ble_multi_adv_param;
|
||||||
tBTA_DM_API_BLE_MULTI_ADV_DATA ble_multi_adv_data;
|
tBTA_DM_API_BLE_MULTI_ADV_DATA ble_multi_adv_data;
|
||||||
@ -1734,6 +1744,7 @@ extern void bta_dm_ble_gap_dtm_rx_start(tBTA_DM_MSG *p_data);
|
|||||||
extern void bta_dm_ble_gap_dtm_stop(tBTA_DM_MSG *p_data);
|
extern void bta_dm_ble_gap_dtm_stop(tBTA_DM_MSG *p_data);
|
||||||
extern void bta_dm_ble_gap_clear_adv(tBTA_DM_MSG *p_data);
|
extern void bta_dm_ble_gap_clear_adv(tBTA_DM_MSG *p_data);
|
||||||
extern void bta_dm_ble_gap_set_rpa_timeout(tBTA_DM_MSG *p_data);
|
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);
|
||||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
#if (BLE_50_FEATURE_SUPPORT == 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);
|
||||||
|
@ -435,6 +435,8 @@ typedef tBTM_SET_LOCAL_PRIVACY_CBACK tBTA_SET_LOCAL_PRIVACY_CBACK;
|
|||||||
|
|
||||||
typedef tBTM_SET_RPA_TIMEOUT_CMPL_CBACK tBTA_SET_RPA_TIMEOUT_CMPL_CBACK;
|
typedef tBTM_SET_RPA_TIMEOUT_CMPL_CBACK tBTA_SET_RPA_TIMEOUT_CMPL_CBACK;
|
||||||
|
|
||||||
|
typedef tBTM_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK tBTA_ADD_DEV_TO_RESOLVING_LIST_CMPL_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;
|
||||||
@ -2550,6 +2552,10 @@ extern void BTA_DmBleStopAdvertising(void);
|
|||||||
extern void BTA_DmSetRandAddress(BD_ADDR rand_addr, tBTA_SET_RAND_ADDR_CBACK *p_set_rand_addr_cback);
|
extern void BTA_DmSetRandAddress(BD_ADDR rand_addr, tBTA_SET_RAND_ADDR_CBACK *p_set_rand_addr_cback);
|
||||||
extern void BTA_DmClearRandAddress(void);
|
extern void BTA_DmClearRandAddress(void);
|
||||||
extern void BTA_DmBleSetRpaTimeout(uint16_t rpa_timeout,tBTA_SET_RPA_TIMEOUT_CMPL_CBACK *p_set_rpa_timeout_cback);
|
extern void BTA_DmBleSetRpaTimeout(uint16_t rpa_timeout,tBTA_SET_RPA_TIMEOUT_CMPL_CBACK *p_set_rpa_timeout_cback);
|
||||||
|
extern void BTA_DmBleAddDevToResolvingList(BD_ADDR addr,
|
||||||
|
uint8_t addr_type,
|
||||||
|
PEER_IRK irk,
|
||||||
|
tBTA_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK *add_dev_to_resolving_list_callback);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BLE_INCLUDED == TRUE
|
#if BLE_INCLUDED == TRUE
|
||||||
|
@ -900,6 +900,25 @@ static void btc_set_rpa_timeout_callback(UINT8 status)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void btc_add_dev_to_resolving_list_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_ADD_DEV_TO_RESOLVING_LIST_COMPLETE_EVT;
|
||||||
|
|
||||||
|
param.add_dev_to_resolving_list_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 (SMP_INCLUDED == TRUE)
|
#if (SMP_INCLUDED == TRUE)
|
||||||
static void btc_set_encryption_callback(BD_ADDR bd_addr, tBTA_TRANSPORT transport, tBTA_STATUS enc_status)
|
static void btc_set_encryption_callback(BD_ADDR bd_addr, tBTA_TRANSPORT transport, tBTA_STATUS enc_status)
|
||||||
{
|
{
|
||||||
@ -1418,6 +1437,14 @@ static void btc_ble_set_rpa_timeout(uint16_t rpa_timeout,tBTA_SET_RPA_TIMEOUT_CM
|
|||||||
BTA_DmBleSetRpaTimeout(rpa_timeout,set_rpa_timeout_cback);
|
BTA_DmBleSetRpaTimeout(rpa_timeout,set_rpa_timeout_cback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void btc_ble_add_device_to_resolving_list(BD_ADDR addr,
|
||||||
|
uint8_t addr_type,
|
||||||
|
uint8_t irk[],
|
||||||
|
tBTA_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK *add_dev_to_resolving_list_callback)
|
||||||
|
{
|
||||||
|
BTA_DmBleAddDevToResolvingList(addr, addr_type, irk, add_dev_to_resolving_list_callback);
|
||||||
|
}
|
||||||
|
|
||||||
static void btc_ble_clear_rand_addr (void)
|
static void btc_ble_clear_rand_addr (void)
|
||||||
{
|
{
|
||||||
BTA_DmClearRandAddress();
|
BTA_DmClearRandAddress();
|
||||||
@ -1876,6 +1903,13 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
|
|||||||
btc_ble_set_rpa_timeout(arg->set_rpa_timeout.rpa_timeout,btc_set_rpa_timeout_callback);
|
btc_ble_set_rpa_timeout(arg->set_rpa_timeout.rpa_timeout,btc_set_rpa_timeout_callback);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case BTC_GAP_BLE_ACT_ADD_DEVICE_TO_RESOLVING_LIST: {
|
||||||
|
btc_ble_add_device_to_resolving_list(arg->add_dev_to_resolving_list.addr,
|
||||||
|
arg->add_dev_to_resolving_list.addr_type,
|
||||||
|
arg->add_dev_to_resolving_list.irk,
|
||||||
|
btc_add_dev_to_resolving_list_callback);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case BTC_GAP_BLE_ACT_CLEAR_RAND_ADDRESS: {
|
case BTC_GAP_BLE_ACT_CLEAR_RAND_ADDRESS: {
|
||||||
btc_ble_clear_rand_addr();
|
btc_ble_clear_rand_addr();
|
||||||
break;
|
break;
|
||||||
|
@ -102,8 +102,9 @@ typedef enum {
|
|||||||
#if (BLE_42_FEATURE_SUPPORT == TRUE)
|
#if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||||
BTC_GAP_BLE_ACT_CLEAR_ADV,
|
BTC_GAP_BLE_ACT_CLEAR_ADV,
|
||||||
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
|
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||||
BTC_GAP_BLE_ACT_VENDOR_HCI_CMD_EVT,
|
|
||||||
BTC_GAP_BLE_ACT_SET_RESOLVABLE_PRIVATE_ADDRESS_TIMEOUT,
|
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_act_t;
|
} btc_gap_ble_act_t;
|
||||||
|
|
||||||
/* btc_ble_gap_args_t */
|
/* btc_ble_gap_args_t */
|
||||||
@ -145,6 +146,12 @@ typedef union {
|
|||||||
struct set_rpa_timeout_args {
|
struct set_rpa_timeout_args {
|
||||||
uint16_t rpa_timeout;
|
uint16_t rpa_timeout;
|
||||||
} set_rpa_timeout;
|
} set_rpa_timeout;
|
||||||
|
//BTC_GAP_BLE_ACT_ADD_DEVICE_TO_RESOLVING_LIST
|
||||||
|
struct add_dev_to_resolving_list_args {
|
||||||
|
esp_bd_addr_t addr;
|
||||||
|
uint8_t addr_type;
|
||||||
|
uint8_t irk[PEER_IRK_LEN];
|
||||||
|
} add_dev_to_resolving_list;
|
||||||
//BTC_GAP_BLE_ACT_CONFIG_LOCAL_PRIVACY,
|
//BTC_GAP_BLE_ACT_CONFIG_LOCAL_PRIVACY,
|
||||||
struct cfg_local_privacy_args {
|
struct cfg_local_privacy_args {
|
||||||
bool privacy_enable;
|
bool privacy_enable;
|
||||||
|
@ -4713,6 +4713,20 @@ BOOLEAN BTM_BleSetRpaTimeout(uint16_t rpa_timeout,tBTM_SET_RPA_TIMEOUT_CMPL_CBAC
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOLEAN BTM_BleAddDevToResolvingList(BD_ADDR addr,
|
||||||
|
uint8_t addr_type,
|
||||||
|
uint8_t irk[],
|
||||||
|
tBTM_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK *p_add_dev_to_resolving_list_callback)
|
||||||
|
{
|
||||||
|
UINT8 *local_irk = btm_cb.devcb.id_keys.irk;
|
||||||
|
if ((btsnd_hcic_ble_add_device_resolving_list(addr_type, addr, irk, local_irk)) != TRUE) {
|
||||||
|
BTM_TRACE_ERROR("Add device to resolving list error");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
btm_cb.devcb.p_add_dev_to_resolving_list_cmpl_cb = p_add_dev_to_resolving_list_callback;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
bool btm_ble_adv_pkt_ready(void)
|
bool btm_ble_adv_pkt_ready(void)
|
||||||
{
|
{
|
||||||
tBTM_BLE_CB *p_cb = &btm_cb.ble_ctr_cb;
|
tBTM_BLE_CB *p_cb = &btm_cb.ble_ctr_cb;
|
||||||
|
@ -275,6 +275,14 @@ void btm_ble_add_resolving_list_entry_complete(UINT8 *p, UINT16 evt_len)
|
|||||||
{
|
{
|
||||||
UINT8 status;
|
UINT8 status;
|
||||||
STREAM_TO_UINT8(status, p);
|
STREAM_TO_UINT8(status, p);
|
||||||
|
if (btm_cb.devcb.p_add_dev_to_resolving_list_cmpl_cb) {
|
||||||
|
tBTM_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK *p_cb = btm_cb.devcb.p_add_dev_to_resolving_list_cmpl_cb;
|
||||||
|
if (p_cb) {
|
||||||
|
(*p_cb)(status);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
BTM_TRACE_DEBUG("no resolving list callback");
|
||||||
|
}
|
||||||
|
|
||||||
BTM_TRACE_DEBUG("%s status = %d", __func__, status);
|
BTM_TRACE_DEBUG("%s status = %d", __func__, status);
|
||||||
|
|
||||||
|
@ -231,6 +231,7 @@ tBTM_CMPL_CB *p_ble_channels_cmpl_cb; /* Callback function to be called
|
|||||||
tBTM_SET_RPA_TIMEOUT_CMPL_CBACK *p_ble_set_rpa_timeout_cmpl_cb; /* Callback function to be called When
|
tBTM_SET_RPA_TIMEOUT_CMPL_CBACK *p_ble_set_rpa_timeout_cmpl_cb; /* Callback function to be called When
|
||||||
ble set rpa timeout is completed */
|
ble set rpa timeout is completed */
|
||||||
|
|
||||||
|
tBTM_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK *p_add_dev_to_resolving_list_cmpl_cb;
|
||||||
tBTM_CMPL_CB *p_le_test_cmd_cmpl_cb; /* Callback function to be called when
|
tBTM_CMPL_CB *p_le_test_cmd_cmpl_cb; /* Callback function to be called when
|
||||||
LE test mode command has been sent successfully */
|
LE test mode command has been sent successfully */
|
||||||
|
|
||||||
|
@ -676,6 +676,11 @@ typedef void (BT_LOG_FUNC) (int trace_type, const char *fmt_str, ...);
|
|||||||
typedef uint8_t BD_ADDR[BD_ADDR_LEN];
|
typedef uint8_t BD_ADDR[BD_ADDR_LEN];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* peer irk */
|
||||||
|
#ifndef PEER_IRK_LEN
|
||||||
|
#define PEER_IRK_LEN 16
|
||||||
|
typedef uint8_t PEER_IRK[PEER_IRK_LEN];
|
||||||
|
#endif
|
||||||
// From bd.c
|
// From bd.c
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
@ -199,6 +199,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);
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
** DEVICE DISCOVERY - Inquiry, Remote Name, Discovery, Class of Device
|
** DEVICE DISCOVERY - Inquiry, Remote Name, Discovery, Class of Device
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
@ -2668,6 +2668,27 @@ BOOLEAN BTM_BleClearAdv(tBTM_CLEAR_ADV_CMPL_CBACK *p_clear_adv_cback);
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
BOOLEAN BTM_BleSetRpaTimeout(uint16_t rpa_timeout, tBTM_SET_RPA_TIMEOUT_CMPL_CBACK *p_set_rpa_timeout_cback);
|
BOOLEAN BTM_BleSetRpaTimeout(uint16_t rpa_timeout, tBTM_SET_RPA_TIMEOUT_CMPL_CBACK *p_set_rpa_timeout_cback);
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
** Function BTM_BleAddDevToResolvingList
|
||||||
|
**
|
||||||
|
** Description This function is called to add a device to the resolving list
|
||||||
|
** used to generate and resolve Resolvable Private Addresses (RPAs)
|
||||||
|
** in the Bluetooth Controller.
|
||||||
|
**
|
||||||
|
** Parameters addr - The address of the device to be added to the resolving list.
|
||||||
|
** addr_type - The address type of the device (public or random).
|
||||||
|
** irk - The Identity Resolving Key (IRK) of the device.
|
||||||
|
** p_add_dev_to_resolving_list_callback - Callback function to be called when the operation is completed.
|
||||||
|
**
|
||||||
|
** Returns TRUE if the operation was successful, otherwise FALSE.
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
BOOLEAN BTM_BleAddDevToResolvingList(BD_ADDR addr,
|
||||||
|
uint8_t addr_type,
|
||||||
|
uint8_t irk[],
|
||||||
|
tBTM_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK *p_add_dev_to_resolving_list_callback);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -621,7 +621,7 @@ BOOLEAN btsnd_hcic_write_voice_settings(UINT16 flags); /* Write Voice
|
|||||||
|
|
||||||
|
|
||||||
BOOLEAN btsnd_hcic_write_auto_flush_tout(UINT16 handle,
|
BOOLEAN btsnd_hcic_write_auto_flush_tout(UINT16 handle,
|
||||||
UINT16 timeout); /* Write Retransmit Timout */
|
UINT16 timeout); /* Write Retransmit Timeout */
|
||||||
|
|
||||||
#define HCIC_PARAM_SIZE_WRITE_AUTO_FLUSH_TOUT 4
|
#define HCIC_PARAM_SIZE_WRITE_AUTO_FLUSH_TOUT 4
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user