UNPKG

modbus-serial

Version:

A pure JavaScript implementation of MODBUS-RTU (Serial and TCP) for NodeJS. The serialport package is an optional dependency (use npm install --no-optional to skip).

28 lines (24 loc) 978 B
/** * References `serialport` / `@serialport/stream`. `serialport` is optional; add it (or `skipLibCheck`) * if this file must type-check when optional deps were skipped. */ import * as events from 'events'; import * as stream from 'stream'; import { SerialPortOpenOptions } from 'serialport'; import { FCallback, IServiceVector } from './ServerTCP'; import { ErrorCallback } from '@serialport/stream'; export class ServerSerial extends events.EventEmitter { socks: Map<stream.Transform, 0>; constructor(vector: IServiceVector, options: IServerSerialOptions); close(cb: FCallback): void; } type IServerSerialOptions = SerialPortOpenOptions<any> & { debug?: boolean, unitID?: number, openCallback?: ErrorCallback } export declare interface ServerSerial { on(event: 'socketError', listener: FCallback): this; on(event: 'error', listener: FCallback): this; on(event: 'initialized', listener: FCallback): this; }