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:
|
2021-03-30 00:12:59 +02:00
|
|
|
BleFingerprint(BLEAdvertisedDevice *advertisedDevice);
|
|
|
|
~BleFingerprint();
|
2021-03-22 14:11:42 +01:00
|
|
|
|
|
|
|
void seen(BLEAdvertisedDevice *advertisedDevice);
|
2021-03-30 00:12:59 +02:00
|
|
|
bool report(JsonDocument *doc);
|
2021-03-22 14:11:42 +01:00
|
|
|
|
2021-03-30 00:12:59 +02:00
|
|
|
String getId() { return id; }
|
|
|
|
|
|
|
|
float getDistance();
|
|
|
|
void setDistance(float distFl);
|
2021-03-22 14:11:42 +01:00
|
|
|
|
2021-03-28 20:35:54 +02:00
|
|
|
NimBLEAddress getAddress() { return address; }
|
2021-03-30 00:12:59 +02:00
|
|
|
void setAddress(NimBLEAddress newAddr) { address = newAddr; }
|
2021-03-22 14:11:42 +01:00
|
|
|
|
|
|
|
private:
|
2021-03-29 21:51:18 +02:00
|
|
|
bool hasValue = false, enroll = false;
|
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
|