Skip to content

Commit

Permalink
Fix Totem alarm decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
tananaev committed Apr 26, 2018
1 parent be6226d commit 2738665
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/org/traccar/protocol/TotemProtocolDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ protected Object decode(

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;
Expand Down
3 changes: 3 additions & 0 deletions test/org/traccar/protocol/TotemProtocolDecoderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ public void testDecode() throws Exception {

TotemProtocolDecoder decoder = new TotemProtocolDecoder(new TotemProtocol());

verifyPosition(decoder, text(
"$$011602867119025755430|50099800180420045019401400000000000000B8797D110816811201.500002132615.7037S02801.8099E056149"));

verifyPosition(decoder, text(
"$$0108AB863835028447675|5004C0001710250234064214059828A058AE121010604000.600000320304.7772N10134.8238E11625B"));

Expand Down

0 comments on commit 2738665

Please sign in to comment.