diff options
-rw-r--r-- | src/org/traccar/protocol/AlematicsProtocolDecoder.java | 4 | ||||
-rw-r--r-- | test/org/traccar/protocol/AlematicsProtocolDecoderTest.java | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/AlematicsProtocolDecoder.java b/src/org/traccar/protocol/AlematicsProtocolDecoder.java index 794588f5f..8909b8d5b 100644 --- a/src/org/traccar/protocol/AlematicsProtocolDecoder.java +++ b/src/org/traccar/protocol/AlematicsProtocolDecoder.java @@ -60,6 +60,8 @@ public class AlematicsProtocolDecoder extends BaseProtocolDecoder { .or() .number("(d+),") // extra mask .expression("(.*)") // extra data + .or() + .any() .groupEnd() .compile(); @@ -144,7 +146,7 @@ public class AlematicsProtocolDecoder extends BaseProtocolDecoder { if (parser.hasNext()) { position.set("text", parser.next()); - } else { + } else if (parser.hasNext()) { decodeExtras(position, parser); } diff --git a/test/org/traccar/protocol/AlematicsProtocolDecoderTest.java b/test/org/traccar/protocol/AlematicsProtocolDecoderTest.java index 448a48101..094e5b56e 100644 --- a/test/org/traccar/protocol/AlematicsProtocolDecoderTest.java +++ b/test/org/traccar/protocol/AlematicsProtocolDecoderTest.java @@ -11,6 +11,12 @@ public class AlematicsProtocolDecoderTest extends ProtocolTest { AlematicsProtocolDecoder decoder = new AlematicsProtocolDecoder(new AlematicsProtocol()); verifyPosition(decoder, text( + "$T,2,64,866050035975497,20180726103446,20180726103514,23.033305,72.558032,0,0,41,5.4,4,0,0,0.000,12.960,0,")); + + verifyPosition(decoder, text( + "$T,2,65,866050035975497,20180726103646,20180726103736,23.033305,72.558032,0,0,41,5.4,4,0,0,0.000,12.976,0,0")); + + verifyPosition(decoder, text( "$T,2,552,868259020159698,20170515060949,20170515060949,25.035277,121.561986,0,202,78,1.0,8,1,0,0.000,12.768,1629,38,12770,4109,9")); verifyPosition(decoder, text( |