From 3c0d6bc88adc702fac35ef4f5c3a42e1b435f603 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 5 Mar 2015 09:46:51 +1300 Subject: Improve Atrack decoder --- src/org/traccar/protocol/AtrackProtocolDecoder.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/org') diff --git a/src/org/traccar/protocol/AtrackProtocolDecoder.java b/src/org/traccar/protocol/AtrackProtocolDecoder.java index 1323ce8a3..607b3e558 100644 --- a/src/org/traccar/protocol/AtrackProtocolDecoder.java +++ b/src/org/traccar/protocol/AtrackProtocolDecoder.java @@ -42,6 +42,8 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder { private static final int MSG_HEARTBEAT = 0x1A; private static final int MSG_DATA = 0x10; + private static final int MIN_DATA_LENGTH = 40; + private static void sendResponse(Channel channel, SocketAddress remoteAddress, long rawId, int index) { if (channel != null) { ChannelBuffer response = ChannelBuffers.directBuffer(12); @@ -104,7 +106,7 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder { List positions = new LinkedList(); - while (buf.readable()) { + while (buf.readableBytes() >= MIN_DATA_LENGTH) { // Create new position Position position = new Position(); -- cgit v1.2.3