aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/Avl08ProtocolDecoder.java17
-rw-r--r--test/org/traccar/protocol/Avl08ProtocolDecoderTest.java3
2 files changed, 12 insertions, 8 deletions
diff --git a/src/org/traccar/protocol/Avl08ProtocolDecoder.java b/src/org/traccar/protocol/Avl08ProtocolDecoder.java
index 488008be4..7cd64ad2b 100644
--- a/src/org/traccar/protocol/Avl08ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Avl08ProtocolDecoder.java
@@ -43,24 +43,24 @@ public class Avl08ProtocolDecoder extends BaseProtocolDecoder {
*/
static private Pattern pattern = Pattern.compile(
"\\$\\$.{2}" + // Length
- "(\\d{15})\\|" + // IMEI
+ "(\\d+)\\|" + // IMEI
"(.{2})" + // Alarm Type
"\\$GPRMC," +
- "(\\d{2})(\\d{2})(\\d{2}).(\\d{3})," + // Time (HHMMSS.SSS)
+ "(\\d{2})(\\d{2})(\\d{2})\\.(\\d+)," + // Time (HHMMSS.SSS)
"([AV])," + // Validity
- "(\\d{2})(\\d{2}.\\d{4})," + // Latitude (DDMM.MMMM)
+ "(\\d{2})(\\d{2}\\.\\d+)," + // Latitude (DDMM.MMMM)
"([NS])," +
- "(\\d{3})(\\d{2}.\\d{4})," + // Longitude (DDDMM.MMMM)
+ "(\\d{3})(\\d{2}\\.\\d+)," + // Longitude (DDDMM.MMMM)
"([EW])," +
- "(\\d+.\\d{2})?," + // Speed
- "(\\d+.\\d{2})?," + // Course
+ "(\\d+\\.\\d+)?," + // Speed
+ "(\\d+\\.\\d+)?," + // Course
"(\\d{2})(\\d{2})(\\d{2}),[^\\|]*\\|" + // Date (DDMMYY)
- "(\\d+.\\d)\\|(\\d+.\\d)\\|(\\d+.\\d)\\|" + // Dilution of precision
+ "(\\d+\\.?\\d+)\\|(\\d+\\.?\\d+)\\|(\\d+\\.?\\d+)\\|" + // Dilution of precision
"(\\d{12})\\|" + // Status
"(\\d{14})\\|" + // Clock
"(\\d{8})\\|" + // Voltage
"(\\d{8})\\|" + // ADC
- "(.{8})\\|" + // Cell
+ "([0-9a-fA-F]{8})\\|" + // Cell
"(.\\d{3})\\|" + // Temperature
"(\\d+.\\d{4})\\|" + // Mileage
"(\\d{4})\\|" + // Serial
@@ -70,6 +70,7 @@ public class Avl08ProtocolDecoder extends BaseProtocolDecoder {
/**
* Decode message
*/
+ @Override
protected Object decode(
ChannelHandlerContext ctx, Channel channel, Object msg)
throws Exception {
diff --git a/test/org/traccar/protocol/Avl08ProtocolDecoderTest.java b/test/org/traccar/protocol/Avl08ProtocolDecoderTest.java
index 19a54b6e3..802b3f949 100644
--- a/test/org/traccar/protocol/Avl08ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Avl08ProtocolDecoderTest.java
@@ -12,6 +12,9 @@ public class Avl08ProtocolDecoderTest {
Avl08ProtocolDecoder decoder = new Avl08ProtocolDecoder(null);
decoder.setDataManager(new TestDataManager());
+ assertNotNull(decoder.decode(null, null,
+ "$$B0456123|61$GPRMC,114725.00,A,1258.68276,N,07730.60237,E,0.410,,080113,,,A*79|1.44|0.66|1.27|000000000000|20130108114425|03600000|00000000|053C2BFE|0000|0.3325|0063|2005"));
+
assertNull(decoder.decode(null, null,
"$$AE359772033395899|AA000000000000000000000000000000000000000000000000000000000000|00.0|00.0|00.0|000000000000|20090215000153|13601435|00000000|00000000|0000|0.0000|0007|2DAA"));