diff options
Diffstat (limited to 'src')
18 files changed, 27 insertions, 25 deletions
diff --git a/src/org/traccar/helper/ObdDecoder.java b/src/org/traccar/helper/ObdDecoder.java index aea23ca60..f2c269f47 100644 --- a/src/org/traccar/helper/ObdDecoder.java +++ b/src/org/traccar/helper/ObdDecoder.java @@ -99,7 +99,7 @@ public final class ObdDecoder { case PID_MIL_DISTANCE: return createEntry("milDistance", value); case PID_FUEL_LEVEL: - return createEntry(Position.KEY_FUEL, convert ? value * 100 / 255 : value); + return createEntry(Position.KEY_FUEL_LEVEL, convert ? value * 100 / 255 : value); case PID_DISTANCE_CLEARED: return createEntry("clearedDistance", value); default: diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java index 9083f070d..ff3ebff22 100644 --- a/src/org/traccar/model/Position.java +++ b/src/org/traccar/model/Position.java @@ -38,7 +38,7 @@ public class Position extends Message { public static final String KEY_OUTPUT = "output"; public static final String KEY_POWER = "power"; public static final String KEY_BATTERY = "battery"; - public static final String KEY_FUEL = "fuel"; + public static final String KEY_FUEL_LEVEL = "fuel"; public static final String KEY_FUEL_CONSUMPTION = "fuelConsumption"; public static final String KEY_RFID = "rfid"; 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 d5779a8d8..24716071c 100644 --- a/src/org/traccar/protocol/AplicomProtocolDecoder.java +++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java @@ -528,7 +528,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { position.set("serviceDistance", buf.readInt()); buf.readUnsignedByte(); // driver activity position.set(Position.KEY_THROTTLE, buf.readUnsignedByte()); - position.set(Position.KEY_FUEL, buf.readUnsignedByte()); + position.set(Position.KEY_FUEL_LEVEL, buf.readUnsignedByte()); } if ((selector & 0x0040) != 0) { diff --git a/src/org/traccar/protocol/AquilaProtocolDecoder.java b/src/org/traccar/protocol/AquilaProtocolDecoder.java index 11ab15c86..2bc3b3a09 100644 --- a/src/org/traccar/protocol/AquilaProtocolDecoder.java +++ b/src/org/traccar/protocol/AquilaProtocolDecoder.java @@ -136,7 +136,7 @@ public class AquilaProtocolDecoder extends BaseProtocolDecoder { if (parser.hasNext(9)) { - position.set(Position.KEY_FUEL, parser.next()); + position.set(Position.KEY_FUEL_LEVEL, parser.next()); position.set(Position.PREFIX_IO + 1, parser.next()); position.set(Position.KEY_CHARGE, parser.next()); position.set(Position.PREFIX_IO + 2, parser.next()); diff --git a/src/org/traccar/protocol/AtrackProtocolDecoder.java b/src/org/traccar/protocol/AtrackProtocolDecoder.java index e395f376d..8e9d051f4 100644 --- a/src/org/traccar/protocol/AtrackProtocolDecoder.java +++ b/src/org/traccar/protocol/AtrackProtocolDecoder.java @@ -143,7 +143,7 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder { position.set(Position.PREFIX_TEMP + 1, buf.readUnsignedShort()); // engine coolant temp break; case "FL": - position.set(Position.KEY_FUEL, buf.readUnsignedByte()); + position.set(Position.KEY_FUEL_LEVEL, buf.readUnsignedByte()); break; case "ML": buf.readUnsignedByte(); // mil status diff --git a/src/org/traccar/protocol/FoxProtocolDecoder.java b/src/org/traccar/protocol/FoxProtocolDecoder.java index cf1e4f1f2..e01c3aae3 100644 --- a/src/org/traccar/protocol/FoxProtocolDecoder.java +++ b/src/org/traccar/protocol/FoxProtocolDecoder.java @@ -111,7 +111,7 @@ public class FoxProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_POWER, parser.nextDouble() / 10); position.set(Position.PREFIX_TEMP + 1, parser.nextInt()); position.set(Position.KEY_RPM, parser.nextInt()); - position.set(Position.KEY_FUEL, parser.nextInt()); + position.set(Position.KEY_FUEL_LEVEL, parser.nextInt()); position.set(Position.PREFIX_ADC + 1, parser.nextInt()); position.set(Position.PREFIX_ADC + 2, parser.nextInt()); position.set(Position.KEY_OUTPUT, parser.nextInt(2)); diff --git a/src/org/traccar/protocol/GalileoProtocolDecoder.java b/src/org/traccar/protocol/GalileoProtocolDecoder.java index a3f99c674..64bfdd270 100644 --- a/src/org/traccar/protocol/GalileoProtocolDecoder.java +++ b/src/org/traccar/protocol/GalileoProtocolDecoder.java @@ -185,7 +185,7 @@ public class GalileoProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_ODOMETER, buf.readUnsignedInt()); break; case 0xc1: - position.set(Position.KEY_FUEL, buf.readUnsignedByte() * 0.4); + position.set(Position.KEY_FUEL_LEVEL, buf.readUnsignedByte() * 0.4); position.set(Position.PREFIX_TEMP + 1, buf.readUnsignedByte() - 40); position.set(Position.KEY_RPM, buf.readUnsignedShort() * 0.125); break; diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java index 4103ebba6..74a734143 100644 --- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java @@ -455,7 +455,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { position.set("dtcsNumber", parser.next()); position.set("dtcsCodes", parser.next()); position.set(Position.KEY_THROTTLE, parser.next()); - position.set(Position.KEY_FUEL, parser.next()); + position.set(Position.KEY_FUEL_LEVEL, parser.next()); position.set(Position.KEY_OBD_ODOMETER, parser.nextInt() * 1000); decodeLocation(position, parser); @@ -533,7 +533,7 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { } position.set(Position.KEY_RPM, parser.next()); - position.set(Position.KEY_FUEL, parser.next()); + position.set(Position.KEY_FUEL_LEVEL, parser.next()); // workaround for wrong location time if (parser.hasNext(6)) { diff --git a/src/org/traccar/protocol/IntellitracProtocolDecoder.java b/src/org/traccar/protocol/IntellitracProtocolDecoder.java index a2720028f..70251fc51 100644 --- a/src/org/traccar/protocol/IntellitracProtocolDecoder.java +++ b/src/org/traccar/protocol/IntellitracProtocolDecoder.java @@ -108,7 +108,7 @@ public class IntellitracProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_OBD_SPEED, parser.next()); position.set(Position.KEY_RPM, parser.next()); position.set("coolant", parser.next()); - position.set(Position.KEY_FUEL, parser.next()); + position.set(Position.KEY_FUEL_LEVEL, parser.next()); position.set(Position.KEY_FUEL_CONSUMPTION, parser.next()); position.set(Position.PREFIX_TEMP + 1, parser.next()); position.set(Position.KEY_CHARGE, parser.next()); diff --git a/src/org/traccar/protocol/Jt600ProtocolDecoder.java b/src/org/traccar/protocol/Jt600ProtocolDecoder.java index 8eef2e700..c8e41b03f 100644 --- a/src/org/traccar/protocol/Jt600ProtocolDecoder.java +++ b/src/org/traccar/protocol/Jt600ProtocolDecoder.java @@ -145,7 +145,7 @@ public class Jt600ProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_ODOMETER, buf.readUnsignedInt() * 1000); fuel += buf.readUnsignedByte(); - position.set(Position.KEY_FUEL, fuel); + position.set(Position.KEY_FUEL_LEVEL, fuel); } diff --git a/src/org/traccar/protocol/KhdProtocolDecoder.java b/src/org/traccar/protocol/KhdProtocolDecoder.java index 1c88a8b9d..d63219736 100644 --- a/src/org/traccar/protocol/KhdProtocolDecoder.java +++ b/src/org/traccar/protocol/KhdProtocolDecoder.java @@ -115,7 +115,7 @@ public class KhdProtocolDecoder extends BaseProtocolDecoder { switch (dataType) { case 0x01: - position.set(Position.KEY_FUEL, + position.set(Position.KEY_FUEL_LEVEL, buf.readUnsignedByte() * 100 + buf.readUnsignedByte()); break; case 0x02: diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java index f5253566b..a4a0d2d42 100644 --- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java +++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java @@ -155,7 +155,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { if (parser.hasNext()) { String fuel = parser.next(); - position.set(Position.KEY_FUEL, + position.set(Position.KEY_FUEL_LEVEL, Integer.parseInt(fuel.substring(0, 2), 16) + Integer.parseInt(fuel.substring(2), 16) * 0.01); } diff --git a/src/org/traccar/protocol/Mta6ProtocolDecoder.java b/src/org/traccar/protocol/Mta6ProtocolDecoder.java index 63266b193..504539c4c 100644 --- a/src/org/traccar/protocol/Mta6ProtocolDecoder.java +++ b/src/org/traccar/protocol/Mta6ProtocolDecoder.java @@ -245,7 +245,7 @@ public class Mta6ProtocolDecoder extends BaseProtocolDecoder { } if (BitUtil.check(flags, 3)) { - position.set(Position.KEY_FUEL, buf.readUnsignedShort()); + position.set(Position.KEY_FUEL_LEVEL, buf.readUnsignedShort()); position.set(Position.PREFIX_ADC + 2, buf.readUnsignedShort()); position.set(Position.PREFIX_ADC + 3, buf.readUnsignedShort()); position.set(Position.PREFIX_ADC + 4, buf.readUnsignedShort()); diff --git a/src/org/traccar/protocol/NoranProtocolDecoder.java b/src/org/traccar/protocol/NoranProtocolDecoder.java index ebeacc659..990f50484 100644 --- a/src/org/traccar/protocol/NoranProtocolDecoder.java +++ b/src/org/traccar/protocol/NoranProtocolDecoder.java @@ -151,7 +151,7 @@ public class NoranProtocolDecoder extends BaseProtocolDecoder { if (!newFormat) { position.set(Position.PREFIX_IO + 1, buf.readUnsignedByte()); - position.set(Position.KEY_FUEL, buf.readUnsignedByte()); + position.set(Position.KEY_FUEL_LEVEL, buf.readUnsignedByte()); } else if (type == MSG_UPLOAD_POSITION_NEW) { position.set(Position.PREFIX_TEMP + 1, buf.readShort()); position.set(Position.KEY_ODOMETER, buf.readFloat()); diff --git a/src/org/traccar/protocol/Stl060ProtocolDecoder.java b/src/org/traccar/protocol/Stl060ProtocolDecoder.java index 87e55ea86..9f7980032 100644 --- a/src/org/traccar/protocol/Stl060ProtocolDecoder.java +++ b/src/org/traccar/protocol/Stl060ProtocolDecoder.java @@ -100,7 +100,7 @@ public class Stl060ProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_ODOMETER, parser.nextInt()); position.set(Position.KEY_IGNITION, parser.nextInt() == 1); position.set(Position.KEY_INPUT, parser.nextInt() + parser.nextInt() << 1); - position.set(Position.KEY_FUEL, parser.nextInt()); + position.set(Position.KEY_FUEL_LEVEL, parser.nextInt()); } // New format @@ -111,7 +111,7 @@ public class Stl060ProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_RFID, parser.next()); position.set(Position.KEY_ODOMETER, parser.nextInt()); position.set(Position.PREFIX_TEMP + 1, parser.nextInt()); - position.set(Position.KEY_FUEL, parser.nextInt()); + position.set(Position.KEY_FUEL_LEVEL, parser.nextInt()); position.set(Position.KEY_ACCELERATION, parser.nextInt() == 1); position.set(Position.KEY_OUTPUT, parser.nextInt() + parser.nextInt() << 1); } diff --git a/src/org/traccar/protocol/T55ProtocolDecoder.java b/src/org/traccar/protocol/T55ProtocolDecoder.java index a41da427a..cd50a99ff 100644 --- a/src/org/traccar/protocol/T55ProtocolDecoder.java +++ b/src/org/traccar/protocol/T55ProtocolDecoder.java @@ -136,7 +136,7 @@ public class T55ProtocolDecoder extends BaseProtocolDecoder { position.setDeviceId(deviceSession.getDeviceId()); position.set(Position.KEY_IGNITION, parser.hasNext() && parser.next().equals("1")); - position.set(Position.KEY_FUEL, parser.nextInt()); + position.set(Position.KEY_FUEL_LEVEL, parser.nextInt()); position.set(Position.KEY_BATTERY, parser.nextInt()); } diff --git a/src/org/traccar/protocol/TytanProtocolDecoder.java b/src/org/traccar/protocol/TytanProtocolDecoder.java index f7d69bfd0..e358e60b1 100644 --- a/src/org/traccar/protocol/TytanProtocolDecoder.java +++ b/src/org/traccar/protocol/TytanProtocolDecoder.java @@ -100,11 +100,11 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder { int fuel = buf.readUnsignedShort(); int fuelFormat = fuel >> 14; if (fuelFormat == 1) { - position.set(Position.KEY_FUEL, (fuel & 0x3fff) * 0.4 + "%"); + position.set(Position.KEY_FUEL_LEVEL, (fuel & 0x3fff) * 0.4 + "%"); } else if (fuelFormat == 2) { - position.set(Position.KEY_FUEL, (fuel & 0x3fff) * 0.5 + " l"); + position.set(Position.KEY_FUEL_LEVEL, (fuel & 0x3fff) * 0.5 + " l"); } else if (fuelFormat == 3) { - position.set(Position.KEY_FUEL, (fuel & 0x3fff) * -0.5 + " l"); + position.set(Position.KEY_FUEL_LEVEL, (fuel & 0x3fff) * -0.5 + " l"); } break; case 108: diff --git a/src/org/traccar/reports/ReportUtils.java b/src/org/traccar/reports/ReportUtils.java index 032925a4a..9541e1027 100644 --- a/src/org/traccar/reports/ReportUtils.java +++ b/src/org/traccar/reports/ReportUtils.java @@ -78,15 +78,17 @@ public final class ReportUtils { public static String calculateFuel(Position firstPosition, Position lastPosition) { - if (firstPosition.getAttributes().get(Position.KEY_FUEL) != null - && lastPosition.getAttributes().get(Position.KEY_FUEL) != null) { + if (firstPosition.getAttributes().get(Position.KEY_FUEL_LEVEL) != null + && lastPosition.getAttributes().get(Position.KEY_FUEL_LEVEL) != null) { try { switch (firstPosition.getProtocol()) { case "meitrack": case "galileo": case "noran": - BigDecimal v = new BigDecimal(firstPosition.getAttributes().get(Position.KEY_FUEL).toString()); - v = v.subtract(new BigDecimal(lastPosition.getAttributes().get(Position.KEY_FUEL).toString())); + BigDecimal v = new BigDecimal(firstPosition.getAttributes() + .get(Position.KEY_FUEL_LEVEL).toString()); + v = v.subtract(new BigDecimal(lastPosition.getAttributes() + .get(Position.KEY_FUEL_LEVEL).toString())); return v.setScale(2, RoundingMode.HALF_EVEN).toString() + " %"; default: break; |