diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-04-27 06:21:56 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2018-04-27 06:21:56 +1200 |
commit | 2738665b298f3b8de33f96c893ae40ac5d6d25d0 (patch) | |
tree | 24716f58005869656b5e7a3c0b0e641843ac230d | |
parent | be6226d7039be781be4ce710e98ca85fd39bb3b9 (diff) | |
download | trackermap-server-2738665b298f3b8de33f96c893ae40ac5d6d25d0.tar.gz trackermap-server-2738665b298f3b8de33f96c893ae40ac5d6d25d0.tar.bz2 trackermap-server-2738665b298f3b8de33f96c893ae40ac5d6d25d0.zip |
Fix Totem alarm decoding
-rw-r--r-- | src/org/traccar/protocol/TotemProtocolDecoder.java | 2 | ||||
-rw-r--r-- | test/org/traccar/protocol/TotemProtocolDecoderTest.java | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java index 841c3c3dc..06a1fbc41 100644 --- a/src/org/traccar/protocol/TotemProtocolDecoder.java +++ b/src/org/traccar/protocol/TotemProtocolDecoder.java @@ -367,7 +367,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder { String sentence = (String) msg; Pattern pattern = PATTERN3; - if (sentence.indexOf("A") == 6) { + if (sentence.charAt(2) == '0') { pattern = PATTERN4; } else if (sentence.contains("$GPRMC")) { pattern = PATTERN1; diff --git a/test/org/traccar/protocol/TotemProtocolDecoderTest.java b/test/org/traccar/protocol/TotemProtocolDecoderTest.java index 67c75e08d..ae0a240b8 100644 --- a/test/org/traccar/protocol/TotemProtocolDecoderTest.java +++ b/test/org/traccar/protocol/TotemProtocolDecoderTest.java @@ -11,6 +11,9 @@ public class TotemProtocolDecoderTest extends ProtocolTest { TotemProtocolDecoder decoder = new TotemProtocolDecoder(new TotemProtocol()); verifyPosition(decoder, text( + "$$011602867119025755430|50099800180420045019401400000000000000B8797D110816811201.500002132615.7037S02801.8099E056149")); + + verifyPosition(decoder, text( "$$0108AB863835028447675|5004C0001710250234064214059828A058AE121010604000.600000320304.7772N10134.8238E11625B")); verifyPosition(decoder, text( |