aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/RoboTrackFrameDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol/RoboTrackFrameDecoder.java')
-rw-r--r--src/org/traccar/protocol/RoboTrackFrameDecoder.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/org/traccar/protocol/RoboTrackFrameDecoder.java b/src/org/traccar/protocol/RoboTrackFrameDecoder.java
index af215103c..aecbaaa3b 100644
--- a/src/org/traccar/protocol/RoboTrackFrameDecoder.java
+++ b/src/org/traccar/protocol/RoboTrackFrameDecoder.java
@@ -15,14 +15,14 @@
*/
package org.traccar.protocol;
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.channel.Channel;
-import org.jboss.netty.channel.ChannelHandlerContext;
-import org.jboss.netty.handler.codec.frame.FrameDecoder;
+import io.netty.buffer.ByteBuf;
+import io.netty.channel.Channel;
+import io.netty.channel.ChannelHandlerContext;
+import org.traccar.BaseFrameDecoder;
-public class RoboTrackFrameDecoder extends FrameDecoder {
+public class RoboTrackFrameDecoder extends BaseFrameDecoder {
- private int messageLength(ChannelBuffer buf) {
+ private int messageLength(ByteBuf buf) {
switch ((int) buf.getByte(buf.readerIndex())) {
case RoboTrackProtocolDecoder.MSG_ID:
return 69;
@@ -33,7 +33,7 @@ public class RoboTrackFrameDecoder extends FrameDecoder {
case RoboTrackProtocolDecoder.MSG_IMAGE_START:
return 24;
case RoboTrackProtocolDecoder.MSG_IMAGE_DATA:
- return 8 + buf.getUnsignedShort(buf.readerIndex() + 1);
+ return 8 + buf.getUnsignedShortLE(buf.readerIndex() + 1);
case RoboTrackProtocolDecoder.MSG_IMAGE_END:
return 6;
default:
@@ -43,12 +43,12 @@ public class RoboTrackFrameDecoder extends FrameDecoder {
@Override
protected Object decode(
- ChannelHandlerContext ctx, Channel channel, ChannelBuffer buf) throws Exception {
+ ChannelHandlerContext ctx, Channel channel, ByteBuf buf) throws Exception {
int length = messageLength(buf);
if (buf.readableBytes() >= length) {
- return buf.readBytes(length);
+ return buf.readRetainedSlice(length);
}
return null;