2021-03-22 14:11:42 +01:00
|
|
|
#ifndef _BLEFINGERPRINT_
|
|
|
|
#define _BLEFINGERPRINT_
|
|
|
|
|
|
|
|
#include <NimBLEDevice.h>
|
|
|
|
#include <NimBLEAdvertisedDevice.h>
|
|
|
|
#include <NimBLEEddystoneURL.h>
|
|
|
|
#include <NimBLEEddystoneTLM.h>
|
|
|
|
#include <NimBLEBeacon.h>
|
|
|
|
#include <ArduinoJson.h>
|
2021-03-22 23:56:29 +01:00
|
|
|
#include <SoftFilters.h>
|
2021-03-22 14:11:42 +01:00
|
|
|
|
|
|
|
class BleFingerprint
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
BleFingerprint(BLEAdvertisedDevice *advertisedDevice, float initalDistance);
|
|
|
|
|
|
|
|
void seen(BLEAdvertisedDevice *advertisedDevice);
|
2021-03-29 20:50:23 +02:00
|
|
|
bool shouldReport();
|
|
|
|
StaticJsonDocument<512> report();
|
2021-03-22 14:11:42 +01:00
|
|
|
|
2021-03-29 14:53:51 +02:00
|
|
|
void setCalRssi(int rssi) { calRssi = rssi; }
|
2021-03-22 14:11:42 +01:00
|
|
|
|
2021-03-28 20:35:54 +02:00
|
|
|
NimBLEAddress getAddress() { return address; }
|
2021-03-22 14:11:42 +01:00
|
|
|
|
|
|
|
private:
|
2021-03-29 20:50:23 +02:00
|
|
|
bool hasValue;
|
2021-03-28 20:35:54 +02:00
|
|
|
NimBLEAddress address;
|
2021-03-29 20:50:23 +02:00
|
|
|
String id, name, url;
|
2021-03-22 14:11:42 +01:00
|
|
|
int rssi, calRssi;
|
2021-03-22 23:56:29 +01:00
|
|
|
float raw;
|
2021-03-29 20:50:23 +02:00
|
|
|
time_t firstSeen;
|
|
|
|
time_t lastSeen;
|
|
|
|
|
2021-03-22 23:56:29 +01:00
|
|
|
Reading<Differential<float>> output;
|
|
|
|
|
|
|
|
TimestampFilter<float> tsFilter;
|
2021-03-24 14:10:33 +01:00
|
|
|
one_euro_filter<double, unsigned long> oneEuro{one_euro_filter<double, unsigned long>(1, 0.01, 0.01, 1)};
|
2021-03-22 23:56:29 +01:00
|
|
|
DifferentialFilter<float> diffFilter;
|
2021-03-22 14:11:42 +01:00
|
|
|
};
|
|
|
|
#endif
|