Common methods for CLIP sensors.
More...
#include <hueplusplus/CLIPSensors.h>
|
| BaseCLIP (Sensor sensor) |
| Protected constructor to be used by subclasses. More...
|
|
| BaseDevice (int id, const std::shared_ptr< APICache > &baseCache) |
| Protected ctor that is used by subclasses, construct with shared cache. More...
|
|
| BaseDevice (int id, const HueCommandAPI &commands, const std::string &path, std::chrono::steady_clock::duration refreshDuration, const nlohmann::json ¤tState) |
| Protected ctor that is used by subclasses. More...
|
|
virtual nlohmann::json | sendPutRequest (const std::string &subPath, const nlohmann::json &request, FileInfo fileInfo) |
| Utility function to send a put request to the device. More...
|
|
Common methods for CLIP sensors.
◆ BaseCLIP()
hueplusplus::sensors::BaseCLIP::BaseCLIP |
( |
Sensor |
sensor | ) |
|
|
inlineexplicitprotected |
Protected constructor to be used by subclasses.
◆ getBatteryState()
int hueplusplus::sensors::BaseCLIP::getBatteryState |
( |
| ) |
const |
Get battery state.
- Returns
- Battery state in percent
- Exceptions
-
nlohmann::json::out_of_range | when sensor has no battery state. |
◆ getLastUpdated()
Get time of last status update.
- Returns
- The last update time, or a time with a zero duration from epoch if the last update time is not set.
◆ getURL()
std::string hueplusplus::sensors::BaseCLIP::getURL |
( |
| ) |
const |
◆ hasBatteryState()
bool hueplusplus::sensors::BaseCLIP::hasBatteryState |
( |
| ) |
const |
Check whether the sensor has a battery state.
◆ hasURL()
bool hueplusplus::sensors::BaseCLIP::hasURL |
( |
| ) |
const |
Check whether the sensor has a URL.
◆ isOn()
bool hueplusplus::sensors::BaseCLIP::isOn |
( |
| ) |
const |
Check if sensor is on.
Sensors which are off do not change their status
◆ isReachable()
bool hueplusplus::sensors::BaseCLIP::isReachable |
( |
| ) |
const |
Check whether the sensor is reachable.
- Note
- Reachable verification is not implemented for CLIP sensors yet
◆ setBatteryState()
void hueplusplus::sensors::BaseCLIP::setBatteryState |
( |
int |
percent | ) |
|
Set battery state.
- Exceptions
-
std::system_error | when system or socket operations fail |
HueException | when response contained no body |
HueAPIResponseException | when response contains an error |
nlohmann::json::parse_error | when response could not be parsed |
◆ setOn()
void hueplusplus::sensors::BaseCLIP::setOn |
( |
bool |
on | ) |
|
Enable or disable sensor.
- Exceptions
-
std::system_error | when system or socket operations fail |
HueException | when response contained no body |
HueAPIResponseException | when response contains an error |
nlohmann::json::parse_error | when response could not be parsed |
◆ setURL()
void hueplusplus::sensors::BaseCLIP::setURL |
( |
const std::string & |
url | ) |
|
Set sensor URL.
- Exceptions
-
std::system_error | when system or socket operations fail |
HueException | when response contained no body |
HueAPIResponseException | when response contains an error |
nlohmann::json::parse_error | when response could not be parsed |
The documentation for this class was generated from the following files: