113template<
typename Enum,
typename T>
115 return Event(
static_cast<uint8_t
>(e), &data,
sizeof(T));
118template<
typename Enum>
120 static_assert(std::is_enum<Enum>::value,
"Enum type required");
121 return Event(
static_cast<uint8_t
>(e), data, size);
Event userEvent(Enum e, const T &data)
Helper to create a user-defined Event with a payload.
SystemNotification
System-defined notification types reserved by the framework.
Base class for FreeRTOS-aware tasks in the framework.
Represents a framework event, optionally carrying payload data.
bool isUser() const
Returns true if this is a user-defined event.
SystemNotification systemCode() const
Returns the system-defined enum value.
Notification notification
Notification identifier (system or user)
FrameworkTask * target
Optional specific target (for directed delivery)
size_t size
Size of payload data
Event(SystemNotification type, const GpioEvent &gpioEvent, size_t size=sizeof(GpioEvent), void *source=nullptr, FrameworkTask *target=nullptr)
Construct an event with a GpioEvent payload.
uint8_t userCode() const
Returns the raw user-defined code (safe to cast in app code)
Event(SystemNotification type, const void *data=nullptr, size_t size=0, void *source=nullptr, FrameworkTask *target=nullptr)
Construct an event with a system notification.
void * source
Optional source (e.g. controller that generated the event)
GpioEvent gpioEvent
Inline data if GpioChange.
const void * data
For user use.
bool isSystem() const
Returns true if this is a system-defined event.
Event()=default
Default constructor (creates a SystemNotification::None event).
Event(uint8_t userCode, const void *data=nullptr, size_t size=0, void *source=nullptr, FrameworkTask *target=nullptr)
Construct an event with a user-defined notification.
Structure representing a GPIO event.
A tagged union representing either a system or user-defined notification.
SystemNotification system