LocalTimeRK
Public Member Functions | Data Fields
LocalTimeScheduleManager Class Reference

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...
 
LocalTimeSchedulegetScheduleByName (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< LocalTimeScheduleschedules
 Vector of all of the schedules. Names and flags are in the schedule object.
 

Detailed Description

Class for managing multiple named schedules.

This is used for the quick and full wake schedules, but can be extended for other uses.

Member Function Documentation

◆ forEach()

void LocalTimeScheduleManager::forEach ( std::function< void(LocalTimeSchedule &schedule)>  callback)

Call a function or lambda for each schedule.

Parameters
callbackFunction or lambda to call.

The callback has this prototype:

void callback(LocalTimeSchedule &schedule)

◆ getNextDataCapture()

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.

Parameters
conv
Returns
time_t

◆ getNextFullWake()

time_t LocalTimeScheduleManager::getNextFullWake ( const LocalTimeConvert conv) const

Get the full wake, typically with a publish.

Parameters
convThe LocalTimeConvert that contains the timezone information to use
Returns
time_t Time of 0 if there is no schedule

◆ getNextTimeByName()

time_t LocalTimeScheduleManager::getNextTimeByName ( const char *  name,
const LocalTimeConvert conv 
)

Get the next scheduled time of the schedule with name "name".

Parameters
nameThe name to look for (c string)
convThe LocalTimeConvert that contains the timezone information to use
Returns
time_t Time of 0 if there is no schedule with that name

◆ getNextWake()

time_t LocalTimeScheduleManager::getNextWake ( const LocalTimeConvert conv) const

Get the wake of any type (quick or full)

Parameters
convThe LocalTimeConvert that contains the timezone information to use
Returns
time_t Time of 0 if there is no schedule

◆ getScheduleByName()

LocalTimeSchedule & LocalTimeScheduleManager::getScheduleByName ( const char *  name)

Get a LocalTimeSchedule reference by name and creates it if it does not exist.

Parameters
nameName to get or create
Returns
LocalTimeSchedule& Reference to the schedule

◆ setFromJsonObject()

void LocalTimeScheduleManager::setFromJsonObject ( const JSONValue &  obj)

Set the schedules from a JSON object.

Parameters
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.


The documentation for this class was generated from the following files: