From d3e39051984592f181b04256e38c2396d0cda78d Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 8 Dec 2017 04:58:58 +1300 Subject: Fix Totem AT09 frames decoding --- src/org/traccar/protocol/TotemFrameDecoder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/org') diff --git a/src/org/traccar/protocol/TotemFrameDecoder.java b/src/org/traccar/protocol/TotemFrameDecoder.java index 6940d7b46..6c9b14559 100644 --- a/src/org/traccar/protocol/TotemFrameDecoder.java +++ b/src/org/traccar/protocol/TotemFrameDecoder.java @@ -42,8 +42,8 @@ public class TotemFrameDecoder extends FrameDecoder { int length; - int flagIndex = buf.indexOf(buf.readerIndex(), buf.writerIndex(), new StringFinder("AA")); - if (flagIndex != -1 && flagIndex - beginIndex == 6) { + int separatorIndex = buf.indexOf(buf.readerIndex(), buf.writerIndex(), (byte) '|'); + if (separatorIndex > 0 && separatorIndex - beginIndex > 19) { length = Integer.parseInt(buf.toString(buf.readerIndex() + 2, 4, StandardCharsets.US_ASCII)); } else { length = Integer.parseInt(buf.toString(buf.readerIndex() + 2, 2, StandardCharsets.US_ASCII), 16); -- cgit v1.2.3