Implement use of Inventory API

This commit is contained in:
2019-04-23 11:41:34 +02:00
parent ea71693886
commit 5724bd45a7
9 changed files with 184 additions and 62 deletions
+7 -2
View File
@@ -14,7 +14,7 @@ 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& target);
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();
@@ -25,11 +25,13 @@ private:
bool Login();
void Logout();
void UpdateDevicesFromInventory();
void UpdatePresentDevices();
void SendStateChange(bool present, const std::string& macAddress);
private:
Util::Timer m_timer;
Util::Timer m_deviceTimer;
Util::Timer m_inventoryTimer;
Util::HttpClient m_httpClient;
std::mutex m_mutex;
@@ -39,6 +41,9 @@ private:
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;