Parking Garage Control System
ESP32 Parking Garage – ESP-IDF/FreeRTOS
Loading...
Searching...
No Matches
IEventBus.h
Go to the documentation of this file.
1#pragma once
2
3#include "Event.h"
4#include <functional>
5
12class IEventBus {
13 public:
14 virtual ~IEventBus() = default;
15
21 virtual void subscribe(EventType type, std::function<void(const Event&)> handler) = 0;
22
27 virtual void publish(const Event& event) = 0;
28
32 virtual void processAllPending() = 0;
33
40 [[nodiscard]] virtual bool waitForEvent(Event& outEvent, uint32_t timeoutMs) = 0;
41};
EventType
Event types in the parking system.
Definition Event.h:9
Interface for event bus.
Definition IEventBus.h:12
virtual void processAllPending()=0
Process all pending events (for synchronous testing)
virtual void subscribe(EventType type, std::function< void(const Event &)> handler)=0
Subscribe to specific event type.
virtual bool waitForEvent(Event &outEvent, uint32_t timeoutMs)=0
Wait for next event (blocking, for FreeRTOS tasks)
virtual void publish(const Event &event)=0
Publish event to all subscribers.
virtual ~IEventBus()=default
Event structure.
Definition Event.h:45
Coverage