diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-04-17 16:38:02 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-04-17 16:38:02 +1200 |
commit | d643e9a75f1c6580d098b68cffc2c709db611d8e (patch) | |
tree | b0d146aaa67352c46d4c5cfbd19aaa2cf6d2973e /src/org/traccar/protocol/WialonProtocolDecoder.java | |
parent | 1c756c57653b72a656407da9c53ac292c5551cdb (diff) | |
download | trackermap-server-d643e9a75f1c6580d098b68cffc2c709db611d8e.tar.gz trackermap-server-d643e9a75f1c6580d098b68cffc2c709db611d8e.tar.bz2 trackermap-server-d643e9a75f1c6580d098b68cffc2c709db611d8e.zip |
Normalize fuel level value
Diffstat (limited to 'src/org/traccar/protocol/WialonProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/WialonProtocolDecoder.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/WialonProtocolDecoder.java b/src/org/traccar/protocol/WialonProtocolDecoder.java index c1a125601..a07dfc7c9 100644 --- a/src/org/traccar/protocol/WialonProtocolDecoder.java +++ b/src/org/traccar/protocol/WialonProtocolDecoder.java @@ -116,7 +116,11 @@ public class WialonProtocolDecoder extends BaseProtocolDecoder { for (String param : values) { Matcher paramParser = Pattern.compile("(.*):[1-3]:(.*)").matcher(param); if (paramParser.matches()) { - position.set(paramParser.group(1).toLowerCase(), paramParser.group(2)); + try { + position.set(paramParser.group(1).toLowerCase(), Double.parseDouble(paramParser.group(2))); + } catch (NumberFormatException e) { + position.set(paramParser.group(1).toLowerCase(), paramParser.group(2)); + } } } } |