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)}
|
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();
|
firstSeenMicros = esp_timer_get_time();
|
||||||
address = advertisedDevice->getAddress();
|
address = advertisedDevice->getAddress();
|
||||||
newest = recent = oldest = rssi = advertisedDevice->getRSSI();
|
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());
|
String fingerprint = "md:" + String(mdHex).substring(2, 4) + String(mdHex).substring(0, 2) + ":" + String(strManufacturerData.length());
|
||||||
if (advertisedDevice->haveTXPower())
|
if (advertisedDevice->haveTXPower())
|
||||||
fingerprint = fingerprint + String(-advertisedDevice->getTXPower());
|
fingerprint = fingerprint + String(-advertisedDevice->getTXPower());
|
||||||
id = fingerprint;
|
id = macPublic ? mac_address : fingerprint;
|
||||||
Serial.printf(", ID: %s", id.c_str());
|
Serial.printf(", ID: %s, MD: %s", id.c_str(), mdHex);
|
||||||
}
|
}
|
||||||
|
|
||||||
calRssi = advertisedDevice->haveTXPower() ? (-advertisedDevice->getTXPower()) - 41 : 0;
|
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)
|
if (id.isEmpty() && macPublic)
|
||||||
id = mac_address;
|
id = mac_address;
|
||||||
Serial.println();
|
Serial.println();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ public:
|
||||||
long getLastSeen() { return lastSeenMicros; };
|
long getLastSeen() { return lastSeenMicros; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool hasValue = false, close = false, reported = false;
|
bool hasValue = false, close = false, reported = false, macPublic = false;
|
||||||
NimBLEAddress address;
|
NimBLEAddress address;
|
||||||
String id, name, url;
|
String id, name, url;
|
||||||
int rssi = -100, calRssi = 0;
|
int rssi = -100, calRssi = 0;
|
||||||
|
|
Loading…
Reference in New Issue