From 52c26cb593201a74443329221722cc33c142b476 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 22 Feb 2011 11:03:54 +0000 Subject: --- .../opentracking/protocol/xexun/XexunProtocolDecoder.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/net/sourceforge/opentracking/protocol/xexun/XexunProtocolDecoder.java b/src/net/sourceforge/opentracking/protocol/xexun/XexunProtocolDecoder.java index 39161f45b..15cb99f55 100644 --- a/src/net/sourceforge/opentracking/protocol/xexun/XexunProtocolDecoder.java +++ b/src/net/sourceforge/opentracking/protocol/xexun/XexunProtocolDecoder.java @@ -58,7 +58,7 @@ public class XexunProtocolDecoder extends OneToOneDecoder { "([\\d]{3})([\\d]{2}.[\\d]{4})," + // Longitude (DDDMM.MMMM) "([EW])," + "([\\d]+.[\\d]{2})," + // Speed - "([\\d]+.[\\d]{2})," + // Course + "([\\d]+.[\\d]{2})?," + // Course "([\\d]{2})([\\d]{2})([\\d]{2})," + // Date (DDMMYY) ".*imei:" + "([\\d]+),"); // IMEI @@ -105,9 +105,14 @@ public class XexunProtocolDecoder extends OneToOneDecoder { if (parser.group(index++).compareTo("W") == 0) lonlitude = -lonlitude; position.setLongitude(lonlitude); - // Speed and course + // Speed position.setSpeed(Double.valueOf(parser.group(index++))); - position.setCourse(Double.valueOf(parser.group(index++))); + + // Course + String course = parser.group(index++); + if (course != null) { + position.setCourse(Double.valueOf(course)); + } // Date time.set(Calendar.DAY_OF_MONTH, Integer.valueOf(parser.group(index++))); -- cgit v1.2.3