aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-11-09 15:48:20 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2018-11-09 15:48:20 +1300
commit806584d5d19f224eb26cade7096926af9cc0e4c2 (patch)
tree7481f16275b03019cec8ed28eb9b818a9dfc2186 /src
parent9c9370f72c51d7466d3b25a59264ee98f4319b3a (diff)
downloadtrackermap-server-806584d5d19f224eb26cade7096926af9cc0e4c2.tar.gz
trackermap-server-806584d5d19f224eb26cade7096926af9cc0e4c2.tar.bz2
trackermap-server-806584d5d19f224eb26cade7096926af9cc0e4c2.zip
Handle GV300 empty CAN fields
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/protocol/Gl200TextProtocolDecoder.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
index 0b6bcd09d..45b80f0a6 100644
--- a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java
@@ -591,8 +591,8 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
if (BitUtil.check(reportMask, 2)) {
position.set(Position.KEY_OBD_ODOMETER, values[index++]);
}
- if (BitUtil.check(reportMask, 3)) {
- position.set(Position.KEY_FUEL_USED, Double.parseDouble(values[index++]));
+ if (BitUtil.check(reportMask, 3) && !values[index++].isEmpty()) {
+ position.set(Position.KEY_FUEL_USED, Double.parseDouble(values[index - 1]));
}
if (BitUtil.check(reportMask, 5) && !values[index++].isEmpty()) {
position.set(Position.KEY_RPM, Integer.parseInt(values[index - 1]));
@@ -615,8 +615,8 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder {
if (BitUtil.check(reportMask, 10) && !values[index++].isEmpty()) {
position.set(Position.KEY_THROTTLE, Integer.parseInt(values[index - 1]));
}
- if (BitUtil.check(reportMask, 11)) {
- position.set(Position.KEY_HOURS, UnitsConverter.msFromHours(Double.parseDouble(values[index++])));
+ if (BitUtil.check(reportMask, 11) && !values[index++].isEmpty()) {
+ position.set(Position.KEY_HOURS, UnitsConverter.msFromHours(Double.parseDouble(values[index - 1])));
}
if (BitUtil.check(reportMask, 12)) {
position.set("drivingHours", Double.parseDouble(values[index++]));