/** * Transport abstraction for the MIK protocol. * * A transport is a bidirectional byte pipe. The protocol layer (session.ts) * builds on top of it. `createSerialTransport` wraps a `serialport` SerialPort * instance; other implementations (loopback, WebSocket) can be added for * testing or alternative connectivity. */ import { Observable } from 'rxjs'; import { SerialPort } from 'serialport'; export interface Transport { /** Push data to the device. Returns a promise that resolves once the * bytes have been flushed to the OS — important for tiny writes * (e.g. 5-byte command frames) on macOS, where node-serialport's * internal queue can otherwise hold them indefinitely behind a * USB-CDC packet boundary. */ write(data: Uint8Array): Promise; /** Observable stream of incoming bytes from the device */ data: Observable; /** Tear down the transport */ close(): void; } /** * Open a serial port as an Observable. Emits the open port, then completes. * Closing the port on unsubscribe ensures cleanup if the subscriber cancels. */ export declare function openSerial(path: string, baudRate: number): Observable; /** * Create a transport backed by a SerialPort instance. * The caller owns the SerialPort lifecycle; `close()` removes listeners * but does NOT close the port (the caller may reuse it). */ export declare function createSerialTransport(serialPort: SerialPort): Transport; //# sourceMappingURL=transport.d.ts.map