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)] }