From 9391d6110334587814bdd38ad2b156c35e625cec Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 18 Apr 2015 11:01:19 +1200 Subject: Fix Ulbotech frame decoder --- src/org/traccar/protocol/UlbotechFrameDecoder.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/org/traccar/protocol/UlbotechFrameDecoder.java b/src/org/traccar/protocol/UlbotechFrameDecoder.java index 3466118b0..6eff29a08 100644 --- a/src/org/traccar/protocol/UlbotechFrameDecoder.java +++ b/src/org/traccar/protocol/UlbotechFrameDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2014 - 2015 Anton Tananaev (anton.tananaev@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; import org.jboss.netty.handler.codec.frame.FrameDecoder; -import org.traccar.helper.ChannelBufferTools; public class UlbotechFrameDecoder extends FrameDecoder { @@ -36,9 +35,9 @@ public class UlbotechFrameDecoder extends FrameDecoder { int index = buf.indexOf(buf.readerIndex() + 1, buf.writerIndex(), (byte) 0xF8); if (index != -1) { - ChannelBuffer result = ChannelBuffers.buffer(index - buf.readerIndex()); + ChannelBuffer result = ChannelBuffers.buffer(index + 1 - buf.readerIndex()); - while (buf.readerIndex() < index) { + while (buf.readerIndex() <= index) { int b = buf.readUnsignedByte(); if (b == 0xF7) { int ext = buf.readUnsignedByte(); -- cgit v1.2.3