aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-08-21 21:00:41 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2013-08-21 21:00:41 +1200
commitba4cb97520ef9bbdd9be90b0c4307073469739c7 (patch)
treed9846ac56ca8de619c354ba5408d3b9ca0c3cf33
parent99e93aa69ac34222101b35c0515fa1f31ff99be4 (diff)
downloadtraccar-server-ba4cb97520ef9bbdd9be90b0c4307073469739c7.tar.gz
traccar-server-ba4cb97520ef9bbdd9be90b0c4307073469739c7.tar.bz2
traccar-server-ba4cb97520ef9bbdd9be90b0c4307073469739c7.zip
Fix Totem regular expr
-rw-r--r--src/org/traccar/protocol/TotemProtocolDecoder.java12
-rw-r--r--test/org/traccar/protocol/TotemProtocolDecoderTest.java3
2 files changed, 9 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/TotemProtocolDecoder.java b/src/org/traccar/protocol/TotemProtocolDecoder.java
index b4fa177be..73bb18aac 100644
--- a/src/org/traccar/protocol/TotemProtocolDecoder.java
+++ b/src/org/traccar/protocol/TotemProtocolDecoder.java
@@ -45,13 +45,13 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
"([NS])," +
"(\\d+)(\\d{2}\\.\\d+)," + // Longitude (DDDMM.MMMM)
"([EW])," +
- "(\\d+\\.\\d+)?," + // Speed
- "(\\d+\\.\\d+)?," + // Course
+ "(\\d+\\.?\\d*)?," + // Speed
+ "(\\d+\\.?\\d*)?," + // Course
"(\\d{2})(\\d{2})(\\d{2})" + // Date (DDMMYY)
"[^\\*]+\\*\\p{XDigit}{2}\\|" + // Checksum
- "\\d+.\\d\\|" + // PDOP
- "(\\d+.\\d)\\|" + // HDOP
- "\\d+.\\d\\|" + // VDOP
+ "\\d+\\.\\d+\\|" + // PDOP
+ "(\\d+\\.\\d+)\\|" + // HDOP
+ "\\d+\\.\\d+\\|" + // VDOP
"(\\d+)\\|" + // IO Status
"\\d+\\|" + // Time
"\\d" + // Charged
@@ -78,7 +78,7 @@ public class TotemProtocolDecoder extends BaseProtocolDecoder {
"([EW])\\|" +
"(\\d+\\.\\d+)?\\|" + // Speed
"(\\d+)?\\|" + // Course
- "(\\d+.\\d+)\\|" + // HDOP
+ "(\\d+\\.\\d+)\\|" + // HDOP
"(\\d+)\\|" + // IO Status
"\\d" + // Charged
"(\\d{2})" + // Battery
diff --git a/test/org/traccar/protocol/TotemProtocolDecoderTest.java b/test/org/traccar/protocol/TotemProtocolDecoderTest.java
index 8572f1998..f241088d2 100644
--- a/test/org/traccar/protocol/TotemProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/TotemProtocolDecoderTest.java
@@ -16,6 +16,9 @@ public class TotemProtocolDecoderTest {
"$$BB862170017856731|AA$GPRMC,000000.00,V,0000.0000,N,00000.0000,E,000.0,000.0,000000,,,A*73|00.0|00.0|00.0|000000001000|20000000000000|13790000|00000000|00000000|00000000|0.0000|0007|8C23"));
assertNotNull(decoder.decode(null, null,
+ "$$B8862170017856731|AA$GPRMC,171849.00,A,3644.9893,N,01012.9927,E,0.049,51,200813,,,A*73|1.59|0.97|1.25|100000001000|20130820171849|13690000|00000000|019BD508|00000000|0.0000|0026|1B2C"));
+
+ assertNotNull(decoder.decode(null, null,
"$$B2359772032984289|AA$GPRMC,104446.000,A,5011.3944,N,01439.6637,E,0.00,,290212,,,A*7D|01.8|00.9|01.5|000000100000|20120229104446|14151221|00050000|046D085E|0000|0.0000|1170|29A7"));
assertNotNull(decoder.decode(null, null,