修改消息长度统计

This commit is contained in:
weidong 2024-02-15 09:35:06 +08:00
parent 82db878eaf
commit 97acf5442c
3 changed files with 9 additions and 12 deletions

View File

@ -1,6 +1,5 @@
package com.imdroid.sideslope.message; package com.imdroid.sideslope.message;
import com.imdroid.common.util.WrongMessageRecorder;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import lombok.Data; import lombok.Data;
@ -32,12 +31,12 @@ public abstract class BaseMessage {
this.len = src.readUnsignedShort(); this.len = src.readUnsignedShort();
this.seq = this.len >> 11; this.seq = this.len >> 11;
this.len = this.len & 0x7FF; this.len = packetLen;//this.len & 0x7FF;
this.id = String.valueOf(src.readUnsignedInt()); this.id = String.valueOf(src.readUnsignedInt());
if (packetLen - 4 != this.len) { /*if (packetLen - 4 != this.len) {
String msg = (String.format("id[%s],长度字段值[%s]与包的消息体长度[%s]不匹配", id, this.len, packetLen - 4)); String msg = (String.format("id[%s],长度字段值[%s]与包的消息体长度[%s]不匹配", id, this.len, packetLen - 4));
WrongMessageRecorder.INSTANCE.append("receive wrong message," + msg); WrongMessageRecorder.INSTANCE.append("receive wrong message," + msg);
} }*/
this.pps = src.readUnsignedShort(); this.pps = src.readUnsignedShort();
} }
decodeBody(src); decodeBody(src);

View File

@ -1,6 +1,5 @@
package com.imdroid.sideslope.message; package com.imdroid.sideslope.message;
import com.imdroid.common.util.WrongMessageRecorder;
import com.imdroid.sideslope.bd.Gga; import com.imdroid.sideslope.bd.Gga;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
@ -17,12 +16,12 @@ public class D331RtcmMessage extends BaseMessage {
this.header = src.getUnsignedShort(0); // flag this.header = src.getUnsignedShort(0); // flag
this.len = src.getUnsignedShort(2); // length:11 bits this.len = src.getUnsignedShort(2); // length:11 bits
this.seq = this.len >> 11; this.seq = this.len >> 11;
this.len = this.len & 0x7FF; this.len = src.readableBytes();//this.len & 0x7FF;//有可能两个d331粘包
this.id = String.valueOf(src.getUnsignedInt(4)); //id this.id = String.valueOf(src.getUnsignedInt(4)); //id
if (src.readableBytes() - 4 < this.len) { /*if (src.readableBytes() - 4 < this.len) {
String msg = String.format("id[%s],长度字段值[%s]效益包的消息体长度[%s]", id, this.len, src.readableBytes() - 4); String msg = String.format("id[%s],长度字段值[%s]效益包的消息体长度[%s]", id, this.len, src.readableBytes() - 4);
WrongMessageRecorder.INSTANCE.append("receive wrong message," + msg); WrongMessageRecorder.INSTANCE.append("receive wrong message," + msg);
} }*/
gga = Gga.getFrom(src); gga = Gga.getFrom(src);
this.srcData = new byte[src.readableBytes()]; this.srcData = new byte[src.readableBytes()];
src.readBytes(this.srcData); src.readBytes(this.srcData);

View File

@ -3,7 +3,6 @@ package com.imdroid.sideslope.message;
import com.imdroid.sideslope.bd.Gga; import com.imdroid.sideslope.bd.Gga;
import com.imdroid.sideslope.bd.Tilt; import com.imdroid.sideslope.bd.Tilt;
import com.imdroid.sideslope.bd.UBXUtil; import com.imdroid.sideslope.bd.UBXUtil;
import com.imdroid.common.util.WrongMessageRecorder;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -26,12 +25,12 @@ public class D341LocationMessage extends BaseMessage {
this.header = src.getUnsignedShort(pos);pos+=2; this.header = src.getUnsignedShort(pos);pos+=2;
this.len = src.getUnsignedShort(pos);pos+=2; this.len = src.getUnsignedShort(pos);pos+=2;
this.seq = this.len >> 11; this.seq = this.len >> 11;
this.len = this.len & 0x7FF; this.len = packetLen;//this.len & 0x7FF;
this.id = String.valueOf(src.getUnsignedInt(pos));pos+=4; //id this.id = String.valueOf(src.getUnsignedInt(pos));pos+=4; //id
if (packetLen - 4 != this.len) { /*if (packetLen - 4 != this.len) {
String msg = (String.format("id[%s],长度字段值[%s]与包的消息体长度[%s]不匹配", id, this.len, packetLen - 4)); String msg = (String.format("id[%s],长度字段值[%s]与包的消息体长度[%s]不匹配", id, this.len, packetLen - 4));
WrongMessageRecorder.INSTANCE.append("receive wrong message," + msg); WrongMessageRecorder.INSTANCE.append("receive wrong message," + msg);
} }*/
this.pps = src.getUnsignedShort(pos);pos+=2; this.pps = src.getUnsignedShort(pos);pos+=2;
tilt = new Tilt(src.getFloat(pos), src.getFloat(pos+4),src.getFloat(pos+8),src.getFloat(pos+12)); tilt = new Tilt(src.getFloat(pos), src.getFloat(pos+4),src.getFloat(pos+8),src.getFloat(pos+12));