aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2014-05-09 21:43:28 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2014-05-09 21:43:28 +1200
commitc054a0ce6db0c9585c9357841ce9ae60d6e509de (patch)
tree73553fc19e23c6e87b40c6fca49e1dd615535937
parent62e04a3d493a98790172def8d1996be63400eb15 (diff)
parent87834b948b441decf408e4d634d8c155d3226465 (diff)
downloadtrackermap-server-c054a0ce6db0c9585c9357841ce9ae60d6e509de.tar.gz
trackermap-server-c054a0ce6db0c9585c9357841ce9ae60d6e509de.tar.bz2
trackermap-server-c054a0ce6db0c9585c9357841ce9ae60d6e509de.zip
Merge pull request #700 from errohitsinghal/patch-3
Update CarTrack protocol decoder
-rw-r--r--src/org/traccar/protocol/CarTrackProtocolDecoder.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/CarTrackProtocolDecoder.java b/src/org/traccar/protocol/CarTrackProtocolDecoder.java
index c5242497c..3b1869d62 100644
--- a/src/org/traccar/protocol/CarTrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/CarTrackProtocolDecoder.java
@@ -46,7 +46,7 @@ public class CarTrackProtocolDecoder extends BaseProtocolDecoder {
"([NS])," + // N/S
"(\\d{3})(\\d{2}\\.\\d{4})," + // Long : YYYMM.DDDD
"([EW])," + // E/W
- "(\\d+.\\d*)," + // Speed in Knots
+ "(\\d+.\\d*)?," + // Speed in Knots
"(\\d+.\\d*)?," + // Heading
"(\\d{2})(\\d{2})(\\d{2})" + // DDMMYY
".*" +
@@ -109,7 +109,12 @@ public class CarTrackProtocolDecoder 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++);