aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-11-06 22:18:28 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2013-11-06 22:18:28 +1300
commitf9ecee5b732b0c82c8a95bebdb5e275ea479cccc (patch)
tree778b3a3a3af7abef4bce7260b61e0a729c510d9f
parente0a8940f73915dc560e68405ad70c45dcbd79899 (diff)
downloadtrackermap-server-f9ecee5b732b0c82c8a95bebdb5e275ea479cccc.tar.gz
trackermap-server-f9ecee5b732b0c82c8a95bebdb5e275ea479cccc.tar.bz2
trackermap-server-f9ecee5b732b0c82c8a95bebdb5e275ea479cccc.zip
Improve V680 decoder
-rw-r--r--src/org/traccar/protocol/V680ProtocolDecoder.java6
-rw-r--r--test/org/traccar/protocol/V680ProtocolDecoderTest.java3
2 files changed, 6 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/V680ProtocolDecoder.java b/src/org/traccar/protocol/V680ProtocolDecoder.java
index ab7c4bff1..0f5d4b942 100644
--- a/src/org/traccar/protocol/V680ProtocolDecoder.java
+++ b/src/org/traccar/protocol/V680ProtocolDecoder.java
@@ -35,7 +35,7 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder {
super(serverManager);
}
- static private Pattern pattern = Pattern.compile(
+ private static final Pattern pattern = Pattern.compile(
"(?:#(\\d+)#" + // IMEI
"([^#]*)#)?" + // User
"(\\d+)#" + // Fix
@@ -46,7 +46,7 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder {
"(?:[^#]+#)?" +
"(\\d+)(\\d{2}\\.\\d+)," + // Longitude (DDDMM.MMMM)
"([EW])," +
- "(\\d{2})(\\d{2}\\.\\d+)," + // Latitude (DDMM.MMMM)
+ "(\\d+)(\\d{2}\\.\\d+)," + // Latitude (DDMM.MMMM)
"([NS])," +
"(\\d+\\.\\d+)," + // Speed
"(\\d+\\.?\\d*)?#" + // Course
@@ -101,7 +101,7 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder {
extendedInfo.set("user", parser.group(index++));
// Validity
- position.setValid(Integer.valueOf(parser.group(index++)) > 0 ? true : false);
+ position.setValid(Integer.valueOf(parser.group(index++)) > 0);
// Password
extendedInfo.set("password", parser.group(index++));
diff --git a/test/org/traccar/protocol/V680ProtocolDecoderTest.java b/test/org/traccar/protocol/V680ProtocolDecoderTest.java
index 02f34d7ed..5b1361e21 100644
--- a/test/org/traccar/protocol/V680ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/V680ProtocolDecoderTest.java
@@ -51,6 +51,9 @@ public class V680ProtocolDecoderTest {
assertNotNull(decoder.decode(null, null,
"#135790246811222#13486119277#1#0000#SOS#1#27bc10af#11407.4182,E,2232.7632,N,0.00,79.50#070709#134147.000##"));
+ assertNotNull(decoder.decode(null, null,
+ "#355488020132015##1#0000#AUT#01#510089246a34c0#10641.338800,E,619.427100,S,0.00,0.00#011113#161942.000##"));
+
/*assertNotNull(decoder.decode(null, null,
"#359094025419110#bigfriend#0#1234#AUTO#1##04632.8846,W,2327.2264,S,0.00,0.00#220913#234808##"));*/