motion-master-client 0.0.247 → 0.0.248
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 +1 -1
- package/src/index.d.ts +2 -0
- package/src/index.js +2 -0
- package/src/index.js.map +1 -1
- package/src/lib/motion-master-req-res-client.d.ts +118 -20
- package/src/lib/motion-master-req-res-client.js +149 -34
- package/src/lib/motion-master-req-res-client.js.map +1 -1
- package/src/lib/smm-od-v1.json +16 -1
- package/src/lib/smm-od-v2.json +2051 -0
- package/src/lib/smm-od.d.ts +41 -0
- package/src/lib/smm-od.js +6 -0
- package/src/lib/smm-od.js.map +1 -0
- package/src/lib/smm.d.ts +199 -48
- package/src/lib/smm.js +273 -95
- package/src/lib/smm.js.map +1 -1
- package/src/lib/util.d.ts +257 -6
- package/src/lib/util.js +328 -4
- package/src/lib/util.js.map +1 -1
|
@@ -2057,7 +2057,7 @@ class MotionMasterReqResClient {
|
|
|
2057
2057
|
* @param deviceRef The reference to the device on which the command will be executed.
|
|
2058
2058
|
* @param command The command to be executed, represented as a Uint8Array.
|
|
2059
2059
|
* @param commandTimeout The maximum time allowed for the command to complete.
|
|
2060
|
-
* @param responsePollingInterval The interval (in milliseconds) for polling the command response.
|
|
2060
|
+
* @param responsePollingInterval The interval (in milliseconds) for polling the command response.
|
|
2061
2061
|
* @param osCommandMode Specifies whether the next OS command should run immediately after the current one or abort the current command. Sets the OS Command Mode. Defaults to false.
|
|
2062
2062
|
* @param fsBufferContent If true, the content of the fs-buffer will be read and assigned to the `fsBuffer` property of {@link OsCommandResponse}. If a Uint8Array is provided, the content will be written to the fs-buffer file. If undefined, only the OS command will be executed, and its response will be read and parsed.
|
|
2063
2063
|
* @returns An observable of type T, which extends {@link OsCommandResponse}, representing the result of the command execution.
|
|
@@ -2512,12 +2512,12 @@ class MotionMasterReqResClient {
|
|
|
2512
2512
|
* @param deviceRef - The reference to the device to which the command will be sent.
|
|
2513
2513
|
* @param index - The index of the SMM parameter to read.
|
|
2514
2514
|
* @param subindex - The subindex of the SMM parameter to read. Defaults to 0.
|
|
2515
|
-
* @param commandTimeout - The timeout for the command in milliseconds.
|
|
2516
|
-
* @param responsePollingInterval - The interval between polling attempts for a response in milliseconds.
|
|
2515
|
+
* @param commandTimeout - The timeout for the command in milliseconds.
|
|
2516
|
+
* @param responsePollingInterval - The interval between polling attempts for a response in milliseconds.
|
|
2517
2517
|
*
|
|
2518
2518
|
* @returns An observable that emits the response from the command once it is received.
|
|
2519
2519
|
*/
|
|
2520
|
-
readSmmParameter(deviceRef, index, subindex = 0, commandTimeout =
|
|
2520
|
+
readSmmParameter(deviceRef, index, subindex = 0, commandTimeout = 5000, responsePollingInterval = 500) {
|
|
2521
2521
|
const command = (0, os_command_1.createSmmAcyclicHandlerReadSmmParameterOsCommand)(index, subindex);
|
|
2522
2522
|
return this.runOsCommandAndReadFsBuffer(deviceRef, command, commandTimeout, responsePollingInterval, os_command_1.OsCommandMode.EXECUTE_THE_NEXT_COMMAND_IMMEDIATELY);
|
|
2523
2523
|
}
|
|
@@ -2614,7 +2614,7 @@ class MotionMasterReqResClient {
|
|
|
2614
2614
|
* @returns An `Observable<number>` emitting the firmware version, represented as an integer.
|
|
2615
2615
|
*/
|
|
2616
2616
|
readSmmFirmareVersionAsNumber(deviceRef) {
|
|
2617
|
-
return this.
|
|
2617
|
+
return this.readSmmFirmareVersion(deviceRef).pipe((0, operators_1.map)((bytes) => (bytes[1] << 8) | bytes[0]));
|
|
2618
2618
|
}
|
|
2619
2619
|
/**
|
|
2620
2620
|
* Resolves the SMM parameter structure version for the specified device based on its firmware version.
|
|
@@ -2705,16 +2705,18 @@ class MotionMasterReqResClient {
|
|
|
2705
2705
|
* @param deviceRef - The reference to the device to which the login command will be sent.
|
|
2706
2706
|
* @param username - The optional username used for logging in to the SMM. If not provided, it will be treated as an empty string.
|
|
2707
2707
|
* @param password - The password used for logging in to the SMM.
|
|
2708
|
+
* @param commandTimeout - The timeout in milliseconds for the command to complete.
|
|
2709
|
+
* @param responsePollingInterval - The interval in milliseconds between polling for the response.
|
|
2708
2710
|
*
|
|
2709
2711
|
* @returns An observable that emits a boolean value indicating whether the login attempt succeeded.
|
|
2710
2712
|
*
|
|
2711
2713
|
* @remarks
|
|
2712
2714
|
* If the device is already logged in, the next login attempt will fail unless the user logs out first.
|
|
2713
2715
|
*/
|
|
2714
|
-
loginToSmmForParameterDownload(deviceRef, username, password) {
|
|
2716
|
+
loginToSmmForParameterDownload(deviceRef, username, password, commandTimeout = 5000, responsePollingInterval = 500) {
|
|
2715
2717
|
const command = (0, os_command_1.createSmmAcyclicHandlerOsCommand)(os_command_1.SmmAcyclicHandlerSubcommandId.PARAMETER_DOWNLOAD_LOGIN);
|
|
2716
2718
|
const content = (0, smm_1.packSmmCredentials)(username, password);
|
|
2717
|
-
return this.runOsCommandAndWriteFsBuffer(deviceRef, command, content).pipe((0, operators_1.last)(), (0, operators_1.map)((response) => response.request === 'succeeded'));
|
|
2719
|
+
return this.runOsCommandAndWriteFsBuffer(deviceRef, command, content, commandTimeout, responsePollingInterval).pipe((0, operators_1.last)(), (0, operators_1.map)((response) => response.request === 'succeeded'));
|
|
2718
2720
|
}
|
|
2719
2721
|
/**
|
|
2720
2722
|
* Logs into the SMM for software update with the provided credentials.
|
|
@@ -2726,16 +2728,18 @@ class MotionMasterReqResClient {
|
|
|
2726
2728
|
* @param deviceRef - The reference to the device to which the login command will be sent.
|
|
2727
2729
|
* @param username - The optional username used for logging in to the SMM. If not provided, it will be treated as an empty string.
|
|
2728
2730
|
* @param password - The password used for logging in to the SMM.
|
|
2731
|
+
* @param commandTimeout - The timeout in milliseconds for the command to complete.
|
|
2732
|
+
* @param responsePollingInterval - The interval in milliseconds between polling for the response.
|
|
2729
2733
|
*
|
|
2730
2734
|
* @returns An observable that emits a boolean value indicating whether the login attempt succeeded.
|
|
2731
2735
|
*
|
|
2732
2736
|
* @remarks
|
|
2733
2737
|
* If the device is already logged in, the next login attempt will fail unless the user logs out first.
|
|
2734
2738
|
*/
|
|
2735
|
-
loginToSmmForSoftwareUpdate(deviceRef, username, password) {
|
|
2739
|
+
loginToSmmForSoftwareUpdate(deviceRef, username, password, commandTimeout = 5000, responsePollingInterval = 500) {
|
|
2736
2740
|
const command = (0, os_command_1.createSmmAcyclicHandlerOsCommand)(os_command_1.SmmAcyclicHandlerSubcommandId.SOFTWARE_UPDATE_LOGIN);
|
|
2737
2741
|
const content = (0, smm_1.packSmmCredentials)(username, password);
|
|
2738
|
-
return this.runOsCommandAndWriteFsBuffer(deviceRef, command, content).pipe((0, operators_1.last)(), (0, operators_1.map)((response) => response.request === 'succeeded'));
|
|
2742
|
+
return this.runOsCommandAndWriteFsBuffer(deviceRef, command, content, commandTimeout, responsePollingInterval).pipe((0, operators_1.last)(), (0, operators_1.map)((response) => response.request === 'succeeded'));
|
|
2739
2743
|
}
|
|
2740
2744
|
/**
|
|
2741
2745
|
* Logs out from the SMM.
|
|
@@ -2744,12 +2748,14 @@ class MotionMasterReqResClient {
|
|
|
2744
2748
|
* is successful and `false` otherwise. The command times out after 10 seconds if no response is received.
|
|
2745
2749
|
*
|
|
2746
2750
|
* @param deviceRef - The reference to the device to which the logout command will be sent.
|
|
2751
|
+
* @param commandTimeout - The timeout in milliseconds for the command to complete.
|
|
2752
|
+
* @param responsePollingInterval - The interval in milliseconds between polling for the response.
|
|
2747
2753
|
*
|
|
2748
2754
|
* @returns An observable that emits a boolean value indicating whether the logout attempt succeeded.
|
|
2749
2755
|
*/
|
|
2750
|
-
logoutFromSmm(deviceRef) {
|
|
2756
|
+
logoutFromSmm(deviceRef, commandTimeout = 5000, responsePollingInterval = 500) {
|
|
2751
2757
|
const command = (0, os_command_1.createSmmAcyclicHandlerOsCommand)(os_command_1.SmmAcyclicHandlerSubcommandId.LOGOUT);
|
|
2752
|
-
return this.runOsCommand(deviceRef, command,
|
|
2758
|
+
return this.runOsCommand(deviceRef, command, commandTimeout, responsePollingInterval).pipe((0, operators_1.last)(), (0, operators_1.map)((response) => response.request === 'succeeded'));
|
|
2753
2759
|
}
|
|
2754
2760
|
/**
|
|
2755
2761
|
* Logs out from the SMM and then logs back in with the provided credentials for parameter download.
|
|
@@ -2761,11 +2767,15 @@ class MotionMasterReqResClient {
|
|
|
2761
2767
|
* @param deviceRef - The reference to the device to which the logout and login commands will be sent.
|
|
2762
2768
|
* @param username - The username used for logging in to the SMM.
|
|
2763
2769
|
* @param password - The password used for logging in to the SMM.
|
|
2770
|
+
* @param commandTimeout - The timeout in milliseconds for the command to complete.
|
|
2771
|
+
* @param responsePollingInterval - The interval in milliseconds between polling for the response.
|
|
2764
2772
|
*
|
|
2765
2773
|
* @returns An observable that emits a boolean value indicating whether the relogin attempt succeeded.
|
|
2766
2774
|
*/
|
|
2767
|
-
reloginToSmmForParameterDownload(deviceRef, username, password) {
|
|
2768
|
-
return this.logoutFromSmm(deviceRef).pipe((0, operators_1.mergeMap)((succeeded) => succeeded
|
|
2775
|
+
reloginToSmmForParameterDownload(deviceRef, username, password, commandTimeout = 5000, responsePollingInterval = 500) {
|
|
2776
|
+
return this.logoutFromSmm(deviceRef, commandTimeout, responsePollingInterval).pipe((0, operators_1.mergeMap)((succeeded) => succeeded
|
|
2777
|
+
? this.loginToSmmForParameterDownload(deviceRef, username, password, commandTimeout, responsePollingInterval)
|
|
2778
|
+
: (0, rxjs_1.of)(false)));
|
|
2769
2779
|
}
|
|
2770
2780
|
/**
|
|
2771
2781
|
* Changes the SMM password for the specified device.
|
|
@@ -2773,6 +2783,8 @@ class MotionMasterReqResClient {
|
|
|
2773
2783
|
* @param deviceRef - A reference to the target device.
|
|
2774
2784
|
* @param oldPassword - The current SMM password.
|
|
2775
2785
|
* @param newPassword - The new password to set for the SMM.
|
|
2786
|
+
* @param commandTimeout - The timeout in milliseconds for the command to complete.
|
|
2787
|
+
* @param responsePollingInterval - The interval in milliseconds between polling for the response.
|
|
2776
2788
|
* @returns An Observable that emits `true` if the password change and SMM restart succeed, otherwise `false`.
|
|
2777
2789
|
*
|
|
2778
2790
|
* @remarks
|
|
@@ -2781,10 +2793,10 @@ class MotionMasterReqResClient {
|
|
|
2781
2793
|
*
|
|
2782
2794
|
* This function sends an acyclic command to update the password. If successful, it triggers an SMM restart.
|
|
2783
2795
|
*/
|
|
2784
|
-
changeSmmPassword(deviceRef, oldPassword, newPassword) {
|
|
2796
|
+
changeSmmPassword(deviceRef, oldPassword, newPassword, commandTimeout = 5000, responsePollingInterval = 500) {
|
|
2785
2797
|
const command = (0, os_command_1.createSmmAcyclicHandlerOsCommand)(os_command_1.SmmAcyclicHandlerSubcommandId.CHANGE_PASSWORD);
|
|
2786
2798
|
const content = (0, smm_1.packSmmChangePassword)(newPassword, oldPassword);
|
|
2787
|
-
return this.runOsCommandAndWriteFsBuffer(deviceRef, command, content).pipe((0, operators_1.last)(), (0, operators_1.map)((response) => response.request === 'succeeded'), (0, operators_1.mergeMap)((succeeded) => (succeeded ? this.triggerSmmRestart(deviceRef) : (0, rxjs_1.of)(false))));
|
|
2799
|
+
return this.runOsCommandAndWriteFsBuffer(deviceRef, command, content, commandTimeout, responsePollingInterval).pipe((0, operators_1.last)(), (0, operators_1.map)((response) => response.request === 'succeeded'), (0, operators_1.mergeMap)((succeeded) => (succeeded ? this.triggerSmmRestart(deviceRef) : (0, rxjs_1.of)(false))));
|
|
2788
2800
|
}
|
|
2789
2801
|
/**
|
|
2790
2802
|
* Triggers a restart for the specified device.
|
|
@@ -2793,12 +2805,12 @@ class MotionMasterReqResClient {
|
|
|
2793
2805
|
* The method will return `true` if the restart was successful, otherwise `false`.
|
|
2794
2806
|
*
|
|
2795
2807
|
* @param deviceRef - The reference to the device to restart.
|
|
2796
|
-
* @param commandTimeout - The timeout in milliseconds for the command to complete.
|
|
2797
|
-
* @param responsePollingInterval - The interval in milliseconds between polling for the response.
|
|
2808
|
+
* @param commandTimeout - The timeout in milliseconds for the command to complete.
|
|
2809
|
+
* @param responsePollingInterval - The interval in milliseconds between polling for the response.
|
|
2798
2810
|
*
|
|
2799
2811
|
* @returns An Observable that emits `true` if the restart was successful, or `false` otherwise.
|
|
2800
2812
|
*/
|
|
2801
|
-
triggerSmmRestart(deviceRef, commandTimeout =
|
|
2813
|
+
triggerSmmRestart(deviceRef, commandTimeout = 5000, responsePollingInterval = 500) {
|
|
2802
2814
|
const command = (0, os_command_1.createSmmAcyclicHandlerOsCommand)(os_command_1.SmmAcyclicHandlerSubcommandId.TRIGGER_RESTART);
|
|
2803
2815
|
return this.runOsCommand(deviceRef, command, commandTimeout, responsePollingInterval).pipe((0, operators_1.last)(), (0, operators_1.map)((response) => response.request === 'succeeded'));
|
|
2804
2816
|
}
|
|
@@ -2809,12 +2821,12 @@ class MotionMasterReqResClient {
|
|
|
2809
2821
|
* The method will return `true` if the acknowledgment was successful, otherwise `false`.
|
|
2810
2822
|
*
|
|
2811
2823
|
* @param deviceRef - The reference to the device to acknowledge the I/O failure on.
|
|
2812
|
-
* @param commandTimeout - The timeout in milliseconds for the command to complete.
|
|
2813
|
-
* @param responsePollingInterval - The interval in milliseconds between polling for the response.
|
|
2824
|
+
* @param commandTimeout - The timeout in milliseconds for the command to complete.
|
|
2825
|
+
* @param responsePollingInterval - The interval in milliseconds between polling for the response.
|
|
2814
2826
|
*
|
|
2815
2827
|
* @returns An Observable that emits `true` if the acknowledgment was successful, or `false` otherwise.
|
|
2816
2828
|
*/
|
|
2817
|
-
acknowledgeIoFailureOnSmm(deviceRef, commandTimeout =
|
|
2829
|
+
acknowledgeIoFailureOnSmm(deviceRef, commandTimeout = 5000, responsePollingInterval = 500) {
|
|
2818
2830
|
const command = (0, os_command_1.createSmmAcyclicHandlerOsCommand)(os_command_1.SmmAcyclicHandlerSubcommandId.IO_FAILURE_ACKNOWLEDGE);
|
|
2819
2831
|
return this.runOsCommand(deviceRef, command, commandTimeout, responsePollingInterval).pipe((0, operators_1.last)(), (0, operators_1.map)((response) => response.request === 'succeeded'));
|
|
2820
2832
|
}
|
|
@@ -2847,15 +2859,17 @@ class MotionMasterReqResClient {
|
|
|
2847
2859
|
* @param deviceRef - The reference to the target device.
|
|
2848
2860
|
* @param values - An array of data values to transmit.
|
|
2849
2861
|
* @param parameterStructureVersion - The version of the parameter structure (default: 0x0041).
|
|
2862
|
+
* @param commandTimeout - The timeout in milliseconds for the command to complete.
|
|
2863
|
+
* @param responsePollingInterval - The interval in milliseconds between polling for the response.
|
|
2850
2864
|
*
|
|
2851
2865
|
* @returns An Observable that emits `true` if the operation succeeds, or `false` if it fails, the `values` array is empty.
|
|
2852
2866
|
*
|
|
2853
2867
|
* @remarks
|
|
2854
2868
|
* - If the `values` array is empty, the function immediately returns `false`.
|
|
2855
2869
|
* - The `version` is prepended to the values array before packing.
|
|
2856
|
-
* - The function constructs an OS command for transmitting the parameters and writes the packed buffer to the file
|
|
2870
|
+
* - The function constructs an OS command for transmitting the parameters and writes the packed buffer to the fs-buffer file.
|
|
2857
2871
|
*/
|
|
2858
|
-
transmitSmmParameters(deviceRef, values, parameterStructureVersion = 0x0041) {
|
|
2872
|
+
transmitSmmParameters(deviceRef, values, parameterStructureVersion = 0x0041, commandTimeout = 5000, responsePollingInterval = 500) {
|
|
2859
2873
|
if (values.length === 0) {
|
|
2860
2874
|
return (0, rxjs_1.of)(false);
|
|
2861
2875
|
}
|
|
@@ -2863,7 +2877,7 @@ class MotionMasterReqResClient {
|
|
|
2863
2877
|
values.unshift(parameterStructureVersion);
|
|
2864
2878
|
const command = (0, os_command_1.createSmmAcyclicHandlerOsCommand)(os_command_1.SmmAcyclicHandlerSubcommandId.TRANSMIT_PARAMETERS);
|
|
2865
2879
|
const { buffer: content } = (0, smm_1.packSmmParameterValues)(values);
|
|
2866
|
-
return this.runOsCommandAndWriteFsBuffer(deviceRef, command, content).pipe((0, operators_1.last)(), (0, operators_1.map)((response) => response.request === 'succeeded'));
|
|
2880
|
+
return this.runOsCommandAndWriteFsBuffer(deviceRef, command, content, commandTimeout, responsePollingInterval).pipe((0, operators_1.last)(), (0, operators_1.map)((response) => response.request === 'succeeded'));
|
|
2867
2881
|
}
|
|
2868
2882
|
/**
|
|
2869
2883
|
* Loads the SMM parameters for verification on the specified device.
|
|
@@ -2873,29 +2887,130 @@ class MotionMasterReqResClient {
|
|
|
2873
2887
|
* into valid parameter values, which are then returned in sequence within the OS command response.
|
|
2874
2888
|
*
|
|
2875
2889
|
* @param deviceRef - The reference to the device from which the parameters should be loaded.
|
|
2890
|
+
* @param commandTimeout - The timeout in milliseconds for the command to complete.
|
|
2891
|
+
* @param responsePollingInterval - The interval in milliseconds between polling for the response.
|
|
2876
2892
|
* @returns An Observable that emits the response from the device, containing the valid parameter values for verification
|
|
2877
2893
|
* after the buffer is processed and reconstructed.
|
|
2878
2894
|
*
|
|
2879
2895
|
* @throws Will throw an error if the command fails or times out.
|
|
2880
2896
|
*/
|
|
2881
|
-
loadSmmParametersForVerification(deviceRef) {
|
|
2897
|
+
loadSmmParametersForVerification(deviceRef, commandTimeout = 5000, responsePollingInterval = 500) {
|
|
2882
2898
|
const command = (0, os_command_1.createSmmAcyclicHandlerOsCommand)(os_command_1.SmmAcyclicHandlerSubcommandId.LOAD_PARAMETERS_FOR_VERIFICATION);
|
|
2883
|
-
return this.runOsCommandAndReadFsBuffer(deviceRef, command,
|
|
2899
|
+
return this.runOsCommandAndReadFsBuffer(deviceRef, command, commandTimeout, responsePollingInterval);
|
|
2884
2900
|
}
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2901
|
+
/**
|
|
2902
|
+
* Verifies a group of SMM parameters for the specified device.
|
|
2903
|
+
*
|
|
2904
|
+
* This function calculates a bitmask from the provided values and group ordinal,
|
|
2905
|
+
* then sends an SMM OS command (subcommand VERIFY_PARAMETERS) along with the bitmask content
|
|
2906
|
+
* via `fs-buffer` to the device for verification.
|
|
2907
|
+
*
|
|
2908
|
+
* @param deviceRef - A reference to the target device.
|
|
2909
|
+
* @param values - An array of parameter values to verify.
|
|
2910
|
+
* @param groupIndex - The verification group index used for bitmask calculation.
|
|
2911
|
+
* @param commandTimeout - The timeout in milliseconds for the command to complete.
|
|
2912
|
+
* @param responsePollingInterval - The interval in milliseconds between polling for the response.
|
|
2913
|
+
* @returns An `Observable<boolean>` that emits `true` if the verification succeeded, or `false` otherwise.
|
|
2914
|
+
*
|
|
2915
|
+
* @remarks
|
|
2916
|
+
* This function requires parameters to be previously loaded for verification to succeed. If parameters are not preloaded, the verification will fail.
|
|
2917
|
+
* The same group can be verified multiple times without causing an error.
|
|
2918
|
+
*/
|
|
2919
|
+
verifySmmParameters(deviceRef, values, groupIndex, commandTimeout = 5000, responsePollingInterval = 500) {
|
|
2920
|
+
const { buffer: content } = (0, smm_1.packSmmParameterValuesForVerification)(values, groupIndex);
|
|
2888
2921
|
const command = (0, os_command_1.createSmmAcyclicHandlerOsCommand)(os_command_1.SmmAcyclicHandlerSubcommandId.VERIFY_PARAMETERS);
|
|
2889
|
-
return this.runOsCommandAndWriteFsBuffer(deviceRef, command, content).pipe((0, operators_1.last)(), (0, operators_1.map)((response) => response.request === 'succeeded'));
|
|
2922
|
+
return this.runOsCommandAndWriteFsBuffer(deviceRef, command, content, commandTimeout, responsePollingInterval).pipe((0, operators_1.last)(), (0, operators_1.map)((response) => response.request === 'succeeded'));
|
|
2890
2923
|
}
|
|
2891
|
-
|
|
2924
|
+
/**
|
|
2925
|
+
* Loads the SMM validation file on the specified device.
|
|
2926
|
+
*
|
|
2927
|
+
* @param deviceRef - A reference to the target device.
|
|
2928
|
+
* @param commandTimeout - The timeout in milliseconds for the command to complete.
|
|
2929
|
+
* @param responsePollingInterval - The interval in milliseconds between polling for the response.
|
|
2930
|
+
* @returns An Observable emitting the OS command response.
|
|
2931
|
+
*
|
|
2932
|
+
* @remarks
|
|
2933
|
+
* This function should only be called **after all parameter groups have been successfully verified**.
|
|
2934
|
+
*/
|
|
2935
|
+
loadSmmValidationFile(deviceRef, commandTimeout = 5000, responsePollingInterval = 500) {
|
|
2892
2936
|
const command = (0, os_command_1.createSmmAcyclicHandlerOsCommand)(os_command_1.SmmAcyclicHandlerSubcommandId.LOAD_VALIDATION_FILE);
|
|
2893
|
-
return this.runOsCommand(deviceRef, command,
|
|
2937
|
+
return this.runOsCommand(deviceRef, command, commandTimeout, responsePollingInterval);
|
|
2938
|
+
}
|
|
2939
|
+
/**
|
|
2940
|
+
* Loads the SMM validation file and then retrieves the safety parameters report file.
|
|
2941
|
+
*
|
|
2942
|
+
* @param deviceRef - A reference to the target device.
|
|
2943
|
+
* @param commandTimeout - The timeout in milliseconds for the command to complete.
|
|
2944
|
+
* @param responsePollingInterval - The interval in milliseconds between polling for the response.
|
|
2945
|
+
* @returns An Observable emitting the decoded content of the `.safety_parameters_report` file.
|
|
2946
|
+
*
|
|
2947
|
+
* @throws An error if loading the validation file fails.
|
|
2948
|
+
*
|
|
2949
|
+
* @remarks
|
|
2950
|
+
* This function should only be called **after all parameter groups have been successfully verified**.
|
|
2951
|
+
*/
|
|
2952
|
+
loadSmmValidationFileAndReadSafetyParametersReportFile(deviceRef, commandTimeout = 5000, responsePollingInterval = 500) {
|
|
2953
|
+
return this.loadSmmValidationFile(deviceRef, commandTimeout, responsePollingInterval).pipe((0, operators_1.last)(), (0, operators_1.mergeMap)((response) => {
|
|
2954
|
+
if (response.request !== 'succeeded') {
|
|
2955
|
+
throw new Error('Failed to load the validation file.');
|
|
2956
|
+
}
|
|
2957
|
+
return this.getDecodedFile(deviceRef, '.safety_parameters_report');
|
|
2958
|
+
}));
|
|
2894
2959
|
}
|
|
2895
|
-
|
|
2960
|
+
/**
|
|
2961
|
+
* Validates the SMM configuration on the specified device.
|
|
2962
|
+
*
|
|
2963
|
+
* @param deviceRef - The reference to the target device.
|
|
2964
|
+
* @param report - A `Uint8Array` representing the validation report data.
|
|
2965
|
+
* @param date - The date associated with the validation.
|
|
2966
|
+
* @param username - The username used for authentication.
|
|
2967
|
+
* @param password - The password used for authentication.
|
|
2968
|
+
* @param commandTimeout - The timeout in milliseconds for the command to complete.
|
|
2969
|
+
* @param responsePollingInterval - The interval in milliseconds between polling for the response.
|
|
2970
|
+
*
|
|
2971
|
+
* @returns An Observable that emits `true` if the configuration validation succeeds, or `false` if it fails.
|
|
2972
|
+
*
|
|
2973
|
+
* @remarks
|
|
2974
|
+
* - Packs the validation report, date, username, and password into a buffer.
|
|
2975
|
+
* - Constructs an OS command using the `VALIDATE_CONFIGURATION` subcommand.
|
|
2976
|
+
* - Sends the command to the device and writes the packed buffer to the fs-buffer file.
|
|
2977
|
+
* - **Important:** Once the configuration is successfully validated, subsequent calls to this function will fail. To revalidate, the user must go through the verification process again.
|
|
2978
|
+
*/
|
|
2979
|
+
validateSmmConfiguration(deviceRef, report, date, username, password, commandTimeout = 5000, responsePollingInterval = 500) {
|
|
2896
2980
|
const { buffer: content } = (0, smm_1.packSmmValidationReport)(report, date, username, password);
|
|
2897
2981
|
const command = (0, os_command_1.createSmmAcyclicHandlerOsCommand)(os_command_1.SmmAcyclicHandlerSubcommandId.VALIDATE_CONFIGURATION);
|
|
2898
|
-
return this.runOsCommandAndWriteFsBuffer(deviceRef, command, content).pipe((0, operators_1.last)(), (0, operators_1.map)((response) => response.request === 'succeeded'));
|
|
2982
|
+
return this.runOsCommandAndWriteFsBuffer(deviceRef, command, content, commandTimeout, responsePollingInterval).pipe((0, operators_1.last)(), (0, operators_1.map)((response) => response.request === 'succeeded'));
|
|
2983
|
+
}
|
|
2984
|
+
/**
|
|
2985
|
+
* Reads the safety parameters report from the device and validates the SMM configuration.
|
|
2986
|
+
*
|
|
2987
|
+
* @param deviceRef - The reference to the target device.
|
|
2988
|
+
* @param date - The date associated with the validation.
|
|
2989
|
+
* @param username - The username used for authentication.
|
|
2990
|
+
* @param password - The password used for authentication.
|
|
2991
|
+
* @param commandTimeout - The timeout in milliseconds for the command to complete.
|
|
2992
|
+
* @param responsePollingInterval - The interval in milliseconds between polling for the response.
|
|
2993
|
+
*
|
|
2994
|
+
* @returns An Observable that emits `true` if the SMM configuration is successfully validated, or `false` if validation fails.
|
|
2995
|
+
*
|
|
2996
|
+
* @throws An error if the `.safety_parameters_report` file is missing.
|
|
2997
|
+
*
|
|
2998
|
+
* @remarks
|
|
2999
|
+
* - The function attempts to retrieve the `.safety_parameters_report` file from the device.
|
|
3000
|
+
* - If the file is missing, an error is thrown.
|
|
3001
|
+
* - The file content is read into a `Uint8Array` and passed to `validateSmmConfiguration`.
|
|
3002
|
+
* - The SMM configuration validation follows the same behavior as `validateSmmConfiguration`:
|
|
3003
|
+
* - If validation succeeds, subsequent calls to this function will fail.
|
|
3004
|
+
* - To revalidate, the user must repeat the verification process.
|
|
3005
|
+
*/
|
|
3006
|
+
readSafetyParametersReportAndValidateSmmConfiguration(deviceRef, date, username, password, commandTimeout = 5000, responsePollingInterval = 500) {
|
|
3007
|
+
return this.getFile(deviceRef, '.safety_parameters_report').pipe((0, operators_1.last)(), (0, operators_1.mergeMap)((file) => {
|
|
3008
|
+
if (!file) {
|
|
3009
|
+
throw new Error("The '.safety_parameters_report' file is missing.");
|
|
3010
|
+
}
|
|
3011
|
+
const report = new Uint8Array(file);
|
|
3012
|
+
return this.validateSmmConfiguration(deviceRef, report, date, username, password, commandTimeout, responsePollingInterval);
|
|
3013
|
+
}));
|
|
2899
3014
|
}
|
|
2900
3015
|
}
|
|
2901
3016
|
exports.MotionMasterReqResClient = MotionMasterReqResClient;
|