bug fixed: D342消息处理
This commit is contained in:
parent
7c7b80771b
commit
ee9cd377f1
@ -25,9 +25,10 @@ public class MultiLineGNSSCalcService {
|
|||||||
LocalDateTime msgTime = d342Message.getOriginalTime();
|
LocalDateTime msgTime = d342Message.getOriginalTime();
|
||||||
LocalDateTime lastDate = deviceMap.get(deviceId);
|
LocalDateTime lastDate = deviceMap.get(deviceId);
|
||||||
int d341Count = d342Message.getMessageList().size();
|
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(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);
|
calcService.calSingleDone(deviceId, d342Message.getTenantId(),lastDate);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,10 @@
|
|||||||
package com.imdroid.sideslope.executor;
|
package com.imdroid.sideslope.executor;
|
||||||
|
|
||||||
import com.imdroid.sideslope.calc.MultiLineGNSSCalcService;
|
import com.imdroid.sideslope.calc.MultiLineGNSSCalcService;
|
||||||
import com.imdroid.sideslope.message.D341LocationMessage;
|
|
||||||
import com.imdroid.sideslope.message.D342LocationMessage;
|
import com.imdroid.sideslope.message.D342LocationMessage;
|
||||||
import com.imdroid.sideslope.sal.Device;
|
import com.imdroid.sideslope.sal.Device;
|
||||||
import com.imdroid.sideslope.sal.DeviceService;
|
import com.imdroid.sideslope.sal.DeviceService;
|
||||||
import com.imdroid.sideslope.util.ThreadManager;
|
import com.imdroid.sideslope.util.ThreadManager;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@ -42,6 +39,6 @@ public class D342LocationMessageExecutor implements Executor<D342LocationMessage
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<?> getMessageType() {
|
public Class<?> getMessageType() {
|
||||||
return D341LocationMessage.class;
|
return D342LocationMessage.class;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,8 @@ public class D342LocationMessage extends BaseMessage {
|
|||||||
this.id = String.valueOf(src.readUnsignedInt()); //id
|
this.id = String.valueOf(src.readUnsignedInt()); //id
|
||||||
this.seq = src.readUnsignedShort();
|
this.seq = src.readUnsignedShort();
|
||||||
|
|
||||||
|
if(this.len<=15) return;
|
||||||
|
|
||||||
short year = src.readUnsignedByte();
|
short year = src.readUnsignedByte();
|
||||||
short month = src.readUnsignedByte();
|
short month = src.readUnsignedByte();
|
||||||
short day = src.readUnsignedByte();
|
short day = src.readUnsignedByte();
|
||||||
@ -34,10 +36,12 @@ public class D342LocationMessage extends BaseMessage {
|
|||||||
|
|
||||||
// 拆分D341,指针已移动到d341了
|
// 拆分D341,指针已移动到d341了
|
||||||
int totalLen = src.readableBytes();
|
int totalLen = src.readableBytes();
|
||||||
int begin = 0;
|
int begin = 15; // d341 head: 10, date: 5
|
||||||
|
|
||||||
while(begin+2 < totalLen){
|
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
|
if(msgLen > totalLen) break; //error
|
||||||
|
|
||||||
ByteBuf msgBuf = src.slice(begin,msgLen);
|
ByteBuf msgBuf = src.slice(begin,msgLen);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user