aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2014-02-24 23:31:36 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2014-02-24 23:31:36 +1300
commit0adbcabc30df3e11b7c4b2f7646305090f330e59 (patch)
tree7afdd3b7191dcbbd0b86dec7b12208a8af40abfb /src/org/traccar
parenta960f770f1c8d52b2c9f6b63cf947f69d7d7e761 (diff)
downloadtraccar-server-0adbcabc30df3e11b7c4b2f7646305090f330e59.tar.gz
traccar-server-0adbcabc30df3e11b7c4b2f7646305090f330e59.tar.bz2
traccar-server-0adbcabc30df3e11b7c4b2f7646305090f330e59.zip
Fix STL060 decoder
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/Stl060ProtocolDecoder.java18
1 files changed, 8 insertions, 10 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);