|
Parking Garage Control System
ESP32 Parking Garage – ESP-IDF/FreeRTOS
|
FreeRTOS implementation of event bus. More...
#include <FreeRtosEventBus.h>


Public Member Functions | |
| FreeRtosEventBus (size_t queueSize=32) | |
| Construct event bus. | |
| ~FreeRtosEventBus () override | |
| FreeRtosEventBus (const FreeRtosEventBus &)=delete | |
| FreeRtosEventBus & | operator= (const FreeRtosEventBus &)=delete |
| void | subscribe (EventType type, std::function< void(const Event &)> handler) override |
| Subscribe to specific event type. | |
| void | publish (const Event &event) override |
| Publish event to all subscribers. | |
| void | processAllPending () override |
| Process all pending events (for synchronous testing) | |
| bool | waitForEvent (Event &outEvent, uint32_t timeoutMs) override |
| Wait for next event (blocking, for FreeRTOS tasks) | |
| bool | publishFromISR (const Event &event) |
| Publish event from ISR context. | |
| void | startEventLoop (uint32_t stackSize=4096, UBaseType_t priority=5, const char *taskName="event_loop") |
| Start the internal event loop task. | |
| void | stopEventLoop () |
| Stop the internal event loop task. | |
| bool | isEventLoopRunning () const |
| Check if event loop is running. | |
Public Member Functions inherited from IEventBus | |
| virtual | ~IEventBus ()=default |
FreeRTOS implementation of event bus.
Thread-safe event bus using FreeRTOS queue and mutex. Supports both asynchronous event publishing and synchronous event processing. Can run its own event loop task for automatic event dispatching.
|
explicit |
Construct event bus.
| queueSize | Maximum number of queued events |
|
override |
|
delete |
| bool FreeRtosEventBus::isEventLoopRunning | ( | ) | const |
Check if event loop is running.
|
delete |
|
overridevirtual |
Process all pending events (for synchronous testing)
Implements IEventBus.
|
overridevirtual |
| bool FreeRtosEventBus::publishFromISR | ( | const Event & | event | ) |
Publish event from ISR context.
| event | Event to publish |
| void FreeRtosEventBus::startEventLoop | ( | uint32_t | stackSize = 4096, |
| UBaseType_t | priority = 5, |
||
| const char * | taskName = "event_loop" |
||
| ) |
Start the internal event loop task.
Creates a FreeRTOS task that continuously processes events from the queue. This is the recommended way to run the event bus in production.
| stackSize | Task stack size in bytes (default: 4096) |
| priority | Task priority (default: 5) |
| taskName | Name for the task (default: "event_loop") |
| void FreeRtosEventBus::stopEventLoop | ( | ) |
Stop the internal event loop task.
Stops and deletes the event loop task if running.
|
overridevirtual |
Wait for next event (blocking, for FreeRTOS tasks)
| outEvent | Output event structure |
| timeoutMs | Timeout in milliseconds (portMAX_DELAY for infinite) |
Implements IEventBus.