From 0adbcabc30df3e11b7c4b2f7646305090f330e59 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 24 Feb 2014 23:31:36 +1300 Subject: Fix STL060 decoder --- src/org/traccar/protocol/Stl060ProtocolDecoder.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/protocol/Stl060ProtocolDecoder.java b/src/org/traccar/protocol/Stl060ProtocolDecoder.java index 29bc558da..2ffb8b9cb 100644 --- a/src/org/traccar/protocol/Stl060ProtocolDecoder.java +++ b/src/org/traccar/protocol/Stl060ProtocolDecoder.java @@ -34,24 +34,22 @@ public class Stl060ProtocolDecoder extends BaseProtocolDecoder { } private static final Pattern pattern = Pattern.compile( - "\\$1," + + ".*\\$1," + "(\\d+)," + // IMEI "D001," + // Type "[^,]*," + // Vehicle "(\\d{2})/(\\d{2})/(\\d{2})," + // Date "(\\d{2}):(\\d{2}):(\\d{2})," + // Time - "(\\d+)(\\d{2}\\.\\d+)" + // Latitude - "([NS])," + - "(\\d+)(\\d{2}\\.\\d+)" + // Longitude - "([EW])," + - "(\\d+)," + // Speed - "(\\d+)," + // Course + "(\\d{2})(\\d+)([NS])," + // Latitude + "(\\d{3})(\\d+)([EW])," + // Longitude + "(\\d+\\.?\\d*)," + // Speed + "(\\d+\\.?\\d*)," + // Course "(\\d+)," + // Milage "(\\d+)," + // Ignition "(\\d+)," + // DIP1 "(\\d+)," + // DIP2 "(\\d+)," + // Fuel - "([AV])," + // Validity + "([AV])" + // Validity ".*"); @Override @@ -97,13 +95,13 @@ public class Stl060ProtocolDecoder extends BaseProtocolDecoder { // Latitude Double latitude = Double.valueOf(parser.group(index++)); - latitude += Double.valueOf(parser.group(index++)) / 60; + latitude += Double.valueOf(parser.group(index++)) / 600000; if (parser.group(index++).compareTo("S") == 0) latitude = -latitude; position.setLatitude(latitude); // Longitude Double longitude = Double.valueOf(parser.group(index++)); - longitude += Double.valueOf(parser.group(index++)) / 60; + longitude += Double.valueOf(parser.group(index++)) / 600000; if (parser.group(index++).compareTo("W") == 0) longitude = -longitude; position.setLongitude(longitude); -- cgit v1.2.3