diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-04-05 12:15:21 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-04-05 12:15:21 +1200 |
commit | b16f2be8393581cd516bf8b6c3d188cd6073a80c (patch) | |
tree | a471007c7a401cb08b57e520172c4d52f9ad1625 /src/org/traccar | |
parent | 5311269628c2c38ccf349e68549aa91fdef80c1a (diff) | |
download | traccar-server-b16f2be8393581cd516bf8b6c3d188cd6073a80c.tar.gz traccar-server-b16f2be8393581cd516bf8b6c3d188cd6073a80c.tar.bz2 traccar-server-b16f2be8393581cd516bf8b6c3d188cd6073a80c.zip |
Allow empty degrees value
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/protocol/V680ProtocolDecoder.java | 10 |
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); |