aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/Gps103ProtocolDecoder.java
diff options
context:
space:
mode:
authorprsolucoes <paulo@prsolucoes.com>2015-03-12 05:36:48 -0300
committerprsolucoes <paulo@prsolucoes.com>2015-03-12 05:36:48 -0300
commitf1c62ff6690ede2ba38e155d3a2ac0e656d4d043 (patch)
tree7a844344e4154b7e28e1e973c3a435344a27cd32 /src/org/traccar/protocol/Gps103ProtocolDecoder.java
parent1d3a0b49ead6f0836583cf5e97948c6a86bb8663 (diff)
downloadtrackermap-server-f1c62ff6690ede2ba38e155d3a2ac0e656d4d043.tar.gz
trackermap-server-f1c62ff6690ede2ba38e155d3a2ac0e656d4d043.tar.bz2
trackermap-server-f1c62ff6690ede2ba38e155d3a2ac0e656d4d043.zip
Update Gps103ProtocolDecoder.java
Added speed as optional, because server is canceling the request because the speed that is empty.
Diffstat (limited to 'src/org/traccar/protocol/Gps103ProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/Gps103ProtocolDecoder.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
index 5ff74e1f1..1c1dbba47 100644
--- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java
@@ -51,7 +51,7 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
"([NS])," +
"(\\d+)(\\d{2}\\.\\d+)," + // Longitude (DDDMM.MMMM)
"([EW])?," +
- "(\\d+\\.?\\d*)," + // Speed
+ "(\\d+\\.?\\d*)?,?" + // Speed
"(\\d+\\.?\\d*)?,?" + // Course
"(\\d+\\.?\\d*)?,?" + // Altitude
"([^,]+)?,?" +
@@ -155,8 +155,13 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder {
position.setLongitude(longitude);
// Speed
- position.setSpeed(Double.valueOf(parser.group(index++)));
-
+ String speed = parser.group(index++);
+ if (speed != null) {
+ position.setSpeed(Double.valueOf(speed));
+ } else {
+ position.setSpeed(0.0);
+ }
+
// Course
String course = parser.group(index++);
if (course != null) {