Logo Pico-Framework A web-first embedded framework for C++
Loading...
Searching...
No Matches
Event.h File Reference

Defines the Event structure and related utilities for event messaging. More...

#include <cstdint>
#include <cstddef>
#include <type_traits>
#include <string>
#include "events/Notification.h"
#include "events/GpioEvent.h"
+ Include dependency graph for Event.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Event
 Represents a framework event, optionally carrying payload data. More...
 

Functions

template<typename Enum , typename T >
Event userEvent (Enum e, const T &data)
 Helper to create a user-defined Event with a payload.
 
template<typename Enum >
Event userEvent (Enum e, const char *data, size_t size)
 

Detailed Description

Version
1.1
Date
2025-04-22
License:\n MIT

Definition in file Event.h.

Function Documentation

◆ userEvent() [1/2]

template<typename Enum >
Event userEvent ( Enum  e,
const char *  data,
size_t  size 
)
inline

Definition at line 119 of file Event.h.

119 {
120 static_assert(std::is_enum<Enum>::value, "Enum type required");
121 return Event(static_cast<uint8_t>(e), data, size);
122}
Represents a framework event, optionally carrying payload data.
Definition Event.h:24

◆ userEvent() [2/2]

template<typename Enum , typename T >
Event userEvent ( Enum  e,
const T &  data 
)
inline
Template Parameters
EnumThe enum type.
TThe data type of the payload.
Parameters
eThe enum value.
dataThe data to attach.
Returns
Event The constructed user event with payload.

Definition at line 114 of file Event.h.

114 {
115 return Event(static_cast<uint8_t>(e), &data, sizeof(T));
116}