Timer that is started and triggers after specified delay.
More...
#include <hueplusplus/TimePattern.h>
Timer that is started and triggers after specified delay.
The timer can have a random variation in the expiry time. It can be one-off, repeated a set number of times or repeated indefinitely.
◆ Timer() [1/2]
hueplusplus::time::Timer::Timer |
( |
clock::duration |
duration, |
|
|
clock::duration |
variation = std::chrono::seconds(0) |
|
) |
| |
Create one-off timer.
- Parameters
-
duration | Expiry time of the timer, max 24 hours. |
variation | Random variation of expiry time, optional. |
◆ Timer() [2/2]
hueplusplus::time::Timer::Timer |
( |
clock::duration |
duration, |
|
|
int |
numExecutions, |
|
|
clock::duration |
variation = std::chrono::seconds(0) |
|
) |
| |
Create a repeated timer.
- Parameters
-
duration | Expiry time of the timer, max 24 hours. |
numExecutions | Number of executions, 1 or higher, or infiniteExecutions to always repeat. |
variation | Random variation of expiry time, optional. |
◆ getExpiryTime()
system_clock::duration hueplusplus::time::Timer::getExpiryTime |
( |
| ) |
const |
◆ getNumberOfExecutions()
int hueplusplus::time::Timer::getNumberOfExecutions |
( |
| ) |
const |
◆ getRandomVariation()
system_clock::duration hueplusplus::time::Timer::getRandomVariation |
( |
| ) |
const |
Get random variation of expiry time.
The expiry time can vary up to this value in both directions.
◆ isRecurring()
bool hueplusplus::time::Timer::isRecurring |
( |
| ) |
const |
Returns true when the timer is executed more than once.
◆ toString()
std::string hueplusplus::time::Timer::toString |
( |
| ) |
const |
Get formatted string as expected by Hue API.
- Returns
- one-off timer: PT
hh:mm:ss
-
one-off timer with variation: PT
hh:mm:ss
Ahh:mm:ss
, with expiry time first and variation second.
-
recurring timer: R/PT
hh:mm:ss
-
recurring timer with n repetitions: R
nn
/PThh:mm:ss
-
recurring timer with random variation: R
nn
/PThh:mm:ss
Ahh:mm:ss
-
infinite recurring timer with random variation: R/PT
hh:mm:ss
Ahh:mm:ss
◆ infiniteExecutions
constexpr int hueplusplus::time::Timer::infiniteExecutions = 0 |
|
static |
The documentation for this class was generated from the following files: