diff options
Diffstat (limited to 'src/org/traccar/protocol/Gt02ProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/Gt02ProtocolDecoder.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/Gt02ProtocolDecoder.java b/src/org/traccar/protocol/Gt02ProtocolDecoder.java index a4f1a4161..3eb3e193a 100644 --- a/src/org/traccar/protocol/Gt02ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gt02ProtocolDecoder.java @@ -15,9 +15,10 @@ */ package org.traccar.protocol; -import org.jboss.netty.buffer.ChannelBuffer; -import org.jboss.netty.buffer.ChannelBuffers; -import org.jboss.netty.channel.Channel; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.ByteBufUtil; +import io.netty.buffer.Unpooled; +import io.netty.channel.Channel; import org.traccar.BaseProtocolDecoder; import org.traccar.DeviceSession; import org.traccar.helper.BitUtil; @@ -42,7 +43,7 @@ public class Gt02ProtocolDecoder extends BaseProtocolDecoder { protected Object decode( Channel channel, SocketAddress remoteAddress, Object msg) throws Exception { - ChannelBuffer buf = (ChannelBuffer) msg; + ByteBuf buf = (ByteBuf) msg; buf.skipBytes(2); // header buf.readByte(); // size @@ -53,7 +54,7 @@ public class Gt02ProtocolDecoder extends BaseProtocolDecoder { int power = buf.readUnsignedByte(); int gsm = buf.readUnsignedByte(); - String imei = ChannelBuffers.hexDump(buf.readBytes(8)).substring(1); + String imei = ByteBufUtil.hexDump(buf.readBytes(8)).substring(1); DeviceSession deviceSession = getDeviceSession(channel, remoteAddress, imei); if (deviceSession == null) { return null; @@ -73,7 +74,7 @@ public class Gt02ProtocolDecoder extends BaseProtocolDecoder { if (channel != null) { byte[] response = {0x54, 0x68, 0x1A, 0x0D, 0x0A}; - channel.write(ChannelBuffers.wrappedBuffer(response)); + channel.write(Unpooled.wrappedBuffer(response)); } } else if (type == MSG_DATA) { |