From e491cdb48129752324c4e3764f99bd9203c56dec Mon Sep 17 00:00:00 2001
From: lgq <1015864684@qq.com>
Date: 星期二, 31 三月 2026 09:48:44 +0800
Subject: [PATCH] 1.新增VF205门禁机代码

---
 vf205_access/src/view/mainView.js | 1646 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 1,646 insertions(+), 0 deletions(-)

diff --git a/vf205_access/src/view/mainView.js b/vf205_access/src/view/mainView.js
new file mode 100644
index 0000000..b3b35ef
--- /dev/null
+++ b/vf205_access/src/view/mainView.js
@@ -0,0 +1,1646 @@
+import dxui from '../../dxmodules/dxUi.js'
+import std from '../../dxmodules/dxStd.js'
+import viewUtils from "./viewUtils.js"
+import appView from './appView.js'
+import topView from './topView.js'
+import pwdView from './pwdView.js'
+import emergencyPwdView from './emergencyPwdView.js'
+import newPwdView from './config/newPwdView.js'
+import screen from '../screen.js'
+import logger from '../../dxmodules/dxLogger.js'
+import config from '../../dxmodules/dxConfig.js'
+import bus from '../../dxmodules/dxEventBus.js'
+import net from '../../dxmodules/dxNet.js'
+import accessService from '../service/accessService.js'
+import grainService from '../service/grainService.js'
+import dxMap from '../../dxmodules/dxMap.js'
+import sqliteService from '../service/sqliteService.js'
+import driver from '../driver.js'
+import capturer from '../../dxmodules/dxCapturer.js'
+
+let map = dxMap.get("LOGIN")
+const mainView = {
+    authComplete: false, // 璁よ瘉鏄惁瀹屾垚锛岀敤浜庢帶鍒禪I鏇存柊
+    verifiedUsers: {}, // 瀛樺偍宸叉牳楠屾垚鍔熺殑鐢ㄦ埛淇℃伅
+    eventListenersRegistered: false // 浜嬩欢鐩戝惉鍣ㄦ槸鍚﹀凡娉ㄥ唽
+}
+mainView.init = function () {
+    logger.info('[mainView]: init鍑芥暟寮�濮嬫墽琛�')
+    
+    /**************************************************鍒涘缓灞忓箷*****************************************************/
+    const screenMain = dxui.View.build('mainView', dxui.Utils.LAYER.MAIN)
+    mainView.screenMain = screenMain
+    screenMain.scroll(false)
+    screenMain.bgOpa(0)
+
+
+
+    // 鏇存柊璁惧淇℃伅锛圫N鍜孖P锛�
+    function updateDeviceInfo() {
+        let config = screen.getConfig()
+        let sn = config["sys.sn"] || ""
+        // 鐩存帴浠巒et妯″潡鑾峰彇IP鍦板潃锛岀‘淇濊幏鍙栧埌鏈�鏂扮殑IP
+        let ip = ""
+        try {
+            let netType = config["net.type"] || 1
+            let netMode = net.getModeByCard(netType)
+            if (netMode && netMode.param && netMode.param.ip) {
+                ip = netMode.param.ip
+            }
+        } catch (error) {
+            // 鍑洪敊鏃朵娇鐢╟onfig涓殑IP
+            ip = config["net.ip"] || ""
+        }
+        // 閫氳繃mainView瀵硅薄璁块棶鏍囩
+        if (mainView.snInfoLbl && mainView.ipInfoLbl) {
+            mainView.snInfoLbl.text("SN: " + sn)
+            mainView.ipInfoLbl.text("IP: " + ip)
+        }
+        // 鏇存柊overlayBox涓殑璁惧淇℃伅
+        if (mainView.overlaySnLbl && mainView.overlayIpLbl) {
+            mainView.overlaySnLbl.text("SN: " + sn)
+            mainView.overlayIpLbl.text("IP: " + ip)
+        }
+    }
+
+    // 鏇存柊搴撳尯鍚嶇О鍜屼粨鍙凤紙鍙湪绋嬪簭鍚姩鍜岄厤缃慨鏀规椂璋冪敤锛�
+    function updateWarehouseInfo() {
+        let config = screen.getConfig()
+        // 鑾峰彇浠撳彿淇℃伅
+        let houseName = config["houseName"] || "01鍙蜂粨"
+        // 鑾峰彇搴撳尯鍚嶇О
+        let GranaryName = config["GranaryName"] || "涓ぎ鍌ㄥ绮煇鏌愮洿灞炲簱"
+        logger.info(`[mainView]: 鏇存柊搴撳尯鍚嶇О鍜屼粨鍙�: 浠撳彿=${houseName}, 搴撳尯鍚嶇О=${GranaryName}`)
+        // 鏇存柊椤堕儴鏍囬鏍忕殑搴撳尯鍚嶇О
+        if (mainView.headerLbl) {
+            mainView.headerLbl.text(GranaryName)
+        }
+        // 鏇存柊浠撳彿鏄剧ず
+        if (mainView.warehouseLbl) {
+            logger.info(`[mainView]: 鏇存柊浠撳彿鏄剧ず涓�: ${houseName}`)
+            mainView.warehouseLbl.text(houseName)
+        } else {
+            logger.error('[mainView]: warehouseLbl涓嶅瓨鍦�')
+        }
+    }
+
+    screenMain.on(dxui.Utils.ENUM.LV_EVENT_SCREEN_LOADED, () => {
+        topView.changeTheme(false)
+
+        // 绋嬪簭鍚姩鏃舵洿鏂板簱鍖哄悕绉板拰浠撳彿
+        updateWarehouseInfo()
+
+        // 鍙敞鍐屼竴娆′簨浠剁洃鍚櫒
+        if (!mainView.eventListenersRegistered) {
+            logger.info('[mainView]: 寮�濮嬫敞鍐屼簨浠剁洃鍚櫒')
+            
+            // 缃戠粶鐘舵�佺洃鍚�
+            bus.on(net.STATUS_CHANGE, (data) => {
+                if (data.connected) {
+                    // 缃戠粶杩炴帴鏃舵洿鏂癐P淇℃伅
+                    updateDeviceInfo()
+                }
+            })
+
+            // 瀹氭湡鏇存柊璁惧淇℃伅锛堟瘡5绉掞級
+            std.setInterval(() => {
+                updateDeviceInfo()
+            }, 5000)
+
+            // 姘斾綋娴撳害鏇存柊浜嬩欢鐩戝惉
+            bus.on('gasConcentrationUpdated', (data) => {
+                logger.info(`[mainView]: 姘斾綋娴撳害鏇存柊浜嬩欢瑙﹀彂: ${JSON.stringify(data)}`)
+                
+                // 妫�鏌ユ皵浣撴祿搴︽暟鎹槸鍚﹀瓨鍦�
+                if (data.data && data.data.value) {
+                    const gasValue = data.data.value[0]
+                    const isO2Qualified = gasValue && gasValue.statusO2 === "0"
+                    const isCo2Qualified = gasValue && gasValue.statusCo2 === "0"
+                    const isPh3Qualified = gasValue && gasValue.statusPh3 === "0"
+                    
+                    if (mainView.oxygenValue && mainView.oxygenStatus && mainView.oxygenBox) {
+                        mainView.oxygenValue.text(gasValue ? gasValue.o2 : '鏈煡')
+                        mainView.oxygenStatus.text(isO2Qualified ? '鍚堟牸' : '涓嶅悎鏍�')
+                        // 鏍规嵁鐘舵�佹洿鏂拌儗鏅浘鐗�
+                        if (!isO2Qualified) {
+                            mainView.oxygenBox.source('/app/code/resource/image/o2_f.png') // 涓嶅悎鏍艰儗鏅浘
+                        } else {
+                            mainView.oxygenBox.source('/app/code/resource/image/o2_s.png') // 鍚堟牸鑳屾櫙鍥�
+                        }
+                        // 鍒锋柊UI
+                        mainView.oxygenValue.update()
+                        mainView.oxygenStatus.update()
+                        mainView.oxygenBox.update()
+                        mainView.oxygenValue.invalidate()
+                        mainView.oxygenStatus.invalidate()
+                        mainView.oxygenBox.invalidate()
+                    }
+                    if (mainView.co2Value && mainView.co2Status && mainView.co2Box) {
+                        mainView.co2Value.text(gasValue ? gasValue.co2 : '鏈煡')
+                        mainView.co2Status.text(isCo2Qualified ? '鍚堟牸' : '涓嶅悎鏍�')
+                        // 鏍规嵁鐘舵�佹洿鏂拌儗鏅浘鐗�
+                        if (!isCo2Qualified) {
+                            mainView.co2Box.source('/app/code/resource/image/co2_f.png') // 涓嶅悎鏍艰儗鏅浘
+                        } else {
+                            mainView.co2Box.source('/app/code/resource/image/co2_s.png') // 鍚堟牸鑳屾櫙鍥�
+                        }
+                        // 鍒锋柊UI
+                        mainView.co2Value.update()
+                        mainView.co2Status.update()
+                        mainView.co2Box.update()
+                        mainView.co2Value.invalidate()
+                        mainView.co2Status.invalidate()
+                        mainView.co2Box.invalidate()
+                    }
+                    if (mainView.ph3Value && mainView.ph3Status && mainView.ph3Box) {
+                        // 鏄庣‘妫�鏌� ph3 鏄惁瀛樺湪锛岃�屼笉鏄娇鐢� || 杩愮畻绗�
+                        let ph3Value = '0'
+                        if (gasValue) {
+                            if (gasValue.ph3) {
+                                ph3Value = gasValue.ph3
+                            } else if (gasValue.statusPh3) {
+                                ph3Value = gasValue.statusPh3
+                            }
+                        }
+                        mainView.ph3Value.text(ph3Value)
+                        mainView.ph3Status.text(isPh3Qualified ? '鍚堟牸' : '涓嶅悎鏍�')
+                        // 鏍规嵁鐘舵�佹洿鏂拌儗鏅浘鐗�
+                        if (!isPh3Qualified) {
+                            mainView.ph3Box.source('/app/code/resource/image/ph3_f.png') // 涓嶅悎鏍艰儗鏅浘
+                        } else {
+                            mainView.ph3Box.source('/app/code/resource/image/ph3_s.png') // 鍚堟牸鑳屾櫙鍥�
+                        }
+                        // 鍒锋柊UI
+                        mainView.ph3Value.update()
+                        mainView.ph3Status.update()
+                        mainView.ph3Box.update()
+                        mainView.ph3Value.invalidate()
+                        mainView.ph3Status.invalidate()
+                        mainView.ph3Box.invalidate()
+                    }
+                } else {
+                    logger.error(`[mainView]: 姘斾綋娴撳害鏁版嵁涓嶅瓨鍦╜)
+                }
+            })
+
+            // 搴撳尯鍚嶇О鍜屼粨鍙锋洿鏂颁簨浠剁洃鍚紙閰嶇疆淇敼鏃惰Е鍙戯級
+            bus.on('warehouseInfoUpdated', () => {
+                logger.info('[mainView]: 鏀跺埌搴撳尯鍚嶇О鍜屼粨鍙锋洿鏂颁簨浠�')
+                updateWarehouseInfo()
+            })
+
+            // 閫氳缁撴灉浜嬩欢鐩戝惉锛堝鐞嗘垚鍔熷拰澶辫触锛�
+            bus.on('accessRes', (result, data) => {
+                logger.info('[mainView]: accessRes浜嬩欢瑙﹀彂, result=' + result + ', data=' + JSON.stringify(data))
+                
+                // 娓呴櫎涔嬪墠鐨勫畾鏃跺櫒
+                if (resetTimerId) {
+                    std.clearTimeout(resetTimerId)
+                    resetTimerId = null
+                    logger.info('[mainView]: 娓呴櫎涔嬪墠鐨勯噸缃畾鏃跺櫒')
+                }
+                
+                // 濡傛灉鏄�氳鎴愬姛锛屾墽琛岄�氳鎴愬姛鐨勯�昏緫
+                if (result) {
+                    // 妫�鏌ユ槸鍚︽槸鍙屼汉璁よ瘉
+                    if (data && data.data && data.data.dualAuthInfo) {
+                        // 鍙屼汉璁よ瘉锛屽垎鍒洿鏂扮敤鎴�1鍜岀敤鎴�2鐨刄I
+                        let dualAuthInfo = data.data.dualAuthInfo
+                        // 璁剧疆璁よ瘉瀹屾垚鏍囧織
+                        mainView.authComplete = true
+                        
+                        // 瀛樺偍宸叉牳楠屾垚鍔熺殑鐢ㄦ埛淇℃伅
+                        mainView.verifiedUsers[1] = dualAuthInfo.firstUserId
+                        mainView.verifiedUsers[2] = dualAuthInfo.secondUserId
+                        logger.info('[mainView]: 瀛樺偍鍙屼汉璁よ瘉鐢ㄦ埛淇℃伅, user1=' + dualAuthInfo.firstUserId + ', user2=' + dualAuthInfo.secondUserId)
+                        
+                        // 鍙洿鏂扮敤鎴�2鐨勪俊鎭紝鐢ㄦ埛1鐨勪俊鎭凡缁忓湪trackResult浜嬩欢涓洿鏂�
+                        let ret2 = sqliteService.d1_person.find({ userId: dualAuthInfo.secondUserId })
+                        if (ret2 && ret2.length > 0) {
+                            let userName2 = ret2[0].name
+                            let userType2 = 0
+                            try {
+                                userType2 = JSON.parse(ret2[0].extra).type || 0
+                            } catch (error) {
+                                logger.error("瑙f瀽鐢ㄦ埛2绫诲瀷澶辫触")
+                            }
+                            
+                            // 妫�鏌ョ敤鎴�2鏉冮檺
+                            let hasPermission2 = false
+                            let permissions2 = sqliteService.d1_permission.find({ userId: dualAuthInfo.secondUserId })
+                            if (permissions2 && permissions2.length > 0) {
+                                hasPermission2 = true
+                            }
+                            
+                            // 鏇存柊鐢ㄦ埛2鐨刄I
+                            if (mainView.user2Name) {
+                                mainView.user2Name.text(userName2)
+                            }
+                            if (mainView.user2Role) {
+                                mainView.user2Role.text(userType2 === 1 ? '绉戦暱' : '淇濈鍛�')
+                            }
+                            if (mainView.user2StatusLbl) {
+                                if (hasPermission2) {
+                                    mainView.user2Box.source('/app/code/resource/image/user_s.png') // 鏍搁獙鎴愬姛鑳屾櫙鍥�
+                                    mainView.user2StatusLbl.text('鏍搁獙鎴愬姛')
+                                } else {
+                                    mainView.user2Box.source('/app/code/resource/image/user_f.png') // 鏍搁獙澶辫触鑳屾櫙鍥�
+                                    mainView.user2StatusLbl.text('鏍搁獙澶辫触')
+                                }
+                            }
+                            
+                            logger.info('[mainView]: 鐢ㄦ埛2淇℃伅宸叉洿鏂帮細' + userName2 + ', ' + (userType2 === 1 ? '绉戦暱' : '淇濈鍛�') + ', ' + (hasPermission2 ? '鏍搁獙鎴愬姛' : '鏍搁獙澶辫触'))
+                        }
+                    } else {
+                        // 鍗曚汉璁よ瘉锛屾鏌ョ敤鎴锋槸鍚﹀凡缁忎綔涓虹浜岀敤鎴疯繘琛屼簡璁よ瘉
+                        if (data && data.data && data.data.userId) {
+                            let userId = data.data.userId
+                            // 妫�鏌ョ敤鎴锋槸鍚﹀凡缁忎綔涓虹浜岀敤鎴疯繘琛屼簡璁よ瘉
+                            if (mainView.verifiedUsers[2] === userId) {
+                                // 鐢ㄦ埛宸茬粡浣滀负绗簩鐢ㄦ埛杩涜浜嗚璇侊紝涓嶆洿鏂扮敤鎴�1鐨刄I
+                                logger.info('[mainView]: 鐢ㄦ埛宸蹭綔涓虹浜岀敤鎴疯繘琛屼簡璁よ瘉锛屼笉鏇存柊鐢ㄦ埛1鐨刄I')
+                            } else {
+                                // 瀛樺偍宸叉牳楠屾垚鍔熺殑鐢ㄦ埛淇℃伅
+                                mainView.verifiedUsers[1] = userId
+                                logger.info('[mainView]: 瀛樺偍鍗曚汉璁よ瘉鐢ㄦ埛淇℃伅, user1=' + userId)
+                                
+                                let ret = sqliteService.d1_person.find({ userId: userId })
+                                
+                                if (ret && ret.length > 0) {
+                                    let userName = ret[0].name
+                                    let userType = 0
+                                    try {
+                                        userType = JSON.parse(ret[0].extra).type || 0
+                                    } catch (error) {
+                                        logger.error("瑙f瀽鐢ㄦ埛绫诲瀷澶辫触")
+                                    }
+                                    
+                                    // 妫�鏌ョ敤鎴锋潈闄�
+                                    let hasPermission = false
+                                    let permissions = sqliteService.d1_permission.find({ userId: userId })
+                                    if (permissions && permissions.length > 0) {
+                                        hasPermission = true
+                                    }
+                                    
+                                    // 鏇存柊鐢ㄦ埛1鐨刄I
+                                    if (mainView.user1Name) {
+                                        mainView.user1Name.text(userName)
+                                    }
+                                    if (mainView.user1Role) {
+                                        mainView.user1Role.text(userType === 1 ? '绉戦暱' : '淇濈鍛�')
+                                    }
+                                    // 鏇存柊鏍搁獙鍖鸿儗鏅壊鍜岀姸鎬佹枃鏈�
+                                    if (mainView.user1StatusLbl) {
+                                        if (hasPermission) {
+                                            mainView.user1Box.source('/app/code/resource/image/user_s.png') // 鏍搁獙鎴愬姛鑳屾櫙鍥�
+                                            mainView.user1StatusLbl.text('鏍搁獙鎴愬姛')
+                                        } else {
+                                            mainView.user1Box.source('/app/code/resource/image/user_f.png') // 鏍搁獙澶辫触鑳屾櫙鍥�
+                                            mainView.user1StatusLbl.text('鏍搁獙澶辫触')
+                                        }
+                                    }
+                                    logger.info('[mainView]: 鐢ㄦ埛1淇℃伅宸叉洿鏂帮細' + userName + ', ' + (userType === 1 ? '绉戦暱' : '淇濈鍛�') + ', ' + (hasPermission ? '鏍搁獙鎴愬姛' : '鏍搁獙澶辫触'))
+                                }
+                            }
+                        }
+                    }
+                } else {
+                    // 閫氳澶辫触锛屾樉绀哄け璐ヤ俊鎭�
+                    if (mainView.smallStatusPanel && mainView.smallStatusPanel.fail) {
+                        mainView.smallStatusPanel.fail('mainView.fail')
+                    }
+                }
+                
+                // 璁剧疆1鍒嗛挓鍚庨噸缃敤鎴稶I鐨勫畾鏃跺櫒
+                resetTimerId = std.setTimeout(() => {
+                    logger.info('[mainView]: 1鍒嗛挓瀹氭椂鍣ㄨЕ鍙戯紝閲嶇疆鐢ㄦ埛UI')
+                    // 瑙﹀彂閫氳瑙i攣瀹屾垚浜嬩欢锛岄�氱煡UI閲嶇疆
+                    bus.fire("accessUnlockComplete")
+                }, 60000) // 60000姣 = 1鍒嗛挓
+                logger.info('[mainView]: 璁剧疆1鍒嗛挓鍚庨噸缃敤鎴稶I鐨勫畾鏃跺櫒')
+            })
+            
+            // 鐘舵�佷俊鎭洿鏂颁簨浠剁洃鍚�
+            bus.on('statusInfoUpdated', (data) => {
+                // 鍙鐞嗗畨鍏ㄥ叆浠撴帶鍒剁殑鍝嶅簲锛屽拷鐣ラ潪瀹夊叏鍏ヤ粨鎺у埗鐨勫搷搴�
+                const safeInputControlFunctionId = config['functionId.safeInputControl'] || '2000'
+                if (data.functionId && data.functionId !== safeInputControlFunctionId) {
+                    logger.info(`[mainView]: 蹇界暐闈炲畨鍏ㄥ叆浠撴帶鍒剁殑鍝嶅簲锛宖unctionId=${data.functionId}`)
+                    return
+                }
+                
+                // 杩欓噷鍙互鏍规嵁瀹為檯鐨勭姸鎬佷俊鎭暟鎹粨鏋勬潵鏇存柊UI
+                logger.info(`[mainView]: 鐘舵�佷俊鎭洿鏂�: ${JSON.stringify(data)}`)
+                
+                // 妫�鏌ヨ繑鍥炵殑mode鍜宐tn鍙傛暟
+                if (data.data) {
+                    const mode = parseInt(data.data.mode) // 灏嗗瓧绗︿覆杞崲涓烘暟瀛�
+                    const btn = parseInt(data.data.btn) // 灏嗗瓧绗︿覆杞崲涓烘暟瀛�
+                    
+                    logger.info(`[mainView]: 鎺ユ敹鍒癿ode=${mode}, btn=${btn}`)
+                    
+                    // 閲嶇疆鎵�鏈夋寜閽负钃濊壊鑳屾櫙
+                    if (mainView.mode1Btn) mainView.mode1Btn.bgColor(0x017FEB)
+                    if (mainView.inBtn) mainView.inBtn.bgColor(0x017FEB)
+                    if (mainView.outBtn) mainView.outBtn.bgColor(0x017FEB)
+                    if (mainView.mode2Btn) mainView.mode2Btn.bgColor(0x017FEB)
+                    if (mainView.startBtn) mainView.startBtn.bgColor(0x017FEB)
+                    if (mainView.stopBtn) mainView.stopBtn.bgColor(0x017FEB)
+                    if (mainView.mode3Btn) mainView.mode3Btn.bgColor(0x017FEB)
+                    if (mainView.emergencyInBtn) mainView.emergencyInBtn.bgColor(0x017FEB)
+                    if (mainView.emergencyOutBtn) mainView.emergencyOutBtn.bgColor(0x017FEB)
+                    
+                    // 鏍规嵁mode鍜宐tn鏇存柊鎸夐挳鐘舵��
+                    if (mode === 1) {
+                        // 鍏佽杩涗粨妯″紡
+                        if (mainView.mode1Btn) mainView.mode1Btn.bgColor(0x037D41) // 鍏佽杩涗粨妯″紡鎸夐挳璁句负缁胯壊
+                        if (btn === 1) {
+                            // 鍏ヤ粨
+                            if (mainView.inBtn) mainView.inBtn.bgColor(0x037D41) // 鍏ヤ粨鎸夐挳璁句负缁胯壊
+                        } else if (btn === 2) {
+                            // 鍑轰粨
+                            if (mainView.outBtn) mainView.outBtn.bgColor(0x037D41) // 鍑轰粨鎸夐挳璁句负缁胯壊
+                        }
+                    } else if (mode === 2) {
+                        // 鍐閫氶妯″紡
+                        if (mainView.mode2Btn) mainView.mode2Btn.bgColor(0x037D41) // 鍐閫氶妯″紡鎸夐挳璁句负缁胯壊
+                        if (btn === 1) {
+                            // 鍚姩
+                            if (mainView.startBtn) mainView.startBtn.bgColor(0x037D41) // 鍚姩鎸夐挳璁句负缁胯壊
+                        } else if (btn === 2) {
+                            // 鍏抽棴
+                            if (mainView.stopBtn) mainView.stopBtn.bgColor(0x037D41) // 鍏抽棴鎸夐挳璁句负缁胯壊
+                        }
+                    } else if (mode === 3) {
+                        // 绂佹杩涗粨妯″紡
+                        if (mainView.mode3Btn) mainView.mode3Btn.bgColor(0x037D41) // 绂佹杩涗粨妯″紡鎸夐挳璁句负缁胯壊
+                        if (btn === 1) {
+                            // 绱ф�ュ叆浠�
+                            if (mainView.emergencyInBtn) mainView.emergencyInBtn.bgColor(0x037D41) // 绱ф�ュ叆浠撴寜閽涓虹豢鑹�
+                        } else if (btn === 2) {
+                            // 鍑轰粨
+                            if (mainView.emergencyOutBtn) mainView.emergencyOutBtn.bgColor(0x037D41) // 鍑轰粨鎸夐挳璁句负缁胯壊
+                        }
+                    }
+                } else if (data.safeInput) {
+                    // 浼犵粺鏂瑰紡鏇存柊鎸夐挳鐘舵�侊紙0-钃濊壊锛�1-缁胯壊锛�
+                    // 鍏佽杩涗粨妯″紡鐩稿叧鎸夐挳
+                    if (mainView.mode1Btn) {
+                        mainView.mode1Btn.bgColor(data.safeInput.A === '1' ? 0x037D41 : 0x017FEB)
+                    }
+                    if (mainView.inBtn) {
+                        mainView.inBtn.bgColor(data.safeInput.A1 === '1' ? 0x037D41 : 0x017FEB)
+                    }
+                    if (mainView.outBtn) {
+                        mainView.outBtn.bgColor(data.safeInput.A2 === '1' ? 0x037D41 : 0x017FEB)
+                    }
+                    
+                    // 鍐閫氶妯″紡鐩稿叧鎸夐挳
+                    if (mainView.mode2Btn) {
+                        mainView.mode2Btn.bgColor(data.safeInput.B === '1' ? 0x037D41 : 0x017FEB)
+                    }
+                    if (mainView.startBtn) {
+                        mainView.startBtn.bgColor(data.safeInput.B1 === '1' ? 0x037D41 : 0x017FEB)
+                    }
+                    if (mainView.stopBtn) {
+                        mainView.stopBtn.bgColor(data.safeInput.B2 === '1' ? 0x037D41 : 0x017FEB)
+                    }
+                    
+                    // 绂佹杩涗粨妯″紡鐩稿叧鎸夐挳
+                    if (mainView.mode3Btn) {
+                        mainView.mode3Btn.bgColor(data.safeInput.C === '1' ? 0x037D41 : 0x017FEB)
+                    }
+                    if (mainView.emergencyInBtn) {
+                        mainView.emergencyInBtn.bgColor(data.safeInput.C1 === '1' ? 0x037D41 : 0x017FEB)
+                    }
+                    if (mainView.emergencyOutBtn) {
+                        mainView.emergencyOutBtn.bgColor(data.safeInput.C2 === '1' ? 0x037D41 : 0x017FEB)
+                    }
+                }
+            })
+            
+            // 閫氳瑙i攣瀹屾垚浜嬩欢鐩戝惉锛岄噸缃敤鎴稶I
+            bus.on('accessUnlockComplete', () => {
+                logger.info('[mainView]: accessUnlockComplete浜嬩欢瑙﹀彂锛岄噸缃敤鎴稶I')
+                
+                // 閲嶇疆璁よ瘉瀹屾垚鏍囧織
+                mainView.authComplete = false
+                // 閲嶇疆宸叉牳楠岀敤鎴蜂俊鎭�
+                mainView.verifiedUsers = {}
+                
+                // 閲嶇疆鐢ㄦ埛1鐨刄I
+                if (mainView.user1Name) {
+                    mainView.user1Name.text('xx')
+                }
+                if (mainView.user1Role) {
+                    mainView.user1Role.text('淇濈鍛�')
+                }
+                if (mainView.user1Box && mainView.user1StatusLbl) {
+                    mainView.user1Box.source('/app/code/resource/image/user_w.png') // 寰呮牳楠岃儗鏅浘
+                    mainView.user1StatusLbl.text('寰呮牳楠�')
+                }
+                
+                // 閲嶇疆鐢ㄦ埛2鐨刄I
+                if (mainView.user2Name) {
+                    mainView.user2Name.text('xx')
+                }
+                if (mainView.user2Role) {
+                    mainView.user2Role.text('淇濈鍛�')
+                }
+                if (mainView.user2Box && mainView.user2StatusLbl) {
+                    mainView.user2Box.source('/app/code/resource/image/user_w.png') // 寰呮牳楠岃儗鏅浘
+                    mainView.user2StatusLbl.text('寰呮牳楠�')
+                }
+    
+                
+                // 鎭㈠浜鸿劯璁よ瘉鍔熻兘
+                try {
+                    driver.face.status(true)
+                    logger.info('[mainView]: 鎭㈠浜鸿劯璁よ瘉鍔熻兘')
+                } catch (error) {
+                    logger.error('[mainView]: 鎭㈠浜鸿劯璁よ瘉鍔熻兘澶辫触: ' + error.message)
+                }
+                
+                logger.info('[mainView]: 鐢ㄦ埛UI宸查噸缃�')
+            })
+            
+            // 浜鸿劯璇嗗埆缁撴灉浜嬩欢鐩戝惉锛堢Щ鍒癓V_EVENT_SCREEN_LOADED鍥炶皟涓級
+            if (!mainView.trackResultListenerRegistered) {
+                logger.info('[mainView]: 寮�濮嬫敞鍐宼rackResult浜嬩欢鐩戝惉鍣�')
+                bus.on('trackResult', (data) => {
+                    logger.info('[mainView]: trackResult浜嬩欢瑙﹀彂, data=' + JSON.stringify(data))
+                    logger.info('[mainView]: authComplete=' + mainView.authComplete + ', data.result=' + data.result + ', data.userId=' + data.userId + ', data.userIndex=' + data.userIndex + ', data.fileName=' + data.fileName)
+                    
+                    // 鍙湪浜鸿劯璁よ瘉鎴愬姛鏃跺瓨鍌ㄧ敤鎴蜂俊鎭�
+                    if (data.result === true && data.userId) {
+                        // 瀛樺偍宸叉牳楠屾垚鍔熺殑鐢ㄦ埛淇℃伅锛堟棤璁烘槸鍚︽湁鏉冮檺閮藉瓨鍌級
+                        mainView.verifiedUsers[data.userIndex] = data.userId
+                        logger.info('[mainView]: 瀛樺偍宸叉牳楠屾垚鍔熺殑鐢ㄦ埛淇℃伅, userIndex=' + data.userIndex + ', userId=' + data.userId)
+                        
+                        // 璋冪敤updateUserUI鏂规硶鏇存柊鐢ㄦ埛UI锛屼紶閫掍汉鑴稿浘鐗囪矾寰�
+                        mainView.updateUserUI(data.userIndex, data.userId, false, data.fileName)
+                    }
+                })
+                mainView.trackResultListenerRegistered = true
+                logger.info('[mainView]: trackResult浜嬩欢鐩戝惉鍣ㄦ敞鍐屽畬鎴�')
+            }
+            
+            mainView.eventListenersRegistered = true
+            logger.info('[mainView]: 浜嬩欢鐩戝惉鍣ㄦ敞鍐屽畬鎴�')
+        }
+
+        // 瀛樺偍瀹氭椂鍣↖D
+        let resetTimerId = null
+
+        // 鑾峰彇姘斾綋娴撳害鍜岀姸鎬佷俊鎭�
+        grainService.checkGasConcentration()
+        grainService.checkDevConcentration()
+
+        // screen.trackUpdate()
+        screen.appMode(screen.getConfig()["base.appMode"])
+        
+        // 寮�濮嬩汉鑴歌瘑鍒紙绉诲埌灞忓箷鍔犺浇瀹屾垚鍚庯級
+        screen.faceRecgStart()
+    })
+
+
+
+    screenMain.on(dxui.Utils.ENUM.LV_EVENT_SCREEN_UNLOADED, () => {
+        screen.faceRecgPause()
+    })
+
+    mainView.trackFaces = []
+    for (let i = 0; i < 10; i++) {
+        let item = {}
+        const trackFace = dxui.View.build('trackFace' + i, screenMain)
+        item.trackFace = trackFace
+        viewUtils._clearStyle(trackFace)
+        trackFace.setSize(200, 200)
+        trackFace.borderWidth(5)
+        trackFace.setBorderColor(0xffffff)
+        trackFace.bgOpa(0)
+        trackFace.hide()
+
+        const trackFaceName = dxui.Label.build('trackFaceName' + i, trackFace)
+        item.trackFaceName = trackFaceName
+        trackFaceName.textFont(viewUtils.font(30))
+        trackFaceName.textColor(0xffffff)
+        trackFaceName.text(" ")
+        trackFaceName.align(dxui.Utils.ALIGN.BOTTOM_MID, 0, 0)
+        // trackFaceName.hide()
+
+
+        mainView.trackFaces.push(item)
+    }
+
+    // const trackFace = dxui.View.build('trackFace', screenMain)
+    // mainView.trackFace = trackFace
+    // viewUtils._clearStyle(trackFace)
+    // trackFace.setSize(200, 200)
+    // trackFace.borderWidth(5)
+    // trackFace.bgOpa(0)
+    // trackFace.hide()
+
+    // const trackFaceName = dxui.Label.build('trackFaceName', trackFace)
+    // mainView.trackFaceName = trackFaceName
+    // trackFaceName.textFont(viewUtils.font(30))
+    // trackFaceName.textColor(0xffffff)
+    // trackFaceName.text(" ")
+    // trackFaceName.align(dxui.Utils.ALIGN.BOTTOM_MID, 0, 0)
+
+    const bottomBox = dxui.Image.build('bottomBox', screenMain)
+    mainView.bottomBox = bottomBox
+    bottomBox.source('/app/code/resource/image/rectangle.png')
+    bottomBox.align(dxui.Utils.ALIGN.BOTTOM_MID, 0, 0)
+    bottomBox.hide() // 闅愯棌bottomBox
+    const bottomSnBtn = dxui.Button.build('bottomSnBtn', bottomBox)
+    mainView.bottomSnBtn = bottomSnBtn
+    bottomSnBtn.bgColor(0xffffff)
+    bottomSnBtn.bgOpa(20)
+    bottomSnBtn.setSize(204, 36)
+    bottomSnBtn.shadow(0, 0, 0, 0, 0xffffff, 100)
+    bottomSnBtn.align(dxui.Utils.ALIGN.BOTTOM_LEFT, 13, -18)
+    bottomSnBtn.on(dxui.Utils.EVENT.CLICK, () => {
+        // 绉婚櫎浜岀淮鐮佹樉绀哄姛鑳�
+    })
+    bottomSnBtn.flexFlow(dxui.Utils.FLEX_FLOW.ROW)
+    bottomSnBtn.flexAlign(dxui.Utils.FLEX_ALIGN.CENTER, dxui.Utils.FLEX_ALIGN.CENTER, dxui.Utils.FLEX_ALIGN.CENTER)
+    bottomSnBtn.obj.lvObjSetStylePadGap(5, dxui.Utils.ENUM._LV_STYLE_STATE_CMP_SAME)
+
+    // 娣诲姞鍗婇�忔槑瑕嗙洊鍥惧眰
+    const overlayBox = dxui.View.build('overlayBox', screenMain)
+    mainView.overlayBox = overlayBox
+    viewUtils._clearStyle(overlayBox)
+    overlayBox.setSize(screen.screenSize.width, screen.screenSize.height)
+    overlayBox.align(dxui.Utils.ALIGN.TOP_MID, 0, 0)
+    overlayBox.bgColor(0xffffff)
+    overlayBox.bgOpa(50) // 鍗婇�忔槑鏁堟灉
+    overlayBox.clickable(false) // 涓嶆嫤鎴偣鍑讳簨浠讹紝璁╃偣鍑诲彲浠ョ┛閫�
+    overlayBox.scroll(false) // 绂佺敤婊氬姩鍔熻兘
+    overlayBox.show() // 纭繚overlayBox鏄剧ず
+    logger.info('[mainView]: overlayBox宸插垱寤哄苟鏄剧ず')
+
+    // 鍦╫verlayBox涓婂垱寤鸿璇佺粨鏋滃睍绀哄尯鍩燂紙浣嶄簬userBox鍜宑ontrolBox涔嬮棿锛�
+    // 鍒濆鍖栧皬鍨嬬姸鎬侀潰鏉�
+    mainView.smallStatusPanel = viewUtils.smallStatusPanel(overlayBox, 'mainView.success', 'mainView.fail')
+    // 璋冩暣灏忓瀷鐘舵�侀潰鏉夸綅缃�
+    if (mainView.smallStatusPanel.successBg) {
+        mainView.smallStatusPanel.successBg.align(dxui.Utils.ALIGN.TOP_MID, 0, 450)
+    }
+    if (mainView.smallStatusPanel.failBg) {
+        mainView.smallStatusPanel.failBg.align(dxui.Utils.ALIGN.TOP_MID, 0, 450)
+    }
+
+    // 璁惧淇℃伅鏄剧ず锛圫N鍜孖P锛�- 鎻愬墠瀹氫箟锛岀‘淇濆湪鍥炶皟涓彲鐢�
+    const mainDeviceInfoBox = dxui.View.build('mainDeviceInfoBox', overlayBox)
+    viewUtils._clearStyle(mainDeviceInfoBox)
+    mainDeviceInfoBox.setSize(screen.screenSize.width, 40)
+    mainDeviceInfoBox.align(dxui.Utils.ALIGN.BOTTOM_MID, 0, 20) // 璋冩暣浣嶇疆锛岃窛绂诲簳閮�20px
+    mainDeviceInfoBox.bgOpa(0)
+    mainDeviceInfoBox.flexFlow(dxui.Utils.FLEX_FLOW.ROW)
+    mainDeviceInfoBox.flexAlign(dxui.Utils.FLEX_ALIGN.SPACE_BETWEEN, dxui.Utils.FLEX_ALIGN.CENTER, dxui.Utils.FLEX_ALIGN.CENTER)
+
+    // SN淇℃伅
+    const overlaySnLbl = dxui.Label.build('overlaySnLbl', mainDeviceInfoBox)
+    overlaySnLbl.text("SN:")
+    overlaySnLbl.textFont(viewUtils.font(16)) // 澧炲ぇ瀛椾綋
+    overlaySnLbl.textColor(0x000000)
+    overlaySnLbl.width(220)
+    overlaySnLbl.longMode(dxui.Utils.LABEL_LONG_MODE.SCROLL_CIRCULAR)
+    overlaySnLbl.align(dxui.Utils.ALIGN.BOTTOM_LEFT, 30, 0) // 璋冩暣浣嶇疆锛岃窛绂诲乏渚�30px
+
+    // IP淇℃伅
+    const overlayIpLbl = dxui.Label.build('overlayIpLbl', mainDeviceInfoBox)
+    mainView.overlayIpLbl = overlayIpLbl
+    mainView.overlaySnLbl = overlaySnLbl
+    overlayIpLbl.text("IP:")
+    overlayIpLbl.textFont(viewUtils.font(16)) // 澧炲ぇ瀛椾綋
+    overlayIpLbl.textColor(0x000000)
+    overlayIpLbl.align(dxui.Utils.ALIGN.BOTTOM_RIGHT, -30, 0) // 璋冩暣浣嶇疆锛岃窛绂诲彸渚�30px
+
+    // 椤堕儴鏍囬鏍�
+    const headerBox = dxui.View.build('headerBox', overlayBox)
+    viewUtils._clearStyle(headerBox)
+    headerBox.setSize(screen.screenSize.width, 63) // 澧炲ぇ楂樺害
+    headerBox.align(dxui.Utils.ALIGN.TOP_MID, 0, 0)
+    headerBox.bgColor(0x037D41)
+    headerBox.flexFlow(dxui.Utils.FLEX_FLOW.ROW)
+    headerBox.flexAlign(dxui.Utils.FLEX_ALIGN.CENTER, dxui.Utils.FLEX_ALIGN.CENTER, dxui.Utils.FLEX_ALIGN.CENTER)
+    headerBox.obj.lvObjSetStylePadGap(10, dxui.Utils.ENUM._LV_STYLE_STATE_CMP_SAME)
+    
+    // 娣诲姞logo鍥炬爣
+    const logoImg = dxui.Image.build('logoImg', headerBox)
+    logoImg.source('/app/code/resource/image/logo.png')
+    logoImg.setSize(34, 37)
+    
+    const headerLbl = dxui.Label.build('headerLbl', headerBox)
+    mainView.headerLbl = headerLbl
+    // 浠庨厤缃腑鑾峰彇搴撳尯鍚嶇О
+    const config = screen.getConfig()
+    const GranaryName = config['GranaryName'] || '涓ぎ鍌ㄥ绮煇鏌愮洿灞炲簱'
+    headerLbl.text(GranaryName)
+    headerLbl.textFont(viewUtils.font(34)) // 澧炲ぇ瀛椾綋
+    headerLbl.textColor(0xffffff)
+
+    // 浠撳彿鏄剧ず
+    const warehouseLbl = dxui.Label.build('warehouseLbl', overlayBox)
+    mainView.warehouseLbl = warehouseLbl
+    // 浠庨厤缃腑鑾峰彇浠撳彿淇℃伅
+    const houseName = config['houseName'] || '01鍙蜂粨'
+    warehouseLbl.text(houseName)
+    warehouseLbl.textFont(viewUtils.font(34, dxui.Utils.FONT_STYLE.BOLD))
+    warehouseLbl.textColor(0x000000)
+    warehouseLbl.align(dxui.Utils.ALIGN.TOP_MID, 0, 80)
+
+    // 姘斾綋娴撳害鏄剧ず
+    const gasBox = dxui.View.build('gasBox', overlayBox)
+    viewUtils._clearStyle(gasBox)
+    gasBox.setSize(screen.screenSize.width, 180)
+    gasBox.align(dxui.Utils.ALIGN.TOP_MID, 11, 140)
+    gasBox.bgOpa(0)
+    gasBox.flexFlow(dxui.Utils.FLEX_FLOW.ROW)
+    gasBox.flexAlign(dxui.Utils.FLEX_ALIGN.FLEX_START, dxui.Utils.FLEX_ALIGN.CENTER, dxui.Utils.FLEX_ALIGN.CENTER)
+    gasBox.obj.lvObjSetStylePadGap(30, dxui.Utils.ENUM._LV_STYLE_STATE_CMP_SAME) // 璁剧疆姘斾綋妗嗛棿璺�
+
+    // 姘ф皵娴撳害
+    const oxygenBox = dxui.Image.build('oxygenBox', gasBox)
+    viewUtils._clearStyle(oxygenBox)
+    oxygenBox.setSize(239, 166)
+    oxygenBox.source('/app/code/resource/image/o2_s.png') // 榛樿浣跨敤鍚堟牸鑳屾櫙鍥�
+    mainView.oxygenBox = oxygenBox // 璁剧疆涓簃ainView灞炴��
+    
+    const oxygenTitle = dxui.Label.build('oxygenTitle', oxygenBox)
+    oxygenTitle.text('姘ф皵')
+    oxygenTitle.textFont(viewUtils.font(24))
+    oxygenTitle.textColor(0xffffff)
+    oxygenTitle.align(dxui.Utils.ALIGN.TOP_MID, 0, 18)
+    
+    // 姘ф皵鏁板�煎拰鍗曚綅瀹瑰櫒
+    const oxygenValueContainer = dxui.View.build('oxygenValueContainer', oxygenBox)
+    viewUtils._clearStyle(oxygenValueContainer)
+    oxygenValueContainer.setSize(100, 40)
+    oxygenValueContainer.bgOpa(0)
+    oxygenValueContainer.align(dxui.Utils.ALIGN.CENTER, 0, 0)
+    oxygenValueContainer.flexFlow(dxui.Utils.FLEX_FLOW.ROW)
+    oxygenValueContainer.flexAlign(dxui.Utils.FLEX_ALIGN.CENTER, dxui.Utils.FLEX_ALIGN.CENTER, dxui.Utils.FLEX_ALIGN.CENTER)
+    oxygenValueContainer.obj.lvObjSetStylePadGap(5, dxui.Utils.ENUM._LV_STYLE_STATE_CMP_SAME)
+    
+    // 姘ф皵鏁板�奸儴鍒�
+    const oxygenValue = dxui.Label.build('oxygenValue', oxygenValueContainer)
+    oxygenValue.text('20')
+    oxygenValue.textFont(viewUtils.font(26, dxui.Utils.FONT_STYLE.BOLD))
+    oxygenValue.textColor(0xffffff)
+    mainView.oxygenValue = oxygenValue // 璁剧疆涓簃ainView灞炴��
+    
+    // 姘ф皵鍗曚綅閮ㄥ垎
+    const oxygenUnit = dxui.Label.build('oxygenUnit', oxygenValueContainer)
+    oxygenUnit.text('%')
+    oxygenUnit.textFont(viewUtils.font(14))
+    oxygenUnit.textColor(0xffffff)
+    mainView.oxygenUnit = oxygenUnit // 璁剧疆涓簃ainView灞炴��
+    
+    const oxygenStatus = dxui.Label.build('oxygenStatus', oxygenBox)
+    oxygenStatus.text('鍚堟牸')
+    oxygenStatus.textFont(viewUtils.font(24, dxui.Utils.FONT_STYLE.BOLD))
+    oxygenStatus.textColor(0xffffff)
+    oxygenStatus.align(dxui.Utils.ALIGN.BOTTOM_MID, 0, -20)
+    mainView.oxygenStatus = oxygenStatus // 璁剧疆涓簃ainView灞炴��
+
+    // 纾峰寲姘㈡祿搴�
+    const ph3Box = dxui.Image.build('ph3Box', gasBox)
+    viewUtils._clearStyle(ph3Box)
+    ph3Box.setSize(239, 166)
+    ph3Box.source('/app/code/resource/image/ph3_s.png') // 榛樿浣跨敤鍚堟牸鑳屾櫙鍥�
+    mainView.ph3Box = ph3Box // 璁剧疆涓簃ainView灞炴��
+    
+    const ph3Title = dxui.Label.build('ph3Title', ph3Box)
+    ph3Title.text('纾峰寲姘�')
+    ph3Title.textFont(viewUtils.font(24))
+    ph3Title.textColor(0xffffff)
+    ph3Title.align(dxui.Utils.ALIGN.TOP_MID, 0, 18)
+    
+    // 纾峰寲姘㈡暟鍊煎拰鍗曚綅瀹瑰櫒
+    const ph3ValueContainer = dxui.View.build('ph3ValueContainer', ph3Box)
+    viewUtils._clearStyle(ph3ValueContainer)
+    ph3ValueContainer.setSize(100, 40)
+    ph3ValueContainer.bgOpa(0)
+    ph3ValueContainer.align(dxui.Utils.ALIGN.CENTER, 0, 0)
+    ph3ValueContainer.flexFlow(dxui.Utils.FLEX_FLOW.ROW)
+    ph3ValueContainer.flexAlign(dxui.Utils.FLEX_ALIGN.CENTER, dxui.Utils.FLEX_ALIGN.CENTER, dxui.Utils.FLEX_ALIGN.CENTER)
+    ph3ValueContainer.obj.lvObjSetStylePadGap(5, dxui.Utils.ENUM._LV_STYLE_STATE_CMP_SAME)
+    
+    // 纾峰寲姘㈡暟鍊奸儴鍒�
+    const ph3Value = dxui.Label.build('ph3Value', ph3ValueContainer)
+    ph3Value.text('0')
+    ph3Value.textFont(viewUtils.font(26, dxui.Utils.FONT_STYLE.BOLD))
+    ph3Value.textColor(0xffffff)
+    mainView.ph3Value = ph3Value // 璁剧疆涓簃ainView灞炴��
+    
+    // 纾峰寲姘㈠崟浣嶉儴鍒�
+    const ph3Unit = dxui.Label.build('ph3Unit', ph3ValueContainer)
+    ph3Unit.text('PPM')
+    ph3Unit.textFont(viewUtils.font(14))
+    ph3Unit.textColor(0xffffff)
+    mainView.ph3Unit = ph3Unit // 璁剧疆涓簃ainView灞炴��
+    
+    const ph3Status = dxui.Label.build('ph3Status', ph3Box)
+    ph3Status.text('鍚堟牸')
+    ph3Status.textFont(viewUtils.font(24, dxui.Utils.FONT_STYLE.BOLD))
+    ph3Status.textColor(0xffffff)
+    ph3Status.align(dxui.Utils.ALIGN.BOTTOM_MID, 0, -20)
+    mainView.ph3Status = ph3Status // 璁剧疆涓簃ainView灞炴��
+
+    // 浜屾哀鍖栫⒊娴撳害
+    const co2Box = dxui.Image.build('co2Box', gasBox)
+    viewUtils._clearStyle(co2Box)
+    co2Box.setSize(239, 166)
+    co2Box.source('/app/code/resource/image/co2_s.png') // 榛樿浣跨敤鍚堟牸鑳屾櫙鍥�
+    mainView.co2Box = co2Box // 璁剧疆涓簃ainView灞炴��
+    
+    const co2Title = dxui.Label.build('co2Title', co2Box)
+    co2Title.text('浜屾哀鍖栫⒊')
+    co2Title.textFont(viewUtils.font(24))
+    co2Title.textColor(0xffffff)
+    co2Title.align(dxui.Utils.ALIGN.TOP_MID, 0, 18)
+    
+    // 浜屾哀鍖栫⒊鏁板�煎拰鍗曚綅瀹瑰櫒
+    const co2ValueContainer = dxui.View.build('co2ValueContainer', co2Box)
+    viewUtils._clearStyle(co2ValueContainer)
+    co2ValueContainer.setSize(100, 40)
+    co2ValueContainer.bgOpa(0)
+    co2ValueContainer.align(dxui.Utils.ALIGN.CENTER, 0, 0)
+    co2ValueContainer.flexFlow(dxui.Utils.FLEX_FLOW.ROW)
+    co2ValueContainer.flexAlign(dxui.Utils.FLEX_ALIGN.CENTER, dxui.Utils.FLEX_ALIGN.CENTER, dxui.Utils.FLEX_ALIGN.CENTER)
+    co2ValueContainer.obj.lvObjSetStylePadGap(5, dxui.Utils.ENUM._LV_STYLE_STATE_CMP_SAME)
+    
+    // 浜屾哀鍖栫⒊鏁板�奸儴鍒�
+    const co2Value = dxui.Label.build('co2Value', co2ValueContainer)
+    co2Value.text('400')
+    co2Value.textFont(viewUtils.font(26, dxui.Utils.FONT_STYLE.BOLD))
+    co2Value.textColor(0xffffff)
+    mainView.co2Value = co2Value // 璁剧疆涓簃ainView灞炴��
+    
+    // 浜屾哀鍖栫⒊鍗曚綅閮ㄥ垎
+    const co2Unit = dxui.Label.build('co2Unit', co2ValueContainer)
+    co2Unit.text('PPM')
+    co2Unit.textFont(viewUtils.font(14))
+    co2Unit.textColor(0xffffff)
+    mainView.co2Unit = co2Unit // 璁剧疆涓簃ainView灞炴��
+    
+    const co2Status = dxui.Label.build('co2Status', co2Box)
+    co2Status.text('鍚堟牸')
+    co2Status.textFont(viewUtils.font(24, dxui.Utils.FONT_STYLE.BOLD))
+    co2Status.textColor(0xffffff)
+    co2Status.align(dxui.Utils.ALIGN.BOTTOM_MID, 0, -20)
+    mainView.co2Status = co2Status // 璁剧疆涓簃ainView灞炴��
+
+    // 鏃堕棿鏄剧ず
+    const timeLbl = dxui.Label.build('timeLbl', overlayBox)
+    timeLbl.text('12:30:30')
+    timeLbl.textFont(viewUtils.font(36))
+    timeLbl.textColor(0x000000)
+    timeLbl.align(dxui.Utils.ALIGN.TOP_MID, 0, 310)
+    
+    const overlayDateLbl = dxui.Label.build('overlayDateLbl', overlayBox)
+    overlayDateLbl.text('2026/02/01')
+    overlayDateLbl.textFont(viewUtils.font(20))
+    overlayDateLbl.textColor(0x000000)
+    overlayDateLbl.align(dxui.Utils.ALIGN.TOP_MID, 0, 360)
+    
+    // 瀹炴椂鏇存柊鏃堕棿鍜屾棩鏈�
+    std.setInterval(() => {
+        const t = new Date()
+        const pad = (n) => n < 10 ? `0${n}` : n
+        timeLbl.text(`${pad(t.getHours())}:${pad(t.getMinutes())}:${pad(t.getSeconds())}`)
+        overlayDateLbl.text(`${t.getFullYear()}/${pad(t.getMonth() + 1)}/${pad(t.getDate())}`)
+    }, 1000, true)
+
+    // 鐢ㄦ埛淇℃伅鏄剧ず
+    const userBox = dxui.View.build('userBox', overlayBox)
+    viewUtils._clearStyle(userBox)
+    userBox.setSize(screen.screenSize.width - 40, 193) // 鍑忓幓宸﹀彸鍚�20px鐨勮竟璺�
+    userBox.align(dxui.Utils.ALIGN.TOP_MID, 0, 620) 
+    userBox.bgColor(0x000000) // 璁剧疆鑳屾櫙棰滆壊涓洪粦鑹�
+    userBox.bgOpa(0) // 璁剧疆鑳屾櫙閫忔槑搴�
+    userBox.flexFlow(dxui.Utils.FLEX_FLOW.ROW)
+    userBox.flexAlign(dxui.Utils.FLEX_ALIGN.SPACE_BETWEEN, dxui.Utils.FLEX_ALIGN.CENTER, dxui.Utils.FLEX_ALIGN.CENTER)
+    userBox.show() // 纭繚鐢ㄦ埛UI鏄剧ず
+    mainView.userBox = userBox // 璁剧疆涓簃ainView灞炴��
+    logger.info('[mainView]: userBox宸插垱寤哄苟鏄剧ず鍦ㄩ《閮ㄤ笅鏂�580鍍忕礌浣嶇疆')
+
+    
+    // 鐢ㄦ埛1
+    const user1Box = dxui.Image.build('user1Box', userBox)
+    viewUtils._clearStyle(user1Box)
+    user1Box.setSize(239, 193) // 浣跨敤姝g‘鐨勮儗鏅浘鐗囧昂瀵�
+    user1Box.source('/app/code/resource/image/user_w.png') // 榛樿浣跨敤寰呮牳楠岃儗鏅浘
+    mainView.user1Box = user1Box // 璁剧疆涓簃ainView灞炴��
+    
+    // 濮撳悕
+    const user1Name = dxui.Label.build('user1Name', user1Box)
+    user1Name.text('xx')  //濮撳悕
+    user1Name.textFont(viewUtils.font(21, dxui.Utils.FONT_STYLE.BOLD))
+    user1Name.textColor(0xffffff)
+    user1Name.align(dxui.Utils.ALIGN.TOP_LEFT, 122, 25)
+    mainView.user1Name = user1Name // 璁剧疆涓簃ainView灞炴��
+    
+    // 鏉冮檺
+    const user1Role = dxui.Label.build('user1Role', user1Box)
+    user1Role.text('淇濈鍛�')
+    user1Role.textFont(viewUtils.font(19))
+    user1Role.textColor(0xffffff)
+    user1Role.align(dxui.Utils.ALIGN.TOP_LEFT, 122, 50)
+    mainView.user1Role = user1Role // 璁剧疆涓簃ainView灞炴��
+    
+    // 鏍搁獙鐘舵��
+    const user1StatusLbl = dxui.Label.build('user1StatusLbl', user1Box)
+    user1StatusLbl.text('寰呮牳楠�')
+    user1StatusLbl.textFont(viewUtils.font(22, dxui.Utils.FONT_STYLE.BOLD))
+    user1StatusLbl.textColor(0xffffff)
+    user1StatusLbl.align(dxui.Utils.ALIGN.BOTTOM_MID, 0, -45)
+    mainView.user1StatusLbl = user1StatusLbl // 璁剧疆涓簃ainView灞炴��
+
+    // 鐢ㄦ埛2
+    const user2Box = dxui.Image.build('user2Box', userBox)
+    viewUtils._clearStyle(user2Box)
+    user2Box.setSize(239, 193) // 浣跨敤姝g‘鐨勮儗鏅浘鐗囧昂瀵�
+    user2Box.source('/app/code/resource/image/user_w.png') // 榛樿浣跨敤寰呮牳楠岃儗鏅浘
+    mainView.user2Box = user2Box // 璁剧疆涓簃ainView灞炴��
+    
+    // 濮撳悕
+    const user2Name = dxui.Label.build('user2Name', user2Box)
+    user2Name.text('xx')
+    user2Name.textFont(viewUtils.font(21, dxui.Utils.FONT_STYLE.BOLD))
+    user2Name.textColor(0xffffff)
+    user2Name.align(dxui.Utils.ALIGN.TOP_LEFT, 122, 25)
+    mainView.user2Name = user2Name // 璁剧疆涓簃ainView灞炴��
+    
+    // 鏉冮檺
+    const user2Role = dxui.Label.build('user2Role', user2Box)
+    user2Role.text('淇濈鍛�')
+    user2Role.textFont(viewUtils.font(19))
+    user2Role.textColor(0xffffff)
+    user2Role.align(dxui.Utils.ALIGN.TOP_LEFT, 122, 50)
+    mainView.user2Role = user2Role // 璁剧疆涓簃ainView灞炴��
+    
+    // 鏍搁獙鐘舵��
+    const user2StatusLbl = dxui.Label.build('user2StatusLbl', user2Box)
+    user2StatusLbl.text('寰呮牳楠�')
+    user2StatusLbl.textFont(viewUtils.font(22, dxui.Utils.FONT_STYLE.BOLD))
+    user2StatusLbl.textColor(0xffffff)
+    user2StatusLbl.align(dxui.Utils.ALIGN.BOTTOM_MID, 0, -45)
+    mainView.user2StatusLbl = user2StatusLbl // 璁剧疆涓簃ainView灞炴��
+
+    // 鏇存柊鐢ㄦ埛UI鐨勬柟娉�
+    mainView.updateUserUI = function(userIndex, userId, forceUpdate = false, fileName = null) {
+        // 鍙湪璁よ瘉鏈畬鎴愭垨寮哄埗鏇存柊鏃舵洿鏂扮敤鎴稶I
+        if (!mainView.authComplete || forceUpdate) {
+            logger.info('[mainView]: 鍑嗗鏇存柊鐢ㄦ埛UI, userIndex=' + userIndex + ', userId=' + userId + ', forceUpdate=' + forceUpdate + ', fileName=' + fileName)
+            
+            // 鏌ヨ鐢ㄦ埛淇℃伅
+            let ret = sqliteService.d1_person.find({ userId: userId })
+            logger.info('[mainView]: 鏌ヨ鐢ㄦ埛缁撴灉, ret=' + JSON.stringify(ret))
+            
+            if (ret && ret.length > 0) {
+                let userName = ret[0].name
+                let userType = 0
+                try {
+                    userType = JSON.parse(ret[0].extra).type || 0
+                } catch (error) {
+                    logger.error("瑙f瀽鐢ㄦ埛绫诲瀷澶辫触")
+                }
+                
+                // 妫�鏌ョ敤鎴锋潈闄�
+                let hasPermission = false
+                let permissions = sqliteService.d1_permission.find({ userId: userId })
+                if (permissions && permissions.length > 0) {
+                    hasPermission = true
+                }
+                
+                // 鏍规嵁鐢ㄦ埛搴忓彿鏇存柊瀵瑰簲鐨刄I
+                if (userIndex === 1) {
+                    // 绗竴涓敤鎴凤紝鏇存柊鐢ㄦ埛1鐨刄I
+                    if (mainView.user1Name) {
+                        mainView.user1Name.text(userName)
+                    }
+                    if (mainView.user1Role) {
+                        mainView.user1Role.text(userType === 1 ? '绉戦暱' : '淇濈鍛�')
+                    }
+                    if (mainView.user1StatusLbl) {
+                        if (hasPermission) {
+                            mainView.user1Box.source('/app/code/resource/image/user_s.png') // 鏍搁獙鎴愬姛鑳屾櫙鍥�
+                            mainView.user1StatusLbl.text('鏍搁獙鎴愬姛')
+                        } else {
+                            mainView.user1Box.source('/app/code/resource/image/user_f.png') // 鏍搁獙澶辫触鑳屾櫙鍥�
+                            mainView.user1StatusLbl.text('鏍搁獙澶辫触')
+                        }
+                    }
+                    // 鏇存柊鐢ㄦ埛1鍥炬爣涓轰汉鑴歌璇佸浘鐗� - 宸叉敞閲婏紝浣跨敤鑳屾櫙鍥剧墖
+                    // if (fileName && mainView.user1Icon) {
+                    //     logger.info('[mainView]: 鏇存柊鐢ㄦ埛1鍥炬爣涓�: ' + fileName)
+                    //     try {
+                    //         // 鍏堣缃浘鏍囧ぇ灏忥紝纭繚瀹瑰櫒鍑嗗灏辩华
+                    //         mainView.user1Icon.setSize(160, 160)
+                    //         // 纭繚鍥剧墖灞呬腑鏄剧ず
+                    //         mainView.user1Icon.align(dxui.Utils.ALIGN.CENTER, 0, 0)
+                    //         
+                    //         // 鍏堟竻闄ゆ棫鍥剧墖锛岀‘淇濋噸鏂板姞杞�
+                    //         mainView.user1Icon.source('')
+                    //         mainView.user1Icon.update()
+                    //         mainView.user1Icon.invalidate()
+                    //         
+                    //         // 浣跨敤capturer璋冩暣鍥剧墖澶у皬
+                    //         // 娉ㄦ剰锛氫负閬垮厤鍐呭瓨閿欒锛屾殏鏃朵笉閿�姣佸浘鍍忓璞�
+                    //         try {
+                    //             // 灏嗗浘鐗囨枃浠惰浆鎹负鍥惧儚瀵硅薄
+                    //             const imageId = capturer.pictureFileToImage(fileName, 1) // 1琛ㄧずIMAGE_YUV420SP
+                    //             if (imageId) {
+                    //                 logger.info('[mainView]: 鍥剧墖杞崲鎴愬姛锛宨mageId=' + imageId)
+                    //                 // 璋冩暣鍥惧儚澶у皬涓�160x160
+                    //                 const resizedImageId = capturer.imageResizeResolution(imageId, 160, 160, 3) // 3琛ㄧずFILTER_MODE_BOX
+                    //                 if (resizedImageId) {
+                    //                     logger.info('[mainView]: 鍥剧墖璋冩暣鎴愬姛锛宺esizedImageId=' + resizedImageId)
+                    //                     // 淇濆瓨璋冩暣鍚庣殑鍥惧儚涓轰复鏃舵枃浠讹紙浣跨敤鍥哄畾璺緞锛屾瘡娆¤鐩栵級
+                    //                     const tempFileName = '/app/data/user/temp/user1_resized.jpg'
+                    //                     const saveResult = capturer.imageToPictureFile(resizedImageId, 1, 0, 80, tempFileName) // 0琛ㄧずTYPE_JPEG
+                    //                     if (saveResult) {
+                    //                         logger.info('[mainView]: 鍥剧墖淇濆瓨鎴愬姛锛宼empFileName=' + tempFileName)
+                    //                         // 浣跨敤璋冩暣鍚庣殑鍥剧墖浣滀负鍥炬爣婧�
+                    //                         mainView.user1Icon.source(tempFileName)
+                    //                     } else {
+                    //                         logger.error('[mainView]: 淇濆瓨璋冩暣鍚庣殑鍥剧墖澶辫触')
+                    //                         // 淇濆瓨澶辫触鏃朵娇鐢ㄥ師濮嬪浘鐗�
+                    //                         mainView.user1Icon.source(fileName)
+                    //                     }
+                    //                 } else {
+                    //                     logger.error('[mainView]: 璋冩暣鍥剧墖澶у皬澶辫触')
+                    //                     // 璋冩暣澶辫触鏃朵娇鐢ㄥ師濮嬪浘鐗�
+                    //                     mainView.user1Icon.source(fileName)
+                    //                 }
+                    //             } else {
+                    //                 logger.error('[mainView]: 杞崲鍥剧墖鏂囦欢澶辫触')
+                    //                 // 杞崲澶辫触鏃朵娇鐢ㄥ師濮嬪浘鐗�
+                    //                 mainView.user1Icon.source(fileName)
+                    //             }
+                    //         } catch (e) {
+                    //             logger.error('[mainView]: 澶勭悊鍥剧墖鏃跺嚭閿�: ' + e.message)
+                    //             // 鍑洪敊鏃朵娇鐢ㄥ師濮嬪浘鐗�
+                    //             mainView.user1Icon.source(fileName)
+                    //         }
+                    //         
+                    //         // 寮哄埗鏇存柊鍜岄噸缁�
+                    //         mainView.user1Icon.update()
+                    //         mainView.user1Icon.invalidate()
+                    //         logger.info('[mainView]: 鐢ㄦ埛1鍥炬爣鏇存柊鎴愬姛')
+                    //     } catch (error) {
+                    //         logger.error('[mainView]: 澶勭悊鍥剧墖鏃跺嚭閿�: ' + error.message)
+                    //         // 鍑洪敊鏃朵娇鐢ㄥ師濮嬪浘鐗�
+                    //         mainView.user1Icon.setSize(160, 160)
+                    //         mainView.user1Icon.align(dxui.Utils.ALIGN.CENTER, 0, 0)
+                    //         mainView.user1Icon.source(fileName)
+                    //         mainView.user1Icon.update()
+                    //         mainView.user1Icon.invalidate()
+                    //         logger.info('[mainView]: 鐢ㄦ埛1鍥炬爣鏇存柊澶辫触锛屼娇鐢ㄥ師濮嬪浘鐗�')
+                    //     }
+                    // } else {
+                    //     logger.error('[mainView]: 鏇存柊鐢ㄦ埛1鍥炬爣澶辫触锛宖ileName=' + fileName + ', user1Icon=' + mainView.user1Icon)
+                    // }
+                    logger.info('[mainView]: 鐢ㄦ埛1淇℃伅宸叉洿鏂帮細' + userName + ', ' + (userType === 1 ? '绉戦暱' : '淇濈鍛�') + ', ' + (hasPermission ? '鏍搁獙鎴愬姛' : '鏍搁獙澶辫触'))
+                } else if (userIndex === 2) {
+                    // 绗簩涓敤鎴凤紝鏇存柊鐢ㄦ埛2鐨刄I
+                    if (mainView.user2Name) {
+                        mainView.user2Name.text(userName)
+                    }
+                    if (mainView.user2Role) {
+                        mainView.user2Role.text(userType === 1 ? '绉戦暱' : '淇濈鍛�')
+                    }
+                    if (mainView.user2StatusLbl) {
+                        if (hasPermission) {
+                            mainView.user2Box.source('/app/code/resource/image/user_s.png') // 鏍搁獙鎴愬姛鑳屾櫙鍥�
+                            mainView.user2StatusLbl.text('鏍搁獙鎴愬姛')
+                        } else {
+                            mainView.user2Box.source('/app/code/resource/image/user_f.png') // 鏍搁獙澶辫触鑳屾櫙鍥�
+                            mainView.user2StatusLbl.text('鏍搁獙澶辫触')
+                        }
+                    }
+                    // 鏇存柊鐢ㄦ埛2鍥炬爣涓轰汉鑴歌璇佸浘鐗� - 宸叉敞閲婏紝浣跨敤鑳屾櫙鍥剧墖
+                    // if (fileName && mainView.user2Icon) {
+                    //     logger.info('[mainView]: 鏇存柊鐢ㄦ埛2鍥炬爣涓�: ' + fileName)
+                    //     try {
+                    //         // 鍏堣缃浘鏍囧ぇ灏忥紝纭繚瀹瑰櫒鍑嗗灏辩华
+                    //         mainView.user2Icon.setSize(160, 160)
+                    //         // 纭繚鍥剧墖灞呬腑鏄剧ず
+                    //         mainView.user2Icon.align(dxui.Utils.ALIGN.CENTER, 0, 0)
+                    //         
+                    //         // 鍏堟竻闄ゆ棫鍥剧墖锛岀‘淇濋噸鏂板姞杞�
+                    //         mainView.user2Icon.source('')
+                    //         mainView.user2Icon.update()
+                    //         mainView.user2Icon.invalidate()
+                    //         
+                    //         // 浣跨敤鍥剧墖澶勭悊娴佺▼锛岀‘淇濆浘鐗囨纭樉绀�
+                    //         logger.info('[mainView]: 寮�濮嬪鐞嗙敤鎴�2鍥剧墖: ' + fileName)
+                    //         // 杞崲鍥剧墖涓哄唴閮ㄦ牸寮�
+                    //         const imageId = capturer.pictureFileToImage(fileName, 1) // 1琛ㄧずIMAGE_YUV420SP
+                    //         if (imageId) {
+                    //             logger.info('[mainView]: 鍥剧墖杞崲鎴愬姛锛宨mageId=' + imageId)
+                    //             // 璋冩暣鍥惧儚澶у皬涓�160x160
+                    //             const resizedImageId = capturer.imageResizeResolution(imageId, 160, 160, 3) // 3琛ㄧずFILTER_MODE_BOX
+                    //             if (resizedImageId) {
+                    //                 logger.info('[mainView]: 鍥剧墖璋冩暣鎴愬姛锛宺esizedImageId=' + resizedImageId)
+                    //                 // 淇濆瓨璋冩暣鍚庣殑鍥惧儚涓轰复鏃舵枃浠讹紙浣跨敤鍥哄畾璺緞锛屾瘡娆¤鐩栵級
+                    //                 const tempFileName = '/app/data/user/temp/user2_resized.jpg'
+                    //                 
+                    //                 const saveResult = capturer.imageToPictureFile(resizedImageId, 1, 0, 80, tempFileName) // 0琛ㄧずTYPE_JPEG
+                    //                 if (saveResult) {
+                    //                     logger.info('[mainView]: 鍥剧墖淇濆瓨鎴愬姛锛宼empFileName=' + tempFileName)
+                    //                     
+                    //                     // 浣跨敤璋冩暣鍚庣殑鍥剧墖浣滀负鍥炬爣婧�
+                    //                     mainView.user2Icon.source(tempFileName)
+                    //                 } else {
+                    //                     logger.error('[mainView]: 淇濆瓨璋冩暣鍚庣殑鍥剧墖澶辫触')
+                    //                     // 淇濆瓨澶辫触鏃朵娇鐢ㄥ師濮嬪浘鐗�
+                    //                     mainView.user2Icon.source(fileName)
+                    //                 }
+                    //             } else {
+                    //                 logger.error('[mainView]: 璋冩暣鍥剧墖澶у皬澶辫触')
+                    //                 // 璋冩暣澶辫触鏃朵娇鐢ㄥ師濮嬪浘鐗�
+                    //                 mainView.user2Icon.source(fileName)
+                    //             }
+                    //         } else {
+                    //             logger.error('[mainView]: 杞崲鍥剧墖澶辫触')
+                    //             // 杞崲澶辫触鏃朵娇鐢ㄥ師濮嬪浘鐗�
+                    //             mainView.user2Icon.source(fileName)
+                    //         }
+                    //         
+                    //         // 寮哄埗鏇存柊鍜岄噸缁�
+                    //         mainView.user2Icon.update()
+                    //         mainView.user2Icon.invalidate()
+                    //         logger.info('[mainView]: 鐢ㄦ埛2鍥炬爣鏇存柊鎴愬姛')
+                    //     } catch (error) {
+                    //         logger.error('[mainView]: 澶勭悊鍥剧墖鏃跺嚭閿�: ' + error.message)
+                    //         // 鍑洪敊鏃朵娇鐢ㄩ粯璁ゅ浘鏍�
+                    //         mainView.user2Icon.setSize(160, 160)
+                    //         mainView.user2Icon.align(dxui.Utils.ALIGN.CENTER, 0, 0)
+                    //         mainView.user2Icon.source('/app/code/resource/image/user_1.png')
+                    //         mainView.user2Icon.update()
+                    //         mainView.user2Icon.invalidate()
+                    //         logger.info('[mainView]: 鐢ㄦ埛2鍥炬爣鏇存柊澶辫触锛屼娇鐢ㄩ粯璁ゅ浘鏍�')
+                    //     }
+                    // } else {
+                    //     logger.error('[mainView]: 鏇存柊鐢ㄦ埛2鍥炬爣澶辫触锛宖ileName=' + fileName + ', user2Icon=' + mainView.user2Icon)
+                    // }
+                    logger.info('[mainView]: 鐢ㄦ埛2淇℃伅宸叉洿鏂帮細' + userName + ', ' + (userType === 1 ? '绉戦暱' : '淇濈鍛�') + ', ' + (hasPermission ? '鏍搁獙鎴愬姛' : '鏍搁獙澶辫触'))
+                } else {
+                    // 鏈煡鐢ㄦ埛搴忓彿锛岄粯璁ゆ洿鏂扮敤鎴�1鐨刄I
+                    if (mainView.user1Name) {
+                        mainView.user1Name.text(userName)
+                    }
+                    if (mainView.user1Role) {
+                        mainView.user1Role.text(userType === 1 ? '绉戦暱' : '淇濈鍛�')
+                    }
+                    if (mainView.user1StatusLbl) {
+                        if (hasPermission) {
+                            mainView.user1Box.source('/app/code/resource/image/user_s.png') // 鏍搁獙鎴愬姛鑳屾櫙鍥�
+                            mainView.user1StatusLbl.text('鏍搁獙鎴愬姛')
+                        } else {
+                            mainView.user1Box.source('/app/code/resource/image/user_f.png') // 鏍搁獙澶辫触鑳屾櫙鍥�
+                            mainView.user1StatusLbl.text('鏍搁獙澶辫触')
+                        }
+                    }
+                    logger.info('[mainView]: 鐢ㄦ埛1淇℃伅宸叉洿鏂帮紙榛樿锛夛細' + userName + ', ' + (userType === 1 ? '绉戦暱' : '淇濈鍛�') + ', ' + (hasPermission ? '鏍搁獙鎴愬姛' : '鏍搁獙澶辫触'))
+                }
+            } else {
+                logger.warn('[mainView]: 鏈壘鍒扮敤鎴蜂俊鎭�, userId=' + userId)
+            }
+        }
+    }
+
+    // 鎺у埗鎸夐挳鍖哄煙
+    const controlBox = dxui.Image.build('controlBox', overlayBox)
+    viewUtils._clearStyle(controlBox)
+    controlBox.setSize(779, 343)
+    controlBox.align(dxui.Utils.ALIGN.BOTTOM_LEFT, 11, -120)
+    controlBox.source('/app/code/resource/image/input_bg.png') // 浣跨敤鑳屾櫙鍥�
+    controlBox.borderWidth(0) // 鍘绘帀杈圭嚎
+    controlBox.radius(15) // 澧炲ぇ鍦嗚寮у害
+
+    const controlTitle = dxui.Label.build('controlTitle', controlBox)
+    controlTitle.text('瀹夊叏鍏ヤ粨鑱斿姩鎺у埗')
+    controlTitle.textFont(viewUtils.font(26, dxui.Utils.FONT_STYLE.BOLD)) // 澧炲ぇ瀛椾綋
+    controlTitle.textColor(0x283248)
+    controlTitle.align(dxui.Utils.ALIGN.TOP_LEFT, 50, 15)
+
+    // 鍏佽杩涗粨妯″紡
+    const mode1Box = dxui.View.build('mode1Box', controlBox)
+    viewUtils._clearStyle(mode1Box)
+    mode1Box.setSize(760, 80)
+    mode1Box.align(dxui.Utils.ALIGN.TOP_LEFT, 43, 50)
+    mode1Box.bgOpa(0)
+    mode1Box.flexFlow(dxui.Utils.FLEX_FLOW.ROW)
+    mode1Box.flexAlign(dxui.Utils.FLEX_ALIGN.FLEX_START, dxui.Utils.FLEX_ALIGN.CENTER, dxui.Utils.FLEX_ALIGN.CENTER)
+    mode1Box.obj.lvObjSetStylePadGap(32, dxui.Utils.ENUM._LV_STYLE_STATE_CMP_SAME) // 璁剧疆鎸夐挳闂磋窛
+    
+    const mode1Btn = dxui.Button.build('mode1Btn', mode1Box)
+    mode1Btn.setSize(301, 68) // 澧炲ぇ鎸夐挳楂樺害
+    mode1Btn.bgColor(0x017FEB)
+    mode1Btn.radius(10) // 璋冩暣鍦嗚寮у害
+    mainView.mode1Btn = mode1Btn // 璁剧疆涓簃ainView灞炴��
+    
+    const mode1Lbl = dxui.Label.build('mode1Lbl', mode1Btn)
+    mode1Lbl.text('鍏佽杩涗粨妯″紡')
+    mode1Lbl.textFont(viewUtils.font(22, dxui.Utils.FONT_STYLE.BOLD)) // 绋嶅井澧炲ぇ瀛椾綋澶у皬
+    mode1Lbl.textColor(0xffffff)
+    mode1Lbl.align(dxui.Utils.ALIGN.CENTER, 0, -12)
+    
+    const mode1SubLbl = dxui.Label.build('mode1SubLbl', mode1Btn)
+    mode1SubLbl.text('(姝e父淇濈/鍏ョ伯鍚庢湡)')
+    mode1SubLbl.textFont(viewUtils.font(21))
+    mode1SubLbl.textColor(0xffffff)
+    mode1SubLbl.align(dxui.Utils.ALIGN.CENTER, 0, 12)
+    
+    const inBtn = dxui.Button.build('inBtn', mode1Box)
+    inBtn.setSize(161, 68) // 澧炲ぇ鎸夐挳楂樺害
+    inBtn.bgColor(0x017FEB)
+    inBtn.radius(10) // 璋冩暣鍦嗚寮у害
+    mainView.inBtn = inBtn // 璁剧疆涓簃ainView灞炴��
+    
+    const inLbl = dxui.Label.build('inLbl', inBtn)
+    inLbl.text('鍏ヤ粨')
+    inLbl.textFont(viewUtils.font(23, dxui.Utils.FONT_STYLE.BOLD)) // 澧炲ぇ瀛椾綋
+    inLbl.textColor(0xffffff)
+    inLbl.align(dxui.Utils.ALIGN.CENTER, 0, 0)
+    
+    const outBtn = dxui.Button.build('outBtn', mode1Box)
+    outBtn.setSize(161, 68) // 澧炲ぇ鎸夐挳楂樺害
+    outBtn.bgColor(0x017FEB)
+    outBtn.radius(10) // 璋冩暣鍦嗚寮у害
+    mainView.outBtn = outBtn // 璁剧疆涓簃ainView灞炴��
+    
+    const outLbl = dxui.Label.build('outLbl', outBtn)
+    outLbl.text('鍑轰粨')
+    outLbl.textFont(viewUtils.font(23, dxui.Utils.FONT_STYLE.BOLD)) // 澧炲ぇ瀛椾綋
+    outLbl.textColor(0xffffff)
+    outLbl.align(dxui.Utils.ALIGN.CENTER, 0, 0)
+
+    // 鍐閫氶妯″紡
+    const mode2Box = dxui.View.build('mode2Box', controlBox)
+    viewUtils._clearStyle(mode2Box)
+    mode2Box.setSize(760, 80)
+    mode2Box.align(dxui.Utils.ALIGN.TOP_LEFT, 43, 145)
+    mode2Box.bgOpa(0)
+    mode2Box.flexFlow(dxui.Utils.FLEX_FLOW.ROW)
+    mode2Box.flexAlign(dxui.Utils.FLEX_ALIGN.FLEX_START, dxui.Utils.FLEX_ALIGN.CENTER, dxui.Utils.FLEX_ALIGN.CENTER)
+    mode2Box.obj.lvObjSetStylePadGap(32, dxui.Utils.ENUM._LV_STYLE_STATE_CMP_SAME) // 璁剧疆鎸夐挳闂磋窛
+    
+    const mode2Btn = dxui.Button.build('mode2Btn', mode2Box)
+    mode2Btn.setSize(301, 68) // 澧炲ぇ鎸夐挳楂樺害
+    mode2Btn.bgColor(0x017FEB)
+    mode2Btn.radius(10) // 璋冩暣鍦嗚寮у害
+    mainView.mode2Btn = mode2Btn // 璁剧疆涓簃ainView灞炴��
+    
+    const mode2Lbl = dxui.Label.build('mode2Lbl', mode2Btn)
+    mode2Lbl.text('鍐閫氶妯″紡')
+    mode2Lbl.textFont(viewUtils.font(22, dxui.Utils.FONT_STYLE.BOLD)) // 绋嶅井澧炲ぇ瀛椾綋澶у皬
+    mode2Lbl.textColor(0xffffff)
+    mode2Lbl.align(dxui.Utils.ALIGN.CENTER, 0, -12)
+    
+    const mode2SubLbl = dxui.Label.build('mode2SubLbl', mode2Btn)
+    mode2SubLbl.text('(闇�绉戦暱鏉冮檺)')
+    mode2SubLbl.textFont(viewUtils.font(21))
+    mode2SubLbl.textColor(0xffffff)
+    mode2SubLbl.align(dxui.Utils.ALIGN.CENTER, 0, 12)
+    
+    const startBtn = dxui.Button.build('startBtn', mode2Box)
+    startBtn.setSize(161, 68) // 澧炲ぇ鎸夐挳楂樺害
+    startBtn.bgColor(0x017FEB)
+    startBtn.radius(10) // 璋冩暣鍦嗚寮у害
+    mainView.startBtn = startBtn // 璁剧疆涓簃ainView灞炴��
+    
+    const startLbl = dxui.Label.build('startLbl', startBtn)
+    startLbl.text('鍚姩')
+    startLbl.textFont(viewUtils.font(23, dxui.Utils.FONT_STYLE.BOLD)) // 澧炲ぇ瀛椾綋
+    startLbl.textColor(0xffffff)
+    startLbl.align(dxui.Utils.ALIGN.CENTER, 0, 0)
+    
+    const stopBtn = dxui.Button.build('stopBtn', mode2Box)
+    stopBtn.setSize(161, 68) // 澧炲ぇ鎸夐挳楂樺害
+    stopBtn.bgColor(0x017FEB)
+    stopBtn.radius(10) // 璋冩暣鍦嗚寮у害
+    mainView.stopBtn = stopBtn // 璁剧疆涓簃ainView灞炴��
+    
+    const stopLbl = dxui.Label.build('stopLbl', stopBtn)
+    stopLbl.text('鍏抽棴')
+    stopLbl.textFont(viewUtils.font(23, dxui.Utils.FONT_STYLE.BOLD)) // 澧炲ぇ瀛椾綋
+    stopLbl.textColor(0xffffff)
+    stopLbl.align(dxui.Utils.ALIGN.CENTER, 0, 0)
+
+    // 绂佹杩涗粨妯″紡
+    const mode3Box = dxui.View.build('mode3Box', controlBox)
+    viewUtils._clearStyle(mode3Box)
+    mode3Box.setSize(760, 80)
+    mode3Box.align(dxui.Utils.ALIGN.TOP_LEFT, 43, 240)
+    mode3Box.bgOpa(0)
+    mode3Box.flexFlow(dxui.Utils.FLEX_FLOW.ROW)
+    mode3Box.flexAlign(dxui.Utils.FLEX_ALIGN.FLEX_START, dxui.Utils.FLEX_ALIGN.CENTER, dxui.Utils.FLEX_ALIGN.CENTER)
+    mode3Box.obj.lvObjSetStylePadGap(32, dxui.Utils.ENUM._LV_STYLE_STATE_CMP_SAME) // 璁剧疆鎸夐挳闂磋窛
+    
+    const mode3Btn = dxui.Button.build('mode3Btn', mode3Box)
+    mode3Btn.setSize(301, 68) // 澧炲ぇ鎸夐挳楂樺害
+    mode3Btn.bgColor(0x017FEB)
+    mode3Btn.radius(10) // 璋冩暣鍦嗚寮у害
+    mainView.mode3Btn = mode3Btn // 璁剧疆涓簃ainView灞炴��
+    
+    const mode3Lbl = dxui.Label.build('mode3Lbl', mode3Btn)
+    mode3Lbl.text('绂佹杩涗粨妯″紡')
+    mode3Lbl.textFont(viewUtils.font(22, dxui.Utils.FONT_STYLE.BOLD)) // 绋嶅井澧炲ぇ瀛椾綋澶у皬
+    mode3Lbl.textColor(0xffffff)
+    mode3Lbl.align(dxui.Utils.ALIGN.CENTER, 0, -12)
+    
+    const mode3SubLbl = dxui.Label.build('mode3SubLbl', mode3Btn)
+    mode3SubLbl.text('(闇�绉戦暱鏉冮檺)')
+    mode3SubLbl.textFont(viewUtils.font(21))
+    mode3SubLbl.textColor(0xffffff)
+    mode3SubLbl.align(dxui.Utils.ALIGN.CENTER, 0, 12)
+    
+    const emergencyInBtn = dxui.Button.build('emergencyInBtn', mode3Box)
+    emergencyInBtn.setSize(161, 68) // 澧炲ぇ鎸夐挳楂樺害
+    emergencyInBtn.bgColor(0x017FEB)
+    emergencyInBtn.radius(10) // 璋冩暣鍦嗚寮у害
+    mainView.emergencyInBtn = emergencyInBtn // 璁剧疆涓簃ainView灞炴��
+    
+    const emergencyInLbl = dxui.Label.build('emergencyInLbl', emergencyInBtn)
+    emergencyInLbl.text('绱ф�ュ叆浠�')
+    emergencyInLbl.textFont(viewUtils.font(23, dxui.Utils.FONT_STYLE.BOLD)) // 澧炲ぇ瀛椾綋
+    emergencyInLbl.textColor(0xffffff)
+    emergencyInLbl.align(dxui.Utils.ALIGN.CENTER, 0, 0)
+    
+    const emergencyOutBtn = dxui.Button.build('emergencyOutBtn', mode3Box)
+    emergencyOutBtn.setSize(161, 68) // 澧炲ぇ鎸夐挳楂樺害
+    emergencyOutBtn.bgColor(0x017FEB)
+    emergencyOutBtn.radius(10) // 璋冩暣鍦嗚寮у害
+    mainView.emergencyOutBtn = emergencyOutBtn // 璁剧疆涓簃ainView灞炴��
+    
+    const emergencyOutLbl = dxui.Label.build('emergencyOutLbl', emergencyOutBtn)
+    emergencyOutLbl.text('鍑轰粨')
+    emergencyOutLbl.textFont(viewUtils.font(23, dxui.Utils.FONT_STYLE.BOLD)) // 澧炲ぇ瀛椾綋
+    emergencyOutLbl.textColor(0xffffff)
+    emergencyOutLbl.align(dxui.Utils.ALIGN.CENTER, 0, 0)
+
+    // 搴曢儴鎺у埗鎸夐挳
+    const bottomControlBox = dxui.View.build('bottomControlBox', overlayBox)
+    viewUtils._clearStyle(bottomControlBox)
+    bottomControlBox.setSize(screen.screenSize.width, 80)
+    bottomControlBox.align(dxui.Utils.ALIGN.BOTTOM_LEFT, 20, -40)
+    bottomControlBox.bgOpa(0)
+    bottomControlBox.flexFlow(dxui.Utils.FLEX_FLOW.ROW)
+    bottomControlBox.flexAlign(dxui.Utils.FLEX_ALIGN.FLEX_START, dxui.Utils.FLEX_ALIGN.CENTER, dxui.Utils.FLEX_ALIGN.CENTER)
+    bottomControlBox.obj.lvObjSetStylePadGap(20, dxui.Utils.ENUM._LV_STYLE_STATE_CMP_SAME) // 璁剧疆鎸夐挳闂磋窛
+
+    // 寮�鐏寜閽�
+    const lightOnBtn = viewUtils.imageBtn(bottomControlBox, 'lightOnBtn', '/app/code/resource/image/light_open.png')
+    lightOnBtn.setSize(240, 68)
+    mainView.lightOnBtn = lightOnBtn // 璁剧疆涓簃ainView灞炴��
+    
+    const lightOnLbl = dxui.Label.build('lightOnLbl', lightOnBtn)
+    lightOnLbl.text('寮�鐏�')
+    lightOnLbl.textFont(viewUtils.font(23, dxui.Utils.FONT_STYLE.BOLD)) // 澧炲ぇ瀛椾綋
+    lightOnLbl.textColor(0xffffff)
+    lightOnLbl.align(dxui.Utils.ALIGN.CENTER, 20, 0)
+
+    // 鍏崇伅鎸夐挳
+    const lightOffBtn = viewUtils.imageBtn(bottomControlBox, 'lightOffBtn', '/app/code/resource/image/light_close.png')
+    lightOffBtn.setSize(240, 68)
+    mainView.lightOffBtn = lightOffBtn // 璁剧疆涓簃ainView灞炴��
+    
+    const lightOffLbl = dxui.Label.build('lightOffLbl', lightOffBtn)
+    lightOffLbl.text('鍏崇伅')
+    lightOffLbl.textFont(viewUtils.font(23, dxui.Utils.FONT_STYLE.BOLD)) // 澧炲ぇ瀛椾綋
+    lightOffLbl.textColor(0xffffff)
+    lightOffLbl.align(dxui.Utils.ALIGN.CENTER, 20, 0)
+
+    // 搴旀�ュ紑浠撴寜閽�
+    const emergencyBtn = viewUtils.imageBtn(bottomControlBox, 'emergencyBtn', '/app/code/resource/image/emergencyOpen.png')
+    emergencyBtn.setSize(240, 68)
+    mainView.emergencyBtn = emergencyBtn // 璁剧疆涓簃ainView灞炴��
+    
+    const emergencyLbl = dxui.Label.build('emergencyLbl', emergencyBtn)
+    emergencyLbl.text('搴旀�ュ紑浠�')
+    emergencyLbl.textFont(viewUtils.font(23, dxui.Utils.FONT_STYLE.BOLD)) // 澧炲ぇ瀛椾綋
+    emergencyLbl.textColor(0xffffff)
+    emergencyLbl.align(dxui.Utils.ALIGN.CENTER, 20, 0)
+
+    // 搴曢儴淇℃伅鏍�
+    const infoBox = dxui.View.build('infoBox', overlayBox)
+    viewUtils._clearStyle(infoBox)
+    infoBox.setSize(screen.screenSize.width, 30)
+    infoBox.align(dxui.Utils.ALIGN.BOTTOM_MID, 0, 0)
+    infoBox.bgColor(0x808080)
+
+    const snInfoLbl = dxui.Label.build('snInfoLbl', infoBox)
+    mainView.snInfoLbl = snInfoLbl
+    snInfoLbl.text('SN: ')
+    snInfoLbl.textFont(viewUtils.font(14))
+    snInfoLbl.textColor(0xffffff)
+    snInfoLbl.align(dxui.Utils.ALIGN.BOTTOM_LEFT, 20, -5)
+
+
+
+    const ipInfoLbl = dxui.Label.build('ipInfoLbl', infoBox)
+    mainView.ipInfoLbl = ipInfoLbl
+    ipInfoLbl.text('IP: ')
+    ipInfoLbl.textFont(viewUtils.font(14))
+    ipInfoLbl.textColor(0xffffff)
+    ipInfoLbl.align(dxui.Utils.ALIGN.BOTTOM_RIGHT, -20, -5)
+
+    // 璁剧疆鎸夐挳鐐瑰嚮浜嬩欢
+    mode1Btn.on(dxui.Utils.EVENT.CLICK, () => {
+        logger.info('鍏佽杩涗粨妯″紡鎸夐挳鐐瑰嚮')
+        // 妫�鏌ユ槸鍚︽湁鐢ㄦ埛宸叉牳楠屾垚鍔�
+        if (!mainView.verifiedUsers[1] && !mainView.verifiedUsers[2]) {
+            // 鏄剧ず寮圭獥閫氱煡
+            bus.fire('showAccessResult', {
+                faceAuth: false,
+                gasConcentration: true,
+                accessAllowed: false,
+                message: "*鑱斿姩鎺у埗鎿嶄綔鏃犳潈闄�*"
+            })
+            // 鎾斁璇煶鎻愮ず
+            driver.alsa.play('/app/code/resource/CN/wav/control_f.wav')
+            return
+        }
+        // 鑾峰彇姘斾綋娴撳害淇℃伅
+        grainService.checkGasConcentration()
+        // 鍙戦�佸畨鍏ㄥ叆浠撹仈鍔ㄦ帶鍒惰姹�
+        grainService.checkDevConcentration({
+            mode: 1, // 鍏佽鍏ヤ粨妯″紡
+            user1: mainView.verifiedUsers[1] || mainView.verifiedUsers[2], // 浣跨敤宸叉牳楠屾垚鍔熺殑鐢ㄦ埛
+            user2: mainView.verifiedUsers[2] && mainView.verifiedUsers[1] ? mainView.verifiedUsers[2] : undefined // 濡傛灉鏈変袱涓敤鎴凤紝閮戒紶閫�
+        })
+    })
+
+    inBtn.on(dxui.Utils.EVENT.CLICK, () => {
+        logger.info('鍏ヤ粨鎸夐挳鐐瑰嚮')
+        // 妫�鏌ユ槸鍚︽湁鐢ㄦ埛宸叉牳楠屾垚鍔�
+        if (!mainView.verifiedUsers[1] && !mainView.verifiedUsers[2]) {
+            // 鏄剧ず寮圭獥閫氱煡
+            bus.fire('showAccessResult', {
+                faceAuth: false,
+                gasConcentration: true,
+                accessAllowed: false,
+                message: "*鑱斿姩鎺у埗鎿嶄綔鏃犳潈闄�*"
+            })
+            // 鎾斁璇煶鎻愮ず
+            driver.alsa.play('/app/code/resource/CN/wav/control_f.wav')
+            return
+        }
+        // 鑾峰彇姘斾綋娴撳害淇℃伅
+        grainService.checkGasConcentration()
+        // 鍙戦�佸畨鍏ㄥ叆浠撹仈鍔ㄦ帶鍒惰姹�
+        grainService.checkDevConcentration({
+            mode: 1, // 鍏佽鍏ヤ粨妯″紡
+            btn: 1, // 鍏ヤ粨
+            user1: mainView.verifiedUsers[1] || mainView.verifiedUsers[2], // 浣跨敤宸叉牳楠屾垚鍔熺殑鐢ㄦ埛
+            user2: mainView.verifiedUsers[2] && mainView.verifiedUsers[1] ? mainView.verifiedUsers[2] : undefined // 濡傛灉鏈変袱涓敤鎴凤紝閮戒紶閫�
+        })
+    })
+
+    outBtn.on(dxui.Utils.EVENT.CLICK, () => {
+        logger.info('鍑轰粨鎸夐挳鐐瑰嚮')
+        // 妫�鏌ユ槸鍚︽湁鐢ㄦ埛宸叉牳楠屾垚鍔�
+        if (!mainView.verifiedUsers[1] && !mainView.verifiedUsers[2]) {
+            // 鏄剧ず寮圭獥閫氱煡
+            bus.fire('showAccessResult', {
+                faceAuth: false,
+                gasConcentration: true,
+                accessAllowed: false,
+                message: "*鑱斿姩鎺у埗鎿嶄綔鏃犳潈闄�*"
+            })
+            // 鎾斁璇煶鎻愮ず
+            driver.alsa.play('/app/code/resource/CN/wav/control_f.wav')
+            return
+        }
+        // 鑾峰彇姘斾綋娴撳害淇℃伅
+        grainService.checkGasConcentration()
+        // 鍙戦�佸畨鍏ㄥ叆浠撹仈鍔ㄦ帶鍒惰姹�
+        grainService.checkDevConcentration({
+            mode: 1, // 鍏佽鍏ヤ粨妯″紡
+            btn: 2, // 鍑轰粨
+            user1: mainView.verifiedUsers[1] || mainView.verifiedUsers[2], // 浣跨敤宸叉牳楠屾垚鍔熺殑鐢ㄦ埛
+            user2: mainView.verifiedUsers[2] && mainView.verifiedUsers[1] ? mainView.verifiedUsers[2] : undefined // 濡傛灉鏈変袱涓敤鎴凤紝閮戒紶閫�
+        })
+    })
+
+    mode2Btn.on(dxui.Utils.EVENT.CLICK, () => {
+        logger.info('鍐閫氶妯″紡鎸夐挳鐐瑰嚮')
+        // 妫�鏌ユ槸鍚︽湁鐢ㄦ埛宸叉牳楠屾垚鍔�
+        if (!mainView.verifiedUsers[1] && !mainView.verifiedUsers[2]) {
+            // 鏄剧ず寮圭獥閫氱煡
+            bus.fire('showAccessResult', {
+                faceAuth: false,
+                gasConcentration: true,
+                accessAllowed: false,
+                message: "*鑱斿姩鎺у埗鎿嶄綔鏃犳潈闄�*"
+            })
+            // 鎾斁璇煶鎻愮ず
+            driver.alsa.play('/app/code/resource/CN/wav/control_f.wav')
+            return
+        }
+        // 鑾峰彇姘斾綋娴撳害淇℃伅
+        grainService.checkGasConcentration()
+        // 鍙戦�佸畨鍏ㄥ叆浠撹仈鍔ㄦ帶鍒惰姹�
+        grainService.checkDevConcentration({
+            mode: 2, // 鍐閫氶妯″紡
+            user1: mainView.verifiedUsers[1] || mainView.verifiedUsers[2], // 浣跨敤宸叉牳楠屾垚鍔熺殑鐢ㄦ埛
+            user2: mainView.verifiedUsers[2] && mainView.verifiedUsers[1] ? mainView.verifiedUsers[2] : undefined // 濡傛灉鏈変袱涓敤鎴凤紝閮戒紶閫�
+        })
+    })
+
+    startBtn.on(dxui.Utils.EVENT.CLICK, () => {
+        logger.info('鍚姩鎸夐挳鐐瑰嚮')
+        // 妫�鏌ユ槸鍚︽湁鐢ㄦ埛宸叉牳楠屾垚鍔�
+        if (!mainView.verifiedUsers[1] && !mainView.verifiedUsers[2]) {
+            // 鏄剧ず寮圭獥閫氱煡
+            bus.fire('showAccessResult', {
+                faceAuth: false,
+                gasConcentration: true,
+                accessAllowed: false,
+                message: "*鑱斿姩鎺у埗鎿嶄綔鏃犳潈闄�*"
+            })
+            // 鎾斁璇煶鎻愮ず
+            driver.alsa.play('/app/code/resource/CN/wav/control_f.wav')
+            return
+        }
+        // 鑾峰彇姘斾綋娴撳害淇℃伅
+        grainService.checkGasConcentration()
+        // 鍙戦�佸畨鍏ㄥ叆浠撹仈鍔ㄦ帶鍒惰姹�
+        grainService.checkDevConcentration({
+            mode: 2, // 鍐閫氶妯″紡
+            btn: 1, // 寮�鍚�
+            user1: mainView.verifiedUsers[1] || mainView.verifiedUsers[2], // 浣跨敤宸叉牳楠屾垚鍔熺殑鐢ㄦ埛
+            user2: mainView.verifiedUsers[2] && mainView.verifiedUsers[1] ? mainView.verifiedUsers[2] : undefined // 濡傛灉鏈変袱涓敤鎴凤紝閮戒紶閫�
+        })
+    })
+
+    stopBtn.on(dxui.Utils.EVENT.CLICK, () => {
+        logger.info('鍏抽棴鎸夐挳鐐瑰嚮')
+        // 妫�鏌ユ槸鍚︽湁鐢ㄦ埛宸叉牳楠屾垚鍔�
+        if (!mainView.verifiedUsers[1] && !mainView.verifiedUsers[2]) {
+            // 鏄剧ず寮圭獥閫氱煡
+            bus.fire('showAccessResult', {
+                faceAuth: false,
+                gasConcentration: true,
+                accessAllowed: false,
+                message: "*鑱斿姩鎺у埗鎿嶄綔鏃犳潈闄�*"
+            })
+            // 鎾斁璇煶鎻愮ず
+            driver.alsa.play('/app/code/resource/CN/wav/control_f.wav')
+            return
+        }
+        // 鑾峰彇姘斾綋娴撳害淇℃伅
+        grainService.checkGasConcentration()
+        // 鍙戦�佸畨鍏ㄥ叆浠撹仈鍔ㄦ帶鍒惰姹�
+        grainService.checkDevConcentration({
+            mode: 2, // 鍐閫氶妯″紡
+            btn: 2, // 鍏抽棴
+            user1: mainView.verifiedUsers[1] || mainView.verifiedUsers[2], // 浣跨敤宸叉牳楠屾垚鍔熺殑鐢ㄦ埛
+            user2: mainView.verifiedUsers[2] && mainView.verifiedUsers[1] ? mainView.verifiedUsers[2] : undefined // 濡傛灉鏈変袱涓敤鎴凤紝閮戒紶閫�
+        })
+    })
+
+    mode3Btn.on(dxui.Utils.EVENT.CLICK, () => {
+        logger.info('绂佹杩涗粨妯″紡鎸夐挳鐐瑰嚮')
+        // 妫�鏌ユ槸鍚︽湁鐢ㄦ埛宸叉牳楠屾垚鍔�
+        if (!mainView.verifiedUsers[1] && !mainView.verifiedUsers[2]) {
+            // 鏄剧ず寮圭獥閫氱煡
+            bus.fire('showAccessResult', {
+                faceAuth: false,
+                gasConcentration: true,
+                accessAllowed: false,
+                message: "*鑱斿姩鎺у埗鎿嶄綔鏃犳潈闄�*"
+            })
+            // 鎾斁璇煶鎻愮ず
+            driver.alsa.play('/app/code/resource/CN/wav/control_f.wav')
+            return
+        }
+        // 鑾峰彇姘斾綋娴撳害淇℃伅
+        grainService.checkGasConcentration()
+        // 鍙戦�佸畨鍏ㄥ叆浠撹仈鍔ㄦ帶鍒惰姹�
+        grainService.checkDevConcentration({
+            mode: 3, // 绂佹鍏ヤ粨妯″紡
+            user1: mainView.verifiedUsers[1] || mainView.verifiedUsers[2], // 浣跨敤宸叉牳楠屾垚鍔熺殑鐢ㄦ埛
+            user2: mainView.verifiedUsers[2] && mainView.verifiedUsers[1] ? mainView.verifiedUsers[2] : undefined // 濡傛灉鏈変袱涓敤鎴凤紝閮戒紶閫�
+        })
+    })
+
+    emergencyInBtn.on(dxui.Utils.EVENT.CLICK, () => {
+        logger.info('绱ф�ュ叆浠撴寜閽偣鍑�')
+        // 妫�鏌ユ槸鍚︽湁鐢ㄦ埛宸叉牳楠屾垚鍔�
+        if (!mainView.verifiedUsers[1] && !mainView.verifiedUsers[2]) {
+            // 鏄剧ず寮圭獥閫氱煡
+            bus.fire('showAccessResult', {
+                faceAuth: false,
+                gasConcentration: true,
+                accessAllowed: false,
+                message: "*鑱斿姩鎺у埗鎿嶄綔鏃犳潈闄�*"
+            })
+            // 鎾斁璇煶鎻愮ず
+            driver.alsa.play('/app/code/resource/CN/wav/control_f.wav')
+            return
+        }
+        // 鑾峰彇姘斾綋娴撳害淇℃伅
+        grainService.checkGasConcentration()
+        // 鍙戦�佸畨鍏ㄥ叆浠撹仈鍔ㄦ帶鍒惰姹�
+        grainService.checkDevConcentration({
+            mode: 3, // 绂佹鍏ヤ粨妯″紡
+            btn: 1, // 绱ф�ュ叆浠�
+            user1: mainView.verifiedUsers[1] || mainView.verifiedUsers[2], // 浣跨敤宸叉牳楠屾垚鍔熺殑鐢ㄦ埛
+            user2: mainView.verifiedUsers[2] && mainView.verifiedUsers[1] ? mainView.verifiedUsers[2] : undefined // 濡傛灉鏈変袱涓敤鎴凤紝閮戒紶閫�
+        })
+    })
+
+    emergencyOutBtn.on(dxui.Utils.EVENT.CLICK, () => {
+        logger.info('鍑轰粨鎸夐挳鐐瑰嚮')
+        // 妫�鏌ユ槸鍚︽湁鐢ㄦ埛宸叉牳楠屾垚鍔�
+        if (!mainView.verifiedUsers[1] && !mainView.verifiedUsers[2]) {
+            // 鏄剧ず寮圭獥閫氱煡
+            bus.fire('showAccessResult', {
+                faceAuth: false,
+                gasConcentration: true,
+                accessAllowed: false,
+                message: "*鑱斿姩鎺у埗鎿嶄綔鏃犳潈闄�*"
+            })
+            // 鎾斁璇煶鎻愮ず
+            driver.alsa.play('/app/code/resource/CN/wav/control_f.wav')
+            return
+        }
+        // 鑾峰彇姘斾綋娴撳害淇℃伅
+        grainService.checkGasConcentration()
+        // 鍙戦�佸畨鍏ㄥ叆浠撹仈鍔ㄦ帶鍒惰姹�
+        grainService.checkDevConcentration({
+            mode: 3, // 绂佹鍏ヤ粨妯″紡
+            btn: 2, // 鍑轰粨
+            user1: mainView.verifiedUsers[1] || mainView.verifiedUsers[2], // 浣跨敤宸叉牳楠屾垚鍔熺殑鐢ㄦ埛
+            user2: mainView.verifiedUsers[2] && mainView.verifiedUsers[1] ? mainView.verifiedUsers[2] : undefined // 濡傛灉鏈変袱涓敤鎴凤紝閮戒紶閫�
+        })
+    })
+
+    lightOnBtn.on(dxui.Utils.EVENT.CLICK, () => {
+        logger.info('寮�鐏寜閽偣鍑�')
+        // 妫�鏌ユ槸鍚︽湁鐢ㄦ埛宸叉牳楠屾垚鍔�
+        if (!mainView.verifiedUsers[1] && !mainView.verifiedUsers[2]) {
+            // 鏄剧ず寮圭獥閫氱煡
+            bus.fire('showAccessResult', {
+                faceAuth: false,
+                gasConcentration: true,
+                accessAllowed: false,
+                message: "*鑱斿姩鎺у埗鎿嶄綔鏃犳潈闄�*"
+            })
+            // 鎾斁璇煶鎻愮ず
+            driver.alsa.play('/app/code/resource/CN/wav/control_f.wav')
+            return
+        }
+        // 鑾峰彇姘斾綋娴撳害鍜岀姸鎬佷俊鎭�
+        grainService.checkGasConcentration()
+        grainService.checkDevConcentration()
+        // 鍙戦�佷粨鍐呯収鏄庤仈鍔ㄦ帶鍒惰姹�
+        grainService.controlLight({
+            btn: 1, // 寮�鐏�
+            user1: mainView.verifiedUsers[1] || mainView.verifiedUsers[2], // 浣跨敤宸叉牳楠屾垚鍔熺殑鐢ㄦ埛
+            user2: mainView.verifiedUsers[2] && mainView.verifiedUsers[1] ? mainView.verifiedUsers[2] : undefined // 濡傛灉鏈変袱涓敤鎴凤紝閮戒紶閫�
+        })
+    })
+
+    lightOffBtn.on(dxui.Utils.EVENT.CLICK, () => {
+        logger.info('鍏崇伅鎸夐挳鐐瑰嚮')
+        // 妫�鏌ユ槸鍚︽湁鐢ㄦ埛宸叉牳楠屾垚鍔�
+        if (!mainView.verifiedUsers[1] && !mainView.verifiedUsers[2]) {
+            // 鏄剧ず寮圭獥閫氱煡
+            bus.fire('showAccessResult', {
+                faceAuth: false,
+                gasConcentration: true,
+                accessAllowed: false,
+                message: "*鑱斿姩鎺у埗鎿嶄綔鏃犳潈闄�*"
+            })
+            // 鎾斁璇煶鎻愮ず
+            driver.alsa.play('/app/code/resource/CN/wav/control_f.wav')
+            return
+        }
+        // 鑾峰彇姘斾綋娴撳害鍜岀姸鎬佷俊鎭�
+        grainService.checkGasConcentration()
+        grainService.checkDevConcentration()
+        // 鍙戦�佷粨鍐呯収鏄庤仈鍔ㄦ帶鍒惰姹�
+        grainService.controlLight({
+            btn: 2, // 鍏崇伅
+            user1: mainView.verifiedUsers[1] || mainView.verifiedUsers[2], // 浣跨敤宸叉牳楠屾垚鍔熺殑鐢ㄦ埛
+            user2: mainView.verifiedUsers[2] && mainView.verifiedUsers[1] ? mainView.verifiedUsers[2] : undefined // 濡傛灉鏈変袱涓敤鎴凤紝閮戒紶閫�
+        })
+    })
+
+    emergencyBtn.on(dxui.Utils.EVENT.CLICK, () => {
+        logger.info('搴旀�ュ紑浠撴寜閽偣鍑�')
+        dxui.loadMain(emergencyPwdView.screenMain)
+    })
+
+}
+
+export default mainView

--
Gitblit v1.9.3