42 lines
1.6 KiB
C
42 lines
1.6 KiB
C
// Routine manifest for the Lisael Box "Routine" mode.
|
|
// /sdcard/routines/routines.json = JSON object { "routines": [ ... ] }, each
|
|
// routine has an id, a title, a tile icon, and an ordered list of steps. ASCII
|
|
// file names; UTF-8 title/text strings. The pure parser is host-testable.
|
|
#pragma once
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
// Caps kept small: lisael_routine_t is ~2 KB; mode keeps a static array of
|
|
// these in PSRAM, never a task stack. Two fixed routines (matin/soir), <=12
|
|
// steps each.
|
|
#define LISAEL_MAX_ROUTINES 2
|
|
#define LISAEL_MAX_STEPS 12
|
|
|
|
typedef struct {
|
|
char text[80]; // UTF-8 step label (e.g. "Habille-toi")
|
|
char icon[40]; // .bin basename under /sdcard/routines/ ("matin_01.bin")
|
|
char audio[40]; // .mp3 basename under /sdcard/routines/ ("matin_01.mp3")
|
|
} lisael_step_t;
|
|
|
|
typedef struct {
|
|
char id[16]; // ASCII id ("matin", "soir")
|
|
char title[48]; // UTF-8 display title ("Le matin")
|
|
char icon[40]; // tile icon basename ("matin.bin"), "" if none
|
|
lisael_step_t steps[LISAEL_MAX_STEPS];
|
|
int n_steps;
|
|
} lisael_routine_t;
|
|
|
|
// Pure parser: JSON string -> routines[]. Expects a root OBJECT with a
|
|
// "routines" array. Skips routines with zero steps. Returns routine count
|
|
// (>=0), or -1 if the JSON is malformed or has no "routines" array.
|
|
int lisael_routine_parse(const char *json, lisael_routine_t *routines, int max_routines);
|
|
|
|
// Read /sdcard/routines/routines.json and parse it. Returns count or -1.
|
|
int lisael_routine_load(lisael_routine_t *routines, int max_routines);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|