diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2014-09-12 00:16:36 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2014-09-12 00:16:36 +1200 |
commit | 2f7e6af55b1a4d65abe3187ca34b4d1d587c833b (patch) | |
tree | 3af7e22f000d5846471e866c3349082a96020dab /src/org/traccar/protocol | |
parent | 0bf776895d82bf70a0e29c67a064024cd24a8927 (diff) | |
download | trackermap-server-2f7e6af55b1a4d65abe3187ca34b4d1d587c833b.tar.gz trackermap-server-2f7e6af55b1a4d65abe3187ca34b4d1d587c833b.tar.bz2 trackermap-server-2f7e6af55b1a4d65abe3187ca34b4d1d587c833b.zip |
Update Wialon regex
Diffstat (limited to 'src/org/traccar/protocol')
-rw-r--r-- | src/org/traccar/protocol/WialonProtocolDecoder.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/WialonProtocolDecoder.java b/src/org/traccar/protocol/WialonProtocolDecoder.java index 6ed597d2f..db9f7b1f6 100644 --- a/src/org/traccar/protocol/WialonProtocolDecoder.java +++ b/src/org/traccar/protocol/WialonProtocolDecoder.java @@ -47,7 +47,7 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder { "(\\d+\\.?\\d*);" + // Speed "(\\d+\\.?\\d*);" + // Course "(?:(\\d+\\.?\\d*)|NA);" + // Altitude - "(\\d+)" + // Satellites + "(?:(\\d+)|NA)" + // Satellites ".*"); // Full format private void sendResponse(Channel channel, String prefix, Integer number) { @@ -62,7 +62,7 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder { } private Position decodePosition(String substring) { - + // Parse message Matcher parser = pattern.matcher(substring); if (deviceId == null || !parser.matches()) { @@ -114,9 +114,13 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder { } // Satellites - int satellites = Integer.valueOf(parser.group(index++)); - position.setValid(satellites >= 3); - extendedInfo.set("satellites", satellites); + String satellites = parser.group(index++); + if (satellites != null) { + position.setValid(Integer.valueOf(satellites) >= 3); + extendedInfo.set("satellites", satellites); + } else { + position.setValid(false); + } // Extended info position.setExtendedInfo(extendedInfo.toString()); |