Commit 1d7354c171b64646b9236c30c3ed8fafd4b472e6
Committed by
Moritz Wirger
1 parent
f225eaee
Apply documentation changes from code review
Co-authored-by: Moritz Wirger <lj.moritorii@web.de>
Showing
5 changed files
with
29 additions
and
27 deletions
README.md
| @@ -11,6 +11,7 @@ A simple and easy to use library for Philips Hue Lights | @@ -11,6 +11,7 @@ A simple and easy to use library for Philips Hue Lights | ||
| 11 | * function to assign a username or set one manually | 11 | * function to assign a username or set one manually |
| 12 | * all common light functions (brightness, color, temperature) | 12 | * all common light functions (brightness, color, temperature) |
| 13 | * extended alert() functions, which alert in a specific color (good for notifications) | 13 | * extended alert() functions, which alert in a specific color (good for notifications) |
| 14 | +* creating custom sensors and reading sensor values | ||
| 14 | * [documented with doxygen](https://enwi.github.io/hueplusplus/) | 15 | * [documented with doxygen](https://enwi.github.io/hueplusplus/) |
| 15 | * tested with google test, google mock and gcov/lcov | 16 | * tested with google test, google mock and gcov/lcov |
| 16 | 17 |
doc/markdown/Mainpage.md
| @@ -6,6 +6,7 @@ A simple and easy to use library for Philips Hue Lights. | @@ -6,6 +6,7 @@ A simple and easy to use library for Philips Hue Lights. | ||
| 6 | * function to assign a username or set one manually | 6 | * function to assign a username or set one manually |
| 7 | * all common light functions (brightness, color, temperature) | 7 | * all common light functions (brightness, color, temperature) |
| 8 | * extended alert() functions, which alert in a specific color (good for notifications) | 8 | * extended alert() functions, which alert in a specific color (good for notifications) |
| 9 | +* creating custom sensors and reading sensor values | ||
| 9 | * documented with doxygen | 10 | * documented with doxygen |
| 10 | * tested with google test, google mock and gcov/lcov | 11 | * tested with google test, google mock and gcov/lcov |
| 11 | 12 |
include/hueplusplus/CLIPSensors.h
| @@ -43,7 +43,7 @@ public: | @@ -43,7 +43,7 @@ public: | ||
| 43 | //! \throws nlohmann::json::parse_error when response could not be parsed | 43 | //! \throws nlohmann::json::parse_error when response could not be parsed |
| 44 | void setOn(bool on); | 44 | void setOn(bool on); |
| 45 | 45 | ||
| 46 | - //! \brief Get whether sensor has a battery state | 46 | + //! \brief Check whether the sensor has a battery state |
| 47 | bool hasBatteryState() const; | 47 | bool hasBatteryState() const; |
| 48 | //! \brief Get battery state | 48 | //! \brief Get battery state |
| 49 | //! \returns Battery state in percent | 49 | //! \returns Battery state in percent |
| @@ -56,11 +56,11 @@ public: | @@ -56,11 +56,11 @@ public: | ||
| 56 | //! \throws nlohmann::json::parse_error when response could not be parsed | 56 | //! \throws nlohmann::json::parse_error when response could not be parsed |
| 57 | void setBatteryState(int percent); | 57 | void setBatteryState(int percent); |
| 58 | 58 | ||
| 59 | - //! \brief Get whether sensor is reachable | 59 | + //! \brief Check whether the sensor is reachable |
| 60 | //! \note Reachable verification is not implemented for CLIP sensors yet | 60 | //! \note Reachable verification is not implemented for CLIP sensors yet |
| 61 | bool isReachable() const; | 61 | bool isReachable() const; |
| 62 | 62 | ||
| 63 | - //! \brief Get whether sensor has a URL | 63 | + //! \brief Check whether the sensor has a URL |
| 64 | bool hasURL() const; | 64 | bool hasURL() const; |
| 65 | //! \brief Get sensor URL | 65 | //! \brief Get sensor URL |
| 66 | std::string getURL() const; | 66 | std::string getURL() const; |
| @@ -108,7 +108,7 @@ public: | @@ -108,7 +108,7 @@ public: | ||
| 108 | //! \brief Construct from generic sensor | 108 | //! \brief Construct from generic sensor |
| 109 | explicit CLIPOpenClose(Sensor sensor) : BaseCLIP(std::move(sensor)) { } | 109 | explicit CLIPOpenClose(Sensor sensor) : BaseCLIP(std::move(sensor)) { } |
| 110 | 110 | ||
| 111 | - //! \brief Get whether switch is open | 111 | + //! \brief Check whether the switch is open |
| 112 | bool isOpen() const; | 112 | bool isOpen() const; |
| 113 | //! \brief Set switch state | 113 | //! \brief Set switch state |
| 114 | //! | 114 | //! |
| @@ -130,7 +130,7 @@ public: | @@ -130,7 +130,7 @@ public: | ||
| 130 | //! \brief Construct from generic sensor | 130 | //! \brief Construct from generic sensor |
| 131 | explicit CLIPPresence(Sensor sensor) : BaseCLIP(std::move(sensor)) { } | 131 | explicit CLIPPresence(Sensor sensor) : BaseCLIP(std::move(sensor)) { } |
| 132 | 132 | ||
| 133 | - //! \brief Get whether presence was dtected | 133 | + //! \brief Check whether presence was detected |
| 134 | bool getPresence() const; | 134 | bool getPresence() const; |
| 135 | //! \brief Set presence state | 135 | //! \brief Set presence state |
| 136 | //! \throws std::system_error when system or socket operations fail | 136 | //! \throws std::system_error when system or socket operations fail |
| @@ -176,7 +176,7 @@ public: | @@ -176,7 +176,7 @@ public: | ||
| 176 | //! \returns Humidity in 0.01% steps | 176 | //! \returns Humidity in 0.01% steps |
| 177 | int getHumidity() const; | 177 | int getHumidity() const; |
| 178 | //! \brief Set humidity | 178 | //! \brief Set humidity |
| 179 | - //! \param humidity Humidity in 0.01% | 179 | + //! \param humidity Humidity in 0.01% steps |
| 180 | //! \throws std::system_error when system or socket operations fail | 180 | //! \throws std::system_error when system or socket operations fail |
| 181 | //! \throws HueException when response contained no body | 181 | //! \throws HueException when response contained no body |
| 182 | //! \throws HueAPIResponseException when response contains an error | 182 | //! \throws HueAPIResponseException when response contains an error |
include/hueplusplus/Sensor.h
| @@ -67,9 +67,9 @@ public: | @@ -67,9 +67,9 @@ public: | ||
| 67 | //!\name Config attributes | 67 | //!\name Config attributes |
| 68 | ///@{ | 68 | ///@{ |
| 69 | 69 | ||
| 70 | - //! \brief Get whether sensor has an on attribute | 70 | + //! \brief Check whether the sensor has an on attribute |
| 71 | bool hasOn() const; | 71 | bool hasOn() const; |
| 72 | - //! \brief Get whether sensor is turned on | 72 | + //! \brief check whether the sensor is turned on |
| 73 | //! | 73 | //! |
| 74 | //! Sensors which are off do not change their status | 74 | //! Sensors which are off do not change their status |
| 75 | //! \throws nlohmann::json::out_of_range when on attribute does not exist. | 75 | //! \throws nlohmann::json::out_of_range when on attribute does not exist. |
| @@ -81,7 +81,7 @@ public: | @@ -81,7 +81,7 @@ public: | ||
| 81 | //! \throws nlohmann::json::parse_error when response could not be parsed | 81 | //! \throws nlohmann::json::parse_error when response could not be parsed |
| 82 | void setOn(bool on); | 82 | void setOn(bool on); |
| 83 | 83 | ||
| 84 | - //! \brief Get whether sensor has a battery state | 84 | + //! \brief Check whether the sensor has a battery state |
| 85 | bool hasBatteryState() const; | 85 | bool hasBatteryState() const; |
| 86 | //! \brief Get battery state | 86 | //! \brief Get battery state |
| 87 | //! \returns Battery state in percent | 87 | //! \returns Battery state in percent |
| @@ -94,7 +94,7 @@ public: | @@ -94,7 +94,7 @@ public: | ||
| 94 | //! \throws nlohmann::json::parse_error when response could not be parsed | 94 | //! \throws nlohmann::json::parse_error when response could not be parsed |
| 95 | void setBatteryState(int percent); | 95 | void setBatteryState(int percent); |
| 96 | 96 | ||
| 97 | - //! \brief Get whether sensor has alerts | 97 | + //! \brief Check whether the sensor has alerts |
| 98 | bool hasAlert() const; | 98 | bool hasAlert() const; |
| 99 | //! \brief Get last sent alert | 99 | //! \brief Get last sent alert |
| 100 | //! \note This is not cleared when the alert ends. | 100 | //! \note This is not cleared when the alert ends. |
| @@ -107,13 +107,13 @@ public: | @@ -107,13 +107,13 @@ public: | ||
| 107 | //! \throws nlohmann::json::parse_error when response could not be parsed | 107 | //! \throws nlohmann::json::parse_error when response could not be parsed |
| 108 | void sendAlert(Alert type); | 108 | void sendAlert(Alert type); |
| 109 | 109 | ||
| 110 | - //! \brief Get whether sensor has reachable validation | 110 | + //! \brief Check whether the sensor has reachable validation |
| 111 | bool hasReachable() const; | 111 | bool hasReachable() const; |
| 112 | //! \brief Get whether sensor is reachable | 112 | //! \brief Get whether sensor is reachable |
| 113 | //! \throws nlohmann::json::out_of_range when sensor has no reachable validation | 113 | //! \throws nlohmann::json::out_of_range when sensor has no reachable validation |
| 114 | bool isReachable() const; | 114 | bool isReachable() const; |
| 115 | 115 | ||
| 116 | - //! \brief Get whether sensor has user test mode | 116 | + //! \brief Check whether the sensor has a user test mode |
| 117 | bool hasUserTest() const; | 117 | bool hasUserTest() const; |
| 118 | //! \brief Enable or disable user test mode | 118 | //! \brief Enable or disable user test mode |
| 119 | //! | 119 | //! |
| @@ -125,7 +125,7 @@ public: | @@ -125,7 +125,7 @@ public: | ||
| 125 | //! \throws nlohmann::json::parse_error when response could not be parsed | 125 | //! \throws nlohmann::json::parse_error when response could not be parsed |
| 126 | void setUserTest(bool enabled); | 126 | void setUserTest(bool enabled); |
| 127 | 127 | ||
| 128 | - //! \brief Get whether sensor has a URL | 128 | + //! \brief Check whether the sensor has a URL |
| 129 | bool hasURL() const; | 129 | bool hasURL() const; |
| 130 | //! \brief Get sensor URL | 130 | //! \brief Get sensor URL |
| 131 | //! | 131 | //! |
| @@ -145,7 +145,7 @@ public: | @@ -145,7 +145,7 @@ public: | ||
| 145 | //! Attempts to set pending config entries may cause errors. | 145 | //! Attempts to set pending config entries may cause errors. |
| 146 | std::vector<std::string> getPendingConfig() const; | 146 | std::vector<std::string> getPendingConfig() const; |
| 147 | 147 | ||
| 148 | - //! \brief Get whether the sensor has a LED indicator | 148 | + //! \brief Check whether the sensor has an LED indicator |
| 149 | bool hasLEDIndication() const; | 149 | bool hasLEDIndication() const; |
| 150 | //! \brief Get whether the indicator LED is on | 150 | //! \brief Get whether the indicator LED is on |
| 151 | //! \throws nlohmann::json::out_of_range when sensor has no LED | 151 | //! \throws nlohmann::json::out_of_range when sensor has no LED |
| @@ -183,9 +183,9 @@ public: | @@ -183,9 +183,9 @@ public: | ||
| 183 | //! The state can usually only be set on CLIP sensors, not on physical devices. | 183 | //! The state can usually only be set on CLIP sensors, not on physical devices. |
| 184 | void setStateAttribute(const std::string& key, const nlohmann::json& value); | 184 | void setStateAttribute(const std::string& key, const nlohmann::json& value); |
| 185 | 185 | ||
| 186 | - //! \brief Check if sensor is Hue certified | 186 | + //! \brief Check if the sensor is Hue certified |
| 187 | bool isCertified() const; | 187 | bool isCertified() const; |
| 188 | - //! \brief Check if sensor is primary sensor of the device | 188 | + //! \brief Check if the sensor is primary sensor of the device |
| 189 | //! | 189 | //! |
| 190 | //! When there are multiple sensors on one physical device (same MAC address), | 190 | //! When there are multiple sensors on one physical device (same MAC address), |
| 191 | //! the primary device is used for the device information. | 191 | //! the primary device is used for the device information. |
| @@ -270,7 +270,7 @@ public: | @@ -270,7 +270,7 @@ public: | ||
| 270 | //! \brief Construct from generic sensor | 270 | //! \brief Construct from generic sensor |
| 271 | explicit DaylightSensor(Sensor sensor) : BaseDevice(std::move(sensor)) { } | 271 | explicit DaylightSensor(Sensor sensor) : BaseDevice(std::move(sensor)) { } |
| 272 | 272 | ||
| 273 | - //! \brief Check if sensor is on | 273 | + //! \brief Check if the sensor is on |
| 274 | //! | 274 | //! |
| 275 | //! Sensors which are off do not change their status | 275 | //! Sensors which are off do not change their status |
| 276 | bool isOn() const; | 276 | bool isOn() const; |
| @@ -282,7 +282,7 @@ public: | @@ -282,7 +282,7 @@ public: | ||
| 282 | //! \throws nlohmann::json::parse_error when response could not be parsed | 282 | //! \throws nlohmann::json::parse_error when response could not be parsed |
| 283 | void setOn(bool on); | 283 | void setOn(bool on); |
| 284 | 284 | ||
| 285 | - //! \brief Get whether sensor has a battery state | 285 | + //! \brief Check whether the sensor has a battery state |
| 286 | bool hasBatteryState() const; | 286 | bool hasBatteryState() const; |
| 287 | //! \brief Get battery state | 287 | //! \brief Get battery state |
| 288 | //! \returns Battery state in percent | 288 | //! \returns Battery state in percent |
| @@ -333,7 +333,7 @@ public: | @@ -333,7 +333,7 @@ public: | ||
| 333 | //! \throws nlohmann::json::parse_error when response could not be parsed | 333 | //! \throws nlohmann::json::parse_error when response could not be parsed |
| 334 | void setSunsetOffset(int minutes); | 334 | void setSunsetOffset(int minutes); |
| 335 | 335 | ||
| 336 | - //! \brief Get reported daylight status | 336 | + //! \brief Check whether it is daylight or not |
| 337 | bool isDaylight() const; | 337 | bool isDaylight() const; |
| 338 | 338 | ||
| 339 | //! \brief Get time of last status update | 339 | //! \brief Get time of last status update |
include/hueplusplus/ZLLSensors.h
| @@ -82,7 +82,7 @@ public: | @@ -82,7 +82,7 @@ public: | ||
| 82 | //! \throws nlohmann::json::parse_error when response could not be parsed | 82 | //! \throws nlohmann::json::parse_error when response could not be parsed |
| 83 | void setOn(bool on); | 83 | void setOn(bool on); |
| 84 | 84 | ||
| 85 | - //! \brief Get whether sensor has a battery state | 85 | + //! \brief Check whether the sensor has a battery state |
| 86 | bool hasBatteryState() const; | 86 | bool hasBatteryState() const; |
| 87 | //! \brief Get battery state | 87 | //! \brief Get battery state |
| 88 | //! \returns Battery state in percent | 88 | //! \returns Battery state in percent |
| @@ -98,7 +98,7 @@ public: | @@ -98,7 +98,7 @@ public: | ||
| 98 | //! \throws nlohmann::json::parse_error when response could not be parsed | 98 | //! \throws nlohmann::json::parse_error when response could not be parsed |
| 99 | void sendAlert(Alert type); | 99 | void sendAlert(Alert type); |
| 100 | 100 | ||
| 101 | - //! \brief Get whether sensor is reachable | 101 | + //! \brief Check whether the sensor is reachable |
| 102 | bool isReachable() const; | 102 | bool isReachable() const; |
| 103 | 103 | ||
| 104 | //! \brief Get the code of the last switch event. | 104 | //! \brief Get the code of the last switch event. |
| @@ -166,7 +166,7 @@ public: | @@ -166,7 +166,7 @@ public: | ||
| 166 | //! \throws nlohmann::json::parse_error when response could not be parsed | 166 | //! \throws nlohmann::json::parse_error when response could not be parsed |
| 167 | void setOn(bool on); | 167 | void setOn(bool on); |
| 168 | 168 | ||
| 169 | - //! \brief Get whether sensor has a battery state | 169 | + //! \brief Check whether the sensor has a battery state |
| 170 | bool hasBatteryState() const; | 170 | bool hasBatteryState() const; |
| 171 | //! \brief Get battery state | 171 | //! \brief Get battery state |
| 172 | //! \returns Battery state in percent | 172 | //! \returns Battery state in percent |
| @@ -182,7 +182,7 @@ public: | @@ -182,7 +182,7 @@ public: | ||
| 182 | //! \throws nlohmann::json::parse_error when response could not be parsed | 182 | //! \throws nlohmann::json::parse_error when response could not be parsed |
| 183 | void sendAlert(Alert type); | 183 | void sendAlert(Alert type); |
| 184 | 184 | ||
| 185 | - //! \brief Get whether sensor is reachable | 185 | + //! \brief Check whether the sensor is reachable |
| 186 | bool isReachable() const; | 186 | bool isReachable() const; |
| 187 | 187 | ||
| 188 | //! \brief Get sensor sensitivity | 188 | //! \brief Get sensor sensitivity |
| @@ -223,7 +223,7 @@ public: | @@ -223,7 +223,7 @@ public: | ||
| 223 | //! \throws nlohmann::json::parse_error when response could not be parsed | 223 | //! \throws nlohmann::json::parse_error when response could not be parsed |
| 224 | void setOn(bool on); | 224 | void setOn(bool on); |
| 225 | 225 | ||
| 226 | - //! \brief Get whether sensor has a battery state | 226 | + //! \brief Check whether the sensor has a battery state |
| 227 | bool hasBatteryState() const; | 227 | bool hasBatteryState() const; |
| 228 | //! \brief Get battery state | 228 | //! \brief Get battery state |
| 229 | //! \returns Battery state in percent | 229 | //! \returns Battery state in percent |
| @@ -239,7 +239,7 @@ public: | @@ -239,7 +239,7 @@ public: | ||
| 239 | //! \throws nlohmann::json::parse_error when response could not be parsed | 239 | //! \throws nlohmann::json::parse_error when response could not be parsed |
| 240 | void sendAlert(Alert type); | 240 | void sendAlert(Alert type); |
| 241 | 241 | ||
| 242 | - //! \brief Get whether sensor is reachable | 242 | + //! \brief Check whether the sensor is reachable |
| 243 | bool isReachable() const; | 243 | bool isReachable() const; |
| 244 | 244 | ||
| 245 | //! \brief Get recorded temperature | 245 | //! \brief Get recorded temperature |
| @@ -273,13 +273,13 @@ public: | @@ -273,13 +273,13 @@ public: | ||
| 273 | //! \throws nlohmann::json::parse_error when response could not be parsed | 273 | //! \throws nlohmann::json::parse_error when response could not be parsed |
| 274 | void setOn(bool on); | 274 | void setOn(bool on); |
| 275 | 275 | ||
| 276 | - //! \brief Get whether sensor has a battery state | 276 | + //! \brief Check whether the sensor has a battery state |
| 277 | bool hasBatteryState() const; | 277 | bool hasBatteryState() const; |
| 278 | //! \brief Get battery state | 278 | //! \brief Get battery state |
| 279 | //! \returns Battery state in percent | 279 | //! \returns Battery state in percent |
| 280 | int getBatteryState() const; | 280 | int getBatteryState() const; |
| 281 | 281 | ||
| 282 | - //! \brief Get whether sensor is reachable | 282 | + //! \brief Check whether the sensor is reachable |
| 283 | bool isReachable() const; | 283 | bool isReachable() const; |
| 284 | 284 | ||
| 285 | //! \brief Get threshold to detect darkness | 285 | //! \brief Get threshold to detect darkness |