37#ifndef EVENT_MANAGER_H
38#define EVENT_MANAGER_H
131 template<
typename Enum,
typename... Rest>
134 (std::is_same_v<Enum, Rest> && ...),
135 "All event types must be of the same enum class (UserNotification or SystemNotification)"
153 void withSubscribers(
const std::function<
void(std::vector<Subscriber> &)> &fn);
Defines the Event structure and related utilities for event messaging.
The FrameworkController class for event-driven control logic in embedded applications.
constexpr uint32_t eventMask(Enum e)
Helper function to create an event mask from an enum value.
Manages the system-wide event queue and subscriptions.
void subscribe(uint32_t eventMask, FrameworkController *controller)
Subscribe a task to specific event types.
void postEvent(const Event &e)
Post a notification to the queue and notify matching subscribers.
void withSubscribersFromISR(const std::function< void(std::vector< Subscriber > &)> &fn)
Provides read-only access to subscribers from ISR context (no locking).
void enqueue(const Event &event)
Post an event to the queue and notify matching subscribers.
void subscribeTo(FrameworkController *ctrl, Enum first, Rest... rest)
void postNotification(const Notification &n, FrameworkTask *target)
Post a notification to the queue and notify matching subscribers.
std::vector< Subscriber > subscribers_
bool hasPendingEvents(FrameworkController *controller) const
Returns true if there are any pending events for a given controller.
static StaticSemaphore_t lockBuffer_
static EventManager & getInstance()
Get the global EventManager instance.
void withSubscribers(const std::function< void(std::vector< Subscriber > &)> &fn)
Base class for event-driven control logic in embedded applications.
Base class for FreeRTOS-aware tasks in the framework.
uint32_t eventMask
Bitmask of subscribed event codes.
FrameworkController * controller
Target controller to notify.
Represents a framework event, optionally carrying payload data.
A tagged union representing either a system or user-defined notification.