@fileGpioController.cpp More...
#include <GpioController.h>
Inheritance diagram for GpioController:
Collaboration diagram for GpioController:Public Member Functions | |
| GpioController (Router &r, PicoModel &pico) | |
| void | initRoutes () override |
| Initialize routes for this controller. | |
Public Member Functions inherited from FrameworkController | |
| 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. | |
Public Member Functions inherited from FrameworkTask | |
| 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 | getState (HttpRequest &req, HttpResponse &res, const std::vector< std::string > ¶ms) |
| void | setState (HttpRequest &req, HttpResponse &res, const std::vector< std::string > ¶ms) |
| void | handleGetMultipleGpios (HttpRequest &req, HttpResponse &res) |
Private Attributes | |
| PicoModel & | pico |
Additional Inherited Members | |
Protected Member Functions inherited from FrameworkController | |
| 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. | |
Protected Member Functions inherited from FrameworkTask | |
| 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. | |
Protected Attributes inherited from FrameworkController | |
| Router & | router |
| Handles path-to-handler mapping - reference to shared Router instance. | |
Protected Attributes inherited from FrameworkTask | |
| const char * | _name |
| uint16_t | _stackSize |
| UBaseType_t | _priority |
| TaskHandle_t | _handle = nullptr |
| QueueHandle_t | _queue = nullptr |
GPIO controller for handling GPIO state retrieval and setting. This controller provides HTTP endpoints to get and set GPIO states.
Definition at line 24 of file GpioController.h.
Definition at line 9 of file GpioController.cpp.
|
private |
Definition at line 30 of file GpioController.cpp.
References PicoModel::getGpioState(), HttpResponse::json(), and pico.
Referenced by initRoutes().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 43 of file GpioController.cpp.
References PicoModel::getGpioState(), HttpRequest::getQueryParams(), HttpResponse::json(), pico, and JsonResponse::sendNoContent().
Referenced by initRoutes().
Here is the call graph for this function:
Here is the caller graph for this function:
|
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 12 of file GpioController.cpp.
References Router::addRoute(), getState(), handleGetMultipleGpios(), RouteMatch::ordered, FrameworkController::router, and setState().
Here is the call graph for this function:
|
private |
Definition at line 36 of file GpioController.cpp.
References HttpResponse::json(), pico, and PicoModel::setGpioState().
Referenced by initRoutes().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 33 of file GpioController.h.
Referenced by getState(), handleGetMultipleGpios(), and setState().