///
import { BindingInterface } from '@serialport/bindings-interface';
import { BindingPortInterface } from '@serialport/bindings-interface';
import { OpenOptions } from '@serialport/bindings-interface';
import { PortInfo } from '@serialport/bindings-interface';
import { PortStatus } from '@serialport/bindings-interface';
import { SetOptions } from '@serialport/bindings-interface';
import { UpdateOptions } from '@serialport/bindings-interface';
export declare class CanceledError extends Error {
canceled: true;
constructor(message: string);
}
export declare interface CreatePortOptions {
echo?: boolean;
record?: boolean;
readyData?: Buffer;
maxReadSize?: number;
manufacturer?: string;
vendorId?: string;
productId?: string;
}
export declare const MockBinding: MockBindingInterface;
export declare interface MockBindingInterface extends BindingInterface {
reset(): void;
createPort(path: string, opt?: CreatePortOptions): void;
}
/**
* Mock bindings for pretend serialport access
*/
export declare class MockPortBinding implements BindingPortInterface {
readonly openOptions: Required;
readonly port: MockPortInternal;
private pendingRead;
lastWrite: null | Buffer;
recording: Buffer;
writeOperation: null | Promise;
isOpen: boolean;
serialNumber?: string;
constructor(port: MockPortInternal, openOptions: Required);
emitData(data: Buffer | string): void;
close(): Promise;
read(buffer: Buffer, offset: number, length: number): Promise<{
buffer: Buffer;
bytesRead: number;
}>;
write(buffer: Buffer): Promise;
update(options: UpdateOptions): Promise;
set(options: SetOptions): Promise;
get(): Promise;
getBaudRate(): Promise<{
baudRate: number;
}>;
flush(): Promise;
drain(): Promise;
}
export declare interface MockPortInternal {
data: Buffer;
echo: boolean;
record: boolean;
info: PortInfo;
maxReadSize: number;
readyData?: Buffer;
openOpt?: OpenOptions;
}
export { }