aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-12-08 04:58:58 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2017-12-08 04:58:58 +1300
commitd3e39051984592f181b04256e38c2396d0cda78d (patch)
treef248ac9f82bac1ad03876cbcbc10baf4d2c37f09 /src/org/traccar/protocol
parentf839ca4c24d80dcd78b5ad1d65f10cdf534d94d8 (diff)
downloadtrackermap-server-d3e39051984592f181b04256e38c2396d0cda78d.tar.gz
trackermap-server-d3e39051984592f181b04256e38c2396d0cda78d.tar.bz2
trackermap-server-d3e39051984592f181b04256e38c2396d0cda78d.zip
Fix Totem AT09 frames decoding
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/TotemFrameDecoder.java4
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);