From 1c029a3bc2437230409c8daf39f03ec52014d579 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 16 Jun 2017 00:57:54 +1200 Subject: Minor Atrack frame decoder update --- src/org/traccar/protocol/AtrackFrameDecoder.java | 4 +--- test/org/traccar/protocol/AtrackFrameDecoderTest.java | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/org/traccar/protocol/AtrackFrameDecoder.java b/src/org/traccar/protocol/AtrackFrameDecoder.java index 3c7d287fe..ce4a9a65f 100644 --- a/src/org/traccar/protocol/AtrackFrameDecoder.java +++ b/src/org/traccar/protocol/AtrackFrameDecoder.java @@ -50,9 +50,7 @@ public class AtrackFrameDecoder extends FrameDecoder { int endIndex = buf.indexOf(buf.readerIndex(), buf.writerIndex(), new StringFinder("\r\n")); if (endIndex > 0) { - ChannelBuffer frame = buf.readBytes(endIndex - buf.readerIndex()); - buf.skipBytes(2); - return frame; + return buf.readBytes(endIndex - buf.readerIndex() + 2); } } diff --git a/test/org/traccar/protocol/AtrackFrameDecoderTest.java b/test/org/traccar/protocol/AtrackFrameDecoderTest.java index 60b338cca..93e804dc9 100644 --- a/test/org/traccar/protocol/AtrackFrameDecoderTest.java +++ b/test/org/traccar/protocol/AtrackFrameDecoderTest.java @@ -12,7 +12,7 @@ public class AtrackFrameDecoderTest extends ProtocolTest { AtrackFrameDecoder decoder = new AtrackFrameDecoder(); Assert.assertEquals( - binary("244F4B"), + binary("244F4B0D0A"), decoder.decode(null, null, binary("244F4B0D0A"))); Assert.assertEquals( -- cgit v1.2.3