@synapticon/motion-master-client 6.0.0-alpha.26 → 6.0.0-alpha.28
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/dist/generated/Api.d.ts +67 -26
- package/dist/generated/Api.js +57 -13
- package/dist/generated/data-contracts.d.ts +27 -0
- package/package.json +1 -1
package/dist/generated/Api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AlStatusCode, DcSyncStatus, DeviceDiagnostics, DeviceParameter, EscRegister, FoeErrorCode, Monitoring, ObjectDataTypeInfo, ParameterCacheEntry, ProcessDataWatchdog, ProcessImageObject, SlaveConfig, SlaveInformationInterface } from "./data-contracts.js";
|
|
1
|
+
import { AlStatusCode, DcSyncStatus, DeviceDiagnostics, DeviceParameter, EscRegister, FoeErrorCode, Monitoring, ObjectDataTypeInfo, OutputStageResult, ParameterCacheEntry, ProcessDataWatchdog, ProcessImageObject, SlaveConfig, SlaveInformationInterface } from "./data-contracts.js";
|
|
2
2
|
import { HttpClient, RequestParams } from "./http-client.js";
|
|
3
3
|
export declare class Api<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
|
|
4
4
|
/**
|
|
@@ -265,31 +265,6 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
265
265
|
*/
|
|
266
266
|
serialNumber: number;
|
|
267
267
|
}, void>>;
|
|
268
|
-
/**
|
|
269
|
-
* @description Performs a live AL-state read for the device and reports whether its CoE/SDO mailbox is active — i.e. it is in PRE-OP, SAFE-OP, or OP. This is independent of the AL error indicator: a device in SAFE-OP+error still answers mailbox requests. Only INIT (no mailbox) and BOOT (FoE-only mailbox) report inactive. The device must already be known from a prior scan. Reading one device at a time means a single missing device reports inactive without failing the others.
|
|
270
|
-
*
|
|
271
|
-
* @name GetDeviceMailboxActive
|
|
272
|
-
* @summary Check whether a device's mailbox is active
|
|
273
|
-
* @request GET:/api/devices/{slavePosition}/mailbox
|
|
274
|
-
*/
|
|
275
|
-
getDeviceMailboxActive: (slavePosition: number, params?: RequestParams) => Promise<import("./http-client.js").HttpResponse<{
|
|
276
|
-
/**
|
|
277
|
-
* 1-based position on the fieldbus
|
|
278
|
-
* @example 1
|
|
279
|
-
*/
|
|
280
|
-
slavePosition: number;
|
|
281
|
-
/**
|
|
282
|
-
* True when the device's CoE/SDO mailbox is active (AL state PRE-OP, SAFE-OP, or OP, regardless of the error indicator); false otherwise.
|
|
283
|
-
* @example true
|
|
284
|
-
*/
|
|
285
|
-
mailboxActive: boolean;
|
|
286
|
-
}, void | {
|
|
287
|
-
/**
|
|
288
|
-
* Human-readable error message from the driver
|
|
289
|
-
* @example "FPRD slave 1: wkc=0"
|
|
290
|
-
*/
|
|
291
|
-
error: string;
|
|
292
|
-
}>>;
|
|
293
268
|
/**
|
|
294
269
|
* @description Constructs the requested fieldbus driver, opens the network interface, and makes the driver available for subsequent calls to /api/scan. The driver defaults to SOEM when omitted. SOEM has no adapter auto-detect: a network adapter must be supplied, otherwise init fails.
|
|
295
270
|
*
|
|
@@ -413,6 +388,20 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
413
388
|
*/
|
|
414
389
|
error: string;
|
|
415
390
|
}>>;
|
|
391
|
+
/**
|
|
392
|
+
* @description Re-reads the value of every readable parameter already loaded for the device at `slavePosition`, leaving the parameter list itself intact (it does not re-enumerate the object dictionary — use `POST …/parameters/init` for that). Each value is read PDO-aware: from the live process image when the device is exchanging and the object is PDO-mapped, otherwise via an SDO upload over the mailbox. Write-only objects are skipped. Best-effort: an entry that fails to read keeps its cached value and the call still succeeds. Returns the refreshed list, ordered by `(index, subindex)`.
|
|
393
|
+
*
|
|
394
|
+
* @name ReadAllDeviceParameters
|
|
395
|
+
* @summary Refresh the cached value of every parameter without re-enumerating the dictionary
|
|
396
|
+
* @request POST:/api/devices/{slavePosition}/parameters/read
|
|
397
|
+
*/
|
|
398
|
+
readAllDeviceParameters: (slavePosition: number, params?: RequestParams) => Promise<import("./http-client.js").HttpResponse<DeviceParameter[], void | {
|
|
399
|
+
/**
|
|
400
|
+
* Human-readable error message from the driver
|
|
401
|
+
* @example "FPRD slave 1: wkc=0"
|
|
402
|
+
*/
|
|
403
|
+
error: string;
|
|
404
|
+
}>>;
|
|
416
405
|
/**
|
|
417
406
|
* @description Returns the parameter list populated by the most recent call to `POST /api/devices/{slavePosition}/parameters/init`. Empty before the first call. Entries are ordered ascending by `(index, subindex)`.
|
|
418
407
|
*
|
|
@@ -421,6 +410,46 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
421
410
|
* @request GET:/api/devices/{slavePosition}/parameters
|
|
422
411
|
*/
|
|
423
412
|
getDeviceParameters: (slavePosition: number, params?: RequestParams) => Promise<import("./http-client.js").HttpResponse<DeviceParameter[], void>>;
|
|
413
|
+
/**
|
|
414
|
+
* @description Reads one parameter of the device at `slavePosition` and returns the full `DeviceParameter` (value plus metadata: data type, access, sync state). Unlike the raw `GET …/sdo/{index}/{subindex}` endpoint, this is PDO-aware. With `source=auto` (the default) the value is taken from the live process image when the device is exchanging and the object is PDO-mapped, otherwise via an SDO upload, otherwise from the cache. With `source=cache` the cached value is served with no bus access at all. Both `index` and `subindex` accept decimal or hexadecimal notation; prefix with `0x` for hex (e.g. `0x6064` or `24676` for object 0x6064).
|
|
415
|
+
*
|
|
416
|
+
* @name ReadParameter
|
|
417
|
+
* @summary Read a single parameter value (PDO-aware, with optional cache-only mode)
|
|
418
|
+
* @request GET:/api/devices/{slavePosition}/parameters/{index}/{subindex}
|
|
419
|
+
*/
|
|
420
|
+
readParameter: (slavePosition: number, index: number, subindex: number, query?: {
|
|
421
|
+
/**
|
|
422
|
+
* `auto` (default) reads PDO-when-exchanging else SDO else cache; `cache` returns the cached value with no bus access.
|
|
423
|
+
* @default "auto"
|
|
424
|
+
*/
|
|
425
|
+
source?: "auto" | "cache";
|
|
426
|
+
}, params?: RequestParams) => Promise<import("./http-client.js").HttpResponse<DeviceParameter, void | {
|
|
427
|
+
/**
|
|
428
|
+
* Human-readable error message from the driver
|
|
429
|
+
* @example "FPRD slave 1: wkc=0"
|
|
430
|
+
*/
|
|
431
|
+
error: string;
|
|
432
|
+
}>>;
|
|
433
|
+
/**
|
|
434
|
+
* @description Writes one parameter of the device at `slavePosition`. The value is coerced to the parameter's declared data type, then routed: staged into the process image when the device is exchanging and the object is output (RxPDO) mapped — sent on the next cycle — otherwise written via an SDO download, otherwise held in the cache as pending until the device is back online. This is the endpoint to set a target (e.g. target torque 0x6071) or the modes of operation: it knows which objects are PDO-mapped and stages them into the process data, falling back to SDO transparently. Returns the updated `DeviceParameter` (with the coerced value and resulting sync state). Both `index` and `subindex` accept decimal or hexadecimal notation; prefix with `0x` for hex.
|
|
435
|
+
*
|
|
436
|
+
* @name WriteParameter
|
|
437
|
+
* @summary Write a single parameter value (PDO-aware)
|
|
438
|
+
* @request PUT:/api/devices/{slavePosition}/parameters/{index}/{subindex}
|
|
439
|
+
*/
|
|
440
|
+
writeParameter: (slavePosition: number, index: number, subindex: number, data: {
|
|
441
|
+
/**
|
|
442
|
+
* The value to set, coerced to the parameter's declared type. A number for integer/real objects, a string for string objects, or an array of bytes for octet/domain objects.
|
|
443
|
+
* @example 100
|
|
444
|
+
*/
|
|
445
|
+
value: number | string | number[];
|
|
446
|
+
}, params?: RequestParams) => Promise<import("./http-client.js").HttpResponse<DeviceParameter, void | {
|
|
447
|
+
/**
|
|
448
|
+
* Human-readable error message from the driver
|
|
449
|
+
* @example "FPRD slave 1: wkc=0"
|
|
450
|
+
*/
|
|
451
|
+
error: string;
|
|
452
|
+
}>>;
|
|
424
453
|
/**
|
|
425
454
|
* @description Reads `length` bytes from the ESC register at `address` on the slave at `slavePosition` using a Configured-Address Read (FPRD) datagram. Pass `address` in decimal (e.g. 272 for DL Status at 0x0110).
|
|
426
455
|
*
|
|
@@ -897,6 +926,18 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
897
926
|
*/
|
|
898
927
|
error: string;
|
|
899
928
|
}>>;
|
|
929
|
+
/**
|
|
930
|
+
* @description Stages many output (RxPDO) objects at once — the "send all" action of the Process Data page. Each value is coerced to the object's declared data type and, when the object is output-mapped and its device is exchanging (SAFE-OP/OP), written into the output image so it is sent on the next real-time cycle and re-sent every cycle thereafter (set-once, sent-continuously). The batch is best-effort atomic: values are staged sequentially, so a batch can straddle two consecutive ~1 ms cycles. The request never fails as a whole — each object gets its own result, so the client can flag any object that was not cyclically staged (unknown device, coercion failure, object not output-mapped, or bus not exchanging; in the last two cases the value is still written via SDO/cache, just not cyclically driven).
|
|
931
|
+
*
|
|
932
|
+
* @name StageProcessDataOutputs
|
|
933
|
+
* @summary Stage a batch of output values into the process image
|
|
934
|
+
* @request POST:/api/process-data/outputs
|
|
935
|
+
*/
|
|
936
|
+
stageProcessDataOutputs: (data: any[][], params?: RequestParams) => Promise<import("./http-client.js").HttpResponse<{
|
|
937
|
+
results: OutputStageResult[];
|
|
938
|
+
}, {
|
|
939
|
+
error: string;
|
|
940
|
+
}>>;
|
|
900
941
|
/**
|
|
901
942
|
* @description Returns the static ESC configuration the master programmed into every slave during the last scan: station/alias addresses, mapped process-data sizes, the mailbox transport windows, the distributed-clock setup, and the configured Sync Managers and FMMUs. Read from cached state with no bus I/O and valid once the bus has been scanned. The list is empty before any scan, or when the active transport has no ESC (e.g. SPoE). Numeric fields (SM/FMMU type, mailbox protocol bits, SM flags) are raw register values; the client decodes them. `deviceName` is empty when no known device occupies the slave.
|
|
902
943
|
*
|
package/dist/generated/Api.js
CHANGED
|
@@ -102,19 +102,6 @@ export class Api extends HttpClient {
|
|
|
102
102
|
format: "json",
|
|
103
103
|
...params,
|
|
104
104
|
});
|
|
105
|
-
/**
|
|
106
|
-
* @description Performs a live AL-state read for the device and reports whether its CoE/SDO mailbox is active — i.e. it is in PRE-OP, SAFE-OP, or OP. This is independent of the AL error indicator: a device in SAFE-OP+error still answers mailbox requests. Only INIT (no mailbox) and BOOT (FoE-only mailbox) report inactive. The device must already be known from a prior scan. Reading one device at a time means a single missing device reports inactive without failing the others.
|
|
107
|
-
*
|
|
108
|
-
* @name GetDeviceMailboxActive
|
|
109
|
-
* @summary Check whether a device's mailbox is active
|
|
110
|
-
* @request GET:/api/devices/{slavePosition}/mailbox
|
|
111
|
-
*/
|
|
112
|
-
getDeviceMailboxActive = (slavePosition, params = {}) => this.request({
|
|
113
|
-
path: `/api/devices/${slavePosition}/mailbox`,
|
|
114
|
-
method: "GET",
|
|
115
|
-
format: "json",
|
|
116
|
-
...params,
|
|
117
|
-
});
|
|
118
105
|
/**
|
|
119
106
|
* @description Constructs the requested fieldbus driver, opens the network interface, and makes the driver available for subsequent calls to /api/scan. The driver defaults to SOEM when omitted. SOEM has no adapter auto-detect: a network adapter must be supplied, otherwise init fails.
|
|
120
107
|
*
|
|
@@ -234,6 +221,19 @@ export class Api extends HttpClient {
|
|
|
234
221
|
format: "json",
|
|
235
222
|
...params,
|
|
236
223
|
});
|
|
224
|
+
/**
|
|
225
|
+
* @description Re-reads the value of every readable parameter already loaded for the device at `slavePosition`, leaving the parameter list itself intact (it does not re-enumerate the object dictionary — use `POST …/parameters/init` for that). Each value is read PDO-aware: from the live process image when the device is exchanging and the object is PDO-mapped, otherwise via an SDO upload over the mailbox. Write-only objects are skipped. Best-effort: an entry that fails to read keeps its cached value and the call still succeeds. Returns the refreshed list, ordered by `(index, subindex)`.
|
|
226
|
+
*
|
|
227
|
+
* @name ReadAllDeviceParameters
|
|
228
|
+
* @summary Refresh the cached value of every parameter without re-enumerating the dictionary
|
|
229
|
+
* @request POST:/api/devices/{slavePosition}/parameters/read
|
|
230
|
+
*/
|
|
231
|
+
readAllDeviceParameters = (slavePosition, params = {}) => this.request({
|
|
232
|
+
path: `/api/devices/${slavePosition}/parameters/read`,
|
|
233
|
+
method: "POST",
|
|
234
|
+
format: "json",
|
|
235
|
+
...params,
|
|
236
|
+
});
|
|
237
237
|
/**
|
|
238
238
|
* @description Returns the parameter list populated by the most recent call to `POST /api/devices/{slavePosition}/parameters/init`. Empty before the first call. Entries are ordered ascending by `(index, subindex)`.
|
|
239
239
|
*
|
|
@@ -247,6 +247,35 @@ export class Api extends HttpClient {
|
|
|
247
247
|
format: "json",
|
|
248
248
|
...params,
|
|
249
249
|
});
|
|
250
|
+
/**
|
|
251
|
+
* @description Reads one parameter of the device at `slavePosition` and returns the full `DeviceParameter` (value plus metadata: data type, access, sync state). Unlike the raw `GET …/sdo/{index}/{subindex}` endpoint, this is PDO-aware. With `source=auto` (the default) the value is taken from the live process image when the device is exchanging and the object is PDO-mapped, otherwise via an SDO upload, otherwise from the cache. With `source=cache` the cached value is served with no bus access at all. Both `index` and `subindex` accept decimal or hexadecimal notation; prefix with `0x` for hex (e.g. `0x6064` or `24676` for object 0x6064).
|
|
252
|
+
*
|
|
253
|
+
* @name ReadParameter
|
|
254
|
+
* @summary Read a single parameter value (PDO-aware, with optional cache-only mode)
|
|
255
|
+
* @request GET:/api/devices/{slavePosition}/parameters/{index}/{subindex}
|
|
256
|
+
*/
|
|
257
|
+
readParameter = (slavePosition, index, subindex, query, params = {}) => this.request({
|
|
258
|
+
path: `/api/devices/${slavePosition}/parameters/${index}/${subindex}`,
|
|
259
|
+
method: "GET",
|
|
260
|
+
query: query,
|
|
261
|
+
format: "json",
|
|
262
|
+
...params,
|
|
263
|
+
});
|
|
264
|
+
/**
|
|
265
|
+
* @description Writes one parameter of the device at `slavePosition`. The value is coerced to the parameter's declared data type, then routed: staged into the process image when the device is exchanging and the object is output (RxPDO) mapped — sent on the next cycle — otherwise written via an SDO download, otherwise held in the cache as pending until the device is back online. This is the endpoint to set a target (e.g. target torque 0x6071) or the modes of operation: it knows which objects are PDO-mapped and stages them into the process data, falling back to SDO transparently. Returns the updated `DeviceParameter` (with the coerced value and resulting sync state). Both `index` and `subindex` accept decimal or hexadecimal notation; prefix with `0x` for hex.
|
|
266
|
+
*
|
|
267
|
+
* @name WriteParameter
|
|
268
|
+
* @summary Write a single parameter value (PDO-aware)
|
|
269
|
+
* @request PUT:/api/devices/{slavePosition}/parameters/{index}/{subindex}
|
|
270
|
+
*/
|
|
271
|
+
writeParameter = (slavePosition, index, subindex, data, params = {}) => this.request({
|
|
272
|
+
path: `/api/devices/${slavePosition}/parameters/${index}/${subindex}`,
|
|
273
|
+
method: "PUT",
|
|
274
|
+
body: data,
|
|
275
|
+
type: ContentType.Json,
|
|
276
|
+
format: "json",
|
|
277
|
+
...params,
|
|
278
|
+
});
|
|
250
279
|
/**
|
|
251
280
|
* @description Reads `length` bytes from the ESC register at `address` on the slave at `slavePosition` using a Configured-Address Read (FPRD) datagram. Pass `address` in decimal (e.g. 272 for DL Status at 0x0110).
|
|
252
281
|
*
|
|
@@ -507,6 +536,21 @@ export class Api extends HttpClient {
|
|
|
507
536
|
format: "json",
|
|
508
537
|
...params,
|
|
509
538
|
});
|
|
539
|
+
/**
|
|
540
|
+
* @description Stages many output (RxPDO) objects at once — the "send all" action of the Process Data page. Each value is coerced to the object's declared data type and, when the object is output-mapped and its device is exchanging (SAFE-OP/OP), written into the output image so it is sent on the next real-time cycle and re-sent every cycle thereafter (set-once, sent-continuously). The batch is best-effort atomic: values are staged sequentially, so a batch can straddle two consecutive ~1 ms cycles. The request never fails as a whole — each object gets its own result, so the client can flag any object that was not cyclically staged (unknown device, coercion failure, object not output-mapped, or bus not exchanging; in the last two cases the value is still written via SDO/cache, just not cyclically driven).
|
|
541
|
+
*
|
|
542
|
+
* @name StageProcessDataOutputs
|
|
543
|
+
* @summary Stage a batch of output values into the process image
|
|
544
|
+
* @request POST:/api/process-data/outputs
|
|
545
|
+
*/
|
|
546
|
+
stageProcessDataOutputs = (data, params = {}) => this.request({
|
|
547
|
+
path: `/api/process-data/outputs`,
|
|
548
|
+
method: "POST",
|
|
549
|
+
body: data,
|
|
550
|
+
type: ContentType.Json,
|
|
551
|
+
format: "json",
|
|
552
|
+
...params,
|
|
553
|
+
});
|
|
510
554
|
/**
|
|
511
555
|
* @description Returns the static ESC configuration the master programmed into every slave during the last scan: station/alias addresses, mapped process-data sizes, the mailbox transport windows, the distributed-clock setup, and the configured Sync Managers and FMMUs. Read from cached state with no bus I/O and valid once the bus has been scanned. The list is empty before any scan, or when the active transport has no ESC (e.g. SPoE). Numeric fields (SM/FMMU type, mailbox protocol bits, SM flags) are raw register values; the client decodes them. `deviceName` is empty when no known device occupies the slave.
|
|
512
556
|
*
|
|
@@ -130,6 +130,33 @@ export interface ProcessImageObject {
|
|
|
130
130
|
*/
|
|
131
131
|
bitLength: number;
|
|
132
132
|
}
|
|
133
|
+
export interface OutputStageResult {
|
|
134
|
+
/**
|
|
135
|
+
* 1-based bus position of the owning device (echoes the request)
|
|
136
|
+
* @example 1
|
|
137
|
+
*/
|
|
138
|
+
slavePosition: number;
|
|
139
|
+
/**
|
|
140
|
+
* CoE object index (echoes the request)
|
|
141
|
+
* @example 24698
|
|
142
|
+
*/
|
|
143
|
+
index: number;
|
|
144
|
+
/**
|
|
145
|
+
* CoE object subindex (echoes the request)
|
|
146
|
+
* @example 0
|
|
147
|
+
*/
|
|
148
|
+
subindex: number;
|
|
149
|
+
/**
|
|
150
|
+
* True when the value landed in the published output image and will be sent on the next exchange cycle
|
|
151
|
+
* @example true
|
|
152
|
+
*/
|
|
153
|
+
staged: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Empty on success; otherwise why the object was not cyclically staged (unknown device, coercion failure, object not output-mapped, or the bus not exchanging)
|
|
156
|
+
* @example ""
|
|
157
|
+
*/
|
|
158
|
+
error: string;
|
|
159
|
+
}
|
|
133
160
|
export interface SyncManagerConfig {
|
|
134
161
|
/**
|
|
135
162
|
* Sync Manager number (0–7)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synapticon/motion-master-client",
|
|
3
|
-
"version": "6.0.0-alpha.
|
|
3
|
+
"version": "6.0.0-alpha.28",
|
|
4
4
|
"description": "Isomorphic TypeScript client for Motion Master: the generated HTTP API client, the WebSocket connection, and helpers.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|