Files
MTGcompanion/main/app_state.h

40 lines
871 B
C

/*
* MTG RFID Companion - System state machine
*
* Phase 7 Step 7.2: State transitions CARD_VIEW <-> LIFE_COUNTER, plus the
* boot/scanner/registration states. Driven by the UI task on Core 1.
*/
#pragma once
#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
APP_STATE_BOOT = 0,
APP_STATE_SCANNER,
APP_STATE_CARD_VIEW,
APP_STATE_LIFE_COUNTER,
APP_STATE_REGISTRATION,
} app_state_t;
const char *app_state_name(app_state_t state);
/* Life counter state */
void app_set_life(int32_t life);
int32_t app_get_life(void);
void app_set_life_preset(int32_t preset);
int32_t app_get_life_preset(void);
/* Which "screen" is active - CARD_VIEW vs LIFE_COUNTER. */
void app_set_view(app_state_t view);
app_state_t app_get_view(void);
void app_enter_keyed_view(app_state_t view);
#ifdef __cplusplus
}
#endif