LocalTimeRK
|
Class for managing multiple named schedules. More...
#include <LocalTimeRK.h>
Public Member Functions | |
time_t | getNextTimeByName (const char *name, const LocalTimeConvert &conv) |
Get the next scheduled time of the schedule with name "name". More... | |
time_t | getNextWake (const LocalTimeConvert &conv) const |
Get the wake of any type (quick or full) More... | |
time_t | getNextFullWake (const LocalTimeConvert &conv) const |
Get the full wake, typically with a publish. More... | |
time_t | getNextDataCapture (const LocalTimeConvert &conv) const |
Get the next scheduled data capture. Data capture schedules are a special class of quick wake that also runs while powered on. More... | |
void | forEach (std::function< void(LocalTimeSchedule &schedule)> callback) |
Call a function or lambda for each schedule. More... | |
LocalTimeSchedule & | getScheduleByName (const char *name) |
Get a LocalTimeSchedule reference by name and creates it if it does not exist. More... | |
void | setFromJsonObject (const JSONValue &obj) |
Set the schedules from a JSON object. More... | |
Data Fields | |
std::vector< LocalTimeSchedule > | schedules |
Vector of all of the schedules. Names and flags are in the schedule object. | |
Class for managing multiple named schedules.
This is used for the quick and full wake schedules, but can be extended for other uses.
void LocalTimeScheduleManager::forEach | ( | std::function< void(LocalTimeSchedule &schedule)> | callback | ) |
Call a function or lambda for each schedule.
callback | Function or lambda to call. |
The callback has this prototype:
void callback(LocalTimeSchedule &schedule)
time_t LocalTimeScheduleManager::getNextDataCapture | ( | const LocalTimeConvert & | conv | ) | const |
Get the next scheduled data capture. Data capture schedules are a special class of quick wake that also runs while powered on.
conv |
time_t LocalTimeScheduleManager::getNextFullWake | ( | const LocalTimeConvert & | conv | ) | const |
Get the full wake, typically with a publish.
conv | The LocalTimeConvert that contains the timezone information to use |
time_t LocalTimeScheduleManager::getNextTimeByName | ( | const char * | name, |
const LocalTimeConvert & | conv | ||
) |
Get the next scheduled time of the schedule with name "name".
name | The name to look for (c string) |
conv | The LocalTimeConvert that contains the timezone information to use |
time_t LocalTimeScheduleManager::getNextWake | ( | const LocalTimeConvert & | conv | ) | const |
Get the wake of any type (quick or full)
conv | The LocalTimeConvert that contains the timezone information to use |
LocalTimeSchedule & LocalTimeScheduleManager::getScheduleByName | ( | const char * | name | ) |
Get a LocalTimeSchedule reference by name and creates it if it does not exist.
name | Name to get or create |
void LocalTimeScheduleManager::setFromJsonObject | ( | const JSONValue & | obj | ) |
Set the schedules from a JSON object.
obj |
Only the keys in obj that already exist as named schedules are processed! This allows a single object to contain both schedules and other settings. Plus, in order for a named schedule to be useful you probably need to have code to handle it, and this eliminates the need to pass the schedule flags in the JSON, since they should be constant depending on how the schedule is being used in the code, not by the schedule settings.