Commit 1f966e6eb6b1d0270a8be210974708e5df0fcbe5
Committed by
Moritz Wirger
1 parent
f0166f40
Add class definitions for all sensor types.
Showing
3 changed files
with
476 additions
and
42 deletions
include/hueplusplus/CLIPSensors.h
0 → 100644
| 1 | +/** | ||
| 2 | + \file CLIPSensors.h | ||
| 3 | + Copyright Notice\n | ||
| 4 | + Copyright (C) 2020 Jan Rogall - developer\n | ||
| 5 | + | ||
| 6 | + This file is part of hueplusplus. | ||
| 7 | + | ||
| 8 | + hueplusplus is free software: you can redistribute it and/or modify | ||
| 9 | + it under the terms of the GNU Lesser General Public License as published by | ||
| 10 | + the Free Software Foundation, either version 3 of the License, or | ||
| 11 | + (at your option) any later version. | ||
| 12 | + | ||
| 13 | + hueplusplus is distributed in the hope that it will be useful, | ||
| 14 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | + GNU Lesser General Public License for more details. | ||
| 17 | + | ||
| 18 | + You should have received a copy of the GNU Lesser General Public License | ||
| 19 | + along with hueplusplus. If not, see <http://www.gnu.org/licenses/>. | ||
| 20 | + */ | ||
| 21 | + | ||
| 22 | +#ifndef INCLUDE_HUEPLUSPLUS_CLIP_SENSORS_H | ||
| 23 | +#define INCLUDE_HUEPLUSPLUS_CLIP_SENSORS_H | ||
| 24 | + | ||
| 25 | +#include "Sensor.h" | ||
| 26 | + | ||
| 27 | +namespace hueplusplus | ||
| 28 | +{ | ||
| 29 | +namespace sensors | ||
| 30 | +{ | ||
| 31 | +class CLIPSwitch : public BaseDevice | ||
| 32 | +{ | ||
| 33 | +public: | ||
| 34 | + CLIPSwitch(Sensor sensor) : BaseDevice(std::move(sensor)) { } | ||
| 35 | + | ||
| 36 | + int getButtonEvent() const; | ||
| 37 | + | ||
| 38 | + static constexpr const char* typeStr = "CLIPSwitch"; | ||
| 39 | +}; | ||
| 40 | +class CLIPOpenClose : public BaseDevice | ||
| 41 | +{ | ||
| 42 | +public: | ||
| 43 | + CLIPOpenClose(Sensor sensor) : BaseDevice(std::move(sensor)) { } | ||
| 44 | + | ||
| 45 | + bool isOn() const; | ||
| 46 | + void setOn(bool on); | ||
| 47 | + | ||
| 48 | + bool hasBattery() const; | ||
| 49 | + int getBatteryState() const; | ||
| 50 | + void setBatteryState(int percent); | ||
| 51 | + | ||
| 52 | + bool isReachable() const; | ||
| 53 | + | ||
| 54 | + bool hasURL() const; | ||
| 55 | + std::string getURL() const; | ||
| 56 | + void setURL(const std::string& url); | ||
| 57 | + | ||
| 58 | + bool isOpen() const; | ||
| 59 | + | ||
| 60 | + time::AbsoluteTime getLastUpdated() const; | ||
| 61 | + | ||
| 62 | + static constexpr const char* typeStr = "CLIPOpenClose"; | ||
| 63 | +}; | ||
| 64 | + | ||
| 65 | +class CLIPPresence : public BaseDevice | ||
| 66 | +{ | ||
| 67 | +public: | ||
| 68 | + bool isOn() const; | ||
| 69 | + void setOn(bool on); | ||
| 70 | + | ||
| 71 | + bool hasBattery() const; | ||
| 72 | + int getBatteryState() const; | ||
| 73 | + void setBatteryState(int percent); | ||
| 74 | + | ||
| 75 | + bool isReachable() const; | ||
| 76 | + | ||
| 77 | + bool hasURL() const; | ||
| 78 | + std::string getURL() const; | ||
| 79 | + void setURL(const std::string& url); | ||
| 80 | + | ||
| 81 | + bool getPresence() const; | ||
| 82 | + void setPresence(bool presence); | ||
| 83 | + | ||
| 84 | + time::AbsoluteTime getLastUpdated() const; | ||
| 85 | + | ||
| 86 | + static constexpr const char* typeStr = "CLIPPresence"; | ||
| 87 | +}; | ||
| 88 | + | ||
| 89 | +class CLIPTemperature : public BaseDevice | ||
| 90 | +{ | ||
| 91 | +public: | ||
| 92 | + CLIPTemperature(Sensor sensor) : BaseDevice(std::move(sensor)) { } | ||
| 93 | + | ||
| 94 | + bool isOn() const; | ||
| 95 | + void setOn(bool on); | ||
| 96 | + | ||
| 97 | + bool hasBattery() const; | ||
| 98 | + int getBatteryState() const; | ||
| 99 | + void setBatteryState(int percent); | ||
| 100 | + | ||
| 101 | + bool isReachable() const; | ||
| 102 | + | ||
| 103 | + bool hasURL() const; | ||
| 104 | + std::string getURL() const; | ||
| 105 | + void setURL(const std::string& url); | ||
| 106 | + | ||
| 107 | + int getTemperature() const; | ||
| 108 | + void setTemperature(int temperature); | ||
| 109 | + | ||
| 110 | + time::AbsoluteTime getLastUpdated() const; | ||
| 111 | + | ||
| 112 | + static constexpr const char* typeStr = "CLIPTemperature"; | ||
| 113 | +}; | ||
| 114 | +class CLIPHumidity : public BaseDevice | ||
| 115 | +{ | ||
| 116 | +public: | ||
| 117 | + CLIPHumidity(Sensor sensor) : BaseDevice(std::move(sensor)) { } | ||
| 118 | + | ||
| 119 | + bool isOn() const; | ||
| 120 | + void setOn(bool on); | ||
| 121 | + | ||
| 122 | + bool hasBattery() const; | ||
| 123 | + int getBatteryState() const; | ||
| 124 | + void setBatteryState(int percent); | ||
| 125 | + | ||
| 126 | + bool isReachable() const; | ||
| 127 | + | ||
| 128 | + bool hasURL() const; | ||
| 129 | + std::string getURL() const; | ||
| 130 | + void setURL(const std::string& url); | ||
| 131 | + | ||
| 132 | + int getHumidity() const; | ||
| 133 | + void setHumidity(int humidity); | ||
| 134 | + | ||
| 135 | + time::AbsoluteTime getLastUpdated() const; | ||
| 136 | + | ||
| 137 | + static constexpr const char* typeStr = "CLIPHumidity"; | ||
| 138 | +}; | ||
| 139 | +class CLIPLightLevel : public BaseDevice | ||
| 140 | +{ | ||
| 141 | +public: | ||
| 142 | + CLIPLightLevel(Sensor sensor) : BaseDevice(std::move(sensor)) { } | ||
| 143 | + | ||
| 144 | + bool isOn() const; | ||
| 145 | + void setOn(bool on); | ||
| 146 | + | ||
| 147 | + bool hasBattery() const; | ||
| 148 | + int getBatteryState() const; | ||
| 149 | + void setBatteryState(int percent); | ||
| 150 | + | ||
| 151 | + bool isReachable() const; | ||
| 152 | + | ||
| 153 | + int getDarkThreshold() const; | ||
| 154 | + void setDarkThreshold(int threshold); | ||
| 155 | + | ||
| 156 | + int getThresholdOffset() const; | ||
| 157 | + void setThresholdOffset(int offset); | ||
| 158 | + | ||
| 159 | + bool hasURL() const; | ||
| 160 | + std::string getURL() const; | ||
| 161 | + void setURL(const std::string& url); | ||
| 162 | + | ||
| 163 | + void setLightLevel(int level); | ||
| 164 | + int getLightLevel() const; | ||
| 165 | + bool isDark() const; | ||
| 166 | + bool isDaylight() const; | ||
| 167 | + | ||
| 168 | + static constexpr const char* typeStr = "CLIPLightLevel"; | ||
| 169 | +}; | ||
| 170 | +class CLIPGenericFlag : public BaseDevice | ||
| 171 | +{ | ||
| 172 | +public: | ||
| 173 | + CLIPGenericFlag(Sensor sensor) : BaseDevice(std::move(sensor)) { } | ||
| 174 | + | ||
| 175 | + bool isOn() const; | ||
| 176 | + void setOn(bool on); | ||
| 177 | + | ||
| 178 | + bool hasBattery() const; | ||
| 179 | + int getBatteryState() const; | ||
| 180 | + void setBatteryState(int percent); | ||
| 181 | + | ||
| 182 | + bool isReachable() const; | ||
| 183 | + | ||
| 184 | + bool hasURL() const; | ||
| 185 | + std::string getURL() const; | ||
| 186 | + void setURL(const std::string& url); | ||
| 187 | + | ||
| 188 | + bool getFlag() const; | ||
| 189 | + void setFlag(bool flag); | ||
| 190 | + | ||
| 191 | + static constexpr const char* typeStr = "CLIPGenericFlag"; | ||
| 192 | +}; | ||
| 193 | +class CLIPGenericStatus : public BaseDevice | ||
| 194 | +{ | ||
| 195 | +public: | ||
| 196 | + CLIPGenericStatus(Sensor sensor) : BaseDevice(std::move(sensor)) { } | ||
| 197 | + | ||
| 198 | + bool isOn() const; | ||
| 199 | + void setOn(bool on); | ||
| 200 | + | ||
| 201 | + bool hasBattery() const; | ||
| 202 | + int getBatteryState() const; | ||
| 203 | + void setBatteryState(int percent); | ||
| 204 | + | ||
| 205 | + bool isReachable() const; | ||
| 206 | + | ||
| 207 | + bool hasURL() const; | ||
| 208 | + std::string getURL() const; | ||
| 209 | + void setURL(const std::string& url); | ||
| 210 | + | ||
| 211 | + int getStatus() const; | ||
| 212 | + void setStatus(int status); | ||
| 213 | + | ||
| 214 | + static constexpr const char* typeStr = "CLIPGenericStatus"; | ||
| 215 | +}; | ||
| 216 | +} // namespace sensors | ||
| 217 | +} // namespace hueplusplus | ||
| 218 | + | ||
| 219 | +#endif |
include/hueplusplus/Sensor.h
| @@ -26,13 +26,14 @@ | @@ -26,13 +26,14 @@ | ||
| 26 | 26 | ||
| 27 | #include "BaseDevice.h" | 27 | #include "BaseDevice.h" |
| 28 | #include "HueCommandAPI.h" | 28 | #include "HueCommandAPI.h" |
| 29 | +#include "TimePattern.h" | ||
| 29 | 30 | ||
| 30 | #include "json/json.hpp" | 31 | #include "json/json.hpp" |
| 31 | 32 | ||
| 32 | namespace hueplusplus | 33 | namespace hueplusplus |
| 33 | { | 34 | { |
| 34 | //! | 35 | //! |
| 35 | -//! Class for Hue sensors | 36 | +//! Generic class for Hue sensors |
| 36 | //! | 37 | //! |
| 37 | class Sensor : public BaseDevice | 38 | class Sensor : public BaseDevice |
| 38 | { | 39 | { |
| @@ -42,47 +43,62 @@ public: | @@ -42,47 +43,62 @@ public: | ||
| 42 | //! \brief std dtor | 43 | //! \brief std dtor |
| 43 | ~Sensor() = default; | 44 | ~Sensor() = default; |
| 44 | 45 | ||
| 45 | - //! \brief Function to get button event | ||
| 46 | - //! | ||
| 47 | - //! \return integer representing the button event | ||
| 48 | - //! \throws std::system_error when system or socket operations fail | ||
| 49 | - //! \throws HueException when response contained no body | ||
| 50 | - //! \throws HueAPIResponseException when response contains an error | ||
| 51 | - //! \throws nlohmann::json::parse_error when response could not be parsed | ||
| 52 | - virtual int getButtonEvent(); | ||
| 53 | - | ||
| 54 | - //! \brief Const function to get button event | ||
| 55 | - //! | ||
| 56 | - //! \note This will not refresh the sensor state | ||
| 57 | - //! \return integer representing the button event | ||
| 58 | - virtual int getButtonEvent() const; | ||
| 59 | - | ||
| 60 | - //! \brief Function to get sensor status | ||
| 61 | - //! | ||
| 62 | - //! \return integer representing the status | ||
| 63 | - //! \throws std::system_error when system or socket operations fail | ||
| 64 | - //! \throws HueException when response contained no body | ||
| 65 | - //! \throws HueAPIResponseException when response contains an error | ||
| 66 | - //! \throws nlohmann::json::parse_error when response could not be parsed | ||
| 67 | - virtual int getStatus(); | ||
| 68 | - | ||
| 69 | - //! \brief Const function to get sensor status | ||
| 70 | - //! | ||
| 71 | - //! \note This will not refresh the sensor state | ||
| 72 | - //! \return integer representing the button event | ||
| 73 | - virtual int getStatus() const; | ||
| 74 | - | ||
| 75 | - //! \brief Const function to check whether this sensor has a button event | ||
| 76 | - //! | ||
| 77 | - //! \return Bool that is true when the sensor has specified abilities and false | ||
| 78 | - //! when not | ||
| 79 | - virtual bool hasButtonEvent() const; | ||
| 80 | - | ||
| 81 | - //! \brief Const function to check whether this sensor has a status | ||
| 82 | - //! | ||
| 83 | - //! \return Bool that is true when the sensor has specified abilities and false | ||
| 84 | - //! when not | ||
| 85 | - virtual bool hasStatus() const; | 46 | + bool hasOn() const; |
| 47 | + // Check whether sensor is on. Does not update when off | ||
| 48 | + bool isOn() const; | ||
| 49 | + void setOn(bool on); | ||
| 50 | + | ||
| 51 | + bool hasBatteryState() const; | ||
| 52 | + // Battery state in percent | ||
| 53 | + int getBatteryState() const; | ||
| 54 | + bool isReachable() const; | ||
| 55 | + | ||
| 56 | + bool hasAlert() const; | ||
| 57 | + std::string getLastAlert() const; | ||
| 58 | + void sendAlert(const std::string& alert); | ||
| 59 | + | ||
| 60 | + bool hasReachable() const; | ||
| 61 | + bool isReachable() const; | ||
| 62 | + | ||
| 63 | + time::AbsoluteTime getLastUpdated() const; | ||
| 64 | + | ||
| 65 | + bool hasUserTest() const; | ||
| 66 | + void setUserTest(bool enabled); | ||
| 67 | + | ||
| 68 | + bool hasURL() const; | ||
| 69 | + std::string getURL() const; | ||
| 70 | + void setURL(const std::string& url); | ||
| 71 | + | ||
| 72 | + std::vector<std::string> getPendingConfig() const; | ||
| 73 | + | ||
| 74 | + bool hasLEDIndication() const; | ||
| 75 | + bool getLEDIndication() const; | ||
| 76 | + void setLEDIndication(bool on); | ||
| 77 | + | ||
| 78 | + nlohmann::json getState() const; | ||
| 79 | + time::AbsoluteTime getLastUpdated() const; | ||
| 80 | + | ||
| 81 | + bool isCertified() const; | ||
| 82 | + bool isPrimary() const; | ||
| 83 | + | ||
| 84 | + template <typename T> | ||
| 85 | + T asSensorType() const | ||
| 86 | + { | ||
| 87 | + if (getType() != T::type_str) | ||
| 88 | + { | ||
| 89 | + throw HueException(FileInfo {__FILE__, __LINE__, __func__}, "Sensor type does not match: " + getType()); | ||
| 90 | + } | ||
| 91 | + return T(*this); | ||
| 92 | + } | ||
| 93 | + template <typename T> | ||
| 94 | + T asSensorType() && | ||
| 95 | + { | ||
| 96 | + if (getType() != T::typeStr) | ||
| 97 | + { | ||
| 98 | + throw HueException(FileInfo {__FILE__, __LINE__, __func__}, "Sensor type does not match: " + getType()); | ||
| 99 | + } | ||
| 100 | + return T(std::move(*this)); | ||
| 101 | + } | ||
| 86 | 102 | ||
| 87 | protected: | 103 | protected: |
| 88 | //! \brief Protected ctor that is used by \ref Bridge class. | 104 | //! \brief Protected ctor that is used by \ref Bridge class. |
| @@ -92,6 +108,36 @@ protected: | @@ -92,6 +108,36 @@ protected: | ||
| 92 | //! \param refreshDuration Time between refreshing the cached state. | 108 | //! \param refreshDuration Time between refreshing the cached state. |
| 93 | Sensor(int id, const HueCommandAPI& commands, std::chrono::steady_clock::duration refreshDuration); | 109 | Sensor(int id, const HueCommandAPI& commands, std::chrono::steady_clock::duration refreshDuration); |
| 94 | }; | 110 | }; |
| 111 | + | ||
| 112 | +namespace sensors | ||
| 113 | +{ | ||
| 114 | +class DaylightSensor : public BaseDevice | ||
| 115 | +{ | ||
| 116 | +public: | ||
| 117 | + DaylightSensor(Sensor sensor) : BaseDevice(std::move(sensor)) { } | ||
| 118 | + | ||
| 119 | + bool isOn() const; | ||
| 120 | + void setOn(bool on); | ||
| 121 | + | ||
| 122 | + bool hasBattery() const; | ||
| 123 | + int getBatteryState() const; | ||
| 124 | + void setBatteryState(int percent); | ||
| 125 | + | ||
| 126 | + void setCoordinates(std::string latitude, std::string longitude); | ||
| 127 | + | ||
| 128 | + int getSunriseOffset() const; | ||
| 129 | + void setSunriseOffset(int minutes); | ||
| 130 | + | ||
| 131 | + int getSunsetOffeset() const; | ||
| 132 | + void setSunsetOffest(int minutes); | ||
| 133 | + | ||
| 134 | + bool isDaylight() const; | ||
| 135 | + | ||
| 136 | + static constexpr const char* typeStr = "Daylight"; | ||
| 137 | +}; | ||
| 138 | + | ||
| 139 | +} // namespace sensors | ||
| 140 | + | ||
| 95 | } // namespace hueplusplus | 141 | } // namespace hueplusplus |
| 96 | 142 | ||
| 97 | #endif | 143 | #endif |
include/hueplusplus/ZLLSensors.h
0 → 100644
| 1 | +/** | ||
| 2 | + \file ZLLSensors.h | ||
| 3 | + Copyright Notice\n | ||
| 4 | + Copyright (C) 2020 Jan Rogall - developer\n | ||
| 5 | + | ||
| 6 | + This file is part of hueplusplus. | ||
| 7 | + | ||
| 8 | + hueplusplus is free software: you can redistribute it and/or modify | ||
| 9 | + it under the terms of the GNU Lesser General Public License as published by | ||
| 10 | + the Free Software Foundation, either version 3 of the License, or | ||
| 11 | + (at your option) any later version. | ||
| 12 | + | ||
| 13 | + hueplusplus is distributed in the hope that it will be useful, | ||
| 14 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | + GNU Lesser General Public License for more details. | ||
| 17 | + | ||
| 18 | + You should have received a copy of the GNU Lesser General Public License | ||
| 19 | + along with hueplusplus. If not, see <http://www.gnu.org/licenses/>. | ||
| 20 | + */ | ||
| 21 | + | ||
| 22 | +#ifndef INCLUDE_HUEPLUSPLUS_ZLL_SENSORS_H | ||
| 23 | +#define INCLUDE_HUEPLUSPLUS_ZLL_SENSORS_H | ||
| 24 | + | ||
| 25 | +#include "Sensor.h" | ||
| 26 | + | ||
| 27 | +namespace hueplusplus | ||
| 28 | +{ | ||
| 29 | +namespace sensors | ||
| 30 | +{ | ||
| 31 | +enum class Alert | ||
| 32 | +{ | ||
| 33 | + none, | ||
| 34 | + select, | ||
| 35 | + lselect | ||
| 36 | +}; | ||
| 37 | + | ||
| 38 | +class ZGPSwitch : public BaseDevice | ||
| 39 | +{ | ||
| 40 | +public: | ||
| 41 | + ZGPSwitch(Sensor sensor) : BaseDevice(std::move(sensor)) { } | ||
| 42 | + | ||
| 43 | + bool isOn() const; | ||
| 44 | + void setOn(bool on); | ||
| 45 | + | ||
| 46 | + int getButtonEvent(); | ||
| 47 | + | ||
| 48 | + static constexpr int c_button1 = 34; | ||
| 49 | + static constexpr int c_button2 = 16; | ||
| 50 | + static constexpr int c_button3 = 17; | ||
| 51 | + static constexpr int c_button4 = 18; | ||
| 52 | + | ||
| 53 | + static constexpr const char* typeStr = "ZGPSwitch"; | ||
| 54 | +}; | ||
| 55 | +class ZLLSwitch : public BaseDevice | ||
| 56 | +{ | ||
| 57 | +public: | ||
| 58 | + ZLLSwitch(Sensor sensor) : BaseDevice(std::move(sensor)) { } | ||
| 59 | + | ||
| 60 | + bool isOn() const; | ||
| 61 | + void setOn(bool on); | ||
| 62 | + | ||
| 63 | + bool hasBattery() const; | ||
| 64 | + int getBatteryState() const; | ||
| 65 | + | ||
| 66 | + Alert getLastAlert() const; | ||
| 67 | + void sendAlert(Alert type); | ||
| 68 | + | ||
| 69 | + bool isReachable() const; | ||
| 70 | + | ||
| 71 | + int getButtonEvent() const; | ||
| 72 | + | ||
| 73 | + time::AbsoluteTime getLastUpdated() const; | ||
| 74 | + | ||
| 75 | + static constexpr int c_ON_INITIAL_PRESS = 1000; | ||
| 76 | + static constexpr int c_ON_HOLD = 1001; | ||
| 77 | + static constexpr int c_ON_SHORT_RELEASED = 1002; | ||
| 78 | + static constexpr int c_ON_LONG_RELEASED = 1003; | ||
| 79 | + static constexpr int c_UP_INITIAL_PRESS = 2000; | ||
| 80 | + static constexpr int c_UP_HOLD = 2001; | ||
| 81 | + static constexpr int c_UP_SHORT_RELEASED = 2002; | ||
| 82 | + static constexpr int c_UP_LONG_RELEASED = 2003; | ||
| 83 | + static constexpr int c_DOWN_INITIAL_PRESS = 3000; | ||
| 84 | + static constexpr int c_DOWN_HOLD = 3001; | ||
| 85 | + static constexpr int c_DOWN_SHORT_RELEASED = 3002; | ||
| 86 | + static constexpr int c_DOWN_LONG_RELEASED = 3003; | ||
| 87 | + static constexpr int c_OFF_INITIAL_PRESS = 4000; | ||
| 88 | + static constexpr int c_OFF_HOLD = 4001; | ||
| 89 | + static constexpr int c_OFF_SHORT_RELEASED = 4002; | ||
| 90 | + static constexpr int c_OFF_LONG_RELEASED = 4003; | ||
| 91 | + | ||
| 92 | + static constexpr const char* typeStr = "ZLLSwitch"; | ||
| 93 | +}; | ||
| 94 | +class ZLLPresence : public BaseDevice | ||
| 95 | +{ | ||
| 96 | +public: | ||
| 97 | + ZLLPresence(Sensor sensor) : BaseDevice(std::move(sensor)) { } | ||
| 98 | + bool isOn() const; | ||
| 99 | + void setOn(bool on); | ||
| 100 | + | ||
| 101 | + bool hasBattery() const; | ||
| 102 | + int getBatteryState() const; | ||
| 103 | + | ||
| 104 | + Alert getLastAlert() const; | ||
| 105 | + void sendAlert(Alert type); | ||
| 106 | + | ||
| 107 | + bool isReachable() const; | ||
| 108 | + | ||
| 109 | + int getSensitivity() const; | ||
| 110 | + int getMaxSensitivity() const; | ||
| 111 | + void setSensitivity(int sensitivity); | ||
| 112 | + | ||
| 113 | + bool getPresence() const; | ||
| 114 | + | ||
| 115 | + time::AbsoluteTime getLastUpdated() const; | ||
| 116 | + | ||
| 117 | + static constexpr const char* typeStr = "ZLLPresence"; | ||
| 118 | +}; | ||
| 119 | + | ||
| 120 | +class ZLLTemperature : public BaseDevice | ||
| 121 | +{ | ||
| 122 | +public: | ||
| 123 | + ZLLTemperature(Sensor sensor) : BaseDevice(std::move(sensor)) { } | ||
| 124 | + | ||
| 125 | + bool isOn() const; | ||
| 126 | + void setOn(bool on); | ||
| 127 | + | ||
| 128 | + bool hasBattery() const; | ||
| 129 | + int getBatteryState() const; | ||
| 130 | + | ||
| 131 | + Alert getLastAlert() const; | ||
| 132 | + void sendAlert(Alert type); | ||
| 133 | + | ||
| 134 | + bool isReachable() const; | ||
| 135 | + | ||
| 136 | + int getTemperature() const; | ||
| 137 | + | ||
| 138 | + static constexpr const char* typeStr = "ZLLTemperature"; | ||
| 139 | +}; | ||
| 140 | +class ZLLLightLevel : public BaseDevice | ||
| 141 | +{ | ||
| 142 | +public: | ||
| 143 | + ZLLLightLevel(Sensor sensor) : BaseDevice(std::move(sensor)) { } | ||
| 144 | + | ||
| 145 | + bool isOn() const; | ||
| 146 | + void setOn(bool on); | ||
| 147 | + | ||
| 148 | + bool hasBattery() const; | ||
| 149 | + int getBatteryState() const; | ||
| 150 | + void setBatteryState(int percent); | ||
| 151 | + | ||
| 152 | + bool isReachable() const; | ||
| 153 | + | ||
| 154 | + int getDarkThreshold() const; | ||
| 155 | + void setDarkThreshold(int threshold); | ||
| 156 | + | ||
| 157 | + int getThresholdOffset() const; | ||
| 158 | + void setThresholdOffset(int offset); | ||
| 159 | + | ||
| 160 | + int getLightLevel() const; | ||
| 161 | + bool isDark() const; | ||
| 162 | + bool isDaylight() const; | ||
| 163 | + | ||
| 164 | + static constexpr const char* typeStr = "ZLLLightLevel"; | ||
| 165 | +}; | ||
| 166 | +} // namespace sensors | ||
| 167 | +} // namespace hueplusplus | ||
| 168 | + | ||
| 169 | +#endif |