修正消息解码时,未将原码保存至 srcData 的问题

This commit is contained in:
fengyarnom 2024-10-30 18:11:08 +08:00
parent b556a3349f
commit 9495bcfcdb
2 changed files with 11 additions and 0 deletions

View File

@ -58,6 +58,11 @@ public class D3F0SelfCheckMessage extends BaseMessage {
" reboot:"+src.readUnsignedShort();
}
// read 会移动 bytebuf 的指针所以保存原始码流需要将此指针挑拨回开始处
src.readerIndex(0);
this.srcData = new byte[src.readableBytes()];
src.readBytes(this.srcData);
}
}

View File

@ -1,5 +1,6 @@
package com.imdroid.sideslope.message;
import com.imdroid.common.util.HexUtil;
import com.imdroid.secapi.dto.GnssTrxMsg;
import io.netty.buffer.ByteBuf;
import lombok.Data;
@ -60,6 +61,11 @@ public class D3F2StopIndicationMessage extends BaseMessage {
}
}
// read 会移动 bytebuf 的指针所以保存原始码流需要将此指针挑拨回开始处
src.readerIndex(0);
this.srcData = new byte[src.readableBytes()];
src.readBytes(this.srcData);
}
}