22 #ifndef INCLUDE_HUEPLUSPLUS_TIME_PATTERN 23 #define INCLUDE_HUEPLUSPLUS_TIME_PATTERN 49 std::chrono::system_clock::time_point
parseTimestamp(
const std::string& timestamp);
57 std::chrono::system_clock::time_point
parseUTCTimestamp(
const std::string& timestamp);
69 std::chrono::system_clock::duration
parseDuration(
const std::string& hourMinSec);
74 using clock = std::chrono::system_clock;
102 clock::time_point base;
110 using clock = std::chrono::system_clock;
117 explicit AbsoluteVariedTime(clock::time_point baseTime, clock::duration variation = std::chrono::seconds(0));
122 clock::duration getRandomVariation()
const;
138 clock::duration variation;
158 bool isMonday()
const;
160 bool isTuesday()
const;
162 bool isWednesday()
const;
164 bool isThursday()
const;
166 bool isFriday()
const;
168 bool isSaturday()
const;
170 bool isSunday()
const;
223 using clock = std::chrono::system_clock;
231 explicit RecurringTime(clock::duration daytime,
Weekdays days, clock::duration variation = std::chrono::seconds(0));
234 clock::duration getDaytime()
const;
238 clock::duration getRandomVariation()
const;
251 clock::duration time;
252 clock::duration variation;
262 using clock = std::chrono::system_clock;
272 clock::duration getStartTime()
const;
274 clock::duration getEndTime()
const;
287 clock::duration start;
298 using clock = std::chrono::system_clock;
302 static constexpr
int infiniteExecutions = 0;
307 Timer(clock::duration duration, clock::duration variation = std::chrono::seconds(0));
312 Timer(clock::duration duration,
int numExecutions, clock::duration variation = std::chrono::seconds(0));
315 bool isRecurring()
const;
319 int getNumberOfExecutions()
const;
321 clock::duration getExpiryTime()
const;
325 clock::duration getRandomVariation()
const;
342 clock::duration expires;
343 clock::duration variation;
386 Type getType()
const;
402 Timer asTimer()
const;
clock::time_point getBaseTime() const
Get base time point.
Definition: TimePattern.cpp:155
Timer timer
Definition: TimePattern.h:430
std::string toString() const
Get formatted string as expected by Hue API.
Definition: TimePattern.cpp:159
std::nullptr_t undefined
Definition: TimePattern.h:426
Time interval repeated daily to weekly.
Definition: TimePattern.h:260
AbsoluteTime(clock::time_point baseTime)
Create absolute time point.
Definition: TimePattern.cpp:153
Namespace for the hueplusplus library.
Definition: Action.h:27
Weekdays(int num)
Create with the day num.
Definition: TimePattern.h:151
Any number of days of the week.
Definition: TimePattern.h:144
Holds different time representations.
Definition: TimePattern.h:351
static Weekdays all()
Creates set of all days.
Definition: TimePattern.cpp:278
std::chrono::system_clock::time_point parseUTCTimestamp(const std::string ×tamp)
Converts an UTC timestamp to a time_point.
Definition: TimePattern.cpp:90
static AbsoluteTime parseUTC(const std::string &s)
Parse AbsoluteTime from formatted UTC string.
Definition: TimePattern.cpp:171
std::string timepointToTimestamp(std::chrono::system_clock::time_point time)
Converts a time_point to a timestamp string.
Definition: TimePattern.cpp:58
Type
Currently active type.
Definition: TimePattern.h:355
std::string durationTo_hh_mm_ss(std::chrono::system_clock::duration duration)
Converts duration to a time string.
Definition: TimePattern.cpp:126
std::chrono::system_clock::time_point parseTimestamp(const std::string ×tamp)
Converts a timestamp to a time_point.
Definition: TimePattern.cpp:79
Time repeated weekly to daily, with possible random variation.
Definition: TimePattern.h:221
static AbsoluteTime parse(const std::string &s)
Parse AbsoluteTime from formatted string in local timezone.
Definition: TimePattern.cpp:164
One-time, absolute time point.
Definition: TimePattern.h:72
AbsoluteVariedTime absolute
Definition: TimePattern.h:427
Definition: TimePattern.h:108
TimeInterval interval
Definition: TimePattern.h:429
Weekdays operator|(Weekdays other) const
Create set union with other Weekdays.
Definition: TimePattern.h:178
std::chrono::system_clock::duration parseDuration(const std::string &hourMinSec)
Converts time string to a duration.
Definition: TimePattern.cpp:144
Timer that is started and triggers after specified delay.
Definition: TimePattern.h:296
RecurringTime recurring
Definition: TimePattern.h:428
bool operator==(const Weekdays &other) const
Check whether all days are equal.
Definition: TimePattern.h:209
Weekdays()
Create with no days.
Definition: TimePattern.h:148
bool operator!=(const Weekdays &other) const
Check whether not all days are equal.
Definition: TimePattern.h:211