From f9ecee5b732b0c82c8a95bebdb5e275ea479cccc Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 6 Nov 2013 22:18:28 +1300 Subject: Improve V680 decoder --- src/org/traccar/protocol/V680ProtocolDecoder.java | 6 +++--- test/org/traccar/protocol/V680ProtocolDecoderTest.java | 3 +++ 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##"));*/ -- cgit v1.2.3