Driver.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef BLUETOOTH_DRIVER_H
  2. #define BLUETOOTH_DRIVER_H
  3. #include "Util/DynamicDevice.h"
  4. #include "Util/StaticDevice.h"
  5. #include <HttpClient.h>
  6. #include <Timer.h>
  7. #include <string>
  8. #include <vector>
  9. namespace PresenceDetection {
  10. namespace Bluetooth {
  11. class Driver
  12. {
  13. public:
  14. Driver(int timeout, const std::string& inventoryURL, const std::string& target, const std::vector<Util::StaticDevice>& staticDevices);
  15. ~Driver();
  16. void Start();
  17. void Stop();
  18. void Wait();
  19. private:
  20. void ClearDevices();
  21. void UpdateDevicesFromInventory();
  22. void UpdatePresentDevices();
  23. void SendStateChange(bool present, const std::string& macAddress);
  24. private:
  25. Timer::Timer m_deviceTimer;
  26. Timer::Timer m_inventoryTimer;
  27. Http::HttpClient m_httpClient;
  28. std::vector<Util::DynamicDevice> m_dynamicDevices;
  29. int m_timeout;
  30. int m_checkInterval;
  31. std::string m_inventoryURL;
  32. std::string m_target;
  33. std::vector<Util::StaticDevice> m_staticDevices;
  34. std::vector<std::string> m_presentDevices;
  35. };
  36. } // namespace Bluetooth
  37. } // namespace PresenceDetection
  38. #endif // BLUETOOTH_DRIVER_H