Add support for apple:findmy packets (only useful for counting) (#498)
This commit is contained in:
parent
5b373fb430
commit
27d1e9e257
|
@ -33,7 +33,7 @@ bool BleFingerprint::setId(const String& newId, short newIdType, const String& n
|
|||
{
|
||||
allowQuery = true;
|
||||
qryAttempts = 0;
|
||||
if (rssi < -60)
|
||||
if (rssi < -70)
|
||||
{
|
||||
qryDelayMillis = 5000;
|
||||
lastQryMillis = millis();
|
||||
|
@ -105,7 +105,7 @@ void BleFingerprint::fingerprintServiceAdvertisements(NimBLEAdvertisedDevice *ad
|
|||
{
|
||||
auto uuid = advertisedDevice->getServiceUUID(i);
|
||||
#ifdef VERBOSE
|
||||
Serial.printf("Verbose | %-58sAD: %s\n", getId().c_str(), advertisedDevice->getServiceUUID(i).toString().c_str());
|
||||
Serial.printf("Verbose | MAC: %s, ID: %-58sAD: %s\n", getMac().c_str(), getId().c_str(), advertisedDevice->getServiceUUID(i).toString().c_str());
|
||||
#endif
|
||||
if (uuid == roomAssistantService)
|
||||
{
|
||||
|
@ -192,7 +192,7 @@ void BleFingerprint::fingerprintServiceData(NimBLEAdvertisedDevice *advertisedDe
|
|||
BLEUUID uuid = advertisedDevice->getServiceDataUUID(i);
|
||||
std::string strServiceData = advertisedDevice->getServiceData(i);
|
||||
#ifdef VERBOSE
|
||||
Serial.printf("Verbose | %-58sSD: %s/%s\n", getId().c_str(), uuid.toString().c_str(), hexStr(strServiceData).c_str());
|
||||
Serial.printf("Verbose | MAC: %s, ID: %-58sSD: %s/%s\n", getMac().c_str(), getId().c_str(), uuid.toString().c_str(), hexStr(strServiceData).c_str());
|
||||
#endif
|
||||
|
||||
if (uuid == exposureUUID)
|
||||
|
@ -281,7 +281,7 @@ void BleFingerprint::fingerprintManufactureData(NimBLEAdvertisedDevice *advertis
|
|||
{
|
||||
std::string strManufacturerData = advertisedDevice->getManufacturerData();
|
||||
#ifdef VERBOSE
|
||||
Serial.printf("Verbose | %-58sMD: %s\n", getId().c_str(), hexStr(strManufacturerData).c_str());
|
||||
Serial.printf("Verbose | MAC: %s, ID: %-58sMD: %s\n", getMac().c_str(), getId().c_str(), hexStr(strManufacturerData).c_str());
|
||||
#endif
|
||||
if (strManufacturerData.length() >= 2)
|
||||
{
|
||||
|
@ -304,6 +304,12 @@ void BleFingerprint::fingerprintManufactureData(NimBLEAdvertisedDevice *advertis
|
|||
disc = hexStr(strManufacturerData.substr(4)).c_str();
|
||||
mdRssi = BleFingerprintCollection::refRssi + APPLE_TX;
|
||||
}
|
||||
else if (strManufacturerData.length() >= 4 && strManufacturerData[2] == 0x12 && strManufacturerData.length() == 29)
|
||||
{
|
||||
String pid = "apple:findmy";
|
||||
setId(pid, ID_TYPE_FINDMY);
|
||||
mdRssi = BleFingerprintCollection::refRssi + APPLE_TX;
|
||||
}
|
||||
else if (strManufacturerData.length() >= 4)
|
||||
{
|
||||
String pid = Sprintf("apple:%02x%02x:%u", strManufacturerData[2], strManufacturerData[3], strManufacturerData.length());
|
||||
|
@ -380,6 +386,8 @@ bool BleFingerprint::seen(BLEAdvertisedDevice *advertisedDevice)
|
|||
|
||||
seenCount++;
|
||||
|
||||
fingerprint(advertisedDevice);
|
||||
|
||||
if (ignore) return false;
|
||||
|
||||
oldest = recent;
|
||||
|
@ -387,9 +395,6 @@ bool BleFingerprint::seen(BLEAdvertisedDevice *advertisedDevice)
|
|||
newest = advertisedDevice->getRSSI();
|
||||
rssi = median_of_3(oldest, recent, newest);
|
||||
|
||||
fingerprint(advertisedDevice);
|
||||
|
||||
if (ignore) return false;
|
||||
|
||||
float ratio = (get1mRssi() - rssi) / (10.0f * BleFingerprintCollection::absorption);
|
||||
raw = pow(10, ratio);
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#define ID_TYPE_SD short(15)
|
||||
#define ID_TYPE_MD short(20)
|
||||
#define ID_TYPE_MISC short(30)
|
||||
#define ID_TYPE_FINDMY short(32)
|
||||
#define ID_TYPE_NAME short(35)
|
||||
#define ID_TYPE_PUBLIC_MAC short(50)
|
||||
#define ID_TYPE_MSFT short(100)
|
||||
|
|
|
@ -108,14 +108,12 @@ void GUI::minusOne(BleFingerprint *f)
|
|||
|
||||
void GUI::close(BleFingerprint *f)
|
||||
{
|
||||
if (f->getIgnore()) return;
|
||||
Serial.printf("\u001b[32m%u Close | MAC: %s, ID: %-60s (%.2fm) %ddBm\u001b[0m\n", xPortGetCoreID(), f->getMac().c_str(), f->getId().c_str(), f->getDistance(), f->getNewestRssi());
|
||||
status("C:%s", f->getId().c_str());
|
||||
}
|
||||
|
||||
void GUI::left(BleFingerprint *f)
|
||||
{
|
||||
if (f->getIgnore()) return;
|
||||
Serial.printf("\u001b[33m%u Left | MAC: %s, ID: %-60s (%.2fm) %ddBm\u001b[0m\n", xPortGetCoreID(), f->getMac().c_str(), f->getId().c_str(), f->getDistance(), f->getNewestRssi());
|
||||
status("L:%s", f->getId().c_str());
|
||||
}
|
||||
|
|
|
@ -191,7 +191,7 @@ void setupNetwork()
|
|||
BleFingerprintCollection::skipMs = WiFiSettings.integer("skip_ms", 0, 3000000, DEFAULT_SKIP_MS, "Skip reporting if message age is less that this (in milliseconds)");
|
||||
|
||||
WiFiSettings.heading("Calibration <a href='https://espresense.com/configuration/settings#calibration' target='_blank'>ℹ️</a>", false);
|
||||
BleFingerprintCollection::refRssi = WiFiSettings.integer("ref_rssi", -100, 100, DEFAULT_REF_RSSI, "Rssi expected from a 0dBm transmitter at 1 meter");
|
||||
BleFingerprintCollection::refRssi = WiFiSettings.integer("ref_rssi", -100, 100, DEFAULT_REF_RSSI, "Rssi expected from a 0dBm transmitter at 1 meter (NOT used for iBecons or Eddystone)");
|
||||
BleFingerprintCollection::absorption = WiFiSettings.floating("absorption", -100, 100, DEFAULT_ABSORPTION, "Factor used to account for absorption, reflection, or diffraction");
|
||||
BleFingerprintCollection::forgetMs = WiFiSettings.integer("forget_ms", 0, 3000000, DEFAULT_FORGET_MS, "Forget beacon if not seen for (in milliseconds)");
|
||||
|
||||
|
|
Loading…
Reference in New Issue