bug fixed: D342消息处理

This commit is contained in:
weidong 2023-12-09 15:14:05 +08:00
parent 7c7b80771b
commit ee9cd377f1
3 changed files with 10 additions and 8 deletions

View File

@ -25,9 +25,10 @@ public class MultiLineGNSSCalcService {
LocalDateTime msgTime = d342Message.getOriginalTime();
LocalDateTime lastDate = deviceMap.get(deviceId);
int d341Count = d342Message.getMessageList().size();
logger.info("proc D342: "+msgTime.toString()+" D341 num: "+d341Count);
if(msgTime!=null) logger.info("proc D342: "+msgTime+" D341 num: "+d341Count);
if(lastDate != null){
if(msgTime.isAfter(lastDate.plusMinutes(1)) || d341Count == 0){
if(d341Count == 0 || (msgTime!=null && msgTime.isAfter(lastDate.plusMinutes(1)))){
// 计算上轮结果
calcService.calSingleDone(deviceId, d342Message.getTenantId(),lastDate);
}

View File

@ -1,13 +1,10 @@
package com.imdroid.sideslope.executor;
import com.imdroid.sideslope.calc.MultiLineGNSSCalcService;
import com.imdroid.sideslope.message.D341LocationMessage;
import com.imdroid.sideslope.message.D342LocationMessage;
import com.imdroid.sideslope.sal.Device;
import com.imdroid.sideslope.sal.DeviceService;
import com.imdroid.sideslope.util.ThreadManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -42,6 +39,6 @@ public class D342LocationMessageExecutor implements Executor<D342LocationMessage
@Override
public Class<?> getMessageType() {
return D341LocationMessage.class;
return D342LocationMessage.class;
}
}

View File

@ -25,6 +25,8 @@ public class D342LocationMessage extends BaseMessage {
this.id = String.valueOf(src.readUnsignedInt()); //id
this.seq = src.readUnsignedShort();
if(this.len<=15) return;
short year = src.readUnsignedByte();
short month = src.readUnsignedByte();
short day = src.readUnsignedByte();
@ -34,10 +36,12 @@ public class D342LocationMessage extends BaseMessage {
// 拆分D341指针已移动到d341了
int totalLen = src.readableBytes();
int begin = 0;
int begin = 15; // d341 head: 10, date: 5
while(begin+2 < totalLen){
int msgLen = src.getShort(begin+2)&0x7FF + 4;
int msgLen = src.getUnsignedShort(begin+2);
msgLen = msgLen&0x07FF;
msgLen = msgLen + 4;
if(msgLen > totalLen) break; //error
ByteBuf msgBuf = src.slice(begin,msgLen);