| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #ifndef UNIFI_DEVICE_H
- #define UNIFI_DEVICE_H
- #include <mutex>
- #include <string>
- #include <vector>
- #include "Util/Timer.h"
- #include "Util/HttpClient.h"
- namespace PresenceDetection {
- namespace UniFi {
- class Device
- {
- public:
- Device(const std::string& hostname, const std::string& username, const std::string& password, const std::string& cookieFile, const std::string& inventoryURL, const std::string& target);
- ~Device();
- void Start();
- void Stop();
- void Wait();
- private:
- bool Login();
- void Logout();
- void UpdateDevicesFromInventory();
- void UpdatePresentDevices();
- void SendStateChange(bool present, const std::string& macAddress);
- private:
- Util::Timer m_deviceTimer;
- Util::Timer m_inventoryTimer;
- Util::HttpClient m_httpClient;
- std::mutex m_mutex;
- bool m_loggedIn;
- std::string m_hostname;
- std::string m_username;
- std::string m_password;
- std::string m_cookieFile;
- std::vector<std::string> m_devices;
- std::string m_inventoryURL;
- std::string m_target;
- int m_offlineTimeout;
- std::vector<std::string> m_presentDevices;
- };
- } // namespace UniFi
- } // namespace PresenceDetection
- #endif // UNIFI_DEVICE_H
|