41 router(sharedRouter) {}
95 TickType_t now = xTaskGetTickCount();
96 TickType_t &last =
_timers[std::string(
id)];
98 if ((now - last) >= pdMS_TO_TICKS(intervalMs))
Event pub/sub manager for embedded applications using FreeRTOS.
Defines the Event structure and related utilities for event messaging.
The FrameworkController class for event-driven control logic in embedded applications.
FreeRTOS-aware task abstraction with built-in notification and queue support.
HTTP routing with middleware and optional JWT-based authorization. Part of the PicoFramework HTTP ser...
void runEvery(uint32_t intervalMs, const std::function< void()> &fn, const char *id)
Run a function periodically with millisecond resolution.
virtual TickType_t getPollIntervalTicks()
Returns the polling interval in ticks used in run().
bool getNextEvent(Event &event, uint32_t timeoutMs)
Check if there are any pending events in the queue.
virtual void onStart()
Called once at task start before entering the main loop.
virtual void onEvent(const Event &event)
Called when an event is dispatched to this controller.
void enableEventQueue(size_t depth=8)
Enable the event queue for this controller.
void run() override final
Main task loop.
virtual void initRoutes()
Initialize routes for this controller.
FrameworkController(const char *name, Router &sharedRouter, uint16_t stackSize=1024, UBaseType_t priority=tskIDLE_PRIORITY+1)
Constructor.
virtual void poll()
Called during every loop iteration for non-blocking background logic.
void waitAndDispatch(uint32_t timeoutMs=portMAX_DELAY)
Waits for an event and dispatches it to onEvent() if applicable.
std::unordered_map< std::string, TickType_t > _timers
Stores last-execution timestamps per ID.
Base class for FreeRTOS-aware tasks in the framework.
The central router for handling HTTP requests and middleware.
Represents a framework event, optionally carrying payload data.