aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
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++);