Loading...
Searching...
No Matches
CLIPSensors.h
Go to the documentation of this file.
#ifndef INCLUDE_HUEPLUSPLUS_CLIP_SENSORS_H
#define INCLUDE_HUEPLUSPLUS_CLIP_SENSORS_H
#include "Sensor.h"
namespace hueplusplus
{
namespace sensors
{
class BaseCLIP : public BaseDevice
{
public:
bool isOn() const;
void setOn(bool on);
bool hasBatteryState() const;
int getBatteryState() const;
void setBatteryState(int percent);
bool isReachable() const;
bool hasURL() const;
std::string getURL() const;
void setURL(const std::string& url);
time::AbsoluteTime getLastUpdated() const;
protected:
explicit BaseCLIP(Sensor sensor) : BaseDevice(std::move(sensor)) { }
};
class CLIPSwitch : public BaseCLIP
{
public:
explicit CLIPSwitch(Sensor sensor) : BaseCLIP(std::move(sensor)) { }
int getButtonEvent() const;
void setButtonEvent(int code);
static constexpr const char* typeStr = "CLIPSwitch";
};
class CLIPOpenClose : public BaseCLIP
{
public:
explicit CLIPOpenClose(Sensor sensor) : BaseCLIP(std::move(sensor)) { }
bool isOpen() const;
void setOpen(bool open);
static constexpr const char* typeStr = "CLIPOpenClose";
};
detail::ConditionHelper<bool> makeCondition(const CLIPOpenClose& sensor);
class CLIPPresence : public BaseCLIP
{
public:
explicit CLIPPresence(Sensor sensor) : BaseCLIP(std::move(sensor)) { }
bool getPresence() const;
void setPresence(bool presence);
static constexpr const char* typeStr = "CLIPPresence";
};
class CLIPTemperature : public BaseCLIP
{
public:
explicit CLIPTemperature(Sensor sensor) : BaseCLIP(std::move(sensor)) { }
int getTemperature() const;
void setTemperature(int temperature);
static constexpr const char* typeStr = "CLIPTemperature";
};
class CLIPHumidity : public BaseCLIP
{
public:
explicit CLIPHumidity(Sensor sensor) : BaseCLIP(std::move(sensor)) { }
int getHumidity() const;
void setHumidity(int humidity);
static constexpr const char* typeStr = "CLIPHumidity";
};
detail::ConditionHelper<int> makeCondition(const CLIPHumidity& sensor);
class CLIPLightLevel : public BaseCLIP
{
public:
explicit CLIPLightLevel(Sensor sensor) : BaseCLIP(std::move(sensor)) { }
int getDarkThreshold() const;
void setDarkThreshold(int threshold);
int getThresholdOffset() const;
void setThresholdOffset(int offset);
int getLightLevel() const;
void setLightLevel(int level);
bool isDark() const;
bool isDaylight() const;
static constexpr const char* typeStr = "CLIPLightLevel";
};
class CLIPGenericFlag : public BaseCLIP
{
public:
explicit CLIPGenericFlag(Sensor sensor) : BaseCLIP(std::move(sensor)) { }
bool getFlag() const;
void setFlag(bool flag);
static constexpr const char* typeStr = "CLIPGenericFlag";
};
detail::ConditionHelper<bool> makeCondition(const CLIPGenericFlag& sensor);
class CLIPGenericStatus : public BaseCLIP
{
public:
explicit CLIPGenericStatus(Sensor sensor) : BaseCLIP(std::move(sensor)) { }
int getStatus() const;
void setStatus(int status);
static constexpr const char* typeStr = "CLIPGenericStatus";
};
detail::ConditionHelper<int> makeCondition(const CLIPGenericStatus& sensor);
} // namespace sensors
} // namespace hueplusplus
#endif
Sensor.h
hueplusplus::BaseDevice
Base class for physical devices connected to the bridge (sensor or light).
Definition BaseDevice.h:36
hueplusplus::Sensor
Class for generic or unknown sensor types.
Definition Sensor.h:60
hueplusplus::sensors::BaseCLIP
Common methods for CLIP sensors.
Definition CLIPSensors.h:33
hueplusplus::sensors::BaseCLIP::hasBatteryState
bool hasBatteryState() const
Check whether the sensor has a battery state.
Definition CLIPSensors.cpp:39
hueplusplus::sensors::BaseCLIP::setOn
void setOn(bool on)
Enable or disable sensor.
Definition CLIPSensors.cpp:35
hueplusplus::sensors::BaseCLIP::hasURL
bool hasURL() const
Check whether the sensor has a URL.
Definition CLIPSensors.cpp:56
hueplusplus::sensors::BaseCLIP::setBatteryState
void setBatteryState(int percent)
Set battery state.
Definition CLIPSensors.cpp:47
hueplusplus::sensors::BaseCLIP::BaseCLIP
BaseCLIP(Sensor sensor)
Protected constructor to be used by subclasses.
Definition CLIPSensors.h:81
hueplusplus::sensors::BaseCLIP::setURL
void setURL(const std::string &url)
Set sensor URL.
Definition CLIPSensors.cpp:64
hueplusplus::sensors::BaseCLIP::getURL
std::string getURL() const
Get sensor URL.
Definition CLIPSensors.cpp:60
hueplusplus::sensors::BaseCLIP::isOn
bool isOn() const
Check if sensor is on.
Definition CLIPSensors.cpp:30
hueplusplus::sensors::BaseCLIP::getBatteryState
int getBatteryState() const
Get battery state.
Definition CLIPSensors.cpp:43
hueplusplus::sensors::BaseCLIP::getLastUpdated
time::AbsoluteTime getLastUpdated() const
Get time of last status update.
Definition CLIPSensors.cpp:69
hueplusplus::sensors::BaseCLIP::isReachable
bool isReachable() const
Check whether the sensor is reachable.
Definition CLIPSensors.cpp:51
hueplusplus::sensors::CLIPGenericFlag
CLIP sensor for a generic 3rd party sensor.
Definition CLIPSensors.h:246
hueplusplus::sensors::CLIPGenericFlag::CLIPGenericFlag
CLIPGenericFlag(Sensor sensor)
Construct from generic sensor.
Definition CLIPSensors.h:249
hueplusplus::sensors::CLIPGenericFlag::setFlag
void setFlag(bool flag)
Set flag.
Definition CLIPSensors.cpp:193
hueplusplus::sensors::CLIPGenericFlag::getFlag
bool getFlag() const
Get boolean flag.
Definition CLIPSensors.cpp:189
hueplusplus::sensors::CLIPGenericFlag::typeStr
static constexpr const char * typeStr
CLIPGenericFlag sensor type name.
Definition CLIPSensors.h:261
hueplusplus::sensors::CLIPGenericStatus
CLIP sensor for a generic 3rd party status.
Definition CLIPSensors.h:270
hueplusplus::sensors::CLIPGenericStatus::CLIPGenericStatus
CLIPGenericStatus(Sensor sensor)
Construct from generic sensor.
Definition CLIPSensors.h:273
hueplusplus::sensors::CLIPGenericStatus::typeStr
static constexpr const char * typeStr
CLIPGenericStatus sensor type name.
Definition CLIPSensors.h:285
hueplusplus::sensors::CLIPGenericStatus::setStatus
void setStatus(int status)
Set sensor status.
Definition CLIPSensors.cpp:210
hueplusplus::sensors::CLIPGenericStatus::getStatus
int getStatus() const
Get sensor status.
Definition CLIPSensors.cpp:205
hueplusplus::sensors::CLIPHumidity
CLIP sensor for humidity.
Definition CLIPSensors.h:172
hueplusplus::sensors::CLIPHumidity::CLIPHumidity
CLIPHumidity(Sensor sensor)
Construct from generic sensor.
Definition CLIPSensors.h:175
hueplusplus::sensors::CLIPHumidity::setHumidity
void setHumidity(int humidity)
Set humidity.
Definition CLIPSensors.cpp:136
hueplusplus::sensors::CLIPHumidity::getHumidity
int getHumidity() const
Get measured humidity.
Definition CLIPSensors.cpp:132
hueplusplus::sensors::CLIPHumidity::typeStr
static constexpr const char * typeStr
CLIPHumidity sensor type name.
Definition CLIPSensors.h:189
hueplusplus::sensors::CLIPLightLevel
CLIP sensor for light level.
Definition CLIPSensors.h:196
hueplusplus::sensors::CLIPLightLevel::getThresholdOffset
int getThresholdOffset() const
Get offset over dark threshold to detect daylight.
Definition CLIPSensors.cpp:157
hueplusplus::sensors::CLIPLightLevel::isDark
bool isDark() const
Check whether light level is below dark threshold.
Definition CLIPSensors.cpp:177
hueplusplus::sensors::CLIPLightLevel::setThresholdOffset
void setThresholdOffset(int offset)
Set offset to detect daylight.
Definition CLIPSensors.cpp:162
hueplusplus::sensors::CLIPLightLevel::getLightLevel
int getLightLevel() const
Get measured light level.
Definition CLIPSensors.cpp:167
hueplusplus::sensors::CLIPLightLevel::setDarkThreshold
void setDarkThreshold(int threshold)
Set threshold to detect darkness.
Definition CLIPSensors.cpp:153
hueplusplus::sensors::CLIPLightLevel::getDarkThreshold
int getDarkThreshold() const
Get threshold to detect darkness.
Definition CLIPSensors.cpp:148
hueplusplus::sensors::CLIPLightLevel::typeStr
static constexpr const char * typeStr
CLIPLightLevel sensor type name.
Definition CLIPSensors.h:239
hueplusplus::sensors::CLIPLightLevel::isDaylight
bool isDaylight() const
Check whether light level is above light threshold.
Definition CLIPSensors.cpp:182
hueplusplus::sensors::CLIPLightLevel::setLightLevel
void setLightLevel(int level)
Set measured light level.
Definition CLIPSensors.cpp:172
hueplusplus::sensors::CLIPLightLevel::CLIPLightLevel
CLIPLightLevel(Sensor sensor)
Construct from generic sensor.
Definition CLIPSensors.h:199
hueplusplus::sensors::CLIPOpenClose
CLIP sensor detecting whether a contact is open or closed.
Definition CLIPSensors.h:106
hueplusplus::sensors::CLIPOpenClose::typeStr
static constexpr const char * typeStr
CLIPOpenClose sensor type name.
Definition CLIPSensors.h:123
hueplusplus::sensors::CLIPOpenClose::setOpen
void setOpen(bool open)
Set switch state.
Definition CLIPSensors.cpp:97
hueplusplus::sensors::CLIPOpenClose::isOpen
bool isOpen() const
Check whether the switch is open.
Definition CLIPSensors.cpp:93
hueplusplus::sensors::CLIPOpenClose::CLIPOpenClose
CLIPOpenClose(Sensor sensor)
Construct from generic sensor.
Definition CLIPSensors.h:109
hueplusplus::sensors::CLIPPresence
CLIP sensor to detect presence.
Definition CLIPSensors.h:130
hueplusplus::sensors::CLIPPresence::CLIPPresence
CLIPPresence(Sensor sensor)
Construct from generic sensor.
Definition CLIPSensors.h:133
hueplusplus::sensors::CLIPPresence::getPresence
bool getPresence() const
Check whether presence was detected.
Definition CLIPSensors.cpp:110
hueplusplus::sensors::CLIPPresence::typeStr
static constexpr const char * typeStr
CLIPPresence sensor type name.
Definition CLIPSensors.h:145
hueplusplus::sensors::CLIPPresence::setPresence
void setPresence(bool presence)
Set presence state.
Definition CLIPSensors.cpp:114
hueplusplus::sensors::CLIPSwitch
CLIP sensor for button presses.
Definition CLIPSensors.h:86
hueplusplus::sensors::CLIPSwitch::typeStr
static constexpr const char * typeStr
CLIPSwitch sensor type name.
Definition CLIPSensors.h:101
hueplusplus::sensors::CLIPSwitch::CLIPSwitch
CLIPSwitch(Sensor sensor)
Construct from generic sensor.
Definition CLIPSensors.h:89
hueplusplus::sensors::CLIPSwitch::setButtonEvent
void setButtonEvent(int code)
Set the button event code.
Definition CLIPSensors.cpp:86
hueplusplus::sensors::CLIPSwitch::getButtonEvent
int getButtonEvent() const
Get the code of the last switch event.
Definition CLIPSensors.cpp:82
hueplusplus::sensors::CLIPTemperature
CLIP sensor for temperature.
Definition CLIPSensors.h:150
hueplusplus::sensors::CLIPTemperature::setTemperature
void setTemperature(int temperature)
Set temperature.
Definition CLIPSensors.cpp:125
hueplusplus::sensors::CLIPTemperature::getTemperature
int getTemperature() const
Get measured temperature.
Definition CLIPSensors.cpp:121
hueplusplus::sensors::CLIPTemperature::typeStr
static constexpr const char * typeStr
CLIPTemperature sensor type name.
Definition CLIPSensors.h:167
hueplusplus::sensors::CLIPTemperature::CLIPTemperature
CLIPTemperature(Sensor sensor)
Construct from generic sensor.
Definition CLIPSensors.h:153
hueplusplus::time::AbsoluteTime
One-time, absolute time point.
Definition TimePattern.h:73
hueplusplus::sensors::makeCondition
detail::ConditionHelper< bool > makeCondition(const CLIPOpenClose &sensor)
Definition CLIPSensors.cpp:103
hueplusplus
Namespace for the hueplusplus library.
Definition Action.h:28