feat(ble/bluedroid): Support anonymous address type for white list

This commit is contained in:
chenjianhua
2025-05-07 17:36:06 +08:00
parent 48b37dd56e
commit 913645d239
3 changed files with 18 additions and 4 deletions

View File

@ -282,8 +282,11 @@ typedef enum {
/// white list address type
typedef enum {
BLE_WL_ADDR_TYPE_PUBLIC = 0x00,
BLE_WL_ADDR_TYPE_RANDOM = 0x01,
BLE_WL_ADDR_TYPE_PUBLIC = 0x00, /*!< Public Device Address */
BLE_WL_ADDR_TYPE_RANDOM = 0x01, /*!< Random Device Address */
#if (CONFIG_BT_BLE_50_FEATURES_SUPPORTED)
BLE_WL_ADDR_TYPE_ANONYMOUS = 0xFF, /*!< Devices sending anonymous advertisements, use to enable anonymous advertising report for scanning */
#endif // (CONFIG_BT_BLE_50_FEATURES_SUPPORTED)
} esp_ble_wl_addr_type_t;
/// Used to exchange the encryption key in the init key & response key

View File

@ -201,7 +201,12 @@ BOOLEAN btm_add_dev_to_controller (BOOLEAN to_add, BD_ADDR bd_addr, tBLE_ADDR_TY
/* Controller do not support resolvable address now, only support public address and static random address */
BOOLEAN started = FALSE;
if(wl_addr_type > BLE_ADDR_RANDOM) {
#if (BLE_50_FEATURE_SUPPORT == TRUE)
if (wl_addr_type > BLE_ADDR_RANDOM && wl_addr_type != BLE_ADDR_ANONYMOUS)
#else
if (wl_addr_type > BLE_ADDR_RANDOM)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
{
BTM_TRACE_ERROR("wl_addr_type is error\n");
return started;
}
@ -278,7 +283,12 @@ void btm_enq_wl_dev_operation(BOOLEAN to_add, BD_ADDR bd_addr, tBLE_ADDR_TYPE ad
*******************************************************************************/
BOOLEAN btm_update_dev_to_white_list(BOOLEAN to_add, BD_ADDR bd_addr, tBLE_ADDR_TYPE addr_type, tBTM_UPDATE_WHITELIST_CBACK *update_wl_cb)
{
if(addr_type > BLE_ADDR_RANDOM) {
#if (BLE_50_FEATURE_SUPPORT == TRUE)
if (addr_type > BLE_ADDR_RANDOM && addr_type != BLE_ADDR_ANONYMOUS)
#else
if (addr_type > BLE_ADDR_RANDOM)
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
{
BTM_TRACE_ERROR("%s address type is error, unable to add device", __func__);
if (update_wl_cb){
update_wl_cb(HCI_ERR_ILLEGAL_PARAMETER_FMT,to_add);

View File

@ -486,6 +486,7 @@ typedef struct {
#define BLE_ADDR_RANDOM_ID 0x03
#define BLE_ADDR_TYPE_MAX BLE_ADDR_RANDOM_ID
#define BLE_ADDR_UNKNOWN_TYPE 0XFF
#define BLE_ADDR_ANONYMOUS 0xFF
typedef UINT8 tBLE_ADDR_TYPE;
#define BLE_ADDR_TYPE_MASK (BLE_ADDR_RANDOM | BLE_ADDR_PUBLIC)