hueplusplus  1.0.0
LibConfig.h
Go to the documentation of this file.
1 
23 #ifndef INCLUDE_HUEPLUSPLUS_HUE_CONFIG_H
24 #define INCLUDE_HUEPLUSPLUS_HUE_CONFIG_H
25 
26 #include <chrono>
27 
28 namespace hueplusplus
29 {
33 class Config
34 {
35 private:
36  using duration = std::chrono::steady_clock::duration;
37 
38 public:
40  duration getPreAlertDelay() const { return preAlertDelay; }
42  duration getPostAlertDelay() const { return postAlertDelay; }
43 
45  duration getUPnPTimeout() const { return upnpTimeout; }
46 
48  duration getBridgeRequestDelay() const { return bridgeRequestDelay; }
49 
51  duration getRequestUsernameTimeout() const { return requestUsernameDelay; }
52 
55 
57  static Config& instance()
58  {
59  static Config c;
60  return c;
61  }
62 protected:
63  Config() = default;
64 
65 protected:
66  duration preAlertDelay = std::chrono::milliseconds(120);
67  duration postAlertDelay = std::chrono::milliseconds(1600);
68  duration upnpTimeout = std::chrono::seconds(5);
69  duration bridgeRequestDelay = std::chrono::milliseconds(100);
70  duration requestUsernameDelay = std::chrono::seconds(35);
71  duration requestUsernameAttemptInterval = std::chrono::seconds(1);
72 };
73 } // namespace hueplusplus
74 
75 #endif
duration getBridgeRequestDelay() const
Delay between bridge requests.
Definition: LibConfig.h:48
duration upnpTimeout
Definition: LibConfig.h:68
duration bridgeRequestDelay
Definition: LibConfig.h:69
Namespace for the hueplusplus library.
Definition: Action.h:27
static Config & instance()
Get config instance.
Definition: LibConfig.h:57
Configurable delays.
Definition: LibConfig.h:33
duration getRequestUsernameAttemptInterval() const
Interval in which username requests are attempted.
Definition: LibConfig.h:54
duration getRequestUsernameTimeout() const
Timeout for Bridge::requestUsername, waits until link button was pressed.
Definition: LibConfig.h:51
duration preAlertDelay
Definition: LibConfig.h:66
duration requestUsernameAttemptInterval
Definition: LibConfig.h:71
duration getUPnPTimeout() const
Timeout for UPnP multicast request.
Definition: LibConfig.h:45
duration requestUsernameDelay
Definition: LibConfig.h:70
duration postAlertDelay
Definition: LibConfig.h:67
duration getPostAlertDelay() const
Delay for advanced alerts after the actual alert.
Definition: LibConfig.h:42
duration getPreAlertDelay() const
Delay for advanced alerts before the actual alert.
Definition: LibConfig.h:40