115 sleepTimer.initializeMs(
118 auto task =
static_cast<Task*
>(param);
124 sleepTimer.startOnce();
137 virtual void loop() = 0;
168 auto task =
reinterpret_cast<Task*
>(param);
169 task->scheduled =
false;
184 notify(notification);
194 bool scheduled{
false};
virtual void loop()=0
Inherited classes override this to perform actual work.
virtual ~Task()
Definition: Task.h:56
SystemClass System
Global instance of system object.
State
State of a task.
Definition: Task.h:39
bool resume()
Call to set task running.
Definition: Task.h:64
void suspend()
Suspend a task.
Definition: Task.h:87
void sleep(unsigned interval)
Puts the task to sleep for a while.
Definition: Task.h:110
static bool queueCallback(TaskCallback32 callback, uint32_t param=0)
Queue a deferred callback.
virtual void onNotify(Notify code)
Called immediately before calling to loop() to indicate a state change.
Definition: Task.h:142
Notify
Notification of state change.
Definition: Task.h:48
Class to support running a background task.
Definition: Task.h:33