|
@@ -64,6 +64,10 @@ public class YiTongGpsServerHandler extends HexBinaryAcceptanceHandlerAdapter {
|
|
|
protected void handle(ByteBuf in, Channel channel) throws Exception {
|
|
|
if (in.isReadable()) {
|
|
|
in.markReaderIndex();
|
|
|
+ byte[] data = new byte[in.readableBytes()];
|
|
|
+ in.readBytes(data,0,in.readableBytes());
|
|
|
+ in.resetReaderIndex();
|
|
|
+
|
|
|
try {
|
|
|
int index = 0;
|
|
|
byte b = 0;
|
|
@@ -80,7 +84,7 @@ public class YiTongGpsServerHandler extends HexBinaryAcceptanceHandlerAdapter {
|
|
|
} else {
|
|
|
length = in.readShort() & 0xffff;
|
|
|
}
|
|
|
- handle(in, length, channel);
|
|
|
+ handle(in, length, channel, data);
|
|
|
} catch (Exception e) {
|
|
|
logger.error(e.getMessage(), e);
|
|
|
}
|
|
@@ -100,13 +104,15 @@ public class YiTongGpsServerHandler extends HexBinaryAcceptanceHandlerAdapter {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- private void handle(ByteBuf in, int length, Channel channel) throws Exception {
|
|
|
+ private void handle(ByteBuf in, int length, Channel channel,byte[] data) throws Exception {
|
|
|
if (in.isReadable()) {
|
|
|
String deviceId = channelDeviceMap.get(channel);
|
|
|
if (deviceId!=null) {
|
|
|
MDC.put(MDC_DEVICEID, deviceId);
|
|
|
}
|
|
|
+
|
|
|
byte msgType = in.readByte();
|
|
|
+
|
|
|
if (LOGIN_MSG == msgType) {
|
|
|
resolveLoginMSG(in, channel);
|
|
|
} else if (LOCATION_MSG == msgType) {
|
|
@@ -136,7 +142,7 @@ public class YiTongGpsServerHandler extends HexBinaryAcceptanceHandlerAdapter {
|
|
|
// 增加KKS 协议报文转发
|
|
|
// KKS protocolCode = 3
|
|
|
boolean isInitial = (LOGIN_MSG == msgType);
|
|
|
- sendOriginalMsg(getOriginalData(in, deviceId), deviceId,isInitial,3);
|
|
|
+ sendOriginalMsg(data, deviceId,isInitial,3);
|
|
|
|
|
|
}
|
|
|
|