-
Notifications
You must be signed in to change notification settings - Fork 713
Open
Labels
Description
Hi,
I was looking for ways to track the RSSI strength of already discovered devices while scan is on.
The current implementation of BLEScan is limited in registering the RSSI strength when a device is detected for the 1st time and subsequent GAP events are ignored . The crude way I have achieved so is by modifying BLEScan:: handleGAPEvent case ESP_GAP_SEARCH_INQ_RES_EVT: like so
// Examine our list of previously scanned addresses and, if we found this one already,
// ignore it.
BLEAddress advertisedAddress(param - > scan_rst.bda);
bool found = false;
for (int i = 0; i < m_scanResults.getCount(); i++) {
if (m_scanResults.getDevice(i).getAddress().equals(advertisedAddress)) {
found = true;
m_scanResults.getDevice(i).setRSSI(param - > scan_rst.rssi);
if (m_pAdvertisedDeviceCallbacks != nullptr) {
m_pAdvertisedDeviceCallbacks - > onResult(m_scanResults.getDevice(i));
}
break;
}
}
is there a better way to achieve what I'm trying ?
pls note , I'm avoiding connecting to the device.