From 7c8e00eba940fdbcde3ea2b60e6094caa9098b99 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 25 Jul 2018 05:44:23 +1200 Subject: Improve Atrack decoder pattern --- src/org/traccar/protocol/AtrackProtocolDecoder.java | 2 +- test/org/traccar/protocol/AtrackProtocolDecoderTest.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/org/traccar/protocol/AtrackProtocolDecoder.java b/src/org/traccar/protocol/AtrackProtocolDecoder.java index ebccfec94..7755bfa25 100644 --- a/src/org/traccar/protocol/AtrackProtocolDecoder.java +++ b/src/org/traccar/protocol/AtrackProtocolDecoder.java @@ -274,7 +274,7 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder { .number("(-?d+),") // latitude .number("(d+),") // course .number("(d+),") // report id - .number("(d+.d+),") // odometer + .number("(d+.?d*),") // odometer .number("(d+),") // hdop .number("(d+),") // inputs .number("(d+),") // speed diff --git a/test/org/traccar/protocol/AtrackProtocolDecoderTest.java b/test/org/traccar/protocol/AtrackProtocolDecoderTest.java index 1fe579c76..fbe94ce19 100644 --- a/test/org/traccar/protocol/AtrackProtocolDecoderTest.java +++ b/test/org/traccar/protocol/AtrackProtocolDecoderTest.java @@ -10,6 +10,9 @@ public class AtrackProtocolDecoderTest extends ProtocolTest { AtrackProtocolDecoder decoder = new AtrackProtocolDecoder(new AtrackProtocol()); + verifyPosition(decoder, buffer( + "@P,3A34,146,41431,353816057242284,20180622015809,20180622015809,20180622015809,9720689,4014230,61,2,0,20,1,0,0,0,0,2000,2000,12160,42,624,002,20009,20014,\r\n")); + verifyPosition(decoder, buffer( "@P,1126,121,104547,358901048091554,20180412143513,20180412143514,20180413060000,16423389,48178700,108,2,6.5,9,0,0,0,0,0,2000,2000,\r\n")); -- cgit v1.2.3