SimScenario
SimScenario charge et exécute des scénarios de simulation stockés en JSON sur carte SD ou SPIFFS.
Format JSON
Section intitulée « Format JSON »{ "id": "acr-fv-adulte", "name": "ACR sur FV — Adulte", "version": "1.0.0", "category": "cardiac", "difficulty": "intermediate", "description": "Arrêt cardio-respiratoire sur fibrillation ventriculaire", "devices": ["dae", "dinamap", "scope"], "initialState": "fv_initial", "states": { "fv_initial": { "vitals": { "hr": 0, "spo2": 0, "rr": 0, "rhythm": "ventricular_fibrillation" }, "transitions": [ { "trigger": "shock", "target": "post_shock_1" }, { "trigger": "timeout", "delay": 120, "target": "fv_initial" } ] }, "post_shock_1": { "vitals": { "hr": 72, "spo2": 96, "rr": 14, "rhythm": "sinus" }, "transitions": [ { "trigger": "timeout", "delay": 30, "target": "stable" } ] }, "stable": { "vitals": { "hr": 80, "spo2": 98, "rr": 16, "rhythm": "sinus" } } }}#include <SimScenario.h>
SimScenario scenario;
// Charger depuis SDscenario.loadFromSD("/scenarios/acr-fv-adulte.json");
// Démarrerscenario.start();
// Obtenir l'état courantconst ScenarioState& state = scenario.currentState();int hr = state.vitals["hr"];
// Déclencher une transitionscenario.trigger("shock");
// Boucle principalevoid loop() { scenario.update(); // Gère les timeouts}Commandes formateur
Section intitulée « Commandes formateur »Le formateur peut envoyer des commandes via la PWA :
| Commande | Action |
|---|---|
goto(stateId) | Sauter à un état spécifique |
trigger(event) | Déclencher une transition |
pause() / resume() | Mettre en pause / reprendre |
override(param, value) | Modifier une valeur vitale |