/// import * as Stream from "stream"; import { BAUD_RATE } from "./interface"; export declare class SerialPort extends Stream.Duplex { constructor(path: string, callback?: SerialPort.ErrorCallback); constructor(path: string, options?: SerialPort.IOpenOptions, callback?: SerialPort.ErrorCallback); readonly baudRate: BAUD_RATE; readonly binding: SerialPort.BaseBinding; readonly isOpen: boolean; readonly path: string; open(callback?: SerialPort.ErrorCallback): void; update(options: SerialPort.IUpdateOptions, callback?: SerialPort.ErrorCallback): void; write(data: string | number[] | Buffer, callback?: (error: any, bytesWritten: number) => void): boolean; write(buffer: string | number[] | Buffer, encoding?: "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "binary" | "hex", callback?: (error: any, bytesWritten: number) => void): boolean; read(size?: number): string | Buffer | null; close(callback?: (error: Error) => void): void; set(options: SerialPort.ISetOptions, callback?: SerialPort.ErrorCallback): void; get(callback?: SerialPort.ModemBitsCallback): void; flush(callback?: SerialPort.ErrorCallback): void; drain(callback?: SerialPort.ErrorCallback): void; pause(): this; resume(): this; on(event: string, callback: (data?: any) => void): this; static Binding: SerialPort.BaseBinding; static list(): Promise; } export declare namespace SerialPort { type ErrorCallback = (error: Error) => void; type ModemBitsCallback = (error: Error, status: { cts: boolean; dsr: boolean; dcd: boolean; }) => void; type ListCallback = (error: Error, port: any[]) => void; interface IOpenOptions { autoOpen?: boolean; baudRate?: 115200 | 57600 | 38400 | 19200 | 9600 | 4800 | 2400 | 1800 | 1200 | 600 | 300 | 200 | 150 | 134 | 110 | 75 | 50 | number; dataBits?: 8 | 7 | 6 | 5; highWaterMark?: number; lock?: boolean; stopBits?: 1 | 2; parity?: "none" | "even" | "mark" | "odd" | "space"; rtscts?: boolean; xon?: boolean; xoff?: boolean; xany?: boolean; binding?: BaseBinding; bindingOptions?: { vmin?: number; vtime?: number; }; } interface IUpdateOptions { baudRate?: 115200 | 57600 | 38400 | 19200 | 9600 | 4800 | 2400 | 1800 | 1200 | 600 | 300 | 200 | 150 | 134 | 110 | 75 | 50 | number; } interface ISetOptions { brk?: boolean; cts?: boolean; dsr?: boolean; dtr?: boolean; rts?: boolean; } namespace parsers { class ByteLength extends Stream.Transform { constructor(options: { length: number; }); } class CCTalk extends Stream.Transform { constructor(); } class Delimiter extends Stream.Transform { constructor(options: { delimiter: string | Buffer | number[]; includeDelimiter?: boolean; }); } class Readline extends Delimiter { constructor(options: { delimiter: string | Buffer | number[]; encoding?: "ascii" | "utf8" | "utf16le" | "ucs2" | "base64" | "binary" | "hex"; }); } class Ready extends Stream.Transform { constructor(options: { data: string | Buffer | number[]; }); } class Regex extends Stream.Transform { constructor(options: { regex: RegExp; }); } } type win32Binding = BaseBinding; type darwinBinding = BaseBinding; type linuxBinding = BaseBinding; class BaseBinding { constructor(options: any); open(path: string, options: IOpenOptions): Promise; close(): Promise; read(data: Buffer, offset: number, length: number): Promise; write(data: Buffer): Promise; update(options?: IUpdateOptions): Promise; set(options?: ISetOptions): Promise; get(): Promise; flush(): Promise; drain(): Promise; static list(): Promise; } }