aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-04-18 11:01:19 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-04-18 11:01:19 +1200
commit9391d6110334587814bdd38ad2b156c35e625cec (patch)
treea43cfcbf1da8a0c131ae8e815e58a826652a1014
parent56a2c772a40c209d980e4ac4caa98969d8aa2cdb (diff)
downloadtrackermap-server-9391d6110334587814bdd38ad2b156c35e625cec.tar.gz
trackermap-server-9391d6110334587814bdd38ad2b156c35e625cec.tar.bz2
trackermap-server-9391d6110334587814bdd38ad2b156c35e625cec.zip
Fix Ulbotech frame decoder
-rw-r--r--src/org/traccar/protocol/UlbotechFrameDecoder.java7
1 files changed, 3 insertions, 4 deletions
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();