@synapticon/motion-master-client 6.0.0-alpha.31 → 6.0.0-alpha.32
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
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AlStatusCode, DcSyncStatus, DeviceDiagnostics, DeviceParameter, EscRegister, FoeErrorCode, Monitoring, ObjectDataTypeInfo, OutputStageResult, ParameterCacheEntry, ProcessDataWatchdog, ProcessImageObject, SlaveConfig, SlaveInformationInterface } from "./data-contracts.js";
|
|
1
|
+
import { AlStatusCode, DcSyncStatus, DeviceDiagnostics, DeviceParameter, EscRegister, FoeErrorCode, Monitoring, ObjectDataTypeInfo, OutputStageResult, ParameterCacheEntry, PdoMapping, PdoMappingRequest, 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
|
/**
|
|
@@ -274,11 +274,11 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
274
274
|
*/
|
|
275
275
|
init: (data?: {
|
|
276
276
|
/**
|
|
277
|
-
* Fieldbus driver to use
|
|
277
|
+
* Fieldbus driver to use (only soem is implemented today; spoe is planned)
|
|
278
278
|
* @default "soem"
|
|
279
279
|
* @example "soem"
|
|
280
280
|
*/
|
|
281
|
-
driver?: "soem" | "spoe"
|
|
281
|
+
driver?: "soem" | "spoe";
|
|
282
282
|
/**
|
|
283
283
|
* Network interface name or MAC address. Required for SOEM — there is no auto-detect, so an empty value makes init fail.
|
|
284
284
|
* @example "eth0"
|
|
@@ -298,7 +298,7 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
298
298
|
error: string;
|
|
299
299
|
}>>;
|
|
300
300
|
/**
|
|
301
|
-
* @description Scans the fieldbus for slaves and configures their sync managers and FMMUs. Must be called after a successful POST /api/init. Slaves remain in INIT state after this call; state transitions are driven by subsequent API calls.
|
|
301
|
+
* @description Scans the fieldbus for slaves and configures their sync managers and FMMUs. Must be called after a successful POST /api/init. Slaves remain in INIT state after this call; state transitions are driven by subsequent API calls. An empty bus is a successful scan returning 0 slaves, not an error: the master cannot distinguish a bus with no devices powered from a disconnected one, and the user recovers by powering devices on and scanning again. A 500 is returned only on a genuine driver failure (e.g. no driver initialised).
|
|
302
302
|
*
|
|
303
303
|
* @name Scan
|
|
304
304
|
* @summary Scan the bus for slaves
|
|
@@ -306,7 +306,7 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
306
306
|
*/
|
|
307
307
|
scan: (params?: RequestParams) => Promise<import("./http-client.js").HttpResponse<{
|
|
308
308
|
/**
|
|
309
|
-
* Number of slaves discovered on the bus
|
|
309
|
+
* Number of slaves discovered on the bus (0 if empty/unpowered)
|
|
310
310
|
* @example 3
|
|
311
311
|
*/
|
|
312
312
|
slaves: number;
|
|
@@ -535,6 +535,34 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
535
535
|
*/
|
|
536
536
|
error: string;
|
|
537
537
|
}>>;
|
|
538
|
+
/**
|
|
539
|
+
* @description Reads the PDO mapping of the slave at `slavePosition` over CoE, grouped by mapping object: the sync-manager assignment (0x1C12 outputs / 0x1C13 inputs) and, for each assigned mapping object (0x16xx / 0x1Axx), its `pdoIndex` and ordered entries. `outputs` are RxPDO objects (master→slave), `inputs` are TxPDO objects (slave→master). Each entry carries its derived `bitOffset` within the direction's window. This is the grouped, round-trippable counterpart of the flat, whole-bus `GET /api/process-image`. Reads fresh over SDO, so the device's mailbox must be active (PRE-OP, SAFE-OP, or OP); a device in INIT or BOOT yields 409.
|
|
540
|
+
*
|
|
541
|
+
* @name GetDevicePdoMapping
|
|
542
|
+
* @summary Read a device's PDO mapping grouped by object (CoE)
|
|
543
|
+
* @request GET:/api/devices/{slavePosition}/pdo-mapping
|
|
544
|
+
*/
|
|
545
|
+
getDevicePdoMapping: (slavePosition: number, params?: RequestParams) => Promise<import("./http-client.js").HttpResponse<PdoMapping, void | {
|
|
546
|
+
/**
|
|
547
|
+
* Human-readable error message from the driver
|
|
548
|
+
* @example "FPRD slave 1: wkc=0"
|
|
549
|
+
*/
|
|
550
|
+
error: string;
|
|
551
|
+
}>>;
|
|
552
|
+
/**
|
|
553
|
+
* @description Reconfigures the PDO mapping of the slave at `slavePosition` over CoE: both directions' sync-manager assignment (0x1C12 outputs / 0x1C13 inputs) and the referenced mapping objects (0x16xx / 0x1Axx). `outputs` are RxPDO objects (master→slave), `inputs` are TxPDO objects (slave→master); the array order is the sync-manager assignment order, which fixes each object's position in the process image. Both directions must be present — an empty array clears that sync manager's assignment. **The device must be in PRE-OP.** The mapping and assignment objects are writable only in PRE-OP; in SAFE-OP/OP the sync managers are active and the slave rejects the write, and INIT/BOOT have no CoE mailbox. This is the "drop to PRE-OP, remap, climb back" flow: take the device to PRE-OP (`POST /api/devices/state`), call this, then transition it back to SAFE-OP/OP — at which point the whole-bus process image is re-mapped from the new mapping. The write follows the CoE ordering rule (clear assignment, rewrite each mapping object, then re-assign), is read back and verified, and is retried a few times so a dropped mailbox frame cannot leave the object dictionary half-configured. The response is the device's grouped read-back mapping (same shape as GET), whose `bitOffset` values are derived by the device (the request omits them). This endpoint does not itself change the AL state or re-map the process image.
|
|
554
|
+
*
|
|
555
|
+
* @name WriteDevicePdoMapping
|
|
556
|
+
* @summary Rewrite a device's PDO mapping (CoE)
|
|
557
|
+
* @request PUT:/api/devices/{slavePosition}/pdo-mapping
|
|
558
|
+
*/
|
|
559
|
+
writeDevicePdoMapping: (slavePosition: number, data: PdoMappingRequest, params?: RequestParams) => Promise<import("./http-client.js").HttpResponse<PdoMapping, void | {
|
|
560
|
+
/**
|
|
561
|
+
* Human-readable error message from the driver
|
|
562
|
+
* @example "FPRD slave 1: wkc=0"
|
|
563
|
+
*/
|
|
564
|
+
error: string;
|
|
565
|
+
}>>;
|
|
538
566
|
/**
|
|
539
567
|
* @description Performs a CoE SDO upload — reads the value of object `index:subindex` from the device at `slavePosition` and returns the raw bytes as a JSON array. Both `index` and `subindex` accept decimal or hexadecimal notation; prefix with `0x` for hex (e.g. `0x6064` or `24676` for object 0x6064).
|
|
540
568
|
*
|
package/dist/generated/Api.js
CHANGED
|
@@ -118,7 +118,7 @@ export class Api extends HttpClient {
|
|
|
118
118
|
...params,
|
|
119
119
|
});
|
|
120
120
|
/**
|
|
121
|
-
* @description Scans the fieldbus for slaves and configures their sync managers and FMMUs. Must be called after a successful POST /api/init. Slaves remain in INIT state after this call; state transitions are driven by subsequent API calls.
|
|
121
|
+
* @description Scans the fieldbus for slaves and configures their sync managers and FMMUs. Must be called after a successful POST /api/init. Slaves remain in INIT state after this call; state transitions are driven by subsequent API calls. An empty bus is a successful scan returning 0 slaves, not an error: the master cannot distinguish a bus with no devices powered from a disconnected one, and the user recovers by powering devices on and scanning again. A 500 is returned only on a genuine driver failure (e.g. no driver initialised).
|
|
122
122
|
*
|
|
123
123
|
* @name Scan
|
|
124
124
|
* @summary Scan the bus for slaves
|
|
@@ -333,6 +333,34 @@ export class Api extends HttpClient {
|
|
|
333
333
|
format: "json",
|
|
334
334
|
...params,
|
|
335
335
|
});
|
|
336
|
+
/**
|
|
337
|
+
* @description Reads the PDO mapping of the slave at `slavePosition` over CoE, grouped by mapping object: the sync-manager assignment (0x1C12 outputs / 0x1C13 inputs) and, for each assigned mapping object (0x16xx / 0x1Axx), its `pdoIndex` and ordered entries. `outputs` are RxPDO objects (master→slave), `inputs` are TxPDO objects (slave→master). Each entry carries its derived `bitOffset` within the direction's window. This is the grouped, round-trippable counterpart of the flat, whole-bus `GET /api/process-image`. Reads fresh over SDO, so the device's mailbox must be active (PRE-OP, SAFE-OP, or OP); a device in INIT or BOOT yields 409.
|
|
338
|
+
*
|
|
339
|
+
* @name GetDevicePdoMapping
|
|
340
|
+
* @summary Read a device's PDO mapping grouped by object (CoE)
|
|
341
|
+
* @request GET:/api/devices/{slavePosition}/pdo-mapping
|
|
342
|
+
*/
|
|
343
|
+
getDevicePdoMapping = (slavePosition, params = {}) => this.request({
|
|
344
|
+
path: `/api/devices/${slavePosition}/pdo-mapping`,
|
|
345
|
+
method: "GET",
|
|
346
|
+
format: "json",
|
|
347
|
+
...params,
|
|
348
|
+
});
|
|
349
|
+
/**
|
|
350
|
+
* @description Reconfigures the PDO mapping of the slave at `slavePosition` over CoE: both directions' sync-manager assignment (0x1C12 outputs / 0x1C13 inputs) and the referenced mapping objects (0x16xx / 0x1Axx). `outputs` are RxPDO objects (master→slave), `inputs` are TxPDO objects (slave→master); the array order is the sync-manager assignment order, which fixes each object's position in the process image. Both directions must be present — an empty array clears that sync manager's assignment. **The device must be in PRE-OP.** The mapping and assignment objects are writable only in PRE-OP; in SAFE-OP/OP the sync managers are active and the slave rejects the write, and INIT/BOOT have no CoE mailbox. This is the "drop to PRE-OP, remap, climb back" flow: take the device to PRE-OP (`POST /api/devices/state`), call this, then transition it back to SAFE-OP/OP — at which point the whole-bus process image is re-mapped from the new mapping. The write follows the CoE ordering rule (clear assignment, rewrite each mapping object, then re-assign), is read back and verified, and is retried a few times so a dropped mailbox frame cannot leave the object dictionary half-configured. The response is the device's grouped read-back mapping (same shape as GET), whose `bitOffset` values are derived by the device (the request omits them). This endpoint does not itself change the AL state or re-map the process image.
|
|
351
|
+
*
|
|
352
|
+
* @name WriteDevicePdoMapping
|
|
353
|
+
* @summary Rewrite a device's PDO mapping (CoE)
|
|
354
|
+
* @request PUT:/api/devices/{slavePosition}/pdo-mapping
|
|
355
|
+
*/
|
|
356
|
+
writeDevicePdoMapping = (slavePosition, data, params = {}) => this.request({
|
|
357
|
+
path: `/api/devices/${slavePosition}/pdo-mapping`,
|
|
358
|
+
method: "PUT",
|
|
359
|
+
body: data,
|
|
360
|
+
type: ContentType.Json,
|
|
361
|
+
format: "json",
|
|
362
|
+
...params,
|
|
363
|
+
});
|
|
336
364
|
/**
|
|
337
365
|
* @description Performs a CoE SDO upload — reads the value of object `index:subindex` from the device at `slavePosition` and returns the raw bytes as a JSON array. Both `index` and `subindex` accept decimal or hexadecimal notation; prefix with `0x` for hex (e.g. `0x6064` or `24676` for object 0x6064).
|
|
338
366
|
*
|
|
@@ -98,6 +98,85 @@ export interface Monitoring {
|
|
|
98
98
|
source: "pdo" | "sdo";
|
|
99
99
|
}[];
|
|
100
100
|
}
|
|
101
|
+
/** One mapping entry to write. Packs to the 32-bit CoE word index<<16 | subindex<<8 | bitLength. */
|
|
102
|
+
export interface PdoMappingRequestEntry {
|
|
103
|
+
/**
|
|
104
|
+
* CoE object index; 0 marks an alignment-padding gap (no bound object)
|
|
105
|
+
* @min 0
|
|
106
|
+
* @max 65535
|
|
107
|
+
* @example 24640
|
|
108
|
+
*/
|
|
109
|
+
index: number;
|
|
110
|
+
/**
|
|
111
|
+
* CoE object subindex
|
|
112
|
+
* @min 0
|
|
113
|
+
* @max 255
|
|
114
|
+
* @example 0
|
|
115
|
+
*/
|
|
116
|
+
subindex: number;
|
|
117
|
+
/**
|
|
118
|
+
* Width of the entry in bits
|
|
119
|
+
* @min 0
|
|
120
|
+
* @max 255
|
|
121
|
+
* @example 16
|
|
122
|
+
*/
|
|
123
|
+
bitLength: number;
|
|
124
|
+
}
|
|
125
|
+
/** One PDO mapping object to write and its ordered entries. */
|
|
126
|
+
export interface PdoMappingRequestObject {
|
|
127
|
+
/**
|
|
128
|
+
* Mapping-object index (0x16xx RxPDO for outputs, 0x1Axx TxPDO for inputs)
|
|
129
|
+
* @min 0
|
|
130
|
+
* @max 65535
|
|
131
|
+
* @example 5632
|
|
132
|
+
*/
|
|
133
|
+
pdoIndex: number;
|
|
134
|
+
entries: PdoMappingRequestEntry[];
|
|
135
|
+
}
|
|
136
|
+
/** A device's desired PDO configuration to write. `outputs` are RxPDO objects (master→slave, assigned to 0x1C12); `inputs` are TxPDO objects (slave→master, assigned to 0x1C13). Vector order is the sync-manager assignment order. Both keys are required; an empty array clears that direction. */
|
|
137
|
+
export interface PdoMappingRequest {
|
|
138
|
+
outputs: PdoMappingRequestObject[];
|
|
139
|
+
inputs: PdoMappingRequestObject[];
|
|
140
|
+
}
|
|
141
|
+
/** One entry of a mapping object, as read back from the device. */
|
|
142
|
+
export interface PdoMappingEntry {
|
|
143
|
+
/**
|
|
144
|
+
* CoE object index; 0 marks an alignment-padding gap
|
|
145
|
+
* @example 24640
|
|
146
|
+
*/
|
|
147
|
+
index: number;
|
|
148
|
+
/**
|
|
149
|
+
* CoE object subindex
|
|
150
|
+
* @example 0
|
|
151
|
+
*/
|
|
152
|
+
subindex: number;
|
|
153
|
+
/**
|
|
154
|
+
* Width of the entry in bits
|
|
155
|
+
* @example 16
|
|
156
|
+
*/
|
|
157
|
+
bitLength: number;
|
|
158
|
+
/**
|
|
159
|
+
* Bit offset from the start of this direction's window (derived by the device)
|
|
160
|
+
* @example 0
|
|
161
|
+
*/
|
|
162
|
+
bitOffset: number;
|
|
163
|
+
}
|
|
164
|
+
/** One mapping object as read back, with its ordered entries (offsets included). */
|
|
165
|
+
export interface PdoMappingObject {
|
|
166
|
+
/**
|
|
167
|
+
* Mapping-object index (0x16xx RxPDO for outputs, 0x1Axx TxPDO for inputs)
|
|
168
|
+
* @example 5632
|
|
169
|
+
*/
|
|
170
|
+
pdoIndex: number;
|
|
171
|
+
entries: PdoMappingEntry[];
|
|
172
|
+
}
|
|
173
|
+
/** A device's PDO mapping grouped by mapping object — the read/write-back shape. `outputs` are RxPDO objects (0x1C12), `inputs` are TxPDO objects (0x1C13), each in sync-manager assignment order with its entries and derived bit offsets. */
|
|
174
|
+
export interface PdoMapping {
|
|
175
|
+
/** RxPDO objects (master→slave), in assignment order */
|
|
176
|
+
outputs: PdoMappingObject[];
|
|
177
|
+
/** TxPDO objects (slave→master), in assignment order */
|
|
178
|
+
inputs: PdoMappingObject[];
|
|
179
|
+
}
|
|
101
180
|
export interface ProcessImageObject {
|
|
102
181
|
/**
|
|
103
182
|
* 1-based bus position of the owning device
|
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.32",
|
|
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": {
|