mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-24 13:05:11 +08:00
解码器拆分
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.jsowell.netty.decoder;
|
||||
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.handler.codec.ByteToMessageDecoder;
|
||||
@@ -107,7 +108,12 @@ public class YunKuaiChongDecoder extends ByteToMessageDecoder {
|
||||
// 读取 data 数据 最后+2是帧校验域长度
|
||||
ByteBuf frame = buffer.retainedSlice(beginReader, HEADER_LENGTH_68 + 1 + length + 2);
|
||||
buffer.readerIndex(beginReader + HEADER_LENGTH_68 + 1 + length + 2);
|
||||
out.add(frame);
|
||||
|
||||
// 转为YKCDataProtocol对象
|
||||
byte[] bytes = new byte[HEADER_LENGTH_68 + 1 + length + 2];
|
||||
frame.readBytes(bytes);
|
||||
YKCDataProtocol ykcDataProtocol = new YKCDataProtocol(bytes);
|
||||
out.add(ykcDataProtocol);
|
||||
}
|
||||
|
||||
// 处理DNY协议消息
|
||||
|
||||
Reference in New Issue
Block a user