diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2014-02-24 23:31:36 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2014-02-24 23:31:36 +1300 |
commit | 0adbcabc30df3e11b7c4b2f7646305090f330e59 (patch) | |
tree | 7afdd3b7191dcbbd0b86dec7b12208a8af40abfb | |
parent | a960f770f1c8d52b2c9f6b63cf947f69d7d7e761 (diff) | |
download | trackermap-server-0adbcabc30df3e11b7c4b2f7646305090f330e59.tar.gz trackermap-server-0adbcabc30df3e11b7c4b2f7646305090f330e59.tar.bz2 trackermap-server-0adbcabc30df3e11b7c4b2f7646305090f330e59.zip |
Fix STL060 decoder
-rw-r--r-- | src/org/traccar/protocol/Stl060ProtocolDecoder.java | 18 | ||||
-rw-r--r-- | test/org/traccar/protocol/Stl060ProtocolDecoderTest.java | 2 |
2 files changed, 9 insertions, 11 deletions
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); diff --git a/test/org/traccar/protocol/Stl060ProtocolDecoderTest.java b/test/org/traccar/protocol/Stl060ProtocolDecoderTest.java index 536049293..eadd8da9b 100644 --- a/test/org/traccar/protocol/Stl060ProtocolDecoderTest.java +++ b/test/org/traccar/protocol/Stl060ProtocolDecoderTest.java @@ -13,7 +13,7 @@ public class Stl060ProtocolDecoderTest { decoder.setDataManager(new TestDataManager()); verify(decoder.decode(null, null, - "$1,357804047969310,D001,AP29AW0963,01/01/13,13:24:47,1723.9582N,07834.0945E,00100,010,0,0,0,0,0,A,")); + "$1,357804048043099,D001,AP29AW0963,23/02/14,14:06:54,17248488N,078342226E,0.08,193.12,1,1,1,1,1,A")); } |