#include <DashboardController.h>
Public Member Functions | |
DashboardController (Router &r, PicoModel &pico) | |
void | initRoutes () override |
Initialize routes for this controller. | |
![]() | |
FrameworkController (const char *name, Router &sharedRouter, uint16_t stackSize=1024, UBaseType_t priority=tskIDLE_PRIORITY+1) | |
Constructor. | |
void | run () override final |
Main task loop. | |
const char * | getName () const |
Get the name of this controller. | |
void | enableEventQueue (size_t depth=8) |
Enable the event queue for this controller. | |
QueueHandle_t | getEventQueue () const |
Get the event queue for this controller. | |
bool | getNextEvent (Event &event, uint32_t timeoutMs) |
Check if there are any pending events in the queue. | |
![]() | |
FrameworkTask (const char *name, uint16_t stackSize=1024, UBaseType_t priority=1) | |
Constructor. | |
virtual | ~FrameworkTask () |
Destructor. | |
bool | start () |
Starts the task via FreeRTOS. | |
void | suspend () |
Suspends the task using vTaskSuspend() . | |
void | resume () |
Resumes the task using vTaskResume() . | |
TaskHandle_t | getHandle () const |
Returns the FreeRTOS task handle. | |
const char * | getName () const |
Returns the task name. | |
void | notify (uint8_t index, uint32_t value=1) |
Sends a notification to this task using an index. | |
void | notify (Notification n, uint32_t value=1) |
Sends a notification using a framework-defined enum. | |
void | notifyFromISR (uint8_t index, uint32_t value=1, BaseType_t *pxHigherPriorityTaskWoken=nullptr) |
Sends a notification from an ISR (by index). | |
void | notifyFromISR (Notification n, uint32_t value=1, BaseType_t *pxHigherPriorityTaskWoken=nullptr) |
Sends a notification from ISR using enum identifier. | |
bool | waitFor (uint8_t index, TickType_t timeout=portMAX_DELAY) |
Waits for a notification (by index). | |
bool | waitFor (Notification n, TickType_t timeout=portMAX_DELAY) |
Waits for a notification (by enum identifier). | |
Notification | waitForAny (uint8_t index, uint32_t mask, TickType_t timeout=portMAX_DELAY) |
waits for any notification matching the given mask. | |
Private Member Functions | |
void | getTemperature (HttpRequest &req, HttpResponse &res, const RouteMatch &match) |
void | getLedState (HttpRequest &req, HttpResponse &res, const RouteMatch &match) |
void | setLedState (HttpRequest &req, HttpResponse &res, const RouteMatch &match) |
void | uploadHandler (HttpRequest &req, HttpResponse &res, const RouteMatch &match) |
void | deleteFile (HttpRequest &req, HttpResponse &res, const RouteMatch &match) |
Private Attributes | |
PicoModel & | pico |
Additional Inherited Members | |
![]() | |
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. | |
virtual TickType_t | getPollIntervalTicks () |
Returns the polling interval in ticks used in run(). | |
virtual void | poll () |
Called during every loop iteration for non-blocking background logic. | |
void | runEvery (uint32_t intervalMs, const std::function< void()> &fn, const char *id) |
Run a function periodically with millisecond resolution. | |
![]() | |
uint32_t | waitFor (TickType_t timeout=portMAX_DELAY) |
Wait for any notification (default index). | |
bool | createQueue (size_t itemSize, size_t length) |
Creates an internal FreeRTOS queue. | |
bool | sendToQueue (const void *item, TickType_t timeout=0) |
Sends an item to the internal queue. | |
bool | receiveFromQueue (void *item, TickType_t timeout=portMAX_DELAY) |
Receives an item from the internal queue. | |
![]() | |
Router & | router |
Handles path-to-handler mapping - reference to shared Router instance. | |
![]() | |
const char * | _name |
uint16_t | _stackSize |
UBaseType_t | _priority |
TaskHandle_t | _handle = nullptr |
QueueHandle_t | _queue = nullptr |
Definition at line 26 of file DashboardController.h.
Definition at line 12 of file DashboardController.cpp.
|
private |
Definition at line 103 of file DashboardController.cpp.
References RouteMatch::getParam(), AppContext::getTypeKey(), HttpResponse::sendError(), and HttpResponse::sendSuccess().
Referenced by initRoutes().
|
private |
Definition at line 85 of file DashboardController.cpp.
References PicoModel::getLedState(), HttpResponse::json(), and pico.
Referenced by initRoutes().
|
private |
Definition at line 79 of file DashboardController.cpp.
References PicoModel::getTemperature(), HttpResponse::json(), and pico.
Referenced by initRoutes().
|
overridevirtual |
@bcopydoc FrameworkController::initRoutes
Override to define HTTP routes or other event handlers. This is called once at task start.
Reimplemented from FrameworkController.
Definition at line 15 of file DashboardController.cpp.
References Router::addCatchAllGetRoute(), Router::addRoute(), deleteFile(), getLedState(), getTemperature(), Router::listDirectory(), FrameworkController::router, HttpResponse::send(), HttpResponse::sendFile(), Router::serveStatic(), HttpResponse::setContentType(), setLedState(), and uploadHandler().
|
private |
Definition at line 91 of file DashboardController.cpp.
References RouteMatch::getParam(), HttpResponse::json(), pico, and PicoModel::setLedState().
Referenced by initRoutes().
|
private |
Definition at line 98 of file DashboardController.cpp.
References HttpRequest::handle_multipart().
Referenced by initRoutes().
|
private |
Definition at line 38 of file DashboardController.h.
Referenced by getLedState(), getTemperature(), and setLedState().