From 0e77bb0fd407806ce11593db37aa8557101022fe Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 28 Feb 2024 06:06:16 -0800 Subject: Add GV350M series CAN support --- src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/main/java/org/traccar/protocol') diff --git a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java index 8fb30e2ad..0dac0ad70 100644 --- a/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Gl200TextProtocolDecoder.java @@ -432,8 +432,8 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder { if (BitUtil.check(reportMask, 1) && !values[index++].isEmpty()) { position.set(Position.KEY_IGNITION, Integer.parseInt(values[index - 1]) > 0); } - if (BitUtil.check(reportMask, 2)) { - position.set(Position.KEY_OBD_ODOMETER, values[index++]); + if (BitUtil.check(reportMask, 2) && !values[index++].isEmpty()) { + position.set(Position.KEY_OBD_ODOMETER, Integer.parseInt(values[index - 1].substring(1))); } if (BitUtil.check(reportMask, 3) && !values[index++].isEmpty()) { position.set(Position.KEY_FUEL_USED, Double.parseDouble(values[index - 1])); @@ -448,7 +448,10 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_COOLANT_TEMP, Integer.parseInt(values[index - 1])); } if (BitUtil.check(reportMask, 7) && !values[index++].isEmpty()) { - position.set(Position.KEY_FUEL_CONSUMPTION, Double.parseDouble(values[index - 1].substring(1))); + String value = values[index - 1]; + if (value.startsWith("L/H")) { + position.set(Position.KEY_FUEL_CONSUMPTION, Double.parseDouble(value.substring(3))); + } } if (BitUtil.check(reportMask, 8) && !values[index++].isEmpty()) { position.set(Position.KEY_FUEL_LEVEL, Double.parseDouble(values[index - 1].substring(1))); -- cgit v1.2.3