@synapticon/motion-master-client 6.0.0-alpha.25 → 6.0.0-alpha.27

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.
@@ -421,6 +421,46 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
421
421
  * @request GET:/api/devices/{slavePosition}/parameters
422
422
  */
423
423
  getDeviceParameters: (slavePosition: number, params?: RequestParams) => Promise<import("./http-client.js").HttpResponse<DeviceParameter[], void>>;
424
+ /**
425
+ * @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).
426
+ *
427
+ * @name ReadParameter
428
+ * @summary Read a single parameter value (PDO-aware, with optional cache-only mode)
429
+ * @request GET:/api/devices/{slavePosition}/parameters/{index}/{subindex}
430
+ */
431
+ readParameter: (slavePosition: number, index: number, subindex: number, query?: {
432
+ /**
433
+ * `auto` (default) reads PDO-when-exchanging else SDO else cache; `cache` returns the cached value with no bus access.
434
+ * @default "auto"
435
+ */
436
+ source?: "auto" | "cache";
437
+ }, params?: RequestParams) => Promise<import("./http-client.js").HttpResponse<DeviceParameter, void | {
438
+ /**
439
+ * Human-readable error message from the driver
440
+ * @example "FPRD slave 1: wkc=0"
441
+ */
442
+ error: string;
443
+ }>>;
444
+ /**
445
+ * @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.
446
+ *
447
+ * @name WriteParameter
448
+ * @summary Write a single parameter value (PDO-aware)
449
+ * @request PUT:/api/devices/{slavePosition}/parameters/{index}/{subindex}
450
+ */
451
+ writeParameter: (slavePosition: number, index: number, subindex: number, data: {
452
+ /**
453
+ * 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.
454
+ * @example 100
455
+ */
456
+ value: number | string | number[];
457
+ }, params?: RequestParams) => Promise<import("./http-client.js").HttpResponse<DeviceParameter, void | {
458
+ /**
459
+ * Human-readable error message from the driver
460
+ * @example "FPRD slave 1: wkc=0"
461
+ */
462
+ error: string;
463
+ }>>;
424
464
  /**
425
465
  * @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
466
  *
@@ -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
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synapticon/motion-master-client",
3
- "version": "6.0.0-alpha.25",
3
+ "version": "6.0.0-alpha.27",
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": {