aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2014-12-02 21:34:18 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2014-12-02 21:34:18 +1300
commit9164f1fbdf12ba2ed65839eb83a794fcc602edf8 (patch)
tree17333ef659b36cff0405c765d39a5bedb01cd6f8 /src/org/traccar
parent2039c90485caaa03ab4833797daaca3250174203 (diff)
downloadtrackermap-server-9164f1fbdf12ba2ed65839eb83a794fcc602edf8.tar.gz
trackermap-server-9164f1fbdf12ba2ed65839eb83a794fcc602edf8.tar.bz2
trackermap-server-9164f1fbdf12ba2ed65839eb83a794fcc602edf8.zip
Handle empty speed and course
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/WialonProtocolDecoder.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/WialonProtocolDecoder.java b/src/org/traccar/protocol/WialonProtocolDecoder.java
index 65cc17bcd..5b8d9a24e 100644
--- a/src/org/traccar/protocol/WialonProtocolDecoder.java
+++ b/src/org/traccar/protocol/WialonProtocolDecoder.java
@@ -47,8 +47,8 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder {
"([NS]);" +
"(\\d{3})(\\d{2}\\.\\d+);" + // Longitude (DDDMM.MMMM)
"([EW]);" +
- "(\\d+\\.?\\d*);" + // Speed
- "(\\d+\\.?\\d*);" + // Course
+ "(\\d+\\.?\\d*)?;" + // Speed
+ "(\\d+\\.?\\d*)?;" + // Course
"(?:(\\d+\\.?\\d*)|NA);" + // Altitude
"(?:(\\d+)|NA)" + // Satellites
".*"); // Full format
@@ -103,10 +103,20 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder {
position.setLongitude(longitude);
// Speed
- position.setSpeed(Double.valueOf(parser.group(index++)) * 0.539957);
+ String speed = parser.group(index++);
+ if (speed != null) {
+ position.setSpeed(Double.valueOf(speed) * 0.539957);
+ } else {
+ position.setSpeed(0.0);
+ }
// Course
- position.setCourse(Double.valueOf(parser.group(index++)));
+ String course = parser.group(index++);
+ if (course != null) {
+ position.setCourse(Double.valueOf(course));
+ } else {
+ position.setCourse(0.0);
+ }
// Altitude
String altitude = parser.group(index++);