简介
最近公司有个项目需要接收公交公司的实时推送的公交车位置数据。于是就用Netty简单实现了JT809协议的部分功能。
主要代码和使用
- 项目结构
解码适配器
package cn.xiuminglee.jt809.protocol;
import cn.xiuminglee.jt809.common.util.CommonUtils;
import cn.xiuminglee.jt809.common.util.CrcUtil;
import cn.xiuminglee.jt809.common.util.PacketDecoderUtils;
import cn.xiuminglee.jt809.packet.JT809BasePacket;
import cn.xiuminglee.jt809.protocol.decoder.DecoderFactory;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;
import org.slf4j.Logger;