diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2013-12-01 20:13:51 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2013-12-01 20:13:51 +1300 |
commit | 1644fb040d087a570afab3030dba5260075d64a6 (patch) | |
tree | ee22c432c6343bb3bf5b1698c567f7c5cc96d1c2 /src | |
parent | da39a23c3811c139b124f708fb097772b63b5c3d (diff) | |
download | traccar-server-1644fb040d087a570afab3030dba5260075d64a6.tar.gz traccar-server-1644fb040d087a570afab3030dba5260075d64a6.tar.bz2 traccar-server-1644fb040d087a570afab3030dba5260075d64a6.zip |
Fix meiligao decoder (fix #463)
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/protocol/MeiligaoProtocolDecoder.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java index b79e6505c..b28b38dc8 100644 --- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java +++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java @@ -45,7 +45,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { "([NS])," + "(\\d+)(\\d{2}\\.\\d+)," + // Longitude (DDDMM.MMMM) "([EW])," + - "(\\d+.\\d+)," + // Speed + "(\\d+\\.?\\d*)?," + // Speed "(\\d+\\.?\\d*)?," + // Course "(\\d{2})(\\d{2})(\\d{2})" + // Date (DDMMYY) "(?:[^\\|]*\\|(\\d+\\.\\d+)\\|" + // Dilution of precision @@ -164,7 +164,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { } // Validity - position.setValid(parser.group(index++).compareTo("A") == 0 ? true : false); + position.setValid(parser.group(index++).compareTo("A") == 0); // Latitude Double latitude = Double.valueOf(parser.group(index++)); @@ -179,7 +179,12 @@ public class MeiligaoProtocolDecoder 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++); |