Device.h 982 B

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