aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-05 22:43:55 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-05 22:43:55 +1300
commitca8264c895b67cb040b63604500254465abc7677 (patch)
tree2fc54af943d37bfff737f81ac99d2c7b1a9cd464 /src/org/traccar/protocol
parent037ff8b24880304190187a632612169c471a82a3 (diff)
downloadtraccar-server-ca8264c895b67cb040b63604500254465abc7677.tar.gz
traccar-server-ca8264c895b67cb040b63604500254465abc7677.tar.bz2
traccar-server-ca8264c895b67cb040b63604500254465abc7677.zip
Handle H02 empty validity flag
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r--src/org/traccar/protocol/H02ProtocolDecoder.java7
1 files changed, 5 insertions, 2 deletions
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++));