|
@@ -32,4 +32,47 @@ const resetAllDevices = async () => {
|
|
throw error;
|
|
throw error;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
-export { resetAllDevices };
|
|
|
|
|
|
+
|
|
|
|
+const setExpEnable = async () => {
|
|
|
|
+ const enableGenerator: DeviceActionMessage = {
|
|
|
|
+ deviceUri: generatorUri,
|
|
|
|
+ reqName: 'SetExpEnable',
|
|
|
|
+ reqParam: '',
|
|
|
|
+ reqTransaction: '',
|
|
|
|
+ reqClientID: '',
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ console.log(`[deviceActions][setExpEnable][使能发生器曝光] ${JSON.stringify(enableGenerator)}`);
|
|
|
|
+ const response = await axiosInstance.post('/auth/device/action', enableGenerator);
|
|
|
|
+ if (response.data.code !== '0x000000') {
|
|
|
|
+ throw new Error('返回码不是0x000000');
|
|
|
|
+ }
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.error(`[使能发生器曝光出错]`, error);
|
|
|
|
+ throw error;
|
|
|
|
+ }
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const setExpDisable = async () => {
|
|
|
|
+ const disableGenerator: DeviceActionMessage = {
|
|
|
|
+ deviceUri: generatorUri,
|
|
|
|
+ reqName: 'SetExpDisable',
|
|
|
|
+ reqParam: '',
|
|
|
|
+ reqTransaction: '',
|
|
|
|
+ reqClientID: '',
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ console.log(`[deviceActions][setExpDisable][禁止发生器曝光] ${JSON.stringify(disableGenerator)}`);
|
|
|
|
+ const response = await axiosInstance.post('/auth/device/action', disableGenerator);
|
|
|
|
+ if (response.data.code !== '0x000000') {
|
|
|
|
+ throw new Error('返回码不是0x000000');
|
|
|
|
+ }
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.error(`[禁止发生器曝光出错]`, error);
|
|
|
|
+ throw error;
|
|
|
|
+ }
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+export { resetAllDevices, setExpEnable, setExpDisable };
|