aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-09-14 02:47:00 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-09-14 02:47:00 +1200
commit38bbab77b848989b1065a41666518bef64d147e5 (patch)
tree5fe8e7e1b6c61583e8df6f3b84430bbd90d5cff1
parent3fa2c036a5928ff85e584f1d05a1fa970f9b1a16 (diff)
downloadtrackermap-server-38bbab77b848989b1065a41666518bef64d147e5.tar.gz
trackermap-server-38bbab77b848989b1065a41666518bef64d147e5.tar.bz2
trackermap-server-38bbab77b848989b1065a41666518bef64d147e5.zip
Support Xexun messages without time
-rw-r--r--src/org/traccar/protocol/XexunProtocolDecoder.java4
-rw-r--r--test/org/traccar/protocol/XexunProtocolDecoderTest.java4
2 files changed, 5 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/XexunProtocolDecoder.java b/src/org/traccar/protocol/XexunProtocolDecoder.java
index 69100f54b..7ec2685fa 100644
--- a/src/org/traccar/protocol/XexunProtocolDecoder.java
+++ b/src/org/traccar/protocol/XexunProtocolDecoder.java
@@ -37,13 +37,13 @@ public class XexunProtocolDecoder extends BaseProtocolDecoder {
private static final Pattern PATTERN_BASIC = new PatternBuilder()
.expression("G[PN]RMC,")
- .number("(dd)(dd)(dd).(d+),") // time
+ .number("(?:(dd)(dd)(dd))?.(d+),") // time
.expression("([AV]),") // validity
.number("(d*?)(d?d.d+),([NS]),") // latitude
.number("(d*?)(d?d.d+),([EW])?,") // longitude
.number("(d+.?d*),") // speed
.number("(d+.?d*)?,") // course
- .number("(dd)(dd)(dd),") // date
+ .number("(?:(dd)(dd)(dd))?,") // date
.expression("[^*]*").text("*")
.number("xx") // checksum
.expression("\\r\\n").optional()
diff --git a/test/org/traccar/protocol/XexunProtocolDecoderTest.java b/test/org/traccar/protocol/XexunProtocolDecoderTest.java
index ac90daec5..e94fb62e8 100644
--- a/test/org/traccar/protocol/XexunProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/XexunProtocolDecoderTest.java
@@ -1,6 +1,5 @@
package org.traccar.protocol;
-
import org.junit.Test;
import org.traccar.ProtocolTest;
@@ -11,6 +10,9 @@ public class XexunProtocolDecoderTest extends ProtocolTest {
XexunProtocolDecoder decoder = new XexunProtocolDecoder(new XexunProtocol(), false);
+ verifyAttributes(decoder, text(
+ "GPRMC,.000,A,0.000000,S,0.0000,W,0.00,0.00,,00,0000.0,A*55,L,,imei:353579010727036,"));
+
verifyPosition(decoder, text(
"GPRMC,113518.000,A,5303.4150,N,10.2368,E,60.73,207.42,260216,00,0000.0,A*74,F,,imei:351525018007873,"));