aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/protocol/V680ProtocolDecoder.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/V680ProtocolDecoder.java b/src/org/traccar/protocol/V680ProtocolDecoder.java
index 81fd393e0..95f4e101c 100644
--- a/src/org/traccar/protocol/V680ProtocolDecoder.java
+++ b/src/org/traccar/protocol/V680ProtocolDecoder.java
@@ -47,9 +47,9 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder {
"(\\d+)#" + // Packet number
"([^#]+)?#?" + // GSM base station
"(?:[^#]+#)?" +
- "(\\d+)(\\d{2}\\.\\d+)," + // Longitude (DDDMM.MMMM)
+ "(\\d+)?(\\d{2}\\.\\d+)," + // Longitude (DDDMM.MMMM)
"([EW])," +
- "(\\d+)(\\d{2}\\.\\d+)," + // Latitude (DDMM.MMMM)
+ "(\\d+)?(\\d{2}\\.\\d+)," + // Latitude (DDMM.MMMM)
"([NS])," +
"(\\d+\\.\\d+)," + // Speed
"(\\d+\\.?\\d*)?#" + // Course
@@ -120,13 +120,15 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder {
extendedInfo.set("gsm", parser.group(index++));
// Longitude
- Double longitude = Double.valueOf(parser.group(index++));
+ String lon = parser.group(index++);
+ Double longitude = (lon != null) ? Double.valueOf(lon) : 0.0;
longitude += Double.valueOf(parser.group(index++)) / 60;
if (parser.group(index++).compareTo("W") == 0) longitude = -longitude;
position.setLongitude(longitude);
// Latitude
- Double latitude = Double.valueOf(parser.group(index++));
+ String lat = parser.group(index++);
+ Double latitude = (lat != null) ? Double.valueOf(lat) : 0.0;
latitude += Double.valueOf(parser.group(index++)) / 60;
if (parser.group(index++).compareTo("S") == 0) latitude = -latitude;
position.setLatitude(latitude);