diff options
Diffstat (limited to 'src/org/traccar')
4 files changed, 58 insertions, 5 deletions
diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java index 5e0d65894..e8d3e4092 100644 --- a/src/org/traccar/model/Position.java +++ b/src/org/traccar/model/Position.java @@ -52,6 +52,7 @@ public class Position extends Message { public static final String KEY_BATTERY = "battery"; // volts public static final String KEY_BATTERY_LEVEL = "batteryLevel"; // percentage public static final String KEY_FUEL_LEVEL = "fuel"; // liters + public static final String KEY_FUEL_USED = "fuelUsed"; // liters public static final String KEY_FUEL_CONSUMPTION = "fuelConsumption"; // liters/hour public static final String KEY_VERSION_FW = "versionFw"; diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java index 7ed187937..79dcac72a 100644 --- a/src/org/traccar/protocol/AplicomProtocolDecoder.java +++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2013 - 2017 Anton Tananaev (anton@traccar.org) + * Copyright 2013 - 2018 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -557,7 +557,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { } if ((selector & 0x0040) != 0) { - position.set("totalFuelUsed", buf.readUnsignedInt()); + position.set(Position.KEY_FUEL_USED, buf.readUnsignedInt()); } if ((selector & 0x0080) != 0) { @@ -579,6 +579,58 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { position.set("overspeedCount", buf.readUnsignedByte()); } + if ((selector & 0x0800) != 0) { + position.set(Position.KEY_HOURS, buf.readUnsignedInt() * 0.05); + position.set(Position.KEY_RPM, buf.readUnsignedShort() * 0.125); + position.set(Position.KEY_OBD_SPEED, buf.readUnsignedShort() / 256.0); + position.set(Position.KEY_FUEL_USED, buf.readUnsignedInt() * 0.5); + position.set(Position.KEY_FUEL_LEVEL, buf.readUnsignedByte() * 0.4); + } + + if ((selector & 0x1000) != 0) { + position.set("ambientTemperature", buf.readUnsignedShort() * 0.03125 - 273); + buf.readUnsignedShort(); // fuel rate + position.set("fuelEconomy", buf.readUnsignedShort() / 512.0); + position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedInt() * 0.001); + buf.readUnsignedByte(); // pto drive engagement + } + + if ((selector & 0x2000) != 0) { + buf.skipBytes(buf.readUnsignedByte()); // driver identification + } + + if ((selector & 0x4000) != 0) { + position.set("torque", buf.readUnsignedByte()); + position.set("brakePressure1", buf.readUnsignedByte() * 8); + position.set("brakePressure2", buf.readUnsignedByte() * 8); + position.set("grossWeight", buf.readUnsignedShort() * 10); + position.set("exhaustFluid", buf.readUnsignedByte() * 0.4); + buf.readUnsignedByte(); // retarder torque mode + position.set("retarderTorque", buf.readUnsignedByte()); + position.set("retarderSelection", buf.readUnsignedByte() * 0.4); + buf.skipBytes(8); // tell tale status block 1 + buf.skipBytes(8); // tell tale status block 2 + buf.skipBytes(8); // tell tale status block 3 + buf.skipBytes(8); // tell tale status block 4 + } + + if ((selector & 0x8000) != 0) { + position.set("parkingBrakeStatus", buf.readUnsignedByte()); + position.set("doorStatus", buf.readUnsignedByte()); + buf.skipBytes(8); // status per door + position.set("alternatorStatus", buf.readUnsignedByte()); + position.set("selectedGear", buf.readUnsignedByte()); + position.set("currentGear", buf.readUnsignedByte()); + buf.skipBytes(4 * 2); // air suspension pressure + } + + if ((selector & 0x0400) != 0) { + int count = buf.readUnsignedByte(); + for (int i = 0; i < count; i++) { + position.set("axle" + i, buf.readUnsignedShort()); + } + } + } @Override diff --git a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java index 598cee814..232f4cdfb 100644 --- a/src/org/traccar/protocol/Gl200TextProtocolDecoder.java +++ b/src/org/traccar/protocol/Gl200TextProtocolDecoder.java @@ -557,10 +557,10 @@ public class Gl200TextProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_IGNITION, Integer.parseInt(values[index++]) > 0); } if (BitUtil.check(reportMask, 2)) { - position.set("totalVehicleDistance", values[index++]); + position.set(Position.KEY_OBD_ODOMETER, values[index++]); } if (BitUtil.check(reportMask, 3)) { - position.set("totalFuelConsumption", Double.parseDouble(values[index++])); + position.set(Position.KEY_FUEL_USED, Double.parseDouble(values[index++])); } if (BitUtil.check(reportMask, 5) && !values[index++].isEmpty()) { position.set(Position.KEY_RPM, Integer.parseInt(values[index - 1])); diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java index 7ae98b46d..d766e32c3 100644 --- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java +++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java @@ -319,7 +319,7 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { position.set("drivingRange", parser.nextDouble()); position.set(Position.KEY_ODOMETER, parser.nextDouble()); position.set("singleFuelConsumption", parser.nextDouble()); - position.set("totalFuelConsumption", parser.nextDouble()); + position.set(Position.KEY_FUEL_USED, parser.nextDouble()); position.set(Position.KEY_DTCS, parser.nextInt()); position.set("hardAccelerationCount", parser.nextInt()); position.set("hardBrakingCount", parser.nextInt()); |