aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/Stl060ProtocolDecoder.java8
-rw-r--r--test/org/traccar/protocol/Stl060ProtocolDecoderTest.java6
2 files changed, 10 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/Stl060ProtocolDecoder.java b/src/org/traccar/protocol/Stl060ProtocolDecoder.java
index b5a67dbab..211483aed 100644
--- a/src/org/traccar/protocol/Stl060ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Stl060ProtocolDecoder.java
@@ -40,8 +40,8 @@ public class Stl060ProtocolDecoder extends BaseProtocolDecoder {
"[^,]*," + // Vehicle
"(\\d{2})/(\\d{2})/(\\d{2})," + // Date
"(\\d{2}):(\\d{2}):(\\d{2})," + // Time
- "(\\d{2})(\\d+)([NS])," + // Latitude
- "(\\d{3})(\\d+)([EW])," + // Longitude
+ "(\\d{2})(\\d{2})\\.?(\\d+)([NS])," + // Latitude
+ "(\\d{3})(\\d{2})\\.?(\\d+)([EW])," + // Longitude
"(\\d+\\.?\\d*)," + // Speed
"(\\d+\\.?\\d*)," + // Course
"(\\d+)," + // Milage
@@ -95,13 +95,13 @@ public class Stl060ProtocolDecoder extends BaseProtocolDecoder {
// Latitude
Double latitude = Double.valueOf(parser.group(index++));
- latitude += Double.valueOf(parser.group(index++)) / 600000;
+ latitude += Double.valueOf(parser.group(index++) + 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++)) / 600000;
+ longitude += Double.valueOf(parser.group(index++) + 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 eadd8da9b..890de4f2d 100644
--- a/test/org/traccar/protocol/Stl060ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Stl060ProtocolDecoderTest.java
@@ -14,6 +14,12 @@ public class Stl060ProtocolDecoderTest {
verify(decoder.decode(null, null,
"$1,357804048043099,D001,AP29AW0963,23/02/14,14:06:54,17248488N,078342226E,0.08,193.12,1,1,1,1,1,A"));
+
+ verify(decoder.decode(null, null,
+ "$1,357804048043099,D001,AP29AW0963,12/05/14,07:39:57,1724.8564N,07834.2199E,0.00,302.84,1,1,1,1,1,A"));
+
+ 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,"));
}