42#include <unordered_map>
77 void withLock(
const std::function<
void()>& fn);
92 void scheduleAt(time_t unixTime,
const Event &event,
const std::string &jobId);
101 void scheduleEvery(uint32_t intervalMs,
const Event &event,
const std::string &jobId);
123 const Event &startEvent,
const Event &stopEvent);
125 const Event &startEvent,
const Event &stopEvent,
const std::string &baseJobId);
134 bool cancel(
const std::string &jobId);
Defines a bitmask enum for days of the week.
uint8_t DaysOfWeek
Type alias for a set of days (bitmask).
Defines the Event structure and related utilities for event messaging.
A simple representation of wall-clock time (HH:MM or HH:MM:SS)
Central service for time-driven scheduling of framework events.
void scheduleAt(time_t unixTime, const Event &event)
Schedule a one-time event at an absolute UNIX timestamp.
void rescheduleDailyJob(const TimerJob &job)
Placeholder for persistence/rescheduling in the future.
void scheduleDailyAt(TimeOfDay time, DaysOfWeek days, const Event &event)
Schedule a recurring event based on time-of-day and day mask.
bool cancel(const std::string &jobId)
void scheduleCallbackAt(time_t unixTime, std::function< void()> callback)
Schedule a one-shot callback at a given absolute time.
void withLock(const std::function< void()> &fn)
std::unordered_map< std::string, TimerHandle_t > scheduledJobs
Map of job IDs to TimerHandles.
void scheduleDuration(TimeOfDay start, DaysOfWeek days, uint32_t durationMs, const Event &startEvent, const Event &stopEvent)
Schedule a start event and stop event with a delay between them.
void checkMissedEvents(time_t now)
Detect and fire any missed events after a reboot (TBD).
void scheduleEvery(uint32_t intervalMs, const Event &event)
Schedule a repeating event at fixed intervals.
static StaticSemaphore_t lockBuffer_
static TimerService & instance()
Access the singleton instance.
Represents a framework event, optionally carrying payload data.
A simple value type representing a time of day (hour, minute, second).
Represents a job scheduled by the TimerService.
Event startEvent
Event to post at start.
TimeOfDay startTime
When the event should start.
Event stopEvent
Optional stop event.
uint32_t durationMs
Optional run duration in ms.
bool recurring
If true, job repeats.
DaysOfWeek repeatDays
Days the job runs (bitmask)