diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-12-08 04:58:58 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-12-08 04:58:58 +1300 |
commit | d3e39051984592f181b04256e38c2396d0cda78d (patch) | |
tree | f248ac9f82bac1ad03876cbcbc10baf4d2c37f09 /src/org/traccar/protocol | |
parent | f839ca4c24d80dcd78b5ad1d65f10cdf534d94d8 (diff) | |
download | traccar-server-d3e39051984592f181b04256e38c2396d0cda78d.tar.gz traccar-server-d3e39051984592f181b04256e38c2396d0cda78d.tar.bz2 traccar-server-d3e39051984592f181b04256e38c2396d0cda78d.zip |
Fix Totem AT09 frames decoding
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r-- | src/org/traccar/protocol/TotemFrameDecoder.java | 4 |
1 files changed, 2 insertions, 2 deletions
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); |