aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-04-14 11:23:48 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2013-04-14 11:23:48 +1200
commit3db0861ba8dca2963b86d8ff7e318a6b4b897d62 (patch)
tree44e87be9d4a8d5cfbc1b60708e0fe5952df185aa
parent577df9d651b16700b820b5aeadfcacd68016ed86 (diff)
downloadtrackermap-server-3db0861ba8dca2963b86d8ff7e318a6b4b897d62.tar.gz
trackermap-server-3db0861ba8dca2963b86d8ff7e318a6b4b897d62.tar.bz2
trackermap-server-3db0861ba8dca2963b86d8ff7e318a6b4b897d62.zip
Improve V680 decoder
-rw-r--r--src/org/traccar/protocol/V680ProtocolDecoder.java11
-rw-r--r--test/org/traccar/protocol/V680ProtocolDecoderTest.java7
2 files changed, 13 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/V680ProtocolDecoder.java b/src/org/traccar/protocol/V680ProtocolDecoder.java
index e8c3d3426..40549857a 100644
--- a/src/org/traccar/protocol/V680ProtocolDecoder.java
+++ b/src/org/traccar/protocol/V680ProtocolDecoder.java
@@ -40,16 +40,17 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder {
"([^#]+)#" + // Password
"[^#]+#" +
"(\\d+)#" + // Packet number
- "(\\d+)." + // GSM base station
- "[^#]+#" +
- "(\\d{3})(\\d{2}\\.\\d+)," + // Longitude (DDDMM.MMMM)
+ "([^#]+)#" + // GSM base station
+ "(?:[^#]+#)?" +
+ "(\\d+)(\\d{2}\\.\\d+)," + // Longitude (DDDMM.MMMM)
"([EW])," +
"(\\d{2})(\\d{2}\\.\\d+)," + // Latitude (DDMM.MMMM)
"([NS])," +
"(\\d+\\.\\d+)," + // Speed
- "(\\d+)#" + // Course
+ "(\\d+\\.?\\d*)#" + // Course
"(\\d{2})(\\d{2})(\\d{2})#" + // Date (DDMMYY)
- "(\\d{2})(\\d{2})(\\d{2})"); // Time (HHMMSS)
+ "(\\d{2})(\\d{2})(\\d{2})" + // Time (HHMMSS)
+ ".*");
@Override
protected Object decode(
diff --git a/test/org/traccar/protocol/V680ProtocolDecoderTest.java b/test/org/traccar/protocol/V680ProtocolDecoderTest.java
index 4098535ed..7a92c7692 100644
--- a/test/org/traccar/protocol/V680ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/V680ProtocolDecoderTest.java
@@ -1,6 +1,7 @@
package org.traccar.protocol;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import org.junit.Test;
public class V680ProtocolDecoderTest {
@@ -11,6 +12,9 @@ public class V680ProtocolDecoderTest {
V680ProtocolDecoder decoder = new V680ProtocolDecoder(null);
decoder.setDataManager(new TestDataManager());
+ assertNull(decoder.decode(null, null,
+ "#353588102019155"));
+
assertNotNull(decoder.decode(null, null,
"#356823031193431##0#0000#SF#1#72403#V#04702.3025,W,2252.18380,S,008.18,0#090413#134938"));
@@ -20,6 +24,9 @@ public class V680ProtocolDecoderTest {
assertNotNull(decoder.decode(null, null,
"356823033219838#1000#0#1478#AUT#1#66830FFB#03855.6628,E,4716.6821,N,001.41,259#130812#143905"));
+ assertNotNull(decoder.decode(null, null,
+ "#353588102019155##1#0000#AUT#01#7240060be7873f#4849.079800,W,2614.458200,S,0.00,0.00#130413#182110.000"));
+
}
}