Add Static Devices

This commit is contained in:
2020-05-01 11:39:46 +02:00
parent 157b1ceb51
commit 21dbdd41d9
12 changed files with 400 additions and 327 deletions
+8 -9
View File
@@ -1,7 +1,8 @@
#ifndef BLUETOOTH_DEVICE_H
#define BLUETOOTH_DEVICE_H
#include "Util/Device.h"
#include "Util/DynamicDevice.h"
#include "Util/StaticDevice.h"
#include <HttpClient.h>
#include <Timer.h>
#include <string>
@@ -14,7 +15,7 @@ namespace Bluetooth {
class Device
{
public:
Device(int timeout, const std::string& inventoryURL, const std::string& target, const std::vector<Util::Device>& devices);
Device(int timeout, const std::string& inventoryURL, const std::string& target, const std::vector<Util::StaticDevice>& staticDevices);
~Device();
void Start();
@@ -24,23 +25,21 @@ public:
private:
void ClearDevices();
void UpdateDevicesFromInventory();
void UpdateOnlineDevices();
void UpdateOfflineDevices();
void UpdatePresentDevices(bool updateOnlineDevices);
void UpdatePresentDevices();
void SendStateChange(bool present, const std::string& macAddress);
private:
Timer::Timer m_onlineDeviceTimer;
Timer::Timer m_offlineDeviceTimer;
Timer::Timer m_deviceTimer;
Timer::Timer m_inventoryTimer;
Http::HttpClient m_httpClient;
std::vector<std::string> m_devices;
std::vector<Util::DynamicDevice> m_dynamicDevices;
int m_timeout;
int m_checkInterval;
std::string m_inventoryURL;
std::string m_target;
std::vector<Util::Device> m_staticDevices;
std::vector<Util::StaticDevice> m_staticDevices;
std::vector<std::string> m_presentDevices;
};