|
Ersa Wearable Platform
Embedded smartwatch firmware and application framework
|
#include <event.h>

Public Member Functions | |
| Event () | |
| Event (EventType t, uint32_t ts=0) | |
Static Public Member Functions | |
| static Event | createButton (EventType t, ButtonId btn, uint32_t ts=0) |
| static Event | createMinuteTick (const TimePayload &tp, uint32_t ts=0) |
| static Event | createTimeSync (uint32_t epoch, TimeSource source, uint32_t ts=0) |
| static Event | createBatteryChanged (uint16_t mv, uint8_t pct, bool conn, bool chg, uint32_t ts=0) |
| static Event | createCall (EventType t, const char *caller, const char *number, uint8_t state, uint32_t ts=0) |
| static Event | createMedia (const char *title, const char *artist, bool playing, uint32_t ts=0) |
| static Event | createNotification (const char *title, const char *message, const char *app="", uint32_t uid=0, uint32_t ts=0, bool canDismissRemotely=false) |
Public Attributes | ||
| EventType | type {EventType::None} | |
| uint32_t | timestampMs {0} | |
| union { | ||
| ButtonPayload button | ||
| TimePayload time | ||
| BatteryPayload battery | ||
| NetworkPayload network | ||
| CallPayload call | ||
| MediaPayload media | ||
| NotificationPayload notification | ||
| void * customPayload | ||
| }; | ||
Fixed-size event envelope with a tagged, type-specific payload union.
Creating and posting an Event copies all bounded text into the value. This lets asynchronous producers release callback-owned buffers immediately and avoids heap allocation; consumers must read only the union member associated with type because the payload storage is shared.
|
inline |
Construct an empty event whose button payload is initialized safely.
|
inlineexplicit |
Construct an event envelope for t at an optional monotonic timestamp.
|
inlinestatic |
Build a battery sample event, copying voltage, estimate, and status bits.
|
inlinestatic |
Build a button event with the requested subtype and logical button key.
|
inlinestatic |
Build a call transition with bounded copies of caller and number. Text is truncated to the inline payload capacity and null-terminated so later asynchronous consumers do not retain borrowed provider pointers.
|
inlinestatic |
Build a media-track event with copied title, artist, and playback state.
|
inlinestatic |
Build a minute-boundary event containing one RTC snapshot.
|
inlinestatic |
Build a notification event with bounded text copies and remote-dismiss metadata. Fixed buffers make queued events self-contained and predictable.
|
inlinestatic |
Build a request to apply an external time value through TimeService.
| union { ... } ersa::events::Event |
| BatteryPayload ersa::events::Event::battery |
| ButtonPayload ersa::events::Event::button |
| CallPayload ersa::events::Event::call |
| void* ersa::events::Event::customPayload |
| MediaPayload ersa::events::Event::media |
| NetworkPayload ersa::events::Event::network |
| NotificationPayload ersa::events::Event::notification |
| TimePayload ersa::events::Event::time |
| uint32_t ersa::events::Event::timestampMs {0} |
Monotonic device uptime at event creation, in milliseconds.
| EventType ersa::events::Event::type {EventType::None} |
Discriminator selecting the active payload member.