diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2013-12-01 20:20:23 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2013-12-01 20:20:23 +1300 |
commit | 1c70f6cad768f47ec8c49444e03691727699322b (patch) | |
tree | af4e43d41c8642ce531db77ef4d2051666533f8c | |
parent | 1644fb040d087a570afab3030dba5260075d64a6 (diff) | |
download | traccar-server-1c70f6cad768f47ec8c49444e03691727699322b.tar.gz traccar-server-1c70f6cad768f47ec8c49444e03691727699322b.tar.bz2 traccar-server-1c70f6cad768f47ec8c49444e03691727699322b.zip |
Improve intellitrack decoder
-rw-r--r-- | src/org/traccar/protocol/IntellitracProtocolDecoder.java | 5 | ||||
-rw-r--r-- | test/org/traccar/protocol/IntellitracProtocolDecoderTest.java | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/IntellitracProtocolDecoder.java b/src/org/traccar/protocol/IntellitracProtocolDecoder.java index b71237e7f..e45c84ba9 100644 --- a/src/org/traccar/protocol/IntellitracProtocolDecoder.java +++ b/src/org/traccar/protocol/IntellitracProtocolDecoder.java @@ -33,7 +33,7 @@ public class IntellitracProtocolDecoder extends BaseProtocolDecoder { super(serverManager); } - static private Pattern pattern = Pattern.compile( + private static final Pattern pattern = Pattern.compile( "(?:.+,)?(\\d+)," + // Device Identifier "(\\d{4})(\\d{2})(\\d{2})" + // Date (YYYYMMDD) "(\\d{2})(\\d{2})(\\d{2})," + // Time (HHMMSS) @@ -47,7 +47,8 @@ public class IntellitracProtocolDecoder extends BaseProtocolDecoder { "(\\d+)," + // Input "(\\d+),?" + // Output "(\\d+\\.\\d+)?,?" + // ADC1 - "(\\d+\\.\\d+)?"); // ADC2 + "(\\d+\\.\\d+)?" + // ADC2 + ".*"); @Override protected Object decode( diff --git a/test/org/traccar/protocol/IntellitracProtocolDecoderTest.java b/test/org/traccar/protocol/IntellitracProtocolDecoderTest.java index 351b6136d..59b47ebf3 100644 --- a/test/org/traccar/protocol/IntellitracProtocolDecoderTest.java +++ b/test/org/traccar/protocol/IntellitracProtocolDecoderTest.java @@ -47,6 +47,13 @@ public class IntellitracProtocolDecoderTest { verify(decoder.decode(null, null, "1010000001,20030105092129,-121.651598,-25.052325,0,0,33,0,1,0,0")); + + verify(decoder.decode(null, null, + "1015210962,20131010144712,-77.070037,-12.097935,0,0,77,7,2,2,0,0,139446.8,2095,20131010144712,,0.103,0.000")); + + verify(decoder.decode(null, null, + "1003269480,20131126100258,10.32989,49.93836,0,304,217,6,2,0,0,0.000,0.000,20131126100258,0,0,0,-40,0,0,-273,0,0,0,0")); + } |