aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-08-29 20:32:10 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2013-08-29 20:32:10 +1200
commit3f8c59f633f430e477d27301f2358499906fb21a (patch)
treee5fae28b1c9ff5f6c1bc1de8170036652be7684f
parent6223aaf9c397ffa930fddbd7b5e42fc6c94ad63d (diff)
downloadtrackermap-server-3f8c59f633f430e477d27301f2358499906fb21a.tar.gz
trackermap-server-3f8c59f633f430e477d27301f2358499906fb21a.tar.bz2
trackermap-server-3f8c59f633f430e477d27301f2358499906fb21a.zip
Fix GPS103 decoder (fix #371)
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolDecoder.java8
-rw-r--r--test/org/traccar/protocol/Gps103ProtocolDecoderTest.java3
2 files changed, 5 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
index 845aa9a8b..cd6dbdcd0 100644
--- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
@@ -33,9 +33,6 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
- /**
- * Regular expressions pattern
- */
static private Pattern pattern = Pattern.compile(
"imei:" +
"(\\d+)," + // IMEI
@@ -46,9 +43,9 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
"[FL]," + // F - full / L - low
"(\\d{2})(\\d{2})(\\d{2})\\.(\\d{3})," + // Time UTC (HHMMSS.SSS)
"([AV])," + // Validity
- "(\\d{2})(\\d{2}\\.\\d{4})," + // Latitude (DDMM.MMMM)
+ "(\\d+)(\\d{2}\\.\\d+)," + // Latitude (DDMM.MMMM)
"([NS])," +
- "(\\d{3})(\\d{2}\\.\\d{4})," + // Longitude (DDDMM.MMMM)
+ "(\\d+)(\\d{2}\\.\\d+)," + // Longitude (DDDMM.MMMM)
"([EW])?," +
"(\\d+\\.?\\d*)," + // Speed
"(\\d+\\.\\d+)?" + // Course
@@ -80,7 +77,6 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
// Parse message
Matcher parser = pattern.matcher(sentence);
if (!parser.matches()) {
- Log.info("Parsing error");
return null;
}
diff --git a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
index 42f79b26a..46f79cacd 100644
--- a/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gps103ProtocolDecoderTest.java
@@ -20,6 +20,9 @@ public class Gps103ProtocolDecoderTest {
// No GPS signal
assertNull(decoder.decode(null, null, "imei:359586015829802,tracker,000000000,13554900601,L,;"));
+
+ assertNotNull(decoder.decode(null, null,
+ "imei:869039001186913,tracker,1308282156,0,F,215630.000,A,5602.11015,N,9246.30767,E,1.4,,175.9,"));
assertNotNull(decoder.decode(null, null,
"imei:359710040656622,tracker,13/02/27 23:40,,F,125952.000,A,3450.9430,S,13828.6753,E,0.00,0"));