From f4815003b0ab7bc1c7f8483ce7cb5eda140e9cc5 Mon Sep 17 00:00:00 2001 From: lvyuankang <1344032923@qq.com> Date: Thu, 20 Feb 2025 11:42:24 +0800 Subject: [PATCH] =?UTF-8?q?tcp=20send=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/common/utils/GlobalTcp.ts | 28 +++++++++---------- .../ets/common/utils/UdpClientByCenter.ts | 3 ++ 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/entry/src/main/ets/common/utils/GlobalTcp.ts b/entry/src/main/ets/common/utils/GlobalTcp.ts index 04485318..f515627d 100644 --- a/entry/src/main/ets/common/utils/GlobalTcp.ts +++ b/entry/src/main/ets/common/utils/GlobalTcp.ts @@ -27,13 +27,13 @@ export async function getTCP(flag=false) { // await globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002 console.log('ttttttt00') - clearInterval(globalThis.intervalSendmsg) - globalThis.intervalSendmsg=setInterval(()=>{ - console.log('getCloseTcp',globalThis.carInfo.carNo) - if(!globalThis.getCloseTcp){ - globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002 - } - },1000/3) + // clearInterval(globalThis.intervalSendmsg) + // globalThis.intervalSendmsg=setInterval(()=>{ + // console.log('getCloseTcp',globalThis.carInfo.carNo) + // if(!globalThis.getCloseTcp){ + // globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002 + // } + // },1000/3) globalThis.TcpClient.onError((val) => { setTimeout(() => { getTCP() @@ -62,13 +62,13 @@ export async function getTCP(flag=false) { await globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002 console.log('ttttttt12') - clearInterval(globalThis.intervalSendmsg) - globalThis.intervalSendmsg=setInterval(()=>{ - // console.log('getCloseTcp',globalThis.getCloseTcp) - if(!globalThis.getCloseTcp){ - globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002 - } - },1000/3) + // clearInterval(globalThis.intervalSendmsg) + // globalThis.intervalSendmsg=setInterval(()=>{ + // // console.log('getCloseTcp',globalThis.getCloseTcp) + // if(!globalThis.getCloseTcp){ + // globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002 + // } + // },1000/3) globalThis.TcpClient.onError((val) => { setTimeout(() => { getTCP() diff --git a/entry/src/main/ets/common/utils/UdpClientByCenter.ts b/entry/src/main/ets/common/utils/UdpClientByCenter.ts index d1891209..372a5535 100644 --- a/entry/src/main/ets/common/utils/UdpClientByCenter.ts +++ b/entry/src/main/ets/common/utils/UdpClientByCenter.ts @@ -337,6 +337,9 @@ export default class UdpClientByCenter { // PLC: JSON.stringify(newArr.toString()), // }) if(strachArr[83]!='4'){ + if(!globalThis.getCloseTcp){ + globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002 + } console.log('差分状态异常',strachArr[83],strachArr[92]) this.writeLog({ time:dateFormat(new Date()),