ads-client 1.13.1 → 1.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [1.13.2] - 17.05.2022
8
+ ### Changed
9
+ - Bug fix: Incorrect parsing of ARRAY OF ARRAY, now works as should [See issue #91](https://github.com/jisotalo/ads-client/issues/91)
10
+ - Added settings descriptions to README
11
+
7
12
  ## [1.13.1] - 04.04.2022
8
13
  ### Changed
9
14
  - Bug fix: Undefined variable `message` [See issue #89](https://github.com/jisotalo/ads-client/issues/89)
package/README.md CHANGED
@@ -38,6 +38,7 @@ Check out the [node-red-contrib-ads-client](https://www.npmjs.com/package/node-r
38
38
  - [Getting started](#getting-started)
39
39
  * [Data types used in getting started](#data-types-used-in-getting-started)
40
40
  * [Creating a new Client instance](#creating-a-new-client-instance)
41
+ * [Available settings](#available-settings)
41
42
  * [Connecting and disconnecting](#connecting-and-disconnecting)
42
43
  * [Reading any type PLC variable](#reading-any-type-plc-variable)
43
44
  + [Example: Reading `INT` type variable](#example-reading-int-type-variable)
@@ -411,8 +412,6 @@ END_TYPE
411
412
 
412
413
  The constructor takes settings as its parameter. Two settings are mandatory: `targetAmsNetId` and `targetAdsPort`. The first is the target PLC system AmsNetId (like *127.0.0.1.1.1* or *192.168.1.10.1.1*) and the latter is target system ADS port (*like 851 for TwinCAT 3 runtime 1*).
413
414
 
414
- See all settings from the [Settings documentation](https://jisotalo.github.io/ads-client/global.html#Settings)
415
-
416
415
  ```js
417
416
  const ads = require('ads-client')
418
417
 
@@ -422,6 +421,84 @@ const client = new ads.Client({
422
421
  targetAdsPort: 851,
423
422
  })
424
423
  ```
424
+ ### Available settings
425
+ **REQUIRED:**
426
+ * `targetAmsNetId`
427
+ * Target system AmsNetId
428
+ * Use `127.0.0.1.1.1` or `localhost` if connecting to a local system
429
+ * `targetAdsPort`
430
+ * Target system ADS port.
431
+ * TwinCAT 3: 851 (1st runtime), 852 (2nd runtime) and so on
432
+ * TwinCAT 2: 801 (1st runtime)
433
+
434
+ **Optional:**
435
+ * `objectifyEnumerations`
436
+ * Default value: `true`
437
+ * If true, read ENUM data types are converted to objects instead of numbers, e.g. `{name: 'enumValue', value: 5}` instead of 5
438
+ * `convertDatesToJavascript`
439
+ * Default value: `true`
440
+ * If true, PLC DT (DATE_AND_TIME) and DATE types are converted to Javascript dates
441
+ * `readAndCacheSymbols`
442
+ * Default value: `false`
443
+ * If true, **all** PLC symbols are cached during connecting. Otherwise they are read and cached only when needed
444
+ * `readAndCacheDataTypes`
445
+ * Default value: `false`
446
+ * If true, **all** PLC data types are cached during connecting. Otherwise they are read and cached only when needed
447
+ * `disableSymbolVersionMonitoring`
448
+ * Default value: `false`
449
+ * If true, PLC symbol version changes aren't monitored and cached symbols and datatypes won't be updated after PLC program download
450
+ * `routerTcpPort`
451
+ * Default value: `48898`
452
+ * Target ADS router TCP port
453
+ * `routerAddress`
454
+ * Default value: `localhost`
455
+ * Target ADS router IP address/hostname
456
+ * `localAddress`
457
+ * Default value: `system default`
458
+ * Local IP address to use, use this to change used network interface if required
459
+ * `localTcpPort`
460
+ * Default value: `system default`
461
+ * Local TCP port to use for outgoing connections
462
+ * `localAmsNetId`
463
+ * Default value: `AMS router provides`
464
+ * Local AmsNetId to use
465
+ * Used especially when connecting from systems without own AMS router, like Raspberry Pi
466
+ * See: [Connecting from any Node.js supported system to the PLC](#setup-3---connecting-from-any-nodejs-supported-system-to-the-plc)
467
+ * `localAdsPort`
468
+ * Default value: `AMS router provides`
469
+ * Local ADS port to use
470
+ * Used especially when connecting from systems without own AMS router, like Raspberry Pi
471
+ * See: [Connecting from any Node.js supported system to the PLC](#setup-3---connecting-from-any-nodejs-supported-system-to-the-plc)
472
+ * `timeoutDelay`
473
+ * Default value: `2000`
474
+ * Time (milliseconds) after connecting to the router or waiting for command response is canceled to a timeout
475
+ * `hideConsoleWarnings`
476
+ * Default value: `false`
477
+ * If true, no warnings are written to console (=nothing is **ever** written to console)
478
+ * `autoReconnect`
479
+ * Default value: `true`
480
+ * If true and connection is lost, the client tries to reconnect automatically
481
+ * `reconnectInterval`
482
+ * Default value: `2000`
483
+ * Time (milliseconds) how often the lost connection is tried to re-establish
484
+ * `checkStateInterval`
485
+ * Default value: `1000`
486
+ * Time (milliseconds) how often the system manager state is read to see if connection is OK
487
+ * `connectionDownDelay`
488
+ * Default value: `5000`
489
+ * Time (milliseconds) after no successful reading of the system manager state the connection is determined to be lost
490
+ * `allowHalfOpen`
491
+ * Default value: `false`
492
+ * 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 connecting the PLC runtime is not immediately available (example: connecting before uploading PLC code and reading data later) -
493
+ * WARNING: If true, reinitializing subscriptions might fail after connection loss.
494
+ * `disableBigInt`
495
+ * Default value: `false`
496
+ * 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)
497
+ * `bareClient`
498
+ * Default value: `false`
499
+ * If true, only direct ads connection is established (no system manager)
500
+ * Can be used to connect to systems without PLC runtime
501
+ * See [Connecting to systems without PLC runtime](#connecting-to-systems-without-plc-runtime)
425
502
 
426
503
 
427
504
  ## Connecting and disconnecting
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ads-client",
3
- "version": "1.13.1",
3
+ "version": "1.13.2",
4
4
  "description": "Beckhoff TwinCAT ADS client library for Node.js (unofficial). Connects to Beckhoff TwinCAT automation systems using ADS protocol.",
5
5
  "main": "./src/ads-client.js",
6
6
  "scripts": {
package/src/ads-client.js CHANGED
@@ -888,7 +888,7 @@ class Client extends EventEmitter {
888
888
  } catch (err) {
889
889
  return reject(new ClientException(this, 'readSymbol()', `Reading symbol ${variableName} failed: Reading data type failed`, err))
890
890
  }
891
-
891
+
892
892
  //4. Parse the data to javascript object
893
893
  let data = {}
894
894
  try {
@@ -5684,8 +5684,8 @@ function _getDataTypeRecursive(dataTypeName, firstLevel = true, size = null) {
5684
5684
  const arrayType = await _getDataTypeRecursive.call(this, dataType.type, false)
5685
5685
 
5686
5686
  parsedDataType = arrayType
5687
- parsedDataType.arrayData = dataType.arrayData
5688
-
5687
+ //Combining array information (for ARRAY OF ARRAY support)
5688
+ parsedDataType.arrayData = dataType.arrayData.concat(parsedDataType.arrayData)
5689
5689
 
5690
5690
  //If the data type has flag "DataType" and it's enum
5691
5691
  } else if (dataType.flagsStr.includes('DataType') && dataType.flagsStr.includes('EnumInfos')) {