87 lines
2.2 KiB
C++
87 lines
2.2 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <type_traits>
|
|
|
|
namespace borla {
|
|
|
|
enum class AppEventType : uint8_t {
|
|
kBootRequested,
|
|
kNetworkConnected,
|
|
kNetworkDisconnected,
|
|
kRealtimeConnected,
|
|
kRealtimeDisconnected,
|
|
kRealtimeProtocolError,
|
|
kButtonClicked,
|
|
kButtonLongPressed,
|
|
kAudioVolumeRequested,
|
|
kWakeWordControlRequested,
|
|
kBargeInControlRequested,
|
|
kRemoteIdleSleepRequested,
|
|
kLedAlertRequested,
|
|
kWakeWordDetected,
|
|
kBargeInCandidate,
|
|
kBargeInRejected,
|
|
kBargeInConfirmed,
|
|
kConversationStopRequested,
|
|
kTtsStarted,
|
|
kTtsStreamEnded,
|
|
kPlaybackPreempted,
|
|
kPlaybackDrained,
|
|
kPlaybackFailed,
|
|
kLocalPromptRequested,
|
|
kLocalPromptStarted,
|
|
kLocalSequenceRequested,
|
|
kLocalSequenceStarted,
|
|
kActivationReplayDue,
|
|
kShutdownPromptRequested,
|
|
kUserActivityDetected,
|
|
kIdleCheckDue,
|
|
kIdleResponseExpired,
|
|
kIdleGoodbyeDue,
|
|
kReminderDue,
|
|
kAlarmDue,
|
|
kFirstDayAlarmDue,
|
|
kAlertFinished,
|
|
kLowBatteryWarning,
|
|
kCriticalBattery,
|
|
kOutgoingCall,
|
|
kIncomingCall,
|
|
kCallConnected,
|
|
kCallEnded,
|
|
kFriendModeEnded,
|
|
kProvisioningRequested,
|
|
// Credentials were accepted and written to NVS. Provisioning stays active
|
|
// afterwards: the miniprogram still owns the reboot that leaves this mode.
|
|
kProvisioningWifiSaved,
|
|
kProvisioningCompleted,
|
|
kUpgradeRequested,
|
|
kUpgradeCompleted,
|
|
kUpgradeFailed,
|
|
kSoftOffRequested,
|
|
kFatalError,
|
|
};
|
|
|
|
// Control-plane event only. Raw audio and JSON payloads must stay in their
|
|
// respective data planes. Keeping this type trivially copyable makes it safe
|
|
// for a statically allocated FreeRTOS queue.
|
|
struct AppEvent {
|
|
AppEventType type = AppEventType::kBootRequested;
|
|
uint32_t correlation_id = 0;
|
|
int32_t value = 0;
|
|
uint32_t flags = 0;
|
|
|
|
static AppEvent Make(AppEventType type, uint32_t correlation_id = 0,
|
|
int32_t value = 0, uint32_t flags = 0)
|
|
{
|
|
return AppEvent{type, correlation_id, value, flags};
|
|
}
|
|
};
|
|
|
|
static_assert(std::is_trivially_copyable<AppEvent>::value,
|
|
"AppEvent must remain safe for FreeRTOS queue copies");
|
|
|
|
const char* ToString(AppEventType type);
|
|
|
|
} // namespace borla
|