Skip to content

Commit 913645d

Browse files
committed
feat(ble/bluedroid): Support anonymous address type for white list
1 parent 48b37dd commit 913645d

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

components/bt/host/bluedroid/api/include/api/esp_bt_defs.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,11 @@ typedef enum {
282282

283283
/// white list address type
284284
typedef enum {
285-
BLE_WL_ADDR_TYPE_PUBLIC = 0x00,
286-
BLE_WL_ADDR_TYPE_RANDOM = 0x01,
285+
BLE_WL_ADDR_TYPE_PUBLIC = 0x00, /*!< Public Device Address */
286+
BLE_WL_ADDR_TYPE_RANDOM = 0x01, /*!< Random Device Address */
287+
#if (CONFIG_BT_BLE_50_FEATURES_SUPPORTED)
288+
BLE_WL_ADDR_TYPE_ANONYMOUS = 0xFF, /*!< Devices sending anonymous advertisements, use to enable anonymous advertising report for scanning */
289+
#endif // (CONFIG_BT_BLE_50_FEATURES_SUPPORTED)
287290
} esp_ble_wl_addr_type_t;
288291

289292
/// Used to exchange the encryption key in the init key & response key

components/bt/host/bluedroid/stack/btm/btm_ble_bgconn.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,12 @@ BOOLEAN btm_add_dev_to_controller (BOOLEAN to_add, BD_ADDR bd_addr, tBLE_ADDR_TY
201201

202202
/* Controller do not support resolvable address now, only support public address and static random address */
203203
BOOLEAN started = FALSE;
204-
if(wl_addr_type > BLE_ADDR_RANDOM) {
204+
#if (BLE_50_FEATURE_SUPPORT == TRUE)
205+
if (wl_addr_type > BLE_ADDR_RANDOM && wl_addr_type != BLE_ADDR_ANONYMOUS)
206+
#else
207+
if (wl_addr_type > BLE_ADDR_RANDOM)
208+
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
209+
{
205210
BTM_TRACE_ERROR("wl_addr_type is error\n");
206211
return started;
207212
}
@@ -278,7 +283,12 @@ void btm_enq_wl_dev_operation(BOOLEAN to_add, BD_ADDR bd_addr, tBLE_ADDR_TYPE ad
278283
*******************************************************************************/
279284
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)
280285
{
281-
if(addr_type > BLE_ADDR_RANDOM) {
286+
#if (BLE_50_FEATURE_SUPPORT == TRUE)
287+
if (addr_type > BLE_ADDR_RANDOM && addr_type != BLE_ADDR_ANONYMOUS)
288+
#else
289+
if (addr_type > BLE_ADDR_RANDOM)
290+
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
291+
{
282292
BTM_TRACE_ERROR("%s address type is error, unable to add device", __func__);
283293
if (update_wl_cb){
284294
update_wl_cb(HCI_ERR_ILLEGAL_PARAMETER_FMT,to_add);

components/bt/host/bluedroid/stack/include/stack/bt_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@ typedef struct {
486486
#define BLE_ADDR_RANDOM_ID 0x03
487487
#define BLE_ADDR_TYPE_MAX BLE_ADDR_RANDOM_ID
488488
#define BLE_ADDR_UNKNOWN_TYPE 0XFF
489+
#define BLE_ADDR_ANONYMOUS 0xFF
489490
typedef UINT8 tBLE_ADDR_TYPE;
490491
#define BLE_ADDR_TYPE_MASK (BLE_ADDR_RANDOM | BLE_ADDR_PUBLIC)
491492

0 commit comments

Comments
 (0)