motion-master-client 0.0.253 → 0.0.255

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "motion-master-client",
3
- "version": "0.0.253",
3
+ "version": "0.0.255",
4
4
  "type": "commonjs",
5
5
  "description": "A library and CLI program used for communicating with Motion Master.",
6
6
  "dependencies": {
@@ -1513,14 +1513,50 @@ export declare class MotionMasterReqResClient {
1513
1513
  * @returns An Observable that emits `true` if the acknowledgment was successful, or `false` otherwise.
1514
1514
  */
1515
1515
  acknowledgeIoFailureOnSmm(deviceRef: DeviceRef, commandTimeout?: number, responsePollingInterval?: number): Observable<boolean>;
1516
+ /**
1517
+ * Configures the SMM software update process for the specified device.
1518
+ * Prepares the device to receive a software update of the given file size.
1519
+ *
1520
+ * @param deviceRef - A reference to the target device.
1521
+ * @param fileSize - The size of the software update file, in bytes.
1522
+ *
1523
+ * @returns An Observable that emits `true` if the configuration succeeds, or `false` if it fails.
1524
+ */
1516
1525
  configureSmmSoftwareUpdate(deviceRef: DeviceRef, fileSize: number): Observable<boolean>;
1526
+ /**
1527
+ * Performs a complete SMM software update on the specified device.
1528
+ * This includes authentication, configuration, data transmission in chunks, CRC validation, and restart.
1529
+ *
1530
+ * @param deviceRef - A reference to the target device.
1531
+ * @param username - The username for authentication.
1532
+ * @param password - The password for authentication.
1533
+ * @param buffer - The software update file as a `Uint8Array`.
1534
+ * @param crc - The CRC checksum of the software update file for integrity verification.
1535
+ * @param chunkSize - (Optional) The size of each data chunk in bytes. Defaults to 1000.
1536
+ *
1537
+ * @returns An Observable that emits each step's result sequentially.
1538
+ * The observable completes successfully if all steps succeed, or errors out on the first failure.
1539
+ *
1540
+ * @remarks
1541
+ * The update process consists of:
1542
+ * 1. Logging in to the SMM device for software update.
1543
+ * 2. Configuring the device for the software update with the provided file size.
1544
+ * 3. Transmitting the file in chunks (default chunk size is 1000 bytes).
1545
+ * 4. Sending a CRC checksum for data integrity verification.
1546
+ * 5. Finalizing the software update.
1547
+ * 6. Triggering an SMM restart to apply the update.
1548
+ *
1549
+ * Each step is represented as a deferred observable, ensuring commands are executed only when subscribed.
1550
+ * If any step fails, the update process stops immediately (via `concat` behavior).
1551
+ */
1517
1552
  updateSmmSoftware(deviceRef: DeviceRef, username: string, password: string, buffer: Uint8Array, crc: number, chunkSize?: number): Observable<boolean>;
1518
1553
  /**
1519
1554
  * Transmits SMM parameters to the specified device.
1520
1555
  *
1521
1556
  * @param deviceRef - The reference to the target device.
1522
1557
  * @param values - An array of data values to transmit.
1523
- * @param parameterStructureVersion - The version of the parameter structure. If not provided, it will be resolved automatically.
1558
+ * @param parameterStructureVersion - (Optional) A specific SMM parameter structure version to use.
1559
+ * If not provided, the version is resolved dynamically from the device.
1524
1560
  * @param commandTimeout - The timeout in milliseconds for the command to complete.
1525
1561
  * @param responsePollingInterval - The interval in milliseconds between polling for the response.
1526
1562
  *
@@ -1528,7 +1564,6 @@ export declare class MotionMasterReqResClient {
1528
1564
  *
1529
1565
  * @remarks
1530
1566
  * - If the `values` array is empty, the function immediately returns `false`.
1531
- * - The `version` is prepended to the values array before packing.
1532
1567
  * - The function constructs an OS command for transmitting the parameters and writes the packed buffer to the fs-buffer file.
1533
1568
  */
1534
1569
  transmitSmmParameters(deviceRef: DeviceRef, values: DataType[], parameterStructureVersion?: number | undefined, commandTimeout?: number, responsePollingInterval?: number): Observable<boolean>;
@@ -1558,7 +1593,8 @@ export declare class MotionMasterReqResClient {
1558
1593
  * @param deviceRef - A reference to the target device.
1559
1594
  * @param values - An array of parameter values to verify.
1560
1595
  * @param groupIndex - The verification group index used for bitmask calculation.
1561
- * @param parameterStructureVersion - The version of the parameter structure. If not provided, it will be resolved automatically.
1596
+ * @param parameterStructureVersion - (Optional) A specific SMM parameter structure version to use.
1597
+ * If not provided, the version is resolved dynamically from the device.
1562
1598
  * @param commandTimeout - The timeout in milliseconds for the command to complete.
1563
1599
  * @param responsePollingInterval - The interval in milliseconds between polling for the response.
1564
1600
  * @returns An `Observable<boolean>` that emits `true` if the verification succeeded, or `false` otherwise.
@@ -1645,8 +1681,8 @@ export declare class MotionMasterReqResClient {
1645
1681
  * It supports resolving the parameter structure version if not explicitly provided.
1646
1682
  *
1647
1683
  * @param deviceRef - The reference to the target device.
1648
- * @param parameterStructureVersion - (Optional) The specific version of the parameter structure to use.
1649
- * If not provided, it resolves the version automatically.
1684
+ * @param parameterStructureVersion - (Optional) A specific SMM parameter structure version to use.
1685
+ * If not provided, the version is resolved dynamically from the device.
1650
1686
  *
1651
1687
  * @returns An `Observable` emitting an array of `SmmParameter` objects, each representing a processed
1652
1688
  * parameter with metadata such as type, access rights, and UI-related configurations.
@@ -1662,8 +1698,8 @@ export declare class MotionMasterReqResClient {
1662
1698
  * of corresponding `SmmParameter` objects belonging to that group.
1663
1699
  *
1664
1700
  * @param deviceRef - The reference to the target device.
1665
- * @param parameterStructureVersion - (Optional) The specific version of the parameter structure to use.
1666
- * If not provided, it resolves the version automatically.
1701
+ * @param parameterStructureVersion - (Optional) A specific SMM parameter structure version to use.
1702
+ * If not provided, the version is resolved dynamically from the device.
1667
1703
  *
1668
1704
  * @returns An `Observable` emitting a `Map<string, SmmParameter[]>`:
1669
1705
  * - The keys are group names.
@@ -1677,4 +1713,20 @@ export declare class MotionMasterReqResClient {
1677
1713
  * This ensures consistency between retrieval, packing, and verification stages.
1678
1714
  */
1679
1715
  getSmmOdGroupedParameters(deviceRef: DeviceRef, parameterStructureVersion?: number | undefined): Observable<Map<string, SmmParameter[]>>;
1716
+ /**
1717
+ * Performs a factory reset on the SMM parameters of the specified device.
1718
+ * It restores all safety-related parameters to their default reset values.
1719
+ *
1720
+ * @param deviceRef - A reference to the target device.
1721
+ * @param parameterStructureVersion - (Optional) A specific SMM parameter structure version to use.
1722
+ * If not provided, the version is resolved dynamically from the device.
1723
+ *
1724
+ * @returns An Observable that emits `true` if the reset succeeds, or `false` if it fails.
1725
+ *
1726
+ * @remarks
1727
+ * This function first determines the SMM parameter structure version — either from the provided argument
1728
+ * or by resolving it from the device. It then extracts the reset values from the safety parameters
1729
+ * and transmits them to the device.
1730
+ */
1731
+ factoryResetSmm(deviceRef: DeviceRef, parameterStructureVersion?: number | undefined): Observable<boolean>;
1680
1732
  }
@@ -2830,10 +2830,45 @@ class MotionMasterReqResClient {
2830
2830
  const command = (0, os_command_1.createSmmAcyclicHandlerOsCommand)(os_command_1.SmmAcyclicHandlerSubcommandId.IO_FAILURE_ACKNOWLEDGE);
2831
2831
  return this.runOsCommand(deviceRef, command, commandTimeout, responsePollingInterval).pipe((0, operators_1.last)(), (0, operators_1.map)((response) => response.request === 'succeeded'));
2832
2832
  }
2833
+ /**
2834
+ * Configures the SMM software update process for the specified device.
2835
+ * Prepares the device to receive a software update of the given file size.
2836
+ *
2837
+ * @param deviceRef - A reference to the target device.
2838
+ * @param fileSize - The size of the software update file, in bytes.
2839
+ *
2840
+ * @returns An Observable that emits `true` if the configuration succeeds, or `false` if it fails.
2841
+ */
2833
2842
  configureSmmSoftwareUpdate(deviceRef, fileSize) {
2834
2843
  const command = (0, os_command_1.createSmmAcyclicHandlerConfigureSoftwareUpdateOsCommand)(fileSize);
2835
2844
  return this.runOsCommand(deviceRef, command, 10000, 100).pipe((0, operators_1.last)(), (0, operators_1.map)((response) => response.request === 'succeeded'));
2836
2845
  }
2846
+ /**
2847
+ * Performs a complete SMM software update on the specified device.
2848
+ * This includes authentication, configuration, data transmission in chunks, CRC validation, and restart.
2849
+ *
2850
+ * @param deviceRef - A reference to the target device.
2851
+ * @param username - The username for authentication.
2852
+ * @param password - The password for authentication.
2853
+ * @param buffer - The software update file as a `Uint8Array`.
2854
+ * @param crc - The CRC checksum of the software update file for integrity verification.
2855
+ * @param chunkSize - (Optional) The size of each data chunk in bytes. Defaults to 1000.
2856
+ *
2857
+ * @returns An Observable that emits each step's result sequentially.
2858
+ * The observable completes successfully if all steps succeed, or errors out on the first failure.
2859
+ *
2860
+ * @remarks
2861
+ * The update process consists of:
2862
+ * 1. Logging in to the SMM device for software update.
2863
+ * 2. Configuring the device for the software update with the provided file size.
2864
+ * 3. Transmitting the file in chunks (default chunk size is 1000 bytes).
2865
+ * 4. Sending a CRC checksum for data integrity verification.
2866
+ * 5. Finalizing the software update.
2867
+ * 6. Triggering an SMM restart to apply the update.
2868
+ *
2869
+ * Each step is represented as a deferred observable, ensuring commands are executed only when subscribed.
2870
+ * If any step fails, the update process stops immediately (via `concat` behavior).
2871
+ */
2837
2872
  updateSmmSoftware(deviceRef, username, password, buffer, crc, chunkSize = 1000) {
2838
2873
  const fileSize = buffer.byteLength;
2839
2874
  const observables = [
@@ -2858,7 +2893,8 @@ class MotionMasterReqResClient {
2858
2893
  *
2859
2894
  * @param deviceRef - The reference to the target device.
2860
2895
  * @param values - An array of data values to transmit.
2861
- * @param parameterStructureVersion - The version of the parameter structure. If not provided, it will be resolved automatically.
2896
+ * @param parameterStructureVersion - (Optional) A specific SMM parameter structure version to use.
2897
+ * If not provided, the version is resolved dynamically from the device.
2862
2898
  * @param commandTimeout - The timeout in milliseconds for the command to complete.
2863
2899
  * @param responsePollingInterval - The interval in milliseconds between polling for the response.
2864
2900
  *
@@ -2866,7 +2902,6 @@ class MotionMasterReqResClient {
2866
2902
  *
2867
2903
  * @remarks
2868
2904
  * - If the `values` array is empty, the function immediately returns `false`.
2869
- * - The `version` is prepended to the values array before packing.
2870
2905
  * - The function constructs an OS command for transmitting the parameters and writes the packed buffer to the fs-buffer file.
2871
2906
  */
2872
2907
  transmitSmmParameters(deviceRef, values, parameterStructureVersion = undefined, commandTimeout = 5000, responsePollingInterval = 500) {
@@ -2875,7 +2910,6 @@ class MotionMasterReqResClient {
2875
2910
  }
2876
2911
  return (parameterStructureVersion ? (0, rxjs_1.of)(parameterStructureVersion) : this.resolveSmmParameterStructureVersion(deviceRef)).pipe((0, operators_1.mergeMap)((version) => {
2877
2912
  const command = (0, os_command_1.createSmmAcyclicHandlerOsCommand)(os_command_1.SmmAcyclicHandlerSubcommandId.TRANSMIT_PARAMETERS);
2878
- values.unshift(version);
2879
2913
  const { buffer: content } = (0, smm_1.packSmmParameterValues)(values, version);
2880
2914
  return this.runOsCommandAndWriteFsBuffer(deviceRef, command, content, commandTimeout, responsePollingInterval).pipe((0, operators_1.last)(), (0, operators_1.map)((response) => response.request === 'succeeded'));
2881
2915
  }));
@@ -2909,7 +2943,8 @@ class MotionMasterReqResClient {
2909
2943
  * @param deviceRef - A reference to the target device.
2910
2944
  * @param values - An array of parameter values to verify.
2911
2945
  * @param groupIndex - The verification group index used for bitmask calculation.
2912
- * @param parameterStructureVersion - The version of the parameter structure. If not provided, it will be resolved automatically.
2946
+ * @param parameterStructureVersion - (Optional) A specific SMM parameter structure version to use.
2947
+ * If not provided, the version is resolved dynamically from the device.
2913
2948
  * @param commandTimeout - The timeout in milliseconds for the command to complete.
2914
2949
  * @param responsePollingInterval - The interval in milliseconds between polling for the response.
2915
2950
  * @returns An `Observable<boolean>` that emits `true` if the verification succeeded, or `false` otherwise.
@@ -3024,8 +3059,8 @@ class MotionMasterReqResClient {
3024
3059
  * It supports resolving the parameter structure version if not explicitly provided.
3025
3060
  *
3026
3061
  * @param deviceRef - The reference to the target device.
3027
- * @param parameterStructureVersion - (Optional) The specific version of the parameter structure to use.
3028
- * If not provided, it resolves the version automatically.
3062
+ * @param parameterStructureVersion - (Optional) A specific SMM parameter structure version to use.
3063
+ * If not provided, the version is resolved dynamically from the device.
3029
3064
  *
3030
3065
  * @returns An `Observable` emitting an array of `SmmParameter` objects, each representing a processed
3031
3066
  * parameter with metadata such as type, access rights, and UI-related configurations.
@@ -3110,8 +3145,8 @@ class MotionMasterReqResClient {
3110
3145
  * of corresponding `SmmParameter` objects belonging to that group.
3111
3146
  *
3112
3147
  * @param deviceRef - The reference to the target device.
3113
- * @param parameterStructureVersion - (Optional) The specific version of the parameter structure to use.
3114
- * If not provided, it resolves the version automatically.
3148
+ * @param parameterStructureVersion - (Optional) A specific SMM parameter structure version to use.
3149
+ * If not provided, the version is resolved dynamically from the device.
3115
3150
  *
3116
3151
  * @returns An `Observable` emitting a `Map<string, SmmParameter[]>`:
3117
3152
  * - The keys are group names.
@@ -3127,6 +3162,28 @@ class MotionMasterReqResClient {
3127
3162
  getSmmOdGroupedParameters(deviceRef, parameterStructureVersion = undefined) {
3128
3163
  return this.getSmmOdParameters(deviceRef, parameterStructureVersion).pipe((0, operators_1.map)((parameters) => (0, util_1.mapByProperty)(parameters, 'group')));
3129
3164
  }
3165
+ /**
3166
+ * Performs a factory reset on the SMM parameters of the specified device.
3167
+ * It restores all safety-related parameters to their default reset values.
3168
+ *
3169
+ * @param deviceRef - A reference to the target device.
3170
+ * @param parameterStructureVersion - (Optional) A specific SMM parameter structure version to use.
3171
+ * If not provided, the version is resolved dynamically from the device.
3172
+ *
3173
+ * @returns An Observable that emits `true` if the reset succeeds, or `false` if it fails.
3174
+ *
3175
+ * @remarks
3176
+ * This function first determines the SMM parameter structure version — either from the provided argument
3177
+ * or by resolving it from the device. It then extracts the reset values from the safety parameters
3178
+ * and transmits them to the device.
3179
+ */
3180
+ factoryResetSmm(deviceRef, parameterStructureVersion = undefined) {
3181
+ return (parameterStructureVersion ? (0, rxjs_1.of)(parameterStructureVersion) : this.resolveSmmParameterStructureVersion(deviceRef)).pipe((0, operators_1.mergeMap)((version) => {
3182
+ const smmOd = (0, smm_1.resolveSmmOd)(version);
3183
+ const values = smmOd.parameters.safety.map((p) => p.resetValue);
3184
+ return this.transmitSmmParameters(deviceRef, values, version);
3185
+ }));
3186
+ }
3130
3187
  }
3131
3188
  exports.MotionMasterReqResClient = MotionMasterReqResClient;
3132
3189
  //# sourceMappingURL=motion-master-req-res-client.js.map