Tutorials

Classes

Anybus
AnybusSettings
Array
Bit
Bits
CIPClass
CIPMap
Number
String
UDT
DF1
DF1PCCCClient
DF1PCCCSerialSettings
DF1PCCCSettings
DN
DNSettings
EIP
EIPSettings
EIPC
PCCCClient
PCCCSettings
Tag
TagClient
AWSDevice
ECGDevice
EXIO
POESL
POESLDevice
POESLInputs
POESLOutputs
FLNET
FLSettings
HLAIM
HLAIMDevice
IOLink
IOLinkDevice
IOLinkMaster
Tag
MDSIO1
AnInput
AnOutput
AuxInput
AuxOutput
HID
HIDData
Input
Inputs
LED
MIOB1
MIOB2
Output
Outputs
Stacklight
Modbus
ModbusClient
ModbusDevice
ModbusSerialClient
ModbusTcpClient
Tag
OBDII
OBDIICAN
OBDIIKLine
OBDIIMode
OBDIIPID
OBDIIPIDs
OBDIIPIDServ
OPCUA
PCCCMap
PCCCTag
PNSettings
Profinet
SS
SSDevice
AsciiClient
Sock
MemInfo
Sys
TempInfo
Watchdog
TMCT
TMCTDevice
Toyopuc
ToyopucBlock
ToyopucDevice
ToyopucGroup
ToyopucRegister
UI
UIAlphaDialog
UICalibDialog
UIDialogs
UIDoubleDialog
UIIntDialog
IPAddress
Plugin
Plugins
SerialPort
Version
WAT
WS
WSClient
WSSite
WSSocket

Mixins

CIPVar
UIEditDialog
AsciiHandler

Events


enabledChanged

Indicates that enabled has changed. Does not indicate if the device has successfully joined a network. Use onlineChanged for that.

Parameters:
Name Type Description
enabled bool
Since:
  • 1.0 (WAT 2.4)

onlineChanged

Indicates that online has changed.

Parameters:
Name Type Description
online bool

New state of online

Since:
  • 1.0 (WAT 2.4)

mmapChanged

Indicates that the mmap property has changed.

Since:
  • 1.0 (WAT 2.4)

mmapFileChanged

Indicates that the mmapFile property has changed.

Since:
  • 1.0 (WAT 2.4)

offlineActionChanged

Indicates that the offlineAction property has changed.

Since:
  • 1.0 (WAT 2.4)

valueChanged

Fires when any attribute in the array has changed as a result of a field bus update.

Since:
  • 1.0 (WAT 1.0)

valueChanged

Fires when the bit toggles as a result of a field bus update.

Parameters:
Name Type Description
newValue bool

The new value of the bit

Since:
  • 1.0 (WAT 1.0)

valueChanged

Fires when the value changes as a result of a field bus update.

Parameters:
Name Type Description
newValue number

The new value of the bits

Since:
  • 1.0 (WAT 1.0)

valueChanged

Fires when the value changes as a result of a field bus update.

Parameters:
Name Type Description
newValue number

The new value of the number

Since:
  • 1.0 (WAT 1.0)

valueChanged

Fires when the value changes as a result of a field bus update.

Parameters:
Name Type Description
newValue string

The new value of the string

Since:
  • 1.0 (WAT 1.0)

valueChanged

Fires when anything in the area of the memory map covered by the UDT changes.

Since:
  • 1.0 (WAT 1.0)

closed

Indicates that DF1 communications have been terminated. connectedChanged may also be used.

Since:
  • 1.0 (WAT 2.2)

connectedChanged

Indicates the connection state of DF1 has changed.

Parameters:
Name Type Description
connectionState bool
Since:
  • 1.0 (WAT 2.2)

error

Emitted whenever a communications error is encountered.

Parameters:
Name Type Description
errorDescription string
Since:
  • 1.0 (WAT 2.2)

opened

Indicates that DF1 communications have been successfully established. connectedChanged may also be used.

This event can be used to show the status of the DF1 connection.

Since:
  • 1.0 (WAT 2.2)

assemblyWritten

Indicates that the output assembly has been written to by the server.

In most cases, it is not necessary to use this event. Instead, it is more convenient to attach to the valueChanged signal from an attribute or instance, as this fires any time the value has changed as a result of the assembly being written.

Since:
  • 1.0 (WAT 1.0)

assemblyWritten

Indicates that the output assembly has been written to by the server.

In most cases, it is not necessary to use this event. Instead, it is more convenient to attach to the valueChanged signal from an attribute or instance, as this fires any time the value has changed as a result of the assembly being written.

Since:
  • 1.0 (WAT 1.0)

enabledChanged

Indicates that the enabled property has changed.

Since:
  • 1.8 (WAT 2.4)

mapChanged

Indicates that the map property has changed.

Since:
  • 1.8 (WAT 2.4)

deviceNameChanged

Indicates that the deviceName property has changed.

Since:
  • 1.8 (WAT 2.4)

deviceTypeChanged

Indicates that the deviceType property has changed.

Since:
  • 1.8 (WAT 2.4)

inputSizeChanged

Indicates that the inputSize property has changed.

Since:
  • 1.8 (WAT 2.4)

mmapChanged

Indicates that the mmap property has changed.

Since:
  • 1.8 (WAT 2.4)

mmapFileChanged

Indicates that the mmapFile property has changed.

Since:
  • 1.8 (WAT 2.4)

outputSizeChanged

Indicates that the outputSize property has changed.

Since:
  • 1.8 (WAT 2.4)

productCodeChanged

Indicates that the productCode property has changed.

Since:
  • 1.8 (WAT 2.4)

serialNumberChanged

Indicates that the serialNumber property has changed.

Since:
  • 1.8 (WAT 2.4)

vendorIdChanged

Indicates that the vendorId property has changed.

Since:
  • 1.8 (WAT 2.4)

closed

Indicates that PCCC communications have been terminated. connectedChanged may also be used.

Since:
  • 1.0 (WAT 2.2)

connectedChanged

Indicates the connection state of the PCCC connection has changed.

Parameters:
Name Type Description
connectionState bool
Since:
  • 1.0 (WAT 2.2)

enabledChanged

Emitted when enabled changes.

Since:
  • 1.5 (WAT 2.4)

error

Emitted whenever a communications error is encountered.

Parameters:
Name Type Description
errorDescription string
Since:
  • 1.0 (WAT 2.2)

hostChanged

Emitted when host changes.

Since:
  • 1.5 (WAT 2.4)

opened

Indicates that PCCC communications have been successfully established. connectedChanged may also be used.

This event can be used to show the status of the PCCC connection.

Since:
  • 1.0 (WAT 2.2)

pcccMapChanged

Emitted when pcccMap changes.

Since:
  • 1.5 (WAT 2.4)

portChanged

Emitted when port changes.

Since:
  • 1.5 (WAT 2.4)

mmapChanged

Emitted when mmap changes.

Since:
  • 1.5 (WAT 2.4)

mmapFileChanged

Emitted when mmapFile changes.

Since:
  • 1.5 (WAT 2.4)

rpiChanged

Emitted when rpi changes.

Since:
  • 1.5 (WAT 2.4)

autoReadChanged

Emitted when autoRead changes.

Since:
  • 1.5 (WAT 2.4)

autoWriteChanged

Emitted when autoWrite changes.

Since:
  • 1.5 (WAT 2.4)

dataChanged

Emitted when data changes.

Since:
  • 1.5 (WAT 2.4)

errorChanged

Emitted when an error occurs. See error for more details.

Parameters:
Name Type Description
description string

The error that occurred

Since:
  • 1.0 (WAT 2.2)

loadedChanged

Emitted when the eipc.Tag#loaded property changes.

Since:
  • 1.0 (WAT 2.2)

loadFailed

Emitted when the eipc.Tag#load is called and fails.

Since:
  • 1.0 (WAT 2.2)

mapChanged

Emitted when map changes.

Since:
  • 1.5 (WAT 2.4)

readFailure

Emitted after a failed read.

Parameters:
Name Type Description
object cip.CIPVar

The object that failed to read

description string

The error that occurred

Since:
  • 1.0 (WAT 2.2)

readSuccess

Emitted after a successful read.

Parameters:
Name Type Description
object cip.CIPVar

The object read

Since:
  • 1.0 (WAT 2.2)

writeFailure

Emitted after a failed write.

Parameters:
Name Type Description
object cip.CIPVar

The object that failed to write

description string

The error that occurred

Since:
  • 1.0 (WAT 2.2)

writeSuccess

Emitted after a successful write.

Parameters:
Name Type Description
object cip.CIPVar

The object written

Since:
  • 1.0 (WAT 2.2)

closed

Indicates that EtherNet/IP communications have been stopped, because close was called, a communications error occurred, or the server terminated the connection.

connectedChanged may also be used.

Since:
  • 1.0 (WAT 2.2)

connectedChanged

Emitted when the connected property changes.

Parameters:
Name Type Description
connectionState bool
Since:
  • 1.0 (WAT 2.2)

error

Emitted whenever a communications error is encountered.

Parameters:
Name Type Description
errorDescription string
Since:
  • 1.0 (WAT 2.2)

hostChanged

Emitted when host changes.

Since:
  • 1.5 (WAT 2.4)

opened

Indicates that EtherNet/IP communications have been successfully established and that the list of available tags have been read (available in tagNames). If any tags had been created prior to this event (using createTag), then the tags will automatically be loaded (or re-loaded) at this time (see eipc.Tag#load). If the tag had been previously loaded (e.g. during a previous connection), then all cip properties in eipc.Tag#data will be destroyed and re-created. This means that any connections to events (e.g. cip.Number#event:valueChanged) will need to be re-established.

connectedChanged may also be used.

Since:
  • 1.0 (WAT 2.2)

portChanged

Emitted when port changes.

Since:
  • 1.5 (WAT 2.4)

skipChangeCheckChanged

Emitted when skipChangeCheck changes.

Since:
  • 1.5 (WAT 2.4)

tagNamesChanged

Emitted when tagNames changes.

Since:
  • 1.5 (WAT 2.4)

closed

Emitted when the connection to the device has been closed.

Since:
  • 0.4 (WAT 2.3)

connectedChanged

Emitted when the connection to the device changes.

Since:
  • 0.4 (WAT 2.3)

error

Emitted when the connection to the device detects an error condition.

Parameters:
Name Type Description
err string

Description of the error

Since:
  • 0.4 (WAT 2.3)

hostChanged

Emitted when host changes.

Since:
  • 0.6 (WAT 2.4)

modelChanged

Emitted when model changes.

Since:
  • 0.6 (WAT 2.4)

monitorModeChanged

Emitted when monitorMode changes.

Since:
  • 0.6 (WAT 2.4)

opened

Emitted when a connection to the device has been established.

Since:
  • 0.4 (WAT 2.3)

readyChanged

Emitted after the remote device has been fully described and the objects are ready to use.

After connecting to the device for the first time, the objects that it supports must be queried. Until this has happened, there will be no objects available for interacting with the hardware. After this event, the object will be available. This event will only fire after the initial connect. If a device becomes disconnected and the reconnects later, this event will not fire.

Since:
  • 0.4 (WAT 2.3)

serialNumberChanged

Emitted when serialNumber changes.

Since:
  • 0.6 (WAT 2.4)

watchdogEnabledChanged

Emitted when watchdogEnabled changes.

Since:
  • 0.6 (WAT 2.4)

canEnabledChanged

Emitted when canEnabled changes.

Since:
  • 0.6 (WAT 2.4)

closed

Emitted when the connection to the device has been closed.

Since:
  • 0.1 (WAT 2.0)

connectedChanged

Emitted when a connection to the device has been closed or established.

Since:
  • 0.6 (WAT 2.4)

error

Emitted when the connection to the device detects an error condition.

Parameters:
Name Type Description
err string

Description of the error

Since:
  • 0.1 (WAT 2.0)

hostChanged

Emitted when host changes.

Since:
  • 0.6 (WAT 2.4)

opened

Emitted when a connection to the device has been established.

Since:
  • 0.1 (WAT 2.0)

closed

Emitted when the connection to the serial port has been closed.

Since:
  • 0.1 (WAT 2.0)

error

Emitted when the connection to the serial port detects an error condition.

Parameters:
Name Type Description
err string

Description of the error

Since:
  • 0.1 (WAT 2.0)

opened

Emitted when a connection to the serial port has been established.

Since:
  • 0.1 (WAT 2.0)

colorChanged

Indicates that the color of the stacklight has changed.

Type: number
Since:
  • 2.5 (WAT 2.4)
Inherited From:

flashChanged

Indicates that the flashing color of the stacklight has changed.

Type: number
Since:
  • 2.5 (WAT 2.4)
Inherited From:

offTimeChanged

Indicates that the off time for the flashing colors has changed.

Type: number
Since:
  • 2.5 (WAT 2.4)
Inherited From:

onTimeChanged

Indicates that the on time for the flashing colors has changed.

Type: number
Since:
  • 2.5 (WAT 2.4)
Inherited From:

stateChanged

Indicates that the state of the stacklight has changed. Event will only fire if monitor mode has been enabled.

Type: object
Parameters:
Name Type Description
state object
Properties:
Name Type Description
color number

Current color setting

flash number

Current flash setting

solid number

Colors that are set, but not flashing

on number

Colors that are set or flashing

off number

Colors that are neither set nor flashing

onTime number

On time for flashing

offTime number

Off time for flashing

Since:
  • 1.0 (WAT 1.0)
Inherited From:
See:
Example
sl.stateChanged.connect(function(state) {
   console.log('Stacklight changed to ' + state.color);
});

closed

Emitted when the connection to the device has been closed.

Since:
  • 0.1 (WAT 2.0)

connectedChanged

Emitted when a connection to the device has been closed or established.

Since:
  • 0.6 (WAT 2.4)

error

Emitted when the connection to the device detects an error condition.

Parameters:
Name Type Description
err string

Description of the error

Since:
  • 0.1 (WAT 2.0)

hostChanged

Emitted when host changes.

Since:
  • 0.6 (WAT 2.4)

opened

Emitted when a connection to the device has been established.

Since:
  • 0.1 (WAT 2.0)

stateChanged

Indicates that the state of the inputs has changed.

Parameters:
Name Type Description
state number

new state of the inputs

Since:
  • 1.0 (WAT 1.0)
Inherited From:
See:

flashChanged

Indicates that the flash state of the outputs has changed.

Type: number
Since:
  • 2.5 (WAT 2.4)
Inherited From:

offTimeChanged

Indicates that the off time for the flashing outputs has changed.

Type: number
Since:
  • 2.5 (WAT 2.4)
Inherited From:

onTimeChanged

Indicates that the on time for the flashing outputs has changed.

Type: number
Since:
  • 2.5 (WAT 2.4)
Inherited From:

solidChanged

Indicates that the solid state of the outputs has changed.

Type: number
Since:
  • 2.5 (WAT 2.4)
Inherited From:

stateChanged

Indicates that the state of the outputs has changed. Event will only fire if monitor mode has been enabled.

Type: object
Properties:
Name Type Description
state number

Current state setting

flash number

Current flash setting

solid number

Outputs that are set, but not flashing

on number

Outputs that are set or flashing

off number

Outputs that are neither set nor flashing

onTime number

On time for flashing

offTime number

Off time for flashing

Since:
  • 1.0 (WAT 1.0)
Inherited From:
Example
outputs.stateChanged.connect(function(state) {
   console.log('Outputs changed to ' + state.state);
});

enabledChanged

Indicates that enabled has changed. Does not indicate if the device has successfully joined a network. Use onlineChanged for that.

Parameters:
Name Type Description
enabled bool
Since:
  • 1.0 (WAT 2.4)
Inherited From:

mapChanged

Indicates that the map property has changed.

Since:
  • 1.8 (WAT 2.4)

onlineChanged

Indicates that online has changed.

Parameters:
Name Type Description
online bool

New state of online

Since:
  • 1.0 (WAT 2.4)
Inherited From:

a1InSizeChanged

Indicates that the a1InSize property has changed.

Since:
  • 1.8 (WAT 2.4)

a1InStartChanged

Indicates that the a1InStart property has changed.

Since:
  • 1.8 (WAT 2.4)

a1OutSizeChanged

Indicates that the a1OutSize property has changed.

Since:
  • 1.8 (WAT 2.4)

a1OutStartChanged

Indicates that the a1OutStart property has changed.

Since:
  • 1.8 (WAT 2.4)

a2InSizeChanged

Indicates that the a2InSize property has changed.

Since:
  • 1.8 (WAT 2.4)

a2InStartChanged

Indicates that the a2InStart property has changed.

Since:
  • 1.8 (WAT 2.4)

a2OutSizeChanged

Indicates that the a2OutSize property has changed.

Since:
  • 1.8 (WAT 2.4)

a2OutStartChanged

Indicates that the a2OutStart property has changed.

Since:
  • 1.8 (WAT 2.4)

mmapChanged

Indicates that the mmap property has changed.

Since:
  • 1.0 (WAT 2.4)
Inherited From:

mmapFileChanged

Indicates that the mmapFile property has changed.

Since:
  • 1.0 (WAT 2.4)
Inherited From:

offlineActionChanged

Indicates that the offlineAction property has changed.

Since:
  • 1.0 (WAT 2.4)
Inherited From:

closed

Emitted whenever the serial port is closed. It can be closed as a result of an error or explicitly by the application.

Since:
  • 1.0 (WAT 1.2)

commError

Emitted whenever a message has not been ACK'd after all retry attempts.

Since:
  • 1.0 (WAT 1.2)

gotAck

Emitted when a message is ACK'd by the remote device.

Since:
  • 1.0 (WAT 1.2)

gotBusy

Emitted when a messages has been rejected by the remote device because the remote device is busy.

Since:
  • 1.0 (WAT 1.2)

gotInvalidSelection

Emitted when a messages has been rejected by the remote device because the message contained invalid values.

Since:
  • 1.0 (WAT 1.2)

gotNak

Emitted when a messages has been NAK'd by the remote device.

Since:
  • 1.0 (WAT 1.2)

resultData

Emitted when the headlamp aim test has successfully completed.

Parameters:
Name Type Description
data object
Properties:
Name Type Description
vin string
vsn string
numLamps number

number of lamps tested

pass bool

true if all tests passed

lampData Array.<object>

one object for each lamp

Properties
Name Type Description
lampNumber number
preAimX number
preAimY number
postAimX number
postAimY number
intensity number
pass bool
errorCode string
Since:
  • 1.0 (WAT 1.2)

bigEndianChanged

Emitted when the endianness of the memory map changes. See bigEndian for more details.

Parameters:
Name Type Description
bigEndian bool

Endianness of the memory map

Since:
  • 0.1 (WAT 2.4)

closed

Emitted when the connection to the IO-Link sensor/actuator has been closed, or is no longer in the Operate state.

Since:
  • 0.1 (WAT 2.4)

connectedChanged

Emitted when the connected state of the IO-Link sensor/actuator changes. See connected for more details.

Parameters:
Name Type Description
connected bool

Whether the sensor/actuator is currently connected, and in the Operate state.

Since:
  • 0.1 (WAT 2.4)

error

Emitted when the connection to the IO-Link sensor/actuator detects an error condition.

Parameters:
Name Type Description
err string

Description of the error

Since:
  • 0.1 (WAT 2.4)

mapChanged

Indicates that the map property has changed.

Since:
  • 0.1 (WAT 2.4)

mmapChanged

Emitted when the XML description of the memory map changes. See mmap for more details.

Parameters:
Name Type Description
mmap string

XML description of the memory map

Since:
  • 0.1 (WAT 2.4)

mmapFileChanged

Emitted when the memory map filename changes. See mmapFile for more details.

Parameters:
Name Type Description
mmapFile string

Name of the memory map file

Since:
  • 0.1 (WAT 2.4)

opened

Emitted when a connection to the IO-Link sensor/actuator has been established, and is in the Operate state.

Since:
  • 0.1 (WAT 2.4)

autoReadChanged

Emitted when the automatic read time changes. See autoRead for more details.

Parameters:
Name Type Description
ms int

The number of milliseconds between automatic reads

Since:
  • 0.1 (WAT 2.4)

autoWriteChanged

Emitted when the automatic write flag changes. See autoWrite for more details.

Parameters:
Name Type Description
enabled bool

Whether automatic writing is enabled

Since:
  • 0.1 (WAT 2.4)

errorChanged

Emitted when an error occurs. See error for more details.

Parameters:
Name Type Description
description string

The error that occurred

Since:
  • 0.1 (WAT 2.4)

readFailure

Emitted after a failed read.

Parameters:
Name Type Description
description string

The error that occurred

Since:
  • 0.1 (WAT 2.4)

readSuccess

Emitted after a successful read.

Since:
  • 0.1 (WAT 2.4)

writeFailure

Emitted after a failed write.

Parameters:
Name Type Description
description string

The error that occurred

Since:
  • 0.1 (WAT 2.4)

writeSuccess

Emitted after a successful write.

Since:
  • 0.1 (WAT 2.4)

stateChanged

Indicates that the state of the analog output has changed. Event will only fire if monitor mode has been enabled.

Parameters:
Name Type Description
value number

new scaled value of the DAC

Since:
  • 1.0 (WAT 1.0)

stateChanged

Indicates that the state of the aux input has changed.

Parameters:
Name Type Description
state bool

new state of the input

Since:
  • 1.0 (WAT 1.0)

stateChanged

Indicates that the state of the aux output has changed.

Parameters:
Name Type Description
state bool

new state of the output

Since:
  • 1.0 (WAT 1.0)

valueChanged

Indicates that the HID read has read something.

Parameters:
Name Type Description
value miob.HIDData

new value read by the reader

Since:
  • 1.0 (WAT 1.0)
Example
hw.hid.valueChanged.connect(function(value) {
   console.log("Read '" + value.str + "' from HID");
});

edgeDetected

Indicates that an edge has been detected. The edges that will cause this event to fire are specified in edgeMask. In edges are counted faster than this event can be handled, the count is accumulated between events and passed as an argument to the event. Note that holdoff would need to be changed from the default in order to count fast events.

Parameters:
Name Type Description
count number

number of edge(s) counted since the last time this event fired

Since:
  • 1.0 (WAT 1.0)
Example
function myInput(hw, num)
{
   this.num = num;
   var input = hw.digInputs[num];
   input.holdoff = 0;
   input.edgeMask = input.Edge.Rising | input.Edge.Falling;
   input.edgeDetected.connect(this, this.onEdge);
}

myInput.prototype =
{
   onEdge: function(count)
   {
      console.log('Got ' + count + ' edge(s) on input ' + this.num + ' since last time');
   }
}

fallingEdge

Indicates that a falling edge has occurred.

Since:
  • 1.0 (WAT 1.0)

risingEdge

Indicates that a rising edge has occurred.

Since:
  • 1.0 (WAT 1.0)

stateChanged

Indicates that the state of the input has changed.

Parameters:
Name Type Description
state bool

new state of the input

Since:
  • 1.0 (WAT 1.0)
Example
function myInput(hw, num)
{
   this.num = num;
   hw.digInputs[num].stateChanged.connect(this, this.onChange);
}

myInput.prototype =
{
   onChange: function(state)
   {
      console.log('Input ' + this.num + ' is now ' + state);
   }
}

stateChanged

Indicates that the state of the inputs has changed.

Parameters:
Name Type Description
state number

new state of the inputs

Since:
  • 1.0 (WAT 1.0)
See:

stateChanged

Indicates that the state of the LED has changed. Event will only fire if monitor mode has been enabled.

Parameters:
Name Type Description
color number

current color setting

Since:
  • 1.0 (WAT 1.0)
See:
Example
led.stateChanged.connect(function(color) {
   console.log('LED color is now ' + color);
});

flashChanged

Indicates that the flash state of the output has changed.

Parameters:
Name Type Description
flash bool

new flash state of the output

Since:
  • 2.5 (WAT 2.4)

stateChanged

Indicates that the state of the output has changed.

Parameters:
Name Type Description
state bool

new state of the output

Since:
  • 1.0 (WAT 1.0)

flashChanged

Indicates that the flash state of the outputs has changed.

Type: number
Since:
  • 2.5 (WAT 2.4)

offTimeChanged

Indicates that the off time for the flashing outputs has changed.

Type: number
Since:
  • 2.5 (WAT 2.4)

onTimeChanged

Indicates that the on time for the flashing outputs has changed.

Type: number
Since:
  • 2.5 (WAT 2.4)

solidChanged

Indicates that the solid state of the outputs has changed.

Type: number
Since:
  • 2.5 (WAT 2.4)

stateChanged

Indicates that the state of the outputs has changed. Event will only fire if monitor mode has been enabled.

Type: object
Properties:
Name Type Description
state number

Current state setting

flash number

Current flash setting

solid number

Outputs that are set, but not flashing

on number

Outputs that are set or flashing

off number

Outputs that are neither set nor flashing

onTime number

On time for flashing

offTime number

Off time for flashing

Since:
  • 1.0 (WAT 1.0)
Example
outputs.stateChanged.connect(function(state) {
   console.log('Outputs changed to ' + state.state);
});

colorChanged

Indicates that the color of the stacklight has changed.

Type: number
Since:
  • 2.5 (WAT 2.4)

flashChanged

Indicates that the flashing color of the stacklight has changed.

Type: number
Since:
  • 2.5 (WAT 2.4)

offTimeChanged

Indicates that the off time for the flashing colors has changed.

Type: number
Since:
  • 2.5 (WAT 2.4)

onTimeChanged

Indicates that the on time for the flashing colors has changed.

Type: number
Since:
  • 2.5 (WAT 2.4)

stateChanged

Indicates that the state of the stacklight has changed. Event will only fire if monitor mode has been enabled.

Type: object
Parameters:
Name Type Description
state object
Properties:
Name Type Description
color number

Current color setting

flash number

Current flash setting

solid number

Colors that are set, but not flashing

on number

Colors that are set or flashing

off number

Colors that are neither set nor flashing

onTime number

On time for flashing

offTime number

Off time for flashing

Since:
  • 1.0 (WAT 1.0)
See:
Example
sl.stateChanged.connect(function(state) {
   console.log('Stacklight changed to ' + state.color);
});

closed

Emitted when the connection to Modbus has been closed.

Since:
  • 0.1 (WAT 2.4)

connectedChanged

Emitted when the connected state of the Modbus client changes. See connected for more details.

Parameters:
Name Type Description
connected bool

Whether the client is currently connected to Modbus

Since:
  • 0.1 (WAT 2.4)

error

Emitted when the connection to Modbus detects an error condition.

Parameters:
Name Type Description
err string

Description of the error

Since:
  • 0.1 (WAT 2.4)

opened

Emitted when a connection to Modbus has been established.

Since:
  • 0.1 (WAT 2.4)

mapChanged

Indicates that the map property has changed.

Since:
  • 0.1 (WAT 2.4)

mmapChanged

Emitted when the XML description of the memory map changes. See mmap for more details.

Parameters:
Name Type Description
mmapFile string

XML description of the memory map

Since:
  • 0.1 (WAT 2.4)

mmapFileChanged

Emitted when the memory map filename changes. See mmapFile for more details.

Parameters:
Name Type Description
mmapFile string

Name of the memory map file

Since:
  • 0.1 (WAT 2.4)

autoReadChanged

Emitted when the automatic read time changes. See autoRead for more details.

Parameters:
Name Type Description
ms int

The number of milliseconds between automatic reads

Since:
  • 0.1 (WAT 2.4)

autoWriteChanged

Emitted when the automatic write flag changes. See autoWrite for more details.

Parameters:
Name Type Description
enabled bool

Whether automatic writing is enabled

Since:
  • 0.1 (WAT 2.4)

errorChanged

Emitted when an error occurs. See error for more details.

Parameters:
Name Type Description
description string

The error that occurred

Since:
  • 0.1 (WAT 2.4)

readFailure

Emitted after a failed read.

Parameters:
Name Type Description
description string

The error that occurred

Since:
  • 0.1 (WAT 2.4)

readSuccess

Emitted after a successful read.

Since:
  • 0.1 (WAT 2.4)

writeFailure

Emitted after a failed write.

Parameters:
Name Type Description
description string

The error that occurred

Since:
  • 0.1 (WAT 2.4)

writeSuccess

Emitted after a successful write.

Since:
  • 0.1 (WAT 2.4)

onComplete

Indicates that the an operation (read/write) on the PID has succeeded and emits the value of the PID. The type of the value depends on the kind of PID.

Type: string | number | Array.<number>
Since:
  • 0.1 (WAT 1.1)
See:

onFailed

Indicates that the an operation (read/write) on the PID failed. Usually this means that the PID is not supported, or the bus is not connected/powered. properly.

Since:
  • 0.1 (WAT 1.1)
See:

onSupported

Indicates the result of a support check. Value is true if the PID is supported.

Type: bool
Since:
  • 0.1 (WAT 1.1)
See:

supported

Indicates that the PID has been identified as supported.

Since:
  • 0.1 (WAT 1.1)
See:

unsupported

Indicates that the PID has been identified as not supported.

Since:
  • 0.1 (WAT 1.1)
See:

valueChanged

Indicates that the value of the PID has changed, either because the program wrote the value property, or because the PID is writable and the PID was written using OBD.

Since:
  • 0.6 (WAT 2.2)

autoReadChanged

Indicates that autoRead changed.

Since:
  • 1.2 (WAT 2.4)

autoWriteChanged

Indicates that autoWrite changed.

Since:
  • 1.2 (WAT 2.4)

error

Indicates that an attempt to read from or write to the remote finished with an error.

If automatic reading or writing is enabled, this event will also fire whenever an automatic read or write fails.

Parameters:
Name Type Description
err string

Description of the error that occurred.

Since:
  • 1.0 (WAT 2.2)
See:

readSuccess

Indicates that an attempt to read from the remote finished successfully.

If autoRead is set up to automatically read, this event will also fire whenever an auto read completes successfully.

If a read attempt fails, error will be fired instead.

Since:
  • 1.0 (WAT 2.2)

writeSuccess

Indicates that an attempt to write to the remote finished successfully.

If autoWrite is set up to automatically write, this event will also fire whenever an auto write completes successfully.

If a write attempt fails, error will be fired instead.

Since:
  • 1.0 (WAT 2.2)

mmapChanged

Indicates that the mmap property has changed.

Since:
  • 1.0 (WAT 2.4)
Inherited From:

mmapFileChanged

Indicates that the mmapFile property has changed.

Since:
  • 1.0 (WAT 2.4)
Inherited From:

offlineActionChanged

Indicates that the offlineAction property has changed.

Since:
  • 1.0 (WAT 2.4)
Inherited From:

enabledChanged

Indicates that enabled has changed. Does not indicate if the device has successfully joined a network. Use onlineChanged for that.

Parameters:
Name Type Description
enabled bool
Since:
  • 1.0 (WAT 2.4)
Inherited From:

onlineChanged

Indicates that online has changed.

Parameters:
Name Type Description
online bool

New state of online

Since:
  • 1.0 (WAT 2.4)
Inherited From:

closed

Emitted whenever the serial port is closed. It can be closed as a result of an error or explicitly by the application.

Since:
  • 0.1 (WAT 1.2)

commError

Emitted whenever a message has not been ACK'd after all retry attempts.

Since:
  • 0.1 (WAT 1.2)

deviceDetected

Emitted when a device has been successfully connected to.

Parameters:
Name Type Description
device string

The name of the device.

Since:
  • 0.1 (WAT 1.2)

eepromFail

Emitted when a device has detected a failed EEPROM.

Since:
  • 0.1 (WAT 1.2)

humidity

Emitted whenever the device sends a humidity reading.

Parameters:
Name Type Description
humidity number

The humidity.

Since:
  • 0.1 (WAT 1.2)

lowPower

Emitted when a device has entered low power mode.

Since:
  • 0.1 (WAT 1.2)

tamper

Emitted when a device has detected a tamper condition.

Since:
  • 0.1 (WAT 1.2)

temperature

Emitted whenever the device sends a temperature reading.

Parameters:
Name Type Description
temp number

The temperature.

Since:
  • 0.1 (WAT 1.2)

unsupportedDevice

Emitted when an attempt is made to connect to a device that is not supported by this plugin.

Since:
  • 0.1 (WAT 1.2)

closed

Emitted whenever the serial port is closed. It can be closed as a result of an error or explicitly by the application.

Since:
  • 1.0 (WAT 1.0)

commandError

Emitted whenever message has been NAK'd with this value.

Since:
  • 1.0 (WAT 1.0)

commError

Emitted whenever a message has not been ACK'd after all retry attempts.

Since:
  • 1.0 (WAT 1.0)

countError

Emitted whenever message has been NAK'd with this value.


gotAck

Emitted for messages sent with a non-zero ID, indicating that the message has been ACK'd by the remote device.

Parameters:
Name Type Description
id number

The ID supplied when the message was sent.

Since:
  • 1.0 (WAT 1.0)

gotNak

Emitted for messages sent with a non-zero ID, indicating that the message has been NAK'd by the remote device.

Parameters:
Name Type Description
id number

The ID supplied when the message was sent.

nak number

The NAK code. See tmct.TMCT#nakCodes.

Since:
  • 1.0 (WAT 1.0)

lengthError

Emitted whenever message has been NAK'd with this value.

Since:
  • 1.0 (WAT 1.0)

otherError

Emitted whenever message has been NAK'd with this value.

Since:
  • 1.0 (WAT 1.0)

programError

Emitted whenever message has been NAK'd with this value.

Since:
  • 1.0 (WAT 1.0)

qualityData

Emitted when quality data for a joint (PSet) is received.

Parameters:
Name Type Description
data object
Properties:
Name Type Description
program number
overall number
comprehensive number

Same as overall

ok bool
torqueJudgement number
torqueOk bool
angleJudgement number
angleOk bool
freerunningJudgement number
freerunningOk bool
timeJudgement number
timeOk bool
almightyJudgement number
almightyOk bool
torque number
angle number
freerunning number
time number
almighty number
nak number

NAK code, see tmct.TMCT#nakCodes

Since:
  • 1.0 (WAT 1.0)

tighteningError

Emitted whenever message has been NAK'd with this value.

Since:
  • 1.0 (WAT 1.0)

vehicleDataError

Emitted whenever message has been NAK'd with this value.

Since:
  • 1.0 (WAT 1.0)

error

Emitted when an error occurs when attempting a read or write operation.

Parameters:
Name Type Description
error string

A string describing the error that occurred.

Since:
  • 0.1 (WAT 1.4)

updated

Emitted when a portion of the block has been updated.

Parameters:
Name Type Description
addr number

The offset of the updated portion.

len number

The length of the updated portion.

Since:
  • 0.1 (WAT 1.4)

connected

Emitted when a connection to a device has been successfully established.

Since:
  • 0.1 (WAT 1.4)

disconnected

Emitted when a connection to a device has been lost.

Since:
  • 0.1 (WAT 1.4)

error

Emitted when an error occurs while connecting to a device.

Parameters:
Name Type Description
error string

A string describing the error that occurred.

Since:
  • 0.1 (WAT 1.4)

isConnectedChanged

Emitted when the value of isConnected changes.

Since:
  • 1.0 (WAT 2.3)

error

Emitted when an error occurs when attempting a read or write operation.

Parameters:
Name Type Description
error string

A string describing the error that occurred.

Since:
  • 1.0 (WAT 2.3)

readFailure

Emitted after a failed read.

Parameters:
Name Type Description
description string

The error that occurred

Since:
  • 1.0 (WAT 2.3)

readSuccess

Emitted after a successful read.

Since:
  • 1.0 (WAT 2.3)

writeFailure

Emitted after a failed write.

Parameters:
Name Type Description
description string

The error that occurred

Since:
  • 1.0 (WAT 2.3)

writeSuccess

Emitted after a successful write.

Since:
  • 1.0 (WAT 2.3)

readFailure

Emitted after a failed read.

Parameters:
Name Type Description
description string

The error that occurred

Since:
  • 1.0 (WAT 2.3)

readSuccess

Emitted after a successful read.

Since:
  • 1.0 (WAT 2.3)

writeFailure

Emitted after a failed write.

Parameters:
Name Type Description
description string

The error that occurred

Since:
  • 1.0 (WAT 2.3)

writeSuccess

Emitted after a successful write.

Since:
  • 1.0 (WAT 2.3)

closed

Emitted when the device been closed.

Since:
  • 1.0

dataReceived

Indicates that data has been received. How often it fires and/or what data is emitted is defined by the configuration properties.

String data is decoded using UTF8.

Type: object
Properties:
Name Type Description
str string

String representation of the data

bytes Array.<number>

Raw values of the bytes received

length number

Number of bytes received

Since:
  • 1.0
Example
dev.dataReceived.connect(function(data) {
   console.log("Read '" + data.str + "' from device");
});

dataSent

Indicates that data has been sent by the application. monitorMode must be enabled before this event will fire.

Type: object
Properties:
Name Type Description
str string

String representation of the data

bytes Array.<number>

Raw values of the bytes sent

length number

Number of bytes sent

Since:
  • 2.1
Example
dev.monitorMode = true;
dev.dataSent.connect(function(data) {
   console.log("Sent '" + data.str + "' to device");
});

opened

Emitted when the device has successfully opened.

Since:
  • 1.0

addrSet

Indicates that the IP address has been changed.

Parameters:
Name Type Description
addr number

New IP address in number representation

Since:
  • 1.0

closed

Emitted when the connection to the client has been closed.

Since:
  • 0.1 (WAT 2.0)

messageReceived

Emitted when a message is received from the client.

Parameters:
Name Type Description
message string

Client message

Since:
  • 0.1 (WAT 2.0)

newClient

Emitted when a new client connects to the web socket.

Parameters:
Name Type Description
client ws.WSClient

New client

Since:
  • 0.1 (WAT 2.0)