| | |
| | | import com.ruoyi.dataInterchange.util.jtt809.common.Jtt809Constant; |
| | | import com.ruoyi.dataInterchange.util.jtt809.common.Jtt809Util; |
| | | import com.ruoyi.dataInterchange.util.jtt809.gnsscenter.GnssCenterService; |
| | | import com.ruoyi.dataInterchange.util.jtt809.packet.common.OuterPacket;import io.netty.buffer.ByteBuf; |
| | | import com.ruoyi.dataInterchange.util.jtt809.packet.common.OuterPacket; |
| | | import io.netty.buffer.ByteBuf; |
| | | import io.netty.buffer.ByteBufUtil; |
| | | import io.netty.buffer.Unpooled; |
| | | import io.netty.channel.ChannelHandlerContext; |
| | | import io.netty.handler.codec.MessageToMessageDecoder; |
| | | import io.netty.util.ReferenceCountUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.time.DateUtils; |
| | | |
| | | import java.text.ParseException; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | long length = byteBuf.readUnsignedInt(); |
| | | // 长度校验, 反转义之后数组加上包头和包尾长度与解析出来的长度对比; |
| | | // 因为数据长度不包含校验码,而此时解析出来的数据不包含头尾标识,刚好都是2个字节,所以两个长度应该相等 |
| | | if (length != bytes.length) { |
| | | log.warn("消息长度校验错误,报文解析出来长度为 {}, 实际可解析的长度为 {}", length, bytes.length); |
| | | return; |
| | | } |
| | | // if (length != bytes.length) { |
| | | // log.warn("消息长度校验错误,报文解析出来长度为 {}, 实际可解析的长度为 {}", length, bytes.length); |
| | | // return; |
| | | // } |
| | | // 报文序列号 |
| | | long sn = byteBuf.readUnsignedInt(); |
| | | // 业务数据类型 |
| | |
| | | out.add(new OuterPacket(length, sn, id, gnsscenterId, version, encryptFlag, encryptKey, body, crcCode)); |
| | | } |
| | | |
| | | |
| | | } |