/// /// import EthernetIP from "../../enip"; import { TaskEasy as Queue } from "task-easy"; import { EventEmitter } from 'events'; export declare class TCPController extends EventEmitter { ethernet: EthernetIP; state: any; OTconnectionID: number; TOconnectionID: number; configInstance: { assembly?: any; size?: number; }; outputInstance: { assembly?: any; size?: number; }; inputInstance: { assembly?: any; size?: number; }; tryingToConnect: boolean; workers: { read: Queue; write: Queue; group: Queue; }; static connect(address: any, arg1: any, configInstance: any, outputInstance: any, inputInstance: any): void; constructor(connectedMessaging?: boolean); /** * Returns the Scan Rate of Subscription Tags * * @memberof Controller * @returns {number} ms */ get scan_rate(): any; /** * Returns the Timeout Setpoint * * @memberof Controller * @returns {number} ms */ get timeout_sp(): any; /** * Sets the Timeout Setpoint * * @memberof Controller */ set timeout_sp(sp: any); /** * Returns the Rpi * * @memberof Controller * @returns {number} ms */ get rpi(): any; /** * Sets the Rpi * * @memberof Controller */ set rpi(sp: any); /** * Get the status of Scan Group * * @readonly * @memberof Controller */ get scanning(): any; /** * Returns the connected / unconnected messaging mode * * @memberof Controller * @returns {boolean} true, if connected messaging; false, if unconnected messaging */ get connectedMessaging(): any; /** * Sets the Mode to connected / unconnected messaging * * @memberof Controller */ set connectedMessaging(conn: any); /** * Gets the Controller Properties Object * * @readonly * @memberof Controller * @returns {object} */ get properties(): any; /** * Fetches the last timestamp retrieved from the controller * in human readable form * * @readonly * @memberof Controller */ get time(): string; /** * Initializes Session with Desired IP Address * Sends forwardOpen to IO device to initialize Ethernet/ip class 1 communication * * @override * @param {string} IP_ADDR - IPv4 Address (can also accept a FQDN, provided port forwarding is configured correctly.) * @param {number} SLOT - Controller Slot Number (0 if CompactLogix) * @param {object} configInstance - configInstance parameters * @param {number} configInstance.assembly - config assembly instance value * @param {number} configInstance.size - config data size * @param {object} outputInstance - outputInstance parameters * @param {number} outputInstance.assembly - output assembly instance value * @param {number} outputInstance.size - output data size * @param {object} inputInstance - inputInstance parameters * @param {number} inputInstance.assembly - input assembly instance value * @param {number} inputInstance.size - config data size * @returns {Promise} * @memberof ENIP */ connect(IP_ADDR: string, SLOT: number | undefined, configInstance: any, outputInstance: any, inputInstance: any): Promise; /** * Disconnects the PLC instance gracefully by issuing forwardClose, UnregisterSession * and then destroying the socket * and Returns a Promise indicating a success or failure or the disconnection * * @memberof Controller * @returns {Promise} */ disconnect(): Promise; /** * Writes a forwardOpen Request and retrieves the connection ID used for * connected messages. * @memberof Controller * @returns {Promise} */ forwardOpen(): Promise; /** * Generates path to IO assembly instances */ _ioPath(): Buffer; /** * Writes a forwardClose Request and retrieves the connection ID used for * connected messages. */ forwardClose(): Promise; /** * Writes Ethernet/IP Data to Socket as an Unconnected Message * or a Transport Class 1 Datagram * * NOTE: Cant Override Socket Write due to net.Socket.write * implementation. =[. Thus, I am spinning up a new Method to * handle it. Dont Use Enip.write, use this function instead. * * @override * @param {buffer} data - Message Router Packet Buffer * @param {boolean} [connected=false] * @param {number} [timeout=10] - Timeout (sec) * @param {function} [cb=null] - Callback to be Passed to Parent.Write() * @memberof ENIP */ write_cip(data: any, connected?: boolean, timeout?: number, cb?: null): void; /** * Reads Controller Identity Object * * @memberof Controller * @returns {Promise} */ readControllerProps(): Promise; /** * Initialized Controller Specific Event Handlers * * @memberof Controller */ _initializeControllerEventHandlers(): void; /** * Remove Controller Specific Event Handlers * * @memberof Controller */ _removeControllerEventHandlers(): void; /** * @typedef EncapsulationData * @type {Object} * @property {number} commandCode - Ecapsulation Command Code * @property {string} command - Encapsulation Command String Interpretation * @property {number} length - Length of Encapsulated Data * @property {number} session - Session ID * @property {number} statusCode - Status Code * @property {string} status - Status Code String Interpretation * @property {number} options - Options (Typically 0x00) * @property {Buffer} data - Encapsulated Data Buffer */ /*****************************************************************/ /** * @typedef MessageRouter * @type {Object} * @property {number} service - Reply Service Code * @property {number} generalStatusCode - General Status Code (Vol 1 - Appendix B) * @property {number} extendedStatusLength - Length of Extended Status (In 16-bit Words) * @property {Array} extendedStatus - Extended Status * @property {Buffer} data - Status Code */ /*****************************************************************/ /** * Handles SendRRData Event Emmitted by Parent and Routes * incoming Message * * @param {Array} srrd - Array of Common Packet Formatted Objects * @memberof Controller */ _handleSendRRDataReceived(srrd: any): void; _handleSendUnitDataReceived(sud: any): void; }