tcp独立进程

This commit is contained in:
lixiao 2025-05-17 14:59:49 +08:00
parent 14760e2c37
commit 54925cad67
4 changed files with 37 additions and 55 deletions

View File

@ -39,6 +39,7 @@ export async function getTCP(flag = false) {
let now = new Date()
if (now.getTime() - lastTime.getTime() > (1000 * 6)) {
console.log("差分tcp信号丢失")
clearInterval(tick)
getTCP(true)
return
}
@ -47,6 +48,7 @@ export async function getTCP(flag = false) {
}
}, 1000 * 1.5)
tcpClient?.onError(() => {
clearInterval(tick)
getTCP(true)
})
tcpClient?.onMessage((val) => {

View File

@ -74,6 +74,7 @@ export default class TcpClient {
this.tcpSendNum++
if (this.tcpSendNum > 10) {
getTCP(true)
this.tcpSendNum = 0
}
})
}

View File

@ -109,30 +109,10 @@ export default struct Index {
this.stachValue = JSON.parse(JSON.stringify(StackValueData))
this.warnFlag = JSON.parse(JSON.stringify(WarnFlagData))
this.passArray = JSON.parse(JSON.stringify(PassData))
// clearInterval(this.interval)
}
//
carConfigurationInfoFn() {
// const fileUtil = new FileUtil(context)
// const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/deviceNo.txt');
// if (data === '' || data === undefined) {
// promptAction.showToast({
// message: `请先进行设备注册`,
// duration: 3000
// });
// globalThis.type='1'
// globalThis.title=decodeURIComponent('请先进行设备注册')
// globalThis.errorDialog.open()
// resolve('')
// } else {
// const fileData=JSON.parse(data)
// globalThis.deviceNo = fileData.deviceName
// console.log('globalThis.deviceNo', globalThis.deviceNo)
// // getCarInfo()
// resolve(fileData.deviceName)
// }
if (globalThis.singlePlay) {
const str = "1:5;2:5;3:5;4:5;5:5;6:5;7:5;8:5;9:5;10:5;11:5;12:5;13:5;14:5;15:5;16:5;17:5;18:5;19:5;20:5;21:5;22:2;23:5;24:5"
const data = str.split(';')
@ -306,6 +286,7 @@ export default struct Index {
}
}, parseInt(this.checkListCopy[0].time) * 1000)
}
initfackCheck(index) {
const that = this
setTimeout(() => {
@ -341,6 +322,7 @@ export default struct Index {
}, 1000)
}
async getCheckList() {
this.index = this.checkListCopy[0].key
this.passArray[this.index] = true

View File

@ -248,7 +248,6 @@ export default class Judge {
const str = await senorToWXDataStr(msg);
usbService.sendUSB(str)
}
// this.judgeUI.isDwztRight = (plcData.gps.dwzt == 4 && plcData.gps.jdzt == 3);
const param350 = judgeUI.judgeConfigObj['350']
//@ts-ignore
this.judgeUI.sd = ((param350 == 0 ? plcData.gps.sd : plcData.sensor.cs) as number * 1.852).toFixed(0) + ''
@ -486,7 +485,7 @@ export default class Judge {
}
// 处理轨迹plc信号
handleTrajectoryUdp = async (strArr) => {
const {fileLog,setJudgeItem,setJudgeMark,endExam} = this;
const {setJudgeItem} = this;
let num = 2;
const judgeTimer = setInterval(async () => {
const msgStr = strArr[num];
@ -504,7 +503,6 @@ export default class Judge {
this.judgeUI.sd = Math.floor(msg?.gps?.sd * 1.852) + '';
this.judgeUI.dw = Math.floor(msg?.sensor?.dw) + ''
this.plcData = msg
// this.judgeUI.isDwztRight = msg.gps.dwzt == 4;
globalThis.msgStr = ''
if (msg.method === 'examJudgeArtificialItem') {
setJudgeItem(msg.itemno, msg.type)
@ -1730,7 +1728,6 @@ export default class Judge {
// 检测差分状态
checkDwzt = async (type) => {
const {avPlayer} = this;
const judgeConfig = this.judgeUI.judgeConfig;
switch (type) {
case 0:
this.judgeUI.isDwztRight = true;