aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-02-07 07:45:44 +1000
committerAnton Tananaev <anton.tananaev@gmail.com>2016-02-07 07:45:44 +1000
commitf325f30ab8d9097eec01a39f5e7ac02c11d608c3 (patch)
tree78da8e3263612ff45e3b778fbeee0f7a1d04476f
parent18aaf44bcde8eb5243b069727fb4f056e94df938 (diff)
downloadtrackermap-server-f325f30ab8d9097eec01a39f5e7ac02c11d608c3.tar.gz
trackermap-server-f325f30ab8d9097eec01a39f5e7ac02c11d608c3.tar.bz2
trackermap-server-f325f30ab8d9097eec01a39f5e7ac02c11d608c3.zip
Handle new line in Xexun messages
-rw-r--r--src/org/traccar/protocol/XexunProtocolDecoder.java5
-rw-r--r--test/org/traccar/protocol/XexunProtocolDecoderTest.java3
2 files changed, 6 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/XexunProtocolDecoder.java b/src/org/traccar/protocol/XexunProtocolDecoder.java
index f9369b463..0929ee99b 100644
--- a/src/org/traccar/protocol/XexunProtocolDecoder.java
+++ b/src/org/traccar/protocol/XexunProtocolDecoder.java
@@ -44,8 +44,9 @@ public class XexunProtocolDecoder extends BaseProtocolDecoder {
.number("(d+.?d*)?,") // course
.number("(dd)(dd)(dd),") // date
.expression("[^*]*").text("*")
- .number("xx,") // checksum
- .expression("([FL]),") // signal
+ .number("xx") // checksum
+ .expression("\\r\\n").optional()
+ .expression(",([FL]),") // signal
.expression("([^,]*),").optional() // alarm
.any()
.number("imei:(d+),") // imei
diff --git a/test/org/traccar/protocol/XexunProtocolDecoderTest.java b/test/org/traccar/protocol/XexunProtocolDecoderTest.java
index 27574ddce..76c516caf 100644
--- a/test/org/traccar/protocol/XexunProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/XexunProtocolDecoderTest.java
@@ -12,6 +12,9 @@ public class XexunProtocolDecoderTest extends ProtocolTest {
XexunProtocolDecoder decoder = new XexunProtocolDecoder(new XexunProtocol(), false);
verifyPosition(decoder, text(
+ "GPRMC,121535.000,A,5417.2666,N,04822.1264,E,1.452,30.42,031014,0.0,A*4D\r\n,L,imei:355227042011730,"));
+
+ verifyPosition(decoder, text(
"GPRMC,150120.000,A,3346.4463,S,15057.3083,E,0.0,117.4,010911,,,A*76,F,imei:351525010943661,"),
position("2011-09-01 15:01:20.000", true, -33.77411, 150.95514));