From f1c62ff6690ede2ba38e155d3a2ac0e656d4d043 Mon Sep 17 00:00:00 2001 From: prsolucoes Date: Thu, 12 Mar 2015 05:36:48 -0300 Subject: Update Gps103ProtocolDecoder.java Added speed as optional, because server is canceling the request because the speed that is empty. --- src/org/traccar/protocol/Gps103ProtocolDecoder.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/org') 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) { -- cgit v1.2.3