hueplusplus  1.0.0
BridgeConfig.h
Go to the documentation of this file.
1 
22 #ifndef INCLUDE_HUEPLUSPLUS_BRIDGE_CONFIG_H
23 #define INCLUDE_HUEPLUSPLUS_BRIDGE_CONFIG_H
24 
25 #include <string>
26 #include <vector>
27 
28 #include "APICache.h"
29 #include "TimePattern.h"
30 
31 namespace hueplusplus
32 {
34 struct Version
35 {
36  int major;
37  int minor;
38  int patch;
39 };
40 
43 {
45  std::string key;
47  std::string name;
52 };
53 
56 {
57 public:
59  BridgeConfig(std::shared_ptr<APICache> baseCache, std::chrono::steady_clock::duration refreshDuration);
60 
68  void refresh(bool force = false);
69 
72  void setRefreshDuration(std::chrono::steady_clock::duration refreshDuration);
73 
76  std::vector<WhitelistedUser> getWhitelistedUsers() const;
83  void removeUser(const std::string& userKey);
84 
89  bool getLinkButton() const;
91  void pressLinkButton();
92 
94  void touchLink();
95 
97  std::string getMACAddress() const;
99  time::AbsoluteTime getUTCTime() const;
102  std::string getTimezone() const;
103 
104 protected:
105  BridgeConfig(const BridgeConfig&) = default;
106  BridgeConfig(BridgeConfig&&) = default;
107  BridgeConfig& operator=(const BridgeConfig&) = default;
108  BridgeConfig& operator=(BridgeConfig&&) = default;
109 
110 private:
111  APICache cache;
112 };
113 } // namespace hueplusplus
114 
115 #endif
User that is whitelisted for Hue API usage.
Definition: BridgeConfig.h:42
int patch
Definition: BridgeConfig.h:38
Namespace for the hueplusplus library.
Definition: Action.h:27
Caches API GET requests and refreshes regularly.
Definition: APICache.h:37
int minor
Definition: BridgeConfig.h:37
int major
Definition: BridgeConfig.h:36
One-time, absolute time point.
Definition: TimePattern.h:72
std::string name
Name provided on user creation.
Definition: BridgeConfig.h:47
API version consisting of major, minor and patch version.
Definition: BridgeConfig.h:34
General bridge configuration properties.
Definition: BridgeConfig.h:55
std::string key
API username of the user.
Definition: BridgeConfig.h:45
time::AbsoluteTime created
Time the user was created.
Definition: BridgeConfig.h:51
time::AbsoluteTime lastUsed
Last time the user was used.
Definition: BridgeConfig.h:49