diff --git a/entry/src/main/ets/common/utils/GlobalTcp.ts b/entry/src/main/ets/common/utils/GlobalTcp.ts index 04485318..93212af6 100644 --- a/entry/src/main/ets/common/utils/GlobalTcp.ts +++ b/entry/src/main/ets/common/utils/GlobalTcp.ts @@ -28,10 +28,14 @@ export async function getTCP(flag=false) { console.log('ttttttt00') clearInterval(globalThis.intervalSendmsg) - globalThis.intervalSendmsg=setInterval(()=>{ + globalThis.intervalSendmsg=setInterval(async ()=>{ console.log('getCloseTcp',globalThis.carInfo.carNo) if(!globalThis.getCloseTcp){ - globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002 + await globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002 + globalThis.tcpStep+=1 + if(globalThis.tcpStep>10){ + getTCP() + } } },1000/3) globalThis.TcpClient.onError((val) => { @@ -63,10 +67,14 @@ export async function getTCP(flag=false) { console.log('ttttttt12') clearInterval(globalThis.intervalSendmsg) - globalThis.intervalSendmsg=setInterval(()=>{ + globalThis.intervalSendmsg=setInterval(async ()=>{ // console.log('getCloseTcp',globalThis.getCloseTcp) if(!globalThis.getCloseTcp){ - globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002 + await globalThis.TcpClient.sendMsg(globalThis.carInfo.carNo) //1002 + globalThis.tcpStep+=1 + if(globalThis.tcpStep>10){ + getTCP() + } } },1000/3) globalThis.TcpClient.onError((val) => { diff --git a/entry/src/main/ets/common/utils/TcpClient.ts b/entry/src/main/ets/common/utils/TcpClient.ts index bf4cd943..2f100c4b 100644 --- a/entry/src/main/ets/common/utils/TcpClient.ts +++ b/entry/src/main/ets/common/utils/TcpClient.ts @@ -156,7 +156,7 @@ export default class TcpClient { // time:dateFormat(new Date()), // message: `${TAG} TCPsend error ${JSON.stringify(err)}`, // }) - reslove(false) + reject(false) }); }) } @@ -167,6 +167,7 @@ export default class TcpClient { // time:dateFormat(new Date()), // PLC:`${TAG} Tcponmessage`, // }) + globalThis.tcpStep=0 globalThis.tcpUdpError = false // console.log('messageLengt',,value.message.length)) diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index be84f0b0..1d86efc0 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -56,7 +56,7 @@ export default class EntryAbility extends UIAbility { globalThis.judgeVersion = GlobalConfig.version.jn.km3[1]; globalThis.tcpSendNum = 0 globalThis.videoVersion = '1.0' - + globalThis.tcpStep=0 //视频遮挡 globalThis.spzd = { spzd1: false,