#pragma once #include #include namespace roro { enum class NotificationLevel : int32_t { Info, Warning, Message }; // Everything Services announce to the UI. Add new kinds before Count. enum class EventType : uint8_t { BatteryChanged, // a = percent, b = millivolts Notification, // text = message, a = NotificationLevel StorageThreshold, // a = usage percent, b = level now in effect (0 / 80 / 90 / 100) SettingChanged, // a = Setting, text = storage key Count }; // Small, fixed-size and copyable so it can cross tasks through a queue without allocating. struct Event { static constexpr size_t kTextCapacity = 48; EventType type; int32_t a = 0; int32_t b = 0; char text[kTextCapacity] = {}; static Event withValues(EventType type, int32_t a, int32_t b = 0) { Event e{type}; e.a = a; e.b = b; return e; } static Event withText(EventType type, const char* text, int32_t a = 0) { Event e{type}; e.a = a; std::strncpy(e.text, text, kTextCapacity - 1); return e; } }; } // namespace roro