motion-master-client 0.0.246 → 0.0.247
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/lib/config-file.js +1 -1
- package/src/lib/config-file.js.map +1 -1
- package/src/lib/motion-master-req-res-client.d.ts +71 -5
- package/src/lib/motion-master-req-res-client.js +88 -17
- package/src/lib/motion-master-req-res-client.js.map +1 -1
- package/src/lib/os-command.d.ts +58 -0
- package/src/lib/os-command.js +10 -0
- package/src/lib/os-command.js.map +1 -1
- package/src/lib/parameter.d.ts +1 -1
- package/src/lib/parameter.js +3 -3
- package/src/lib/parameter.js.map +1 -1
- package/src/lib/smm-od-v1.json +1836 -0
- package/src/lib/smm.d.ts +1 -0
- package/src/lib/smm.js +3 -1
- package/src/lib/smm.js.map +1 -1
package/package.json
CHANGED
package/src/lib/config-file.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-file.js","sourceRoot":"","sources":["../../../../../libs/motion-master-client/src/lib/config-file.ts"],"names":[],"mappings":";;;AAAA,yCAA+C;AAC/C,
|
|
1
|
+
{"version":3,"file":"config-file.js","sourceRoot":"","sources":["../../../../../libs/motion-master-client/src/lib/config-file.ts"],"names":[],"mappings":"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"}
|
|
@@ -8,7 +8,7 @@ import { Parameter, UIFeaturesConfig } from './parameter';
|
|
|
8
8
|
import { SystemLogLine } from './system-log-line';
|
|
9
9
|
import { MotionMasterMessage, ParameterValueType, ParameterTypeValue, DeviceParameterValuesStatus, ParameterTypeValueKey, DeviceRefObj, DeviceRef, FullAutoTuningStatus, SystemVersionStatus, DeviceInfoStatus, DeviceParameterInfoStatus, GetDeviceParameterInfoRequest, GetDeviceParameterValuesRequest, GetMultiDeviceParameterValuesRequest, MultiDeviceParameterValuesStatus, SetDeviceParameterValuesRequest, SetMultiDeviceParameterValuesRequest, GetDeviceFileListRequest, DeviceFileListStatus, GetDeviceFileRequest, DeviceFileStatus, SetDeviceFileRequest, DeleteDeviceFileRequest, ResetDeviceFaultRequest, DeviceFaultResetStatus, StopDeviceRequest, DeviceStopStatus, StartDeviceFirmwareInstallationRequest, DeviceFirmwareInstallationStatus, GetDeviceLogRequest, DeviceLogStatus, StartCoggingTorqueRecordingRequest, CoggingTorqueRecordingStatus, GetCoggingTorqueDataRequest, CoggingTorqueDataStatus, StartOffsetDetectionRequest, OffsetDetectionStatus, StartPlantModelIdentificationRequest, PlantIdentificationStatus, ComputeAutoTuningGainsRequest, AutoTuningStatus, SetMotionControllerParametersRequest, MotionControllerStatus, EnableMotionControllerRequest, SetSignalGeneratorParametersRequest, SignalGeneratorStatus, StopSignalGeneratorRequest, StartMonitoringDeviceParameterValuesRequest, MonitoringParameterValuesStatus, StopMonitoringDeviceParameterValuesRequest, GetEthercatNetworkStateRequest, EthercatNetworkStateStatus, SetEthercatNetworkStateRequest, StartNarrowAngleCalibrationRequest, NarrowAngleCalibrationStatus, SetSystemClientTimeoutRequest, StartSystemIdentificationRequest, SystemIdentificationStatus, CirculoEncoderMagnetDistanceStatus, StartCirculoEncoderNarrowAngleCalibrationProcedureRequest, CirculoEncoderNarrowAngleCalibrationProcedureStatus, GetDeviceCiA402StateRequest, DeviceCiA402StateStatus, SetDeviceCiA402StateRequest, SystemLogStatus, StartDeviceSiiRestoreRequest, DeviceSiiRestoreStatus, StartOpenLoopFieldControlRequest, OpenLoopFieldControlStatus, ComputeFullAutoTuningGainsRequest, StartFullAutoTuningRequest, StopFullAutoTuningRequest, StartCirculoEncoderConfigurationRequest, CirculoEncoderConfigurationStatus, StopCirculoEncoderNarrowAngleCalibrationProcedureRequest, StartOsCommandRequest, OsCommandStatus, RestoreDefaultParametersType, DeviceParameterAddressValue, DeviceParameterIds, DeviceParameterInfo, RequestStatusMessage } from './types';
|
|
10
10
|
import { Cia402State, ModesOfOperation } from './cia402';
|
|
11
|
-
import { EncoderRegisterCommunicationOsCommandResponse, MotorPhaseOrderDetectionOsCommandResponse, OpenPhaseDetectionOsCommandResponse, OsCommandMode, OsCommandResponse, PhaseResistanceMeasurementOsCommandResponse, PhaseInductanceMeasurementOsCommandResponse, PolePairDetectionOsCommandResponse, CommutationOffsetMeasurementOsCommandResponse, IcMuCalibrationModeOsCommandResponse, OpenLoopFieldModeOsCommandResponse, HrdStreamingOsCommandResponse, TorqueConstantMeasurementOsCommandResponse, SkippedCyclesCounterOsCommandResponse, IgnoreBissStatusBitsOsCommandResponse, SystemIdentificationOsCommandResponse, KublerEncoderCommandOsCommandResponse, UseInternalEncoderVelocityOsCommandResponse, KublerEncoderRegisterCommunicationOsCommandResponse, SmmAcyclicHandlerOsCommandResponse, HrdStreamingOsCommandAction, HrdStreamingOsCommandDataIndex } from './os-command';
|
|
11
|
+
import { EncoderRegisterCommunicationOsCommandResponse, MotorPhaseOrderDetectionOsCommandResponse, OpenPhaseDetectionOsCommandResponse, OsCommandMode, OsCommandResponse, PhaseResistanceMeasurementOsCommandResponse, PhaseInductanceMeasurementOsCommandResponse, PolePairDetectionOsCommandResponse, CommutationOffsetMeasurementOsCommandResponse, IcMuCalibrationModeOsCommandResponse, OpenLoopFieldModeOsCommandResponse, HrdStreamingOsCommandResponse, TorqueConstantMeasurementOsCommandResponse, SkippedCyclesCounterOsCommandResponse, IgnoreBissStatusBitsOsCommandResponse, SystemIdentificationOsCommandResponse, KublerEncoderCommandOsCommandResponse, UseInternalEncoderVelocityOsCommandResponse, KublerEncoderRegisterCommunicationOsCommandResponse, SmmAcyclicHandlerOsCommandResponse, HrdStreamingOsCommandAction, HrdStreamingOsCommandDataIndex, SmmAcyclicHandlerLoadParametersForVerificationOsCommandResponse } from './os-command';
|
|
12
12
|
import { IntegroVariant } from './integro-variant';
|
|
13
13
|
import { ConfigParameter } from './config-file';
|
|
14
14
|
import { MotionMasterClientIndexedDB } from './mmcidb';
|
|
@@ -1321,7 +1321,7 @@ export declare class MotionMasterReqResClient {
|
|
|
1321
1321
|
*/
|
|
1322
1322
|
readSmmParameterArrayValue(deviceRef: DeviceRef, index: number, subindex?: number): Observable<number[]>;
|
|
1323
1323
|
/**
|
|
1324
|
-
* Reads the SMM firmware version from a device.
|
|
1324
|
+
* Reads the SMM firmware version from a device as an array of bytes.
|
|
1325
1325
|
*
|
|
1326
1326
|
* This method reads the firmware version (MCU Software Version 0x0001:00) of the device as an array of numbers.
|
|
1327
1327
|
* The first byte represents the minor version, and the second byte represents the major version.
|
|
@@ -1331,6 +1331,32 @@ export declare class MotionMasterReqResClient {
|
|
|
1331
1331
|
* @returns An observable that emits an array of numbers, representing the byte values of the firmware version.
|
|
1332
1332
|
*/
|
|
1333
1333
|
readSmmFirmareVersion(deviceRef: DeviceRef): Observable<number[]>;
|
|
1334
|
+
/**
|
|
1335
|
+
* Reads the SMM firmware version from a device as a number.
|
|
1336
|
+
*
|
|
1337
|
+
* This function retrieves a specific parameter from the device's SMM memory
|
|
1338
|
+
* and interprets the result as a 16-bit version number.
|
|
1339
|
+
*
|
|
1340
|
+
* @param deviceRef - A reference to the target device.
|
|
1341
|
+
* @returns An `Observable<number>` emitting the firmware version, represented as an integer.
|
|
1342
|
+
*/
|
|
1343
|
+
readSmmFirmareVersionAsNumber(deviceRef: DeviceRef): Observable<number>;
|
|
1344
|
+
/**
|
|
1345
|
+
* Resolves the SMM parameter structure version for the specified device based on its firmware version.
|
|
1346
|
+
*
|
|
1347
|
+
* @param deviceRef - The reference to the target device.
|
|
1348
|
+
*
|
|
1349
|
+
* @returns An Observable that emits the appropriate SMM parameter structure version:
|
|
1350
|
+
* - 0x0041 for firmware versions below 2.3 (0x0203).
|
|
1351
|
+
* - 0x0203 for firmware versions 2.3 (0x0203) and above.
|
|
1352
|
+
*
|
|
1353
|
+
* @remarks
|
|
1354
|
+
* - The function first reads the firmware version of the device.
|
|
1355
|
+
* - Based on the firmware version, it returns the corresponding parameter structure version:
|
|
1356
|
+
* - If the firmware version is less than 0x0203, the parameter structure version is 0x0041.
|
|
1357
|
+
* - If the firmware version is 0x0203 or greater, the parameter structure version is 0x0203.
|
|
1358
|
+
*/
|
|
1359
|
+
resolveSmmParameterStructureVersion(deviceRef: DeviceRef): Observable<number>;
|
|
1334
1360
|
/**
|
|
1335
1361
|
* Reads the SMM serial number from a device.
|
|
1336
1362
|
*
|
|
@@ -1436,6 +1462,20 @@ export declare class MotionMasterReqResClient {
|
|
|
1436
1462
|
* @returns An observable that emits a boolean value indicating whether the relogin attempt succeeded.
|
|
1437
1463
|
*/
|
|
1438
1464
|
reloginToSmmForParameterDownload(deviceRef: DeviceRef, username: string, password: string): Observable<boolean>;
|
|
1465
|
+
/**
|
|
1466
|
+
* Changes the SMM password for the specified device.
|
|
1467
|
+
*
|
|
1468
|
+
* @param deviceRef - A reference to the target device.
|
|
1469
|
+
* @param oldPassword - The current SMM password.
|
|
1470
|
+
* @param newPassword - The new password to set for the SMM.
|
|
1471
|
+
* @returns An Observable that emits `true` if the password change and SMM restart succeed, otherwise `false`.
|
|
1472
|
+
*
|
|
1473
|
+
* @remarks
|
|
1474
|
+
* A prior successful login is required before changing the password.
|
|
1475
|
+
* The new password must be at least 4 characters long.
|
|
1476
|
+
*
|
|
1477
|
+
* This function sends an acyclic command to update the password. If successful, it triggers an SMM restart.
|
|
1478
|
+
*/
|
|
1439
1479
|
changeSmmPassword(deviceRef: DeviceRef, oldPassword: string, newPassword: string): Observable<boolean>;
|
|
1440
1480
|
/**
|
|
1441
1481
|
* Triggers a restart for the specified device.
|
|
@@ -1465,9 +1505,35 @@ export declare class MotionMasterReqResClient {
|
|
|
1465
1505
|
acknowledgeIoFailureOnSmm(deviceRef: DeviceRef, commandTimeout?: number, responsePollingInterval?: number): Observable<boolean>;
|
|
1466
1506
|
configureSmmSoftwareUpdate(deviceRef: DeviceRef, fileSize: number): Observable<boolean>;
|
|
1467
1507
|
updateSmmSoftware(deviceRef: DeviceRef, username: string, password: string, buffer: Uint8Array, crc: number, chunkSize?: number): Observable<boolean>;
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1508
|
+
/**
|
|
1509
|
+
* Transmits SMM parameters to the specified device.
|
|
1510
|
+
*
|
|
1511
|
+
* @param deviceRef - The reference to the target device.
|
|
1512
|
+
* @param values - An array of data values to transmit.
|
|
1513
|
+
* @param parameterStructureVersion - The version of the parameter structure (default: 0x0041).
|
|
1514
|
+
*
|
|
1515
|
+
* @returns An Observable that emits `true` if the operation succeeds, or `false` if it fails, the `values` array is empty.
|
|
1516
|
+
*
|
|
1517
|
+
* @remarks
|
|
1518
|
+
* - If the `values` array is empty, the function immediately returns `false`.
|
|
1519
|
+
* - The `version` is prepended to the values array before packing.
|
|
1520
|
+
* - The function constructs an OS command for transmitting the parameters and writes the packed buffer to the file system.
|
|
1521
|
+
*/
|
|
1522
|
+
transmitSmmParameters(deviceRef: DeviceRef, values: DataType[], parameterStructureVersion?: number): Observable<boolean>;
|
|
1523
|
+
/**
|
|
1524
|
+
* Loads the SMM parameters for verification on the specified device.
|
|
1525
|
+
*
|
|
1526
|
+
* This method sends a command to the device to load the SMM parameters for verification and waits for the response.
|
|
1527
|
+
* The device returns a buffer with all bits inverted. The OS command will invert the bits and reconstruct the buffer
|
|
1528
|
+
* into valid parameter values, which are then returned in sequence within the OS command response.
|
|
1529
|
+
*
|
|
1530
|
+
* @param deviceRef - The reference to the device from which the parameters should be loaded.
|
|
1531
|
+
* @returns An Observable that emits the response from the device, containing the valid parameter values for verification
|
|
1532
|
+
* after the buffer is processed and reconstructed.
|
|
1533
|
+
*
|
|
1534
|
+
* @throws Will throw an error if the command fails or times out.
|
|
1535
|
+
*/
|
|
1536
|
+
loadSmmParametersForVerification(deviceRef: DeviceRef): Observable<SmmAcyclicHandlerLoadParametersForVerificationOsCommandResponse>;
|
|
1471
1537
|
verifySmmParameters(deviceRef: DeviceRef, parameters: Pick<Parameter, 'value'>[], groupOrdinal: SmmVerificationGroupOrdinal): Observable<boolean>;
|
|
1472
1538
|
loadSmmValidationFile(deviceRef: DeviceRef): Observable<OsCommandResponse>;
|
|
1473
1539
|
validateSmmConfiguration(deviceRef: DeviceRef, report: Uint8Array, date: Date, username: string, password: string): Observable<boolean>;
|
|
@@ -2081,7 +2081,7 @@ class MotionMasterReqResClient {
|
|
|
2081
2081
|
? rxjs_1.EMPTY
|
|
2082
2082
|
: (0, rxjs_1.timer)(responsePollingInterval),
|
|
2083
2083
|
}))).pipe((0, operators_1.takeUntil)((0, rxjs_1.timer)(commandTimeout).pipe((0, operators_1.mergeMap)(() => (0, rxjs_1.throwError)(() => new Error(`A timeout has occurred for the OS command ${JSON.stringify(command)} on device ${deviceRef}.`))))), (0, operators_1.filter)(os_command_1.isOsCommandResponse), (0, operators_1.mergeMap)((response) => {
|
|
2084
|
-
if (fsBufferContent === true) {
|
|
2084
|
+
if (response.request === 'succeeded' && fsBufferContent === true) {
|
|
2085
2085
|
return this.getFile(deviceRef, 'fs-buffer', 20000).pipe((0, operators_1.map)((value) => {
|
|
2086
2086
|
response.fsBuffer = value;
|
|
2087
2087
|
return response;
|
|
@@ -2592,7 +2592,7 @@ class MotionMasterReqResClient {
|
|
|
2592
2592
|
}));
|
|
2593
2593
|
}
|
|
2594
2594
|
/**
|
|
2595
|
-
* Reads the SMM firmware version from a device.
|
|
2595
|
+
* Reads the SMM firmware version from a device as an array of bytes.
|
|
2596
2596
|
*
|
|
2597
2597
|
* This method reads the firmware version (MCU Software Version 0x0001:00) of the device as an array of numbers.
|
|
2598
2598
|
* The first byte represents the minor version, and the second byte represents the major version.
|
|
@@ -2604,6 +2604,43 @@ class MotionMasterReqResClient {
|
|
|
2604
2604
|
readSmmFirmareVersion(deviceRef) {
|
|
2605
2605
|
return this.readSmmParameterArrayValue(deviceRef, 0x0001, 0);
|
|
2606
2606
|
}
|
|
2607
|
+
/**
|
|
2608
|
+
* Reads the SMM firmware version from a device as a number.
|
|
2609
|
+
*
|
|
2610
|
+
* This function retrieves a specific parameter from the device's SMM memory
|
|
2611
|
+
* and interprets the result as a 16-bit version number.
|
|
2612
|
+
*
|
|
2613
|
+
* @param deviceRef - A reference to the target device.
|
|
2614
|
+
* @returns An `Observable<number>` emitting the firmware version, represented as an integer.
|
|
2615
|
+
*/
|
|
2616
|
+
readSmmFirmareVersionAsNumber(deviceRef) {
|
|
2617
|
+
return this.readSmmParameterArrayValue(deviceRef, 0x0001, 0).pipe((0, operators_1.map)((bytes) => (bytes[1] << 8) | bytes[0]));
|
|
2618
|
+
}
|
|
2619
|
+
/**
|
|
2620
|
+
* Resolves the SMM parameter structure version for the specified device based on its firmware version.
|
|
2621
|
+
*
|
|
2622
|
+
* @param deviceRef - The reference to the target device.
|
|
2623
|
+
*
|
|
2624
|
+
* @returns An Observable that emits the appropriate SMM parameter structure version:
|
|
2625
|
+
* - 0x0041 for firmware versions below 2.3 (0x0203).
|
|
2626
|
+
* - 0x0203 for firmware versions 2.3 (0x0203) and above.
|
|
2627
|
+
*
|
|
2628
|
+
* @remarks
|
|
2629
|
+
* - The function first reads the firmware version of the device.
|
|
2630
|
+
* - Based on the firmware version, it returns the corresponding parameter structure version:
|
|
2631
|
+
* - If the firmware version is less than 0x0203, the parameter structure version is 0x0041.
|
|
2632
|
+
* - If the firmware version is 0x0203 or greater, the parameter structure version is 0x0203.
|
|
2633
|
+
*/
|
|
2634
|
+
resolveSmmParameterStructureVersion(deviceRef) {
|
|
2635
|
+
return this.readSmmFirmareVersionAsNumber(deviceRef).pipe((0, operators_1.map)((version) => {
|
|
2636
|
+
if (version < 0x0203) {
|
|
2637
|
+
return 0x0041;
|
|
2638
|
+
}
|
|
2639
|
+
else {
|
|
2640
|
+
return 0x0203;
|
|
2641
|
+
}
|
|
2642
|
+
}));
|
|
2643
|
+
}
|
|
2607
2644
|
/**
|
|
2608
2645
|
* Reads the SMM serial number from a device.
|
|
2609
2646
|
*
|
|
@@ -2728,12 +2765,26 @@ class MotionMasterReqResClient {
|
|
|
2728
2765
|
* @returns An observable that emits a boolean value indicating whether the relogin attempt succeeded.
|
|
2729
2766
|
*/
|
|
2730
2767
|
reloginToSmmForParameterDownload(deviceRef, username, password) {
|
|
2731
|
-
return (0,
|
|
2768
|
+
return this.logoutFromSmm(deviceRef).pipe((0, operators_1.mergeMap)((succeeded) => succeeded ? this.loginToSmmForParameterDownload(deviceRef, username, password) : (0, rxjs_1.of)(false)));
|
|
2732
2769
|
}
|
|
2770
|
+
/**
|
|
2771
|
+
* Changes the SMM password for the specified device.
|
|
2772
|
+
*
|
|
2773
|
+
* @param deviceRef - A reference to the target device.
|
|
2774
|
+
* @param oldPassword - The current SMM password.
|
|
2775
|
+
* @param newPassword - The new password to set for the SMM.
|
|
2776
|
+
* @returns An Observable that emits `true` if the password change and SMM restart succeed, otherwise `false`.
|
|
2777
|
+
*
|
|
2778
|
+
* @remarks
|
|
2779
|
+
* A prior successful login is required before changing the password.
|
|
2780
|
+
* The new password must be at least 4 characters long.
|
|
2781
|
+
*
|
|
2782
|
+
* This function sends an acyclic command to update the password. If successful, it triggers an SMM restart.
|
|
2783
|
+
*/
|
|
2733
2784
|
changeSmmPassword(deviceRef, oldPassword, newPassword) {
|
|
2734
2785
|
const command = (0, os_command_1.createSmmAcyclicHandlerOsCommand)(os_command_1.SmmAcyclicHandlerSubcommandId.CHANGE_PASSWORD);
|
|
2735
2786
|
const content = (0, smm_1.packSmmChangePassword)(newPassword, oldPassword);
|
|
2736
|
-
return
|
|
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))));
|
|
2737
2788
|
}
|
|
2738
2789
|
/**
|
|
2739
2790
|
* Triggers a restart for the specified device.
|
|
@@ -2790,26 +2841,46 @@ class MotionMasterReqResClient {
|
|
|
2790
2841
|
observables.push((0, rxjs_1.defer)(() => this.runOsCommandAndWriteFsBuffer(deviceRef, finalizeSoftwareUpdateCommand, packedCrc).pipe((0, operators_1.last)(), (0, operators_1.map)((response) => response.request === 'succeeded'))), (0, rxjs_1.defer)(() => this.triggerSmmRestart(deviceRef)));
|
|
2791
2842
|
return (0, rxjs_1.concat)(...observables);
|
|
2792
2843
|
}
|
|
2793
|
-
|
|
2794
|
-
|
|
2844
|
+
/**
|
|
2845
|
+
* Transmits SMM parameters to the specified device.
|
|
2846
|
+
*
|
|
2847
|
+
* @param deviceRef - The reference to the target device.
|
|
2848
|
+
* @param values - An array of data values to transmit.
|
|
2849
|
+
* @param parameterStructureVersion - The version of the parameter structure (default: 0x0041).
|
|
2850
|
+
*
|
|
2851
|
+
* @returns An Observable that emits `true` if the operation succeeds, or `false` if it fails, the `values` array is empty.
|
|
2852
|
+
*
|
|
2853
|
+
* @remarks
|
|
2854
|
+
* - If the `values` array is empty, the function immediately returns `false`.
|
|
2855
|
+
* - 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 system.
|
|
2857
|
+
*/
|
|
2858
|
+
transmitSmmParameters(deviceRef, values, parameterStructureVersion = 0x0041) {
|
|
2859
|
+
if (values.length === 0) {
|
|
2860
|
+
return (0, rxjs_1.of)(false);
|
|
2861
|
+
}
|
|
2795
2862
|
// usedParameterStructVersion: 1st byte is major version, 2nd byte is minor version (0x0028 -> 0.40)
|
|
2796
|
-
values.unshift(
|
|
2863
|
+
values.unshift(parameterStructureVersion);
|
|
2797
2864
|
const command = (0, os_command_1.createSmmAcyclicHandlerOsCommand)(os_command_1.SmmAcyclicHandlerSubcommandId.TRANSMIT_PARAMETERS);
|
|
2798
2865
|
const { buffer: content } = (0, smm_1.packSmmParameterValues)(values);
|
|
2799
2866
|
return this.runOsCommandAndWriteFsBuffer(deviceRef, command, content).pipe((0, operators_1.last)(), (0, operators_1.map)((response) => response.request === 'succeeded'));
|
|
2800
2867
|
}
|
|
2868
|
+
/**
|
|
2869
|
+
* Loads the SMM parameters for verification on the specified device.
|
|
2870
|
+
*
|
|
2871
|
+
* This method sends a command to the device to load the SMM parameters for verification and waits for the response.
|
|
2872
|
+
* The device returns a buffer with all bits inverted. The OS command will invert the bits and reconstruct the buffer
|
|
2873
|
+
* into valid parameter values, which are then returned in sequence within the OS command response.
|
|
2874
|
+
*
|
|
2875
|
+
* @param deviceRef - The reference to the device from which the parameters should be loaded.
|
|
2876
|
+
* @returns An Observable that emits the response from the device, containing the valid parameter values for verification
|
|
2877
|
+
* after the buffer is processed and reconstructed.
|
|
2878
|
+
*
|
|
2879
|
+
* @throws Will throw an error if the command fails or times out.
|
|
2880
|
+
*/
|
|
2801
2881
|
loadSmmParametersForVerification(deviceRef) {
|
|
2802
2882
|
const command = (0, os_command_1.createSmmAcyclicHandlerOsCommand)(os_command_1.SmmAcyclicHandlerSubcommandId.LOAD_PARAMETERS_FOR_VERIFICATION);
|
|
2803
|
-
return this.runOsCommandAndReadFsBuffer(deviceRef, command,
|
|
2804
|
-
}
|
|
2805
|
-
loadSmmParametersForVerificationAndUnpack(deviceRef) {
|
|
2806
|
-
return this.loadSmmParametersForVerification(deviceRef).pipe((0, operators_1.map)((response) => {
|
|
2807
|
-
if (!response.fsBuffer) {
|
|
2808
|
-
throw new Error('Reading loading SMM parameters for verification. The response buffer is empty.');
|
|
2809
|
-
}
|
|
2810
|
-
const values = Uint8Array.from(response.fsBuffer).map((byte) => byte ^ 0xff);
|
|
2811
|
-
return (0, smm_1.unpackSmmParameterValues)(values);
|
|
2812
|
-
}));
|
|
2883
|
+
return this.runOsCommandAndReadFsBuffer(deviceRef, command, 10000, 1000);
|
|
2813
2884
|
}
|
|
2814
2885
|
verifySmmParameters(deviceRef, parameters, groupOrdinal) {
|
|
2815
2886
|
const values = parameters.map((p) => p.value);
|