diff --git a/components/bt/bluedroid/stack/btm/btm_ble_gap.c b/components/bt/bluedroid/stack/btm/btm_ble_gap.c index 14dae938c..14c60f44e 100644 --- a/components/bt/bluedroid/stack/btm/btm_ble_gap.c +++ b/components/bt/bluedroid/stack/btm/btm_ble_gap.c @@ -2984,14 +2984,14 @@ void btm_send_sel_conn_callback(BD_ADDR remote_bda, UINT8 evt_type, UINT8 *p_dat void btm_ble_process_adv_pkt (UINT8 *p_data) { BD_ADDR bda; - BD_ADDR temp_bda; - UINT8 temp_addr_type = 0; UINT8 evt_type = 0, *p = p_data; UINT8 addr_type = 0; UINT8 num_reports; UINT8 data_len; #if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE) BOOLEAN match = FALSE; + BD_ADDR temp_bda; + UINT8 temp_addr_type = 0; #endif /* Only process the results if the inquiry is still active */ @@ -3007,11 +3007,12 @@ void btm_ble_process_adv_pkt (UINT8 *p_data) STREAM_TO_UINT8 (evt_type, p); STREAM_TO_UINT8 (addr_type, p); STREAM_TO_BDADDR (bda, p); - temp_addr_type = addr_type; - memcpy(temp_bda, bda, BD_ADDR_LEN); //BTM_TRACE_ERROR("btm_ble_process_adv_pkt:bda= %0x:%0x:%0x:%0x:%0x:%0x\n", // bda[0],bda[1],bda[2],bda[3],bda[4],bda[5]); #if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE) + temp_addr_type = addr_type; + memcpy(temp_bda, bda, BD_ADDR_LEN); + /* map address to security record */ match = btm_identity_addr_to_random_pseudo(bda, &addr_type, FALSE); @@ -3023,6 +3024,7 @@ void btm_ble_process_adv_pkt (UINT8 *p_data) } else #endif btm_ble_process_adv_pkt_cont(bda, addr_type, evt_type, p); +#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE) //save current adv addr information if p_dev_rec!= NULL tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bda); if(p_dev_rec) { @@ -3030,6 +3032,7 @@ void btm_ble_process_adv_pkt (UINT8 *p_data) memcpy(p_dev_rec->ble.current_addr, temp_bda, BD_ADDR_LEN); p_dev_rec->ble.current_addr_valid = true; } +#endif STREAM_TO_UINT8(data_len, p); /* Advance to the next event data_len + rssi byte */