diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-03-05 09:46:51 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-03-05 09:46:51 +1300 |
commit | 3c0d6bc88adc702fac35ef4f5c3a42e1b435f603 (patch) | |
tree | 10644bd6d0b2adccc980ff69e7ea12b5972c5962 /src | |
parent | 4aaf5526f676b810b919737f081796614f93faf9 (diff) | |
download | traccar-server-3c0d6bc88adc702fac35ef4f5c3a42e1b435f603.tar.gz traccar-server-3c0d6bc88adc702fac35ef4f5c3a42e1b435f603.tar.bz2 traccar-server-3c0d6bc88adc702fac35ef4f5c3a42e1b435f603.zip |
Improve Atrack decoder
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/protocol/AtrackProtocolDecoder.java | 4 |
1 files changed, 3 insertions, 1 deletions
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<Position> positions = new LinkedList<Position>(); - while (buf.readable()) { + while (buf.readableBytes() >= MIN_DATA_LENGTH) { // Create new position Position position = new Position(); |