import { EngineControlResponse, EngineSettings, EngineStatus, SerializableEngine, } from "jm-castle-ac-dc-types"; import { CastleAcDc } from "../system/status/System.mjs"; import { ControlContext } from "./ControlContext.mjs"; import { EngineContext } from "./EngineContext.mjs"; export interface Engine { start: () => Promise; stop: () => Promise; status: () => Promise; settings: () => Promise; getSerializable: () => Promise; } export interface Datacollector { onLapEnd: (consumer: EngineContextConsumer) => void; } export interface Datastate { onLapEnd: (consumer: EngineContextConsumer) => void; } export interface Control { onLapEnd: (consumer: ControlContextConsumer) => void; consumeAction: ( actionId: string, context: EngineContext, system: CastleAcDc ) => Promise; } export interface EngineContextConsumer { onContextChange: (context: EngineContext) => Promise; } export interface ControlContextConsumer { onControlContextChange: (context: ControlContext) => Promise; } export const SystemEngineKey_datastate = "state"; export type SystemEngineKey = typeof SystemEngineKey_datastate; export const isSystemEngineKey = (key: string): key is SystemEngineKey => { switch (key) { case SystemEngineKey_datastate: return true; default: return false; } };