Skip to content

Commit

Permalink
Adjust Alematics regex pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
tananaev committed Jul 30, 2018
1 parent 6135c62 commit 36d06c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/org/traccar/protocol/AlematicsProtocolDecoder.java
Expand Up @@ -60,6 +60,8 @@ public AlematicsProtocolDecoder(AlematicsProtocol protocol) {
.or()
.number("(d+),") // extra mask
.expression("(.*)") // extra data
.or()
.any()
.groupEnd()
.compile();

Expand Down Expand Up @@ -144,7 +146,7 @@ protected Object decode(

if (parser.hasNext()) {
position.set("text", parser.next());
} else {
} else if (parser.hasNext()) {
decodeExtras(position, parser);
}

Expand Down
6 changes: 6 additions & 0 deletions test/org/traccar/protocol/AlematicsProtocolDecoderTest.java
Expand Up @@ -10,6 +10,12 @@ public void testDecode() throws Exception {

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"));

Expand Down

0 comments on commit 36d06c7

Please sign in to comment.