ESPresense/lib/BleFingerprint/BleFingerprint.h

53 lines
1.3 KiB
C
Raw Normal View History

#ifndef _BLEFINGERPRINT_
#define _BLEFINGERPRINT_
2021-04-05 04:12:46 +02:00
#include <ArduinoJson.h>
2021-08-23 15:48:40 +02:00
#include <GUI.h>
#include <NimBLEAdvertisedDevice.h>
#include <NimBLEBeacon.h>
2021-04-05 04:12:46 +02:00
#include <NimBLEDevice.h>
#include <NimBLEEddystoneTLM.h>
#include <NimBLEEddystoneURL.h>
2021-03-22 23:56:29 +01:00
#include <SoftFilters.h>
class BleFingerprint
{
public:
2021-04-05 04:12:46 +02:00
BleFingerprint(BLEAdvertisedDevice *advertisedDevice, float fcmin, float beta, float dcutoff);
~BleFingerprint();
void seen(BLEAdvertisedDevice *advertisedDevice);
2021-03-31 19:36:20 +02:00
bool report(JsonDocument *doc, int maxDistance);
String getId() { return id; }
2021-04-07 02:13:13 +02:00
float getDistance() { return output.value.position; }
int getRSSI() { return rssi; }
void setInitial(int rssi, float distance);
NimBLEAddress getAddress() { return address; }
2021-04-02 21:16:30 +02:00
long getLastSeen() { return lastSeenMicros; };
private:
bool hasValue = false, close = false, reported = false, macPublic = false;
NimBLEAddress address;
2021-03-29 20:50:23 +02:00
String id, name, url;
2021-04-07 02:13:13 +02:00
int rssi = -100, calRssi = 0;
int newest = -100;
int recent = -100;
int oldest = -100;
2021-04-02 13:56:27 +02:00
float raw, lastReported = 0;
long firstSeenMicros, lastSeenMicros = 0, lastReportedMicros = 0;
2021-03-29 20:50:23 +02:00
2021-03-22 23:56:29 +01:00
Reading<Differential<float>> output;
TimestampFilter<float> tsFilter;
2021-04-05 04:12:46 +02:00
one_euro_filter<double, unsigned long> oneEuro;
2021-03-22 23:56:29 +01:00
DifferentialFilter<float> diffFilter;
2021-04-07 02:13:13 +02:00
bool filter();
};
#endif