The FrameworkController class for event-driven control logic in embedded applications. More...
#include "FrameworkTask.h"
#include <unordered_map>
#include <functional>
#include <string>
#include <FreeRTOS.h>
#include <task.h>
#include "events/Event.h"
#include "http/Router.h"
Go to the source code of this file.
Classes | |
class | FrameworkController |
Base class for event-driven control logic in embedded applications. More... | |
Macros | |
#define | STRINGIFY_DETAIL(x) #x |
Utility macro for periodic polling using a unique ID. | |
#define | STRINGIFY(x) STRINGIFY_DETAIL(x) |
#define | RUN_EVERY(ms, fn) runEvery(ms, fn, __FUNCTION__ ":" STRINGIFY(__LINE__)) |
Extends FrameworkTask to provide a convenient structure for application logic with periodic polling, event handling, and timed function execution.
Your application will typically implement one or more controllers to manage different aspects of your system. Each controller can handle its own events, perform background tasks, and run periodic functions.
You will typically use the EventManager, which provides pub/sub capabilities to dispatch events to the appropriate controller. The architucture allows for both event handling and polling in the same controller
This class is designed to be flexible and modular, allowing you to create multiple instances for different parts of your application. For example, you might have a SensorController
for reading sensor data, a NetworkController
for handling communication, and a MainController
to coordinate overall application behavior.
Intended to be subclassed. You override onStart()
, onEvent()
, and poll()
to define your application's behavior.
Definition in file FrameworkController.h.
#define RUN_EVERY | ( | ms, | |
fn | |||
) | runEvery(ms, fn, __FUNCTION__ ":" STRINGIFY(__LINE__)) |
Definition at line 201 of file FrameworkController.h.
#define STRINGIFY | ( | x | ) | STRINGIFY_DETAIL(x) |
Definition at line 200 of file FrameworkController.h.
#define STRINGIFY_DETAIL | ( | x | ) | #x |
Expands to runEvery(ms, fn, "function:line")
automatically.
Definition at line 199 of file FrameworkController.h.