-
-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ServerSerial types and emit initialized * file * better * open callback * openCallback on SerialPort open * open on SerialPort --------- Co-authored-by: cplepage <[email protected]>
- Loading branch information
Showing
4 changed files
with
28 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import * as events from 'events'; | ||
import { SerialPortOpenOptions } from "serialport" | ||
import { FCallback, IServiceVector } from './ServerTCP'; | ||
import { ErrorCallback } from '@serialport/stream'; | ||
|
||
export class ServerSerial extends events.EventEmitter { | ||
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import {ModbusRTU} from "./ModbusRTU"; | ||
export * from "./ServerTCP"; | ||
export * from "./ServerSerial"; | ||
|
||
export default ModbusRTU; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters