From 1644fb040d087a570afab3030dba5260075d64a6 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 1 Dec 2013 20:13:51 +1300 Subject: Fix meiligao decoder (fix #463) --- src/org/traccar/protocol/MeiligaoProtocolDecoder.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') 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++); -- cgit v1.2.3