Type Definitions
AdsErrorInfo
- Source:
Properties:
Name | Type | Description |
---|---|---|
adsErrorType |
string | Type of the error (AMS error, ADS error)
|
adsErrorCode |
number | ADS error code |
adsErrorStr |
string | The description/message of ADS error code https://infosys.beckhoff.com/english.php?content=../content/1033/tf6610_tc3_s5s7communication/36028797393240971.html&id= |
Connection
- Source:
Properties:
Name | Type | Description |
---|---|---|
connected |
boolean | True if target is connected |
isLocal |
boolean | True if target is local runtime / loopback connection |
localAmsNetId |
string | Local system AmsNetId |
localAdsPort |
number | Local system ADS port |
targetAmsNetId |
string | Target system AmsNetId |
targetAdsPort |
number | Target system ADS port |
CreateVariableHandleMultiResult
- Source:
Properties:
Name | Type | Description |
---|---|---|
success |
boolean | True if creating handle was successful |
errorInfo |
MultiErrorInfo | Error information (if any) |
target |
string | Target variable name |
handle |
number | Returned variable handle (if successful) |
CreateVariableHandleResult
- Source:
Properties:
Name | Type | Description |
---|---|---|
handle |
number | Received variable handle |
size |
number | Received target variable size |
type |
string | Received target variable type |
DeleteVariableHandleMultiResult
- Source:
Properties:
Name | Type | Description |
---|---|---|
success |
boolean | True if deleting handle was successful |
errorInfo |
MultiErrorInfo | Error information (if any) |
handle |
number | The variable handle that was tried to be deleted |
IndexGroupAndOffset
- Source:
Properties:
Name | Type | Description |
---|---|---|
indexGroup |
number | Index group in the PLC |
indexOffset |
number | Index offset in the PLC |
Metadata
- Source:
Properties:
Name | Type | Description |
---|---|---|
deviceInfo |
object | Target device info (read after connecting) |
systemManagerState |
object | Target device system manager state (run, config, etc.) |
plcRuntimeState |
object | Target PLC runtime state (run, stop, etc.) (the runtime state of settings.targetAdsPort PLC runtime) |
uploadInfo |
object | Contains information of target data types, symbols and so on |
symbolVersion |
number | Active symbol version at target system. Changes when PLC software is updated |
allSymbolsCached |
boolean | True if all symbols are cached (so we know to re-cache all during symbol version change) |
symbols |
object | Object containing all so far cached symbols |
allDataTypesCached |
boolean | True if all data types are cached (so we know to re-cache all during symbol version change) |
dataTypes |
object | Object containing all so far cached data types |
routerState |
object | Local AMS router state (RUN, STOP etc) - Updated only if router sends notification (debug/run change etc) |
MultiResult
- Source:
Properties:
Name | Type | Description |
---|---|---|
error |
boolean | If true, command failed |
errorCode |
number | If error, ADS error code |
errorStr |
string | If error, ADS error as string |
ReadRawMultiParam
- Source:
Properties:
Name | Type | Description |
---|---|---|
indexGroup |
number | Variable index group in the PLC |
indexOffset |
number | Variable index offset in the PLC |
size |
number | Variable size in the PLC (bytes) |
ReadRawMultiResult
- Source:
Properties:
Name | Type | Description |
---|---|---|
success |
boolean | True if read was successful |
errorInfo |
MultiErrorInfo | Error information (if any) |
target |
IndexGroupAndOffset | Original target info |
data |
Buffer | Read data as byte Buffer |
RpcMethodResult
- Source:
Properties:
Name | Type | Description |
---|---|---|
returnValue |
object | The return value of the method |
outputs |
object | Object containing all VAR_OUTPUT variables of the method |
Settings
- Source:
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
targetAmsNetId |
string | Target system AmsNetId, use '127.0.0.1.1.1' if connecting to a local system |
||
targetAdsPort |
number | Target system ADS port, TwinCAT 3: 851 (1st runtime), 852 (2nd runtime) and so on |
||
objectifyEnumerations |
boolean |
<optional> |
true
|
If true, read ENUM data types are converted to objects instead of numbers, e.g. {name: 'enumValue', value: 5} instead of 5 - (default: true) |
convertDatesToJavascript |
boolean |
<optional> |
true
|
If true, PLC DT (DATE_AND_TIME) and DATE types are converted to Javascript dates - Optional (default: true) |
readAndCacheSymbols |
boolean |
<optional> |
false
|
If true, all PLC symbols are cached during connecting. Otherwise they are read and cached only when needed - Optional (default: false) |
readAndCacheDataTypes |
boolean |
<optional> |
false
|
If true, all PLC data types are cached during connecting. Otherwise they are read and cached only when needed - Optional (default: false) |
disableSymbolVersionMonitoring |
boolean |
<optional> |
false
|
If true, PLC symbol version changes aren't monitored and cached symbols and datatypes won't be updated after PLC program download - Optional - Optional (default: false) |
routerTcpPort |
number |
<optional> |
48898
|
Target ADS router TCP port - Optional (default: 48898) |
routerAddress |
string |
<optional> |
127.0.0.1
|
Target ADS router IP address/hostname - Optional (default: 127.0.0.1) |
localAddress |
string |
<optional> |
'(system default)'
|
Local IP address to use, use this to change used network interface if required - Optional (default: System default) |
localTcpPort |
number |
<optional> |
'(system default)'
|
Local TCP port to use for outgoing connections - Optional (default: System default) |
localAmsNetId |
string |
<optional> |
'(from AMS router)'
|
Local AmsNetId to use - Optional (default: From AMS router) |
localAdsPort |
number |
<optional> |
'(from AMS router)'
|
Local ADS port to use - Optional (default: From AMS router) |
timeoutDelay |
number |
<optional> |
2000
|
Time (milliseconds) after connecting to the router or waiting for command response is canceled to timeout - Optional (default: 2000 ms) |
hideConsoleWarnings |
boolean |
<optional> |
false
|
If true, no warnings are written to console (=nothing is ever written to console) - Optional (default: false) |
autoReconnect |
boolean |
<optional> |
true
|
If true and connection is lost, the client tries to reconnect automatically - Optional (default: true) |
reconnectInterval |
number |
<optional> |
2000
|
Time (milliseconds) how often the lost connection is tried to re-establish - Optional (default: 2000 ms) |
checkStateInterval |
number |
<optional> |
1000
|
Time (milliseconds) how often the system manager state is read to see if connection is OK - Optional (default: 1000 ms) |
connectionDownDelay |
number |
<optional> |
5000
|
Time (milliseconds) after no successful reading of the system manager state the connection is determined to be lost - Optional (default: 5000 ms) |
allowHalfOpen |
boolean |
<optional> |
false
|
If true, connect() is successful even if no PLC runtime is found (but target and system manager are available) - Can be useful if it's ok that after connect() the PLC runtime is not immediately available (example: connecting before uploading PLC code and reading data later) - WARNING: If true, reinitializing subscriptions might fail after connection loss. |
disableBigInt |
boolean |
<optional> |
false
|
If true, 64 bit integer PLC variables are kept as Buffer objects instead of converting to Javascript BigInt variables (JSON.strigify and libraries that use it have no BigInt support) |
bareClient |
boolean |
<optional> |
false
|
If true, only direct ads connection is established (no system manager etc) - Can be used to connect to systems without PLC runtimes etc. |
subscriptionCallback(data, sub)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
data |
subscriptionCallbackData | Object containing {value, timeStamp, type] where value is the latest data from PLC |
sub |
object | Subscription object - Information about subscription and for example, unsubscribe() method |
subscriptionCallbackData
- Source:
Properties:
Name | Type | Description |
---|---|---|
value |
object | Parsed data (if available) or Buffer |
timeStamp |
Date | Date object that contains the PLC timestamp of the data |
type |
object | Data type object (if available) |
WriteRawMultiParam
- Source:
Properties:
Name | Type | Description |
---|---|---|
indexGroup |
number | Variable index group in the PLC |
indexOffset |
number | Variable index offset in the PLC |
data |
Buffer | Buffer object that contains the data (and byteLength is acceptable) |
WriteRawMultiResult
- Source:
Properties:
Name | Type | Description |
---|---|---|
success |
boolean | True if write was successful |
errorInfo |
MultiErrorInfo | Error information (if any) |
target |
IndexGroupAndOffset | Original target info |