/** * SerialSession — transport-agnostic serial session interface and Web Serial API implementation. * * The interface is identical regardless of the underlying transport (Web Serial API in browser, * Node.js serialport in standalone/test builds). The concrete implementations differ only in * how they talk to the hardware; the rest of the stack (CWKeyer, ProtocolAdapter) uses only * this interface and is never aware of the transport layer. */ export interface SerialSession { writeBytes(data: Uint8Array): Promise; writeText(text: string): Promise; disconnect(): Promise; on(listener: (data: Uint8Array) => void): void; off(listener: (data: Uint8Array) => void): void; } export declare function isWebSerialSupported(): boolean; export declare function requestSerialPort(options?: SerialPortRequestOptions): Promise; export declare function openSerialPort(port: SerialPort, options: SerialOptions): Promise; export declare function closeSerialPort(port: SerialPort): Promise; /** * Wraps an already-opened Web Serial API SerialPort into a SerialSession. * Uses the WHATWG Streams API (port.readable / port.writable). */ export declare function createWebSerialSession(port: SerialPort): SerialSession; /** * Requests a Web Serial port, opens it, and returns a SerialSession. * Browser-only; throws if the Web Serial API is unavailable. */ export declare function connectSerialSession(serialOptions: SerialOptions, requestOptions?: SerialPortRequestOptions): Promise; /** * Silently reconnects using the first previously-granted Web Serial port. * Returns a connected SerialSession, or null if no port was previously granted * or if the Web Serial API is unavailable. * Does NOT show a port-picker dialog. */ export declare function autoConnectWebSerial(serialOptions: SerialOptions): Promise;