If all we have is md for fingerprint, but mac is static, use static mac.
This commit is contained in:
parent
91e379aa93
commit
9c12f798c6
|
@ -8,6 +8,9 @@ BleFingerprint::~BleFingerprint()
|
|||
|
||||
BleFingerprint::BleFingerprint(BLEAdvertisedDevice *advertisedDevice, float fcmin, float beta, float dcutoff) : oneEuro{one_euro_filter<double, unsigned long>(1, fcmin, beta, dcutoff)}
|
||||
{
|
||||
if (advertisedDevice->getAddressType() == BLE_ADDR_PUBLIC)
|
||||
macPublic = true;
|
||||
|
||||
firstSeenMicros = esp_timer_get_time();
|
||||
address = advertisedDevice->getAddress();
|
||||
newest = recent = oldest = rssi = advertisedDevice->getRSSI();
|
||||
|
@ -114,8 +117,8 @@ BleFingerprint::BleFingerprint(BLEAdvertisedDevice *advertisedDevice, float fcmi
|
|||
String fingerprint = "md:" + String(mdHex).substring(2, 4) + String(mdHex).substring(0, 2) + ":" + String(strManufacturerData.length());
|
||||
if (advertisedDevice->haveTXPower())
|
||||
fingerprint = fingerprint + String(-advertisedDevice->getTXPower());
|
||||
id = fingerprint;
|
||||
Serial.printf(", ID: %s", id.c_str());
|
||||
id = macPublic ? mac_address : fingerprint;
|
||||
Serial.printf(", ID: %s, MD: %s", id.c_str(), mdHex);
|
||||
}
|
||||
|
||||
calRssi = advertisedDevice->haveTXPower() ? (-advertisedDevice->getTXPower()) - 41 : 0;
|
||||
|
@ -128,8 +131,8 @@ BleFingerprint::BleFingerprint(BLEAdvertisedDevice *advertisedDevice, float fcmi
|
|||
}
|
||||
}
|
||||
|
||||
if (id.isEmpty() && advertisedDevice->getAddressType() == BLE_ADDR_PUBLIC)
|
||||
id = mac_address;
|
||||
if (id.isEmpty() && macPublic)
|
||||
id = mac_address;
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
long getLastSeen() { return lastSeenMicros; };
|
||||
|
||||
private:
|
||||
bool hasValue = false, close = false, reported = false;
|
||||
bool hasValue = false, close = false, reported = false, macPublic = false;
|
||||
NimBLEAddress address;
|
||||
String id, name, url;
|
||||
int rssi = -100, calRssi = 0;
|
||||
|
|
Loading…
Reference in New Issue