From 2f3c5cac45601f54fa0dd46a23cbd593b5779cc1 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 18 Jun 2013 22:28:13 +1200 Subject: Fix V680 decoder (fix #311) --- src/org/traccar/protocol/V680ProtocolDecoder.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/org') diff --git a/src/org/traccar/protocol/V680ProtocolDecoder.java b/src/org/traccar/protocol/V680ProtocolDecoder.java index e3388576e..53843c23d 100644 --- a/src/org/traccar/protocol/V680ProtocolDecoder.java +++ b/src/org/traccar/protocol/V680ProtocolDecoder.java @@ -49,7 +49,7 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder { "(\\d{2})(\\d{2}\\.\\d+)," + // Latitude (DDMM.MMMM) "([NS])," + "(\\d+\\.\\d+)," + // Speed - "(\\d+\\.?\\d*)#" + // Course + "(\\d+\\.?\\d*)?#" + // Course "(\\d{2})(\\d{2})(\\d{2})#" + // Date (DDMMYY) "(\\d{2})(\\d{2})(\\d{2})" + // Time (HHMMSS) ".*"); @@ -129,7 +129,12 @@ public class V680ProtocolDecoder extends BaseProtocolDecoder { // Speed and Course position.setSpeed(Double.valueOf(parser.group(index++))); - position.setCourse(Double.valueOf(parser.group(index++))); + String course = parser.group(index++); + if (course != null) { + position.setCourse(Double.valueOf(course)); + } else { + position.setCourse(0.0); + } // Date Calendar time = Calendar.getInstance(TimeZone.getTimeZone("UTC")); -- cgit v1.2.3