1、修改d331解析角度的bug

This commit is contained in:
weidong 2025-10-28 10:06:15 +08:00
parent ab0bd9943c
commit f2ef68a9ae

View File

@ -20,21 +20,22 @@ public class D331RtcmMessage extends BaseMessage {
@Override @Override
public void decodeBody(ByteBuf src) { public void decodeBody(ByteBuf src) {
// get操作不会移动指针这样可以确保整个全转发出去 // get操作不会移动指针这样可以确保整个全转发出去
int pos = 0;
this.packetNum = 1; this.packetNum = 1;
this.len = src.readableBytes();//this.len & 0x7FF;//有可能两个d331粘包 this.len = src.readableBytes();//this.len & 0x7FF;//有可能两个d331粘包
this.header = src.getUnsignedShort(0); // flag this.header = src.getUnsignedShort(pos); pos+=2;// flag
int onePacketLen = src.getUnsignedShort(2); // length:11 bits int onePacketLen = src.getUnsignedShort(pos); pos+=2;// length:11 bits
this.seq = onePacketLen >> 11; this.seq = onePacketLen >> 11;
onePacketLen = onePacketLen&0x7FF; onePacketLen = onePacketLen&0x7FF;
this.id = String.valueOf(src.getUnsignedInt(4)); //id this.id = String.valueOf(src.getUnsignedInt(pos)); pos+=4;//id
int pos = onePacketLen + 4; if(onePacketLen + 4<this.len) {
while (pos < this.len) { while (pos < this.len) {
if (src.getUnsignedShort(pos) == 0xd331) { if (src.getUnsignedShort(pos) == 0xd331) {
onePacketLen = src.getUnsignedShort(pos + 2) & 0x7FF; onePacketLen = src.getUnsignedShort(pos + 2) & 0x7FF;
pos = pos + 4 + onePacketLen; pos = pos + 4 + onePacketLen;
packetNum++; packetNum++;
} else pos++;
} }
else pos++;
} }
/*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);