aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-07-27 12:27:10 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2013-07-27 12:27:10 +1200
commit5f75f109dfc1140d2f644857d877baf88cb1fe83 (patch)
treebd5f5112eea031f8d1900916e970d9b0edc375dc
parent0032fdd6fd9773be320e79ae74f0e6396d8a3625 (diff)
downloadtrackermap-server-5f75f109dfc1140d2f644857d877baf88cb1fe83.tar.gz
trackermap-server-5f75f109dfc1140d2f644857d877baf88cb1fe83.tar.bz2
trackermap-server-5f75f109dfc1140d2f644857d877baf88cb1fe83.zip
Fix V680 decoder
-rw-r--r--src/org/traccar/protocol/V680ProtocolDecoder.java4
-rw-r--r--test/org/traccar/protocol/V680ProtocolDecoderTest.java3
2 files changed, 5 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/V680ProtocolDecoder.java b/src/org/traccar/protocol/V680ProtocolDecoder.java
index 53843c23d..570069116 100644
--- a/src/org/traccar/protocol/V680ProtocolDecoder.java
+++ b/src/org/traccar/protocol/V680ProtocolDecoder.java
@@ -38,7 +38,7 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder {
static private Pattern pattern = Pattern.compile(
"(?:#(\\d+)#" + // IMEI
"([^#]*)#)?" + // User
- "([01])#" + // Fix
+ "(\\d+)#" + // Fix
"([^#]+)#" + // Password
"[^#]+#" +
"(\\d+)#" + // Packet number
@@ -101,7 +101,7 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder {
extendedInfo.set("user", parser.group(index++));
// Validity
- position.setValid(parser.group(index++).compareTo("1") == 0 ? true : false);
+ position.setValid(Integer.valueOf(parser.group(index++)) > 0 ? true : false);
// Password
extendedInfo.set("password", parser.group(index++));
diff --git a/test/org/traccar/protocol/V680ProtocolDecoderTest.java b/test/org/traccar/protocol/V680ProtocolDecoderTest.java
index 89c4c8747..f3ee5f968 100644
--- a/test/org/traccar/protocol/V680ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/V680ProtocolDecoderTest.java
@@ -41,6 +41,9 @@ public class V680ProtocolDecoderTest {
assertNotNull(decoder.decode(null, null,
"#352897045085282##0#0000#AUT#1#72400510730208,00d36307,10734fc4#4647.8922,W,2339.1956,S,2.60,63.74#200413#094310.000##"));
+
+ assertNotNull(decoder.decode(null, null,
+ "#352165050199210##13#0000#AUT#1#72400605471305,054712fd,054712ff#05144.0008,W,3005.5011,S,0.11,201.46#260713#172647.000##"));
}