From da7852b28d48f0c3a3a2e5d272fa89ea28817abf Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 10 Jan 2015 13:40:37 +1300 Subject: Fix Tramigo frame decoder --- src/org/traccar/protocol/TramigoFrameDecoder.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/org/traccar/protocol/TramigoFrameDecoder.java b/src/org/traccar/protocol/TramigoFrameDecoder.java index 5b3f41078..f6dde4298 100644 --- a/src/org/traccar/protocol/TramigoFrameDecoder.java +++ b/src/org/traccar/protocol/TramigoFrameDecoder.java @@ -44,10 +44,16 @@ public class TramigoFrameDecoder extends LengthFieldBasedFrameDecoder { int length = buf.readableBytes(); byte bytes[] = new byte[length]; buf.getBytes(buf.readerIndex(), bytes); - buf = ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, bytes); + + ChannelBuffer result = (ChannelBuffer) super.decode( + ctx, channel, ChannelBuffers.wrappedBuffer(ByteOrder.LITTLE_ENDIAN, bytes)); + if (result != null) { + buf.skipBytes(result.readableBytes()); + } + return result; } - return decode(ctx, channel, buf); + return super.decode(ctx, channel, buf); } } -- cgit v1.2.3