ads-client 2.0.0-beta.2 → 2.0.0-beta.4
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 +23 -0
- package/README.md +505 -254
- package/dist/ads-client.d.ts +627 -123
- package/dist/ads-client.js +747 -172
- package/dist/ads-client.js.map +1 -1
- package/dist/types/ads-client-types.d.ts +200 -17
- package/dist/types/ads-client-types.js.map +1 -1
- package/dist/types/ads-protocol-types.d.ts +75 -1
- package/dist/types/ads-protocol-types.js.map +1 -1
- package/package.json +3 -4
|
@@ -4,6 +4,8 @@ import { PlcPrimitiveType } from "./ads-client-types";
|
|
|
4
4
|
* AMS address
|
|
5
5
|
*
|
|
6
6
|
* Combination of AmsNetId and ADS port
|
|
7
|
+
*
|
|
8
|
+
* @category Types
|
|
7
9
|
*/
|
|
8
10
|
export interface AmsAddress {
|
|
9
11
|
/** AmsNetId, such as `192.168.1.2.1.1`*/
|
|
@@ -13,6 +15,8 @@ export interface AmsAddress {
|
|
|
13
15
|
}
|
|
14
16
|
/**
|
|
15
17
|
* AMS packet for communication
|
|
18
|
+
*
|
|
19
|
+
* @category Types
|
|
16
20
|
*/
|
|
17
21
|
export interface AmsTcpPacket<T = AdsData> {
|
|
18
22
|
/** AMS TCP header */
|
|
@@ -24,6 +28,8 @@ export interface AmsTcpPacket<T = AdsData> {
|
|
|
24
28
|
}
|
|
25
29
|
/**
|
|
26
30
|
* AMS TCP header
|
|
31
|
+
*
|
|
32
|
+
* @category Types
|
|
27
33
|
*/
|
|
28
34
|
export interface AmsTcpHeader {
|
|
29
35
|
/** AMS command as number */
|
|
@@ -37,6 +43,8 @@ export interface AmsTcpHeader {
|
|
|
37
43
|
}
|
|
38
44
|
/**
|
|
39
45
|
* AMS header
|
|
46
|
+
*
|
|
47
|
+
* @category Types
|
|
40
48
|
*/
|
|
41
49
|
export interface AmsHeader {
|
|
42
50
|
/** Target AmsNetId and port (receiver) */
|
|
@@ -64,10 +72,14 @@ export interface AmsHeader {
|
|
|
64
72
|
}
|
|
65
73
|
/**
|
|
66
74
|
* ADS data
|
|
75
|
+
*
|
|
76
|
+
* @category Types
|
|
67
77
|
*/
|
|
68
78
|
export type AdsData = AdsResponse | AdsRequest;
|
|
69
79
|
/**
|
|
70
80
|
* AmsTcpHeader data that is received when AMS router state changes
|
|
81
|
+
*
|
|
82
|
+
* @category Types
|
|
71
83
|
*/
|
|
72
84
|
export interface AmsRouterStateData {
|
|
73
85
|
/** New router state as number */
|
|
@@ -75,10 +87,14 @@ export interface AmsRouterStateData {
|
|
|
75
87
|
}
|
|
76
88
|
/**
|
|
77
89
|
* AmsTcpHeader data that is received when AMS port is registered from the router
|
|
90
|
+
*
|
|
91
|
+
* @category Types
|
|
78
92
|
*/
|
|
79
93
|
export type AmsPortRegisteredData = AmsAddress;
|
|
80
94
|
/**
|
|
81
95
|
* AMS router state
|
|
96
|
+
*
|
|
97
|
+
* @category Types
|
|
82
98
|
*/
|
|
83
99
|
export interface AmsRouterState {
|
|
84
100
|
/** Router state */
|
|
@@ -88,10 +104,14 @@ export interface AmsRouterState {
|
|
|
88
104
|
}
|
|
89
105
|
/**
|
|
90
106
|
* ADS response
|
|
107
|
+
*
|
|
108
|
+
* @category Types
|
|
91
109
|
*/
|
|
92
110
|
export type AdsResponse = EmptyAdsResponse | UnknownAdsResponse | AdsReadResponse | AdsReadWriteResponse | AdsWriteResponse | AdsReadDeviceInfoResponse | AdsNotificationResponse | AdsAddNotificationResponse | AdsDeleteNotificationResponse | AdsWriteControlResponse;
|
|
93
111
|
/**
|
|
94
112
|
* ADS request
|
|
113
|
+
*
|
|
114
|
+
* @category Types
|
|
95
115
|
*/
|
|
96
116
|
export interface AdsRequest {
|
|
97
117
|
/** Payload of the ADS request (if any) */
|
|
@@ -99,6 +119,8 @@ export interface AdsRequest {
|
|
|
99
119
|
}
|
|
100
120
|
/**
|
|
101
121
|
* ADS error
|
|
122
|
+
*
|
|
123
|
+
* @category Types
|
|
102
124
|
*/
|
|
103
125
|
export interface AdsError {
|
|
104
126
|
/** ADS error code (0 = no error, -1 = other than ADS error) */
|
|
@@ -108,6 +130,8 @@ export interface AdsError {
|
|
|
108
130
|
}
|
|
109
131
|
/**
|
|
110
132
|
* Base ADS reponse (that is received in all responses)
|
|
133
|
+
*
|
|
134
|
+
* @category Types
|
|
111
135
|
*/
|
|
112
136
|
export interface BaseAdsResponse {
|
|
113
137
|
/** True if response has error (ADS or our own customer error) */
|
|
@@ -119,12 +143,16 @@ export interface BaseAdsResponse {
|
|
|
119
143
|
}
|
|
120
144
|
/**
|
|
121
145
|
* Empty ADS response (no payload)
|
|
146
|
+
*
|
|
147
|
+
* @category Types
|
|
122
148
|
*/
|
|
123
149
|
export type EmptyAdsResponse = {
|
|
124
150
|
[K in any]: never;
|
|
125
151
|
};
|
|
126
152
|
/**
|
|
127
153
|
* ADS response for `Read` command
|
|
154
|
+
*
|
|
155
|
+
* @category Types
|
|
128
156
|
*/
|
|
129
157
|
export interface AdsReadResponse extends BaseAdsResponse {
|
|
130
158
|
/** Data length */
|
|
@@ -134,6 +162,8 @@ export interface AdsReadResponse extends BaseAdsResponse {
|
|
|
134
162
|
}
|
|
135
163
|
/**
|
|
136
164
|
* ADS response for `ReadWrite` command
|
|
165
|
+
*
|
|
166
|
+
* @category Types
|
|
137
167
|
*/
|
|
138
168
|
export interface AdsReadWriteResponse extends BaseAdsResponse {
|
|
139
169
|
/** Data length */
|
|
@@ -143,11 +173,15 @@ export interface AdsReadWriteResponse extends BaseAdsResponse {
|
|
|
143
173
|
}
|
|
144
174
|
/**
|
|
145
175
|
* ADS response for `Write` command
|
|
176
|
+
*
|
|
177
|
+
* @category Types
|
|
146
178
|
*/
|
|
147
179
|
export interface AdsWriteResponse extends BaseAdsResponse {
|
|
148
180
|
}
|
|
149
181
|
/**
|
|
150
182
|
* ADS response for `ReadDeviceInfo` command
|
|
183
|
+
*
|
|
184
|
+
* @category Types
|
|
151
185
|
*/
|
|
152
186
|
export interface AdsReadDeviceInfoResponse extends BaseAdsResponse {
|
|
153
187
|
/** Device info */
|
|
@@ -155,6 +189,8 @@ export interface AdsReadDeviceInfoResponse extends BaseAdsResponse {
|
|
|
155
189
|
}
|
|
156
190
|
/**
|
|
157
191
|
* ADS response for `ReadState` command
|
|
192
|
+
*
|
|
193
|
+
* @category Types
|
|
158
194
|
*/
|
|
159
195
|
export interface AdsReadStateResponse extends BaseAdsResponse {
|
|
160
196
|
/** ADS state */
|
|
@@ -162,6 +198,8 @@ export interface AdsReadStateResponse extends BaseAdsResponse {
|
|
|
162
198
|
}
|
|
163
199
|
/**
|
|
164
200
|
* ADS response for `AddNotification` command
|
|
201
|
+
*
|
|
202
|
+
* @category Types
|
|
165
203
|
*/
|
|
166
204
|
export interface AdsAddNotificationResponse extends BaseAdsResponse {
|
|
167
205
|
/** Device notification handle */
|
|
@@ -169,16 +207,22 @@ export interface AdsAddNotificationResponse extends BaseAdsResponse {
|
|
|
169
207
|
}
|
|
170
208
|
/**
|
|
171
209
|
* ADS response for `DeleteNotification` command
|
|
210
|
+
*
|
|
211
|
+
* @category Types
|
|
172
212
|
*/
|
|
173
213
|
export interface AdsDeleteNotificationResponse extends BaseAdsResponse {
|
|
174
214
|
}
|
|
175
215
|
/**
|
|
176
216
|
* ADS response for `WriteControl` command
|
|
217
|
+
*
|
|
218
|
+
* @category Types
|
|
177
219
|
*/
|
|
178
220
|
export interface AdsWriteControlResponse extends BaseAdsResponse {
|
|
179
221
|
}
|
|
180
222
|
/**
|
|
181
223
|
* ADS response for `Notification` command
|
|
224
|
+
*
|
|
225
|
+
* @category Types
|
|
182
226
|
*/
|
|
183
227
|
export interface AdsNotificationResponse extends BaseAdsResponse {
|
|
184
228
|
/** Notification data */
|
|
@@ -186,11 +230,15 @@ export interface AdsNotificationResponse extends BaseAdsResponse {
|
|
|
186
230
|
}
|
|
187
231
|
/**
|
|
188
232
|
* ADS response for unknown command
|
|
233
|
+
*
|
|
234
|
+
* @category Types
|
|
189
235
|
*/
|
|
190
236
|
export interface UnknownAdsResponse extends BaseAdsResponse {
|
|
191
237
|
}
|
|
192
238
|
/**
|
|
193
239
|
* ADS device info
|
|
240
|
+
*
|
|
241
|
+
* @category Types
|
|
194
242
|
*/
|
|
195
243
|
export interface AdsDeviceInfo {
|
|
196
244
|
/** Major version number */
|
|
@@ -204,6 +252,8 @@ export interface AdsDeviceInfo {
|
|
|
204
252
|
}
|
|
205
253
|
/**
|
|
206
254
|
* ADS state
|
|
255
|
+
*
|
|
256
|
+
* @category Types
|
|
207
257
|
*/
|
|
208
258
|
export interface AdsState {
|
|
209
259
|
/** ADS state */
|
|
@@ -214,7 +264,9 @@ export interface AdsState {
|
|
|
214
264
|
deviceState: number;
|
|
215
265
|
}
|
|
216
266
|
/**
|
|
217
|
-
* ADS `AddNotification`
|
|
267
|
+
* ADS `AddNotification` response payload
|
|
268
|
+
*
|
|
269
|
+
* @category Types
|
|
218
270
|
*/
|
|
219
271
|
export interface AdsAddNotificationResponseData {
|
|
220
272
|
/** Notification handle */
|
|
@@ -222,6 +274,8 @@ export interface AdsAddNotificationResponseData {
|
|
|
222
274
|
}
|
|
223
275
|
/**
|
|
224
276
|
* ADS notification with number of stamps
|
|
277
|
+
*
|
|
278
|
+
* @category Types
|
|
225
279
|
*/
|
|
226
280
|
export interface AdsNotification {
|
|
227
281
|
/** Total data length (bytes) */
|
|
@@ -233,6 +287,8 @@ export interface AdsNotification {
|
|
|
233
287
|
}
|
|
234
288
|
/**
|
|
235
289
|
* Single ADS notification stamp with multiple samples
|
|
290
|
+
*
|
|
291
|
+
* @category Types
|
|
236
292
|
*/
|
|
237
293
|
export interface AdsNotificationStamp {
|
|
238
294
|
/** Timestamp of the included data*/
|
|
@@ -244,6 +300,8 @@ export interface AdsNotificationStamp {
|
|
|
244
300
|
}
|
|
245
301
|
/**
|
|
246
302
|
* Single ADS notification sample
|
|
303
|
+
*
|
|
304
|
+
* @category Types
|
|
247
305
|
*/
|
|
248
306
|
export interface AdsNotificationSample {
|
|
249
307
|
/** Notification handle this data belongs to */
|
|
@@ -255,6 +313,8 @@ export interface AdsNotificationSample {
|
|
|
255
313
|
}
|
|
256
314
|
/**
|
|
257
315
|
* ADS raw address
|
|
316
|
+
*
|
|
317
|
+
* @category Types
|
|
258
318
|
*/
|
|
259
319
|
export interface AdsRawAddress {
|
|
260
320
|
/** Address indexGroup */
|
|
@@ -266,6 +326,8 @@ export interface AdsRawAddress {
|
|
|
266
326
|
}
|
|
267
327
|
/**
|
|
268
328
|
* ADS symbol object
|
|
329
|
+
*
|
|
330
|
+
* @category Types
|
|
269
331
|
*/
|
|
270
332
|
export interface AdsSymbol {
|
|
271
333
|
/** Symbol address indexGroup */
|
|
@@ -302,6 +364,8 @@ export interface AdsSymbol {
|
|
|
302
364
|
}
|
|
303
365
|
/**
|
|
304
366
|
* Array information entry for symbol or data type
|
|
367
|
+
*
|
|
368
|
+
* @category Types
|
|
305
369
|
*/
|
|
306
370
|
export interface AdsArrayInfoEntry {
|
|
307
371
|
/** Array start/first index */
|
|
@@ -311,6 +375,8 @@ export interface AdsArrayInfoEntry {
|
|
|
311
375
|
}
|
|
312
376
|
/**
|
|
313
377
|
* Attribute entry for symbol, data type, RPC method etc.
|
|
378
|
+
*
|
|
379
|
+
* @category Types
|
|
314
380
|
*/
|
|
315
381
|
export interface AdsAttributeEntry {
|
|
316
382
|
/** Attribute name */
|
|
@@ -320,6 +386,8 @@ export interface AdsAttributeEntry {
|
|
|
320
386
|
}
|
|
321
387
|
/**
|
|
322
388
|
* ADS data type object
|
|
389
|
+
*
|
|
390
|
+
* @category Types
|
|
323
391
|
*/
|
|
324
392
|
export interface AdsDataType {
|
|
325
393
|
/** Structure version */
|
|
@@ -383,6 +451,8 @@ export interface AdsDataType {
|
|
|
383
451
|
}
|
|
384
452
|
/**
|
|
385
453
|
* RPC method entry for a data type
|
|
454
|
+
*
|
|
455
|
+
* @category Types
|
|
386
456
|
*/
|
|
387
457
|
export interface AdsRpcMethodEntry {
|
|
388
458
|
/** Structure version */
|
|
@@ -418,6 +488,8 @@ export interface AdsRpcMethodEntry {
|
|
|
418
488
|
}
|
|
419
489
|
/**
|
|
420
490
|
* RPC method parameter entry for a RPC method
|
|
491
|
+
*
|
|
492
|
+
* @category Types
|
|
421
493
|
*/
|
|
422
494
|
export interface AdsRpcMethodParameterEntry {
|
|
423
495
|
/** Size (bytes) */
|
|
@@ -451,6 +523,8 @@ export interface AdsRpcMethodParameterEntry {
|
|
|
451
523
|
}
|
|
452
524
|
/**
|
|
453
525
|
* ADS enumeration entry
|
|
526
|
+
*
|
|
527
|
+
* @category Types
|
|
454
528
|
*/
|
|
455
529
|
export interface AdsEnumInfoEntry {
|
|
456
530
|
/** Enumeration name*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ads-protocol-types.js","sourceRoot":"","sources":["../../src/types/ads-protocol-types.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;EAoBE,CAAA,CAAC;
|
|
1
|
+
{"version":3,"file":"ads-protocol-types.js","sourceRoot":"","sources":["../../src/types/ads-protocol-types.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;EAoBE,CAAA,CAAC;AA2IF,CAAC;AAgDD,CAAC;AAYD,CAAC;AAQD,CAAC;AAUD,CAAC;AAUD,CAAC;AAUD,CAAC;AAOwE,CAAC;AAOP,CAAC;AAUpE,CAAC;AAO6D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ads-client",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.4",
|
|
4
4
|
"description": "Beckhoff TwinCAT ADS client library for Node.js (unofficial). Connect to a Beckhoff TwinCAT automation system using the ADS protocol from a Node.js app.",
|
|
5
5
|
"main": "./dist/ads-client.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "jest --runInBand",
|
|
8
|
-
"test-
|
|
9
|
-
"test-watch": "npm run test -- --watch --config test/jest.config.js",
|
|
7
|
+
"test-tc3": "jest --runInBand TC3/ads-client.test.js",
|
|
8
|
+
"test-tc2": "jest --runInBand TC2/ads-client.test.js",
|
|
10
9
|
"build": "tsc",
|
|
11
10
|
"watch": "tsc -w",
|
|
12
11
|
"create-docs": "npx typedoc"
|