/** * TCP client for communicating with the CrossPad simulator's remote control server. * Protocol: newline-delimited JSON over TCP on localhost:19840. * * Two rules here are not style choices, they are defects this file exists to * not repeat (spec §3.8): * * • One socket, one request at a time. The simulator parks every non-ping * command on a single process-wide `s_responseReady` flag, so two requests * in flight can each be handed the other's reply — and opening a second * socket does not help, because the flag is shared by all of them. * • Only reads are retried. v9 retried whatever timed out, so one slow * `pad_press` became three presses the sim actually played. */ export interface RemoteResponse { ok: boolean; [key: string]: unknown; } export interface SendOptions { /** Response timeout in ms. Default 15 s — a kit load parks the LVGL thread. */ timeoutMs?: number; /** Force the retry decision. Defaults to "only if the command is a read". */ retry?: boolean; } /** Whether `cmd` may be re-sent when the first attempt times out. */ export declare function isReadCommand(cmd: unknown): boolean; /** Close the socket (simulator killed, tests). The next send reconnects. */ export declare function closeSimConnection(): void; /** * Send a JSON command to the running simulator and return the response. * Requests never overlap; a read that times out is retried, a command with a * side effect is not. */ export declare function sendRemoteCommand(command: Record, options?: SendOptions): Promise; /** * Check if the simulator's remote control server is reachable. One short * attempt: callers poll this in a loop, so a retry ladder here would only make * "not up yet" take a minute to answer. */ export declare function isSimulatorRunning(): Promise;