aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2012-07-18 21:56:27 +0400
committerAnton Tananaev <anton.tananaev@gmail.com>2012-07-18 21:56:27 +0400
commitf4d3760c0d0523548dcaec42ba25f6a81a8c3254 (patch)
tree0431c7b2ed81e5b30f459763d69884e737428c70
parent05e2bd3f8e2988d021a42b10a9f0617cda388da5 (diff)
downloadtraccar-server-f4d3760c0d0523548dcaec42ba25f6a81a8c3254.tar.gz
traccar-server-f4d3760c0d0523548dcaec42ba25f6a81a8c3254.tar.bz2
traccar-server-f4d3760c0d0523548dcaec42ba25f6a81a8c3254.zip
Fix enfora protocol (fix #26)
-rw-r--r--src/org/traccar/protocol/EnforaProtocolDecoder.java2
-rw-r--r--test/org/traccar/protocol/EnforaProtocolDecoderTest.java3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/EnforaProtocolDecoder.java b/src/org/traccar/protocol/EnforaProtocolDecoder.java
index 196f16f05..2910108a5 100644
--- a/src/org/traccar/protocol/EnforaProtocolDecoder.java
+++ b/src/org/traccar/protocol/EnforaProtocolDecoder.java
@@ -54,7 +54,7 @@ public class EnforaProtocolDecoder extends GenericProtocolDecoder {
"(\\d+.\\d)?," + // Speed
"(\\d+.\\d)?," + // Course
"(\\d{2})(\\d{2})(\\d{2})," + // Date (DDMMYY)
- ".*[\r\n]*");
+ ".*[\r\n\u0000]*");
public static final int IMEI_LENGTH = 15;
diff --git a/test/org/traccar/protocol/EnforaProtocolDecoderTest.java b/test/org/traccar/protocol/EnforaProtocolDecoderTest.java
index 9830e0c2f..06e8155ae 100644
--- a/test/org/traccar/protocol/EnforaProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/EnforaProtocolDecoderTest.java
@@ -22,6 +22,9 @@ public class EnforaProtocolDecoderTest {
byte[] buf3 = {0x00,0x71,0x00,0x04,0x02,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x30,0x31,0x32,0x33,0x34,0x35,0x20,0x31,0x33,0x20,0x24,0x47,0x50,0x52,0x4D,0x43,0x2C,0x32,0x32,0x33,0x31,0x35,0x32,0x2E,0x30,0x30,0x2C,0x41,0x2C,0x33,0x35,0x30,0x39,0x2E,0x38,0x36,0x30,0x35,0x39,0x34,0x2C,0x4E,0x2C,0x30,0x33,0x33,0x32,0x32,0x2E,0x37,0x34,0x33,0x38,0x38,0x37,0x2C,0x45,0x2C,0x30,0x2E,0x30,0x2C,0x30,0x2E,0x30,0x2C,0x30,0x32,0x30,0x36,0x31,0x32,0x2C,0x2C,0x2C,0x41,0x2A,0x35,0x32,0x0D,0x0A};
assertNotNull(decoder.decode(null, null, factory.getBuffer(buf3, 0, buf3.length)));
+
+ byte[] buf4 = {0x00,0x76,0x00,0x04,0x02,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x30,0x31,0x31,0x38,0x39,0x32,0x30,0x30,0x30,0x36,0x30,0x38,0x31,0x38,0x39,0x20,0x31,0x33,0x20,0x24,0x47,0x50,0x52,0x4D,0x43,0x2C,0x31,0x37,0x31,0x38,0x34,0x31,0x2E,0x30,0x30,0x2C,0x41,0x2C,0x33,0x35,0x30,0x39,0x2E,0x38,0x35,0x32,0x34,0x31,0x30,0x2C,0x4E,0x2C,0x30,0x33,0x33,0x32,0x32,0x2E,0x37,0x35,0x39,0x31,0x31,0x33,0x2C,0x45,0x2C,0x30,0x2E,0x30,0x2C,0x30,0x2E,0x30,0x2C,0x31,0x37,0x30,0x37,0x31,0x32,0x2C,0x33,0x2E,0x34,0x2C,0x57,0x2C,0x41,0x2A,0x32,0x35,0x0D,0x0A,0x00};
+ assertNotNull(decoder.decode(null, null, factory.getBuffer(buf4, 0, buf4.length)));
}
}