2021-09-14 03:22:00 +02:00
|
|
|
#ifndef _BLEFINGERPRINTCOLLECTION_
|
|
|
|
#define _BLEFINGERPRINTCOLLECTION_
|
|
|
|
|
|
|
|
#include "BleFingerprint.h"
|
|
|
|
#include <ArduinoJson.h>
|
|
|
|
|
2022-02-20 22:03:03 +01:00
|
|
|
#define ONE_EURO_FCMIN 1e-5f
|
|
|
|
#define ONE_EURO_BETA 1e-7f
|
|
|
|
#define ONE_EURO_DCUTOFF 1e-5f
|
2021-09-14 03:22:00 +02:00
|
|
|
|
2022-08-04 02:27:06 +02:00
|
|
|
#ifndef ALLOW_BLE_CONTROLLER_RESTART_AFTER_SECS
|
|
|
|
#define ALLOW_BLE_CONTROLLER_RESTART_AFTER_SECS 1800
|
|
|
|
#endif
|
|
|
|
|
2021-09-14 03:22:00 +02:00
|
|
|
class BleFingerprintCollection : public BLEAdvertisedDeviceCallbacks
|
|
|
|
{
|
|
|
|
public:
|
2021-09-30 18:48:50 +02:00
|
|
|
BleFingerprintCollection()
|
2021-09-14 03:22:00 +02:00
|
|
|
{
|
|
|
|
fingerprintSemaphore = xSemaphoreCreateBinary();
|
|
|
|
xSemaphoreGive(fingerprintSemaphore);
|
|
|
|
}
|
|
|
|
BleFingerprint *getFingerprint(BLEAdvertisedDevice *advertisedDevice);
|
|
|
|
void cleanupOldFingerprints();
|
2022-03-14 02:54:50 +01:00
|
|
|
const std::list<BleFingerprint *>* const getNative();
|
|
|
|
const std::list<BleFingerprint *> getCopy();
|
2021-09-30 18:48:50 +02:00
|
|
|
void setDisable(bool disable) { _disable = disable; }
|
2022-07-18 08:30:20 +02:00
|
|
|
void connectToWifi();
|
|
|
|
bool command(String& command, String& pay);
|
|
|
|
bool config(String& id, String& json);
|
|
|
|
static std::vector<std::pair<uint8_t*,String>> irks;
|
|
|
|
static String knownMacs, knownIrks, include, exclude, query;
|
2022-03-06 17:48:04 +01:00
|
|
|
static float skipDistance, maxDistance, absorption;
|
|
|
|
static int refRssi, forgetMs, skipMs;
|
2022-03-14 02:54:50 +01:00
|
|
|
static String countIds;
|
|
|
|
static float countEnter, countExit;
|
|
|
|
static int countMs;
|
2021-09-14 03:22:00 +02:00
|
|
|
|
|
|
|
private:
|
2021-09-30 18:48:50 +02:00
|
|
|
bool _disable = false;
|
|
|
|
|
2021-10-05 13:54:41 +02:00
|
|
|
unsigned long lastCleanup = 0;
|
2021-09-30 18:48:50 +02:00
|
|
|
|
2021-09-14 03:22:00 +02:00
|
|
|
SemaphoreHandle_t fingerprintSemaphore;
|
|
|
|
std::list<BleFingerprint *> fingerprints;
|
|
|
|
BleFingerprint *getFingerprintInternal(BLEAdvertisedDevice *advertisedDevice);
|
|
|
|
|
2022-03-06 17:48:04 +01:00
|
|
|
void onResult(BLEAdvertisedDevice *advertisedDevice) override
|
2021-09-14 03:22:00 +02:00
|
|
|
{
|
2021-09-30 18:48:50 +02:00
|
|
|
if (_disable) return;
|
2021-09-14 03:22:00 +02:00
|
|
|
|
2022-06-25 10:43:21 +02:00
|
|
|
BLEAdvertisedDevice copy = *advertisedDevice;
|
|
|
|
|
2022-03-06 17:48:04 +01:00
|
|
|
GUI::seenStart();
|
2022-06-25 10:43:21 +02:00
|
|
|
BleFingerprint *f = getFingerprint(©);
|
|
|
|
if (f->seen(©))
|
2022-03-06 17:48:04 +01:00
|
|
|
GUI::added(f);
|
|
|
|
GUI::seenEnd();
|
2021-09-14 03:22:00 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|