diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-03-12 22:11:29 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-03-12 22:11:29 +1300 |
commit | c87fd6136bd6ec7afda1b93d5665881b06a3185a (patch) | |
tree | 7a844344e4154b7e28e1e973c3a435344a27cd32 /src/org/traccar/protocol/Gps103ProtocolDecoder.java | |
parent | 1d3a0b49ead6f0836583cf5e97948c6a86bb8663 (diff) | |
parent | f1c62ff6690ede2ba38e155d3a2ac0e656d4d043 (diff) | |
download | trackermap-server-c87fd6136bd6ec7afda1b93d5665881b06a3185a.tar.gz trackermap-server-c87fd6136bd6ec7afda1b93d5665881b06a3185a.tar.bz2 trackermap-server-c87fd6136bd6ec7afda1b93d5665881b06a3185a.zip |
Merge pull request #1116 from prsolucoes/prsolucoes-patch-speed-gps103
Update Gps103 protocol decoder
Diffstat (limited to 'src/org/traccar/protocol/Gps103ProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/Gps103ProtocolDecoder.java | 11 |
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) { |