4#include "freertos/FreeRTOS.h"
5#include "freertos/queue.h"
6#include "freertos/semphr.h"
7#include "freertos/task.h"
53 void startEventLoop(uint32_t stackSize = 4096, UBaseType_t priority = 5,
54 const char* taskName =
"event_loop");
70 void dispatchEvent(
const Event& event);
71 static void eventLoopTask(
void* pvParameters);
73 QueueHandle_t m_queue;
74 SemaphoreHandle_t m_mutex;
75 std::map<
EventType, std::vector<std::function<void(
const Event&)>>> m_subscribers;
76 TaskHandle_t m_eventLoopTask =
nullptr;
77 volatile bool m_stopRequested =
false;
EventType
Event types in the parking system.
Definition Event.h:9
FreeRTOS implementation of event bus.
Definition FreeRtosEventBus.h:18
FreeRtosEventBus(const FreeRtosEventBus &)=delete
bool publishFromISR(const Event &event)
Publish event from ISR context.
Definition FreeRtosEventBus.cpp:58
void processAllPending() override
Process all pending events (for synchronous testing)
Definition FreeRtosEventBus.cpp:78
bool waitForEvent(Event &outEvent, uint32_t timeoutMs) override
Wait for next event (blocking, for FreeRTOS tasks)
Definition FreeRtosEventBus.cpp:85
void startEventLoop(uint32_t stackSize=4096, UBaseType_t priority=5, const char *taskName="event_loop")
Start the internal event loop task.
Definition FreeRtosEventBus.cpp:116
void publish(const Event &event) override
Publish event to all subscribers.
Definition FreeRtosEventBus.cpp:41
FreeRtosEventBus & operator=(const FreeRtosEventBus &)=delete
void stopEventLoop()
Stop the internal event loop task.
Definition FreeRtosEventBus.cpp:142
bool isEventLoopRunning() const
Check if event loop is running.
Definition FreeRtosEventBus.cpp:163
void subscribe(EventType type, std::function< void(const Event &)> handler) override
Subscribe to specific event type.
Definition FreeRtosEventBus.cpp:33
~FreeRtosEventBus() override
Definition FreeRtosEventBus.cpp:21
Interface for event bus.
Definition IEventBus.h:12
Event structure.
Definition Event.h:45