From 970221509c9a903e050b214304104e7f8757490b Mon Sep 17 00:00:00 2001 From: lixiao <932184220@qq.com> Date: Wed, 15 Oct 2025 17:52:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=BA=A2=E7=90=83udp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/ets/utils/business/JudgeUdpBusiness.ets | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/entry/src/main/ets/utils/business/JudgeUdpBusiness.ets b/entry/src/main/ets/utils/business/JudgeUdpBusiness.ets index 510828d..b601406 100644 --- a/entry/src/main/ets/utils/business/JudgeUdpBusiness.ets +++ b/entry/src/main/ets/utils/business/JudgeUdpBusiness.ets @@ -30,7 +30,7 @@ class JudgeUdpBusiness { private carInfo: CarInfoType = {} private singlePlay: boolean = false private lsh: string = "" - private serialIndex: number = 0 + private serialIndex: number = 1 constructor() { if (!JudgeUdpBusiness.instance) { @@ -39,7 +39,7 @@ class JudgeUdpBusiness { return JudgeUdpBusiness.instance } - async getMessageHeartbeat(msg: string): Promise { + async getMessageHeartbeat(msg: string, isEnd: boolean = false): Promise { let gpsDigit = JudgeConfig.fourInOneScreen.gpsDigit const asclshArr = StringToASCII(FillZero( this.singlePlay @@ -77,7 +77,7 @@ class JudgeUdpBusiness { //科目类型(0:未考试 1:科目二 2:科目三) + 考试开始时间 NumberToByteArray(`${0}${'00:00:000'}`, 4 * 8), // 消息序号 - NumberToByteArray(this.serialIndex, 2 * 8), + NumberToByteArray(isEnd ? 0 : this.serialIndex, 2 * 8), translateSignals, NumberToByteArray(tempSd * 100, 2 * 8), NumberToByteArray(plcData.sensor.fdjzs / 100, 8), @@ -128,7 +128,11 @@ class JudgeUdpBusiness { result = result.concat(itemArr) }) // AppStorage.setOrCreate("serialIndex", 0) - this.serialIndex = 0 + if (isEnd) { + this.serialIndex = 1 + } else { + this.serialIndex += 1 + } return [...new Uint8Array(result)] }