add code for presence detection

This commit is contained in:
technyon
2022-04-05 21:35:21 +02:00
parent 286ac0effe
commit 4616b5e020
7 changed files with 162 additions and 8 deletions

28
PresenceDetection.h Normal file
View File

@@ -0,0 +1,28 @@
#pragma once
#include "BleScanner.h"
#include "BleInterfaces.h"
struct PdDevice
{
char address[18] = {0};
char name[30] = {0};
unsigned long timestamp;
};
class PresenceDetection : public BLEScannerSubscriber
{
public:
PresenceDetection(BleScanner* bleScanner);
virtual ~PresenceDetection();
void initialize();
void update();
void onResult(NimBLEAdvertisedDevice* advertisedDevice) override;
private:
BleScanner* _bleScanner;
std::map<long long, PdDevice> _devices;
uint _timeout = 20000;
};