- move source file according with platformio standard directory structure

- remove lib_deps from platformio.ini since they are already in libs folder
This commit is contained in:
Luca Oliano
2024-04-27 11:06:13 +02:00
parent afd4d68580
commit ade24e86a8
54 changed files with 132 additions and 45 deletions

38
src/PresenceDetection.h Normal file
View File

@@ -0,0 +1,38 @@
#pragma once
#include "BleScanner.h"
#include "BleInterfaces.h"
#include "Network.h"
struct PdDevice
{
char address[18] = {0};
char name[37] = {0};
unsigned long timestamp = 0;
int rssi = 0;
bool hasRssi = false;
};
class PresenceDetection : public BleScanner::Subscriber
{
public:
PresenceDetection(Preferences* preferences, BleScanner::Scanner* bleScanner, Network* network, char* buffer, size_t bufferSize);
virtual ~PresenceDetection();
void initialize();
void update();
void onResult(NimBLEAdvertisedDevice* advertisedDevice) override;
private:
void buildCsv(const PdDevice& device);
Preferences* _preferences;
BleScanner::Scanner* _bleScanner;
Network* _network;
char* _csv = {0};
size_t _bufferSize = 0;
std::map<long long, PdDevice> _devices;
int _timeout = 20000;
int _csvIndex = 0;
};