panqiuyao 7 месяцев назад
Родитель
Сommit
08a4aca42f
1 измененных файлов с 37 добавлено и 4 удалено
  1. 37 4
      frontend/src/stores/modules/check.ts

+ 37 - 4
frontend/src/stores/modules/check.ts

@@ -9,6 +9,10 @@ const socketStore = socket();
 const clientStore = client();
 
 
+/**
+ * 定义检查信息的Store
+ * 包含设备连接状态检查、错误信息获取和重置检查等功能
+ */
 export const checkInfo = defineStore('checkInfo', () => {
 
     // 定义设备列表
@@ -35,12 +39,22 @@ export const checkInfo = defineStore('checkInfo', () => {
         },*/
     });
 
+    // 定义蓝牙扫描编号
     const blue_tooth_scan_NO = ref('')
+    // 定义检查时间
     const checkTime = ref(0)
+    // 定义检查设备状态的定时器
     let CKTimerInterval:any = null
+    // 定义检查相机控制的定时器
     let CKCamControlInterval:any = null
+    // 定义初始化mcu的类型
     let init_mcu_type = ref(true)
+    // 定义检查状态
     const isCheckStatus = ref(true)
+    /**
+     * 设置检查状态
+     * @param value 检查状态值
+     */
     const set_isCheckStatus = (value)=>{
         isCheckStatus.value = value
         //开始监听相机软件连接状态
@@ -88,6 +102,9 @@ export const checkInfo = defineStore('checkInfo', () => {
     });
 
     const configInfoStore = configInfo();
+    /**
+     * 检查相机控制
+     */
     const checkcamControl = async ()=>{
 
 
@@ -116,6 +133,9 @@ export const checkInfo = defineStore('checkInfo', () => {
     }
 
 
+    /**
+     * 检查相机
+     */
     const checkcamera = ()=>{
         clientStore.ipc.removeAllListeners(icpList.camera.hascamera);
         clientStore.ipc.send(icpList.camera.hascamera);
@@ -133,7 +153,11 @@ export const checkInfo = defineStore('checkInfo', () => {
 
     //第二次才算mcu正在失败
     const mcuErrorCount = ref(0);
-    // 通用设备检查函数
+    /**
+     * 通用设备检查函数
+     * @param deviceName 设备名称
+     * @param messageType 消息类型
+     */
     const checkDevice = async (deviceName: string, messageType: string) => {
         try {
             await socketStore.connectSocket();
@@ -197,7 +221,9 @@ export const checkInfo = defineStore('checkInfo', () => {
         }
     };
 
-    // 执行所有设备检查
+    /**
+     * 执行所有设备检查
+     */
     const checkAction = async () => {
         for (const deviceName of Object.keys(devices)) {
             switch (deviceName){
@@ -215,7 +241,9 @@ export const checkInfo = defineStore('checkInfo', () => {
 
     };
 
-    // 重新检查所有设备
+    /**
+     * 重新检查所有设备
+     */
     const reCheckAction = async () => {
         for (const device of Object.values(devices)) {
             device.status = 0;
@@ -234,7 +262,8 @@ export const checkInfo = defineStore('checkInfo', () => {
                 if( devices.mcu.status !== 2 || mcu.status !== 2 ){
                     devices.mcu.status = -1;
                     mcu.status = -1;
-                    devices.blue_tooth.msg = '拍照机连接失败';
+                    mcu.isInitSend = false;
+                    devices.mcu.msg = '拍照机连接失败';
                 }
             }
         },1000)
@@ -242,6 +271,10 @@ export const checkInfo = defineStore('checkInfo', () => {
 
     };
 
+    /**
+     * 设置蓝牙扫描编号
+     * @param value 蓝牙扫描编号值
+     */
     function set_blue_tooth_scan_NO(value){
         blue_tooth_scan_NO.value = value
     }