From ca8264c895b67cb040b63604500254465abc7677 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 5 Oct 2015 22:43:55 +1300 Subject: Handle H02 empty validity flag --- src/org/traccar/protocol/H02ProtocolDecoder.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/org/traccar') diff --git a/src/org/traccar/protocol/H02ProtocolDecoder.java b/src/org/traccar/protocol/H02ProtocolDecoder.java index c93d0c6dd..30193a648 100644 --- a/src/org/traccar/protocol/H02ProtocolDecoder.java +++ b/src/org/traccar/protocol/H02ProtocolDecoder.java @@ -112,7 +112,7 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder { "V\\d," + // Version? ".*" + "(\\d{2})(\\d{2})(\\d{2})," + // Time (HHMMSS) - "([AV])," + // Validity + "([AV])?," + // Validity "-?(\\d+)-?(\\d{2}.\\d+)," + // Latitude (DDMM.MMMM) "([NS])," + "-?(\\d+)-?(\\d{2}.\\d+)," + // Longitude (DDMM.MMMM) @@ -151,7 +151,10 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder { time.set(Calendar.SECOND, Integer.valueOf(parser.group(index++))); // Validity - position.setValid(parser.group(index++).compareTo("A") == 0); + String valid = parser.group(index++); + if (valid != null) { + position.setValid(valid.compareTo("A") == 0); + } // Latitude Double latitude = Double.valueOf(parser.group(index++)); -- cgit v1.2.3