diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-07-05 04:53:34 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-07-05 04:53:34 +1200 |
commit | d5dfbc2b8b70209e40231f5da27809548b4c8853 (patch) | |
tree | c99a47f77c16ac287ddb6e6c9a0f8584a64c5b12 | |
parent | cdfc5a4881e21903e161782e751007d5b653f393 (diff) | |
download | traccar-server-d5dfbc2b8b70209e40231f5da27809548b4c8853.tar.gz traccar-server-d5dfbc2b8b70209e40231f5da27809548b4c8853.tar.bz2 traccar-server-d5dfbc2b8b70209e40231f5da27809548b4c8853.zip |
Add new attribute keys (fix #3313)
-rw-r--r-- | src/org/traccar/helper/ObdDecoder.java | 6 | ||||
-rw-r--r-- | src/org/traccar/model/Position.java | 2 | ||||
-rw-r--r-- | src/org/traccar/protocol/Gps103ProtocolDecoder.java | 4 | ||||
-rw-r--r-- | src/org/traccar/protocol/MeiligaoProtocolDecoder.java | 30 |
4 files changed, 22 insertions, 20 deletions
diff --git a/src/org/traccar/helper/ObdDecoder.java b/src/org/traccar/helper/ObdDecoder.java index f2c269f47..4bc3bcdfb 100644 --- a/src/org/traccar/helper/ObdDecoder.java +++ b/src/org/traccar/helper/ObdDecoder.java @@ -87,15 +87,15 @@ public final class ObdDecoder { public static Map.Entry<String, Object> decodeData(int pid, int value, boolean convert) { switch (pid) { case PID_ENGINE_LOAD: - return createEntry("engineLoad", convert ? value * 100 / 255 : value); + return createEntry(Position.KEY_ENGINE_LOAD, convert ? value * 100 / 255 : value); case PID_COOLANT_TEMPERATURE: - return createEntry("coolantTemperature", convert ? value - 40 : value); + return createEntry(Position.KEY_COOLANT_TEMP, convert ? value - 40 : value); case PID_ENGINE_RPM: return createEntry(Position.KEY_RPM, convert ? value / 4 : value); case PID_VEHICLE_SPEED: return createEntry(Position.KEY_OBD_SPEED, value); case PID_THROTTLE_POSITION: - return createEntry("throttle", convert ? value * 100 / 255 : value); + return createEntry(Position.KEY_THROTTLE, convert ? value * 100 / 255 : value); case PID_MIL_DISTANCE: return createEntry("milDistance", value); case PID_FUEL_LEVEL: diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java index 2198d3b24..5835310ae 100644 --- a/src/org/traccar/model/Position.java +++ b/src/org/traccar/model/Position.java @@ -69,6 +69,8 @@ public class Position extends Message { public static final String KEY_GEOFENCE = "geofence"; public static final String KEY_ACCELERATION = "acceleration"; public static final String KEY_DEVICE_TEMP = "deviceTemp"; // celsius + public static final String KEY_COOLANT_TEMP = "coolantTemp"; // celsius + public static final String KEY_ENGINE_LOAD = "engineLoad"; public static final String KEY_OPERATOR = "operator"; public static final String KEY_COMMAND = "command"; public static final String KEY_BLOCKED = "blocked"; diff --git a/src/org/traccar/protocol/Gps103ProtocolDecoder.java b/src/org/traccar/protocol/Gps103ProtocolDecoder.java index ec8871865..f5ba3cff7 100644 --- a/src/org/traccar/protocol/Gps103ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gps103ProtocolDecoder.java @@ -211,8 +211,8 @@ public class Gps103ProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_FUEL_CONSUMPTION, parser.nextDouble(0)); position.set(Position.KEY_HOURS, parser.nextInt()); position.set(Position.KEY_OBD_SPEED, parser.nextInt(0)); - position.set("powerLoad", parser.next()); - position.set(Position.PREFIX_TEMP + 1, parser.nextInt()); + position.set(Position.KEY_ENGINE_LOAD, parser.next()); + position.set(Position.KEY_COOLANT_TEMP, parser.nextInt()); position.set(Position.KEY_THROTTLE, parser.next()); position.set(Position.KEY_RPM, parser.nextInt(0)); position.set(Position.KEY_BATTERY, parser.nextDouble(0)); diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java index 199feaf97..44e01d5e0 100644 --- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java +++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java @@ -282,21 +282,21 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder { getLastLocation(position, null); - position.set(Position.KEY_BATTERY, parser.nextDouble(0)); - position.set(Position.KEY_RPM, parser.nextInt(0)); - position.set(Position.KEY_OBD_SPEED, parser.nextInt(0)); - position.set(Position.KEY_THROTTLE, parser.nextDouble(0)); - position.set("engineLoad", parser.nextDouble(0)); - position.set(Position.PREFIX_TEMP + 1, parser.nextInt(0)); - position.set(Position.KEY_FUEL_CONSUMPTION, parser.nextDouble(0)); - position.set("averageFuelConsumption", parser.nextDouble(0)); - position.set("drivingRange", parser.nextDouble(0)); - position.set(Position.KEY_ODOMETER, parser.nextDouble(0)); - position.set("singleFuelConsumption", parser.nextDouble(0)); - position.set("totalFuelConsumption", parser.nextDouble(0)); - position.set(Position.KEY_DTCS, parser.nextInt(0)); - position.set("harshAcelerationNo", parser.nextInt(0)); - position.set("harshBreakerNo", parser.nextInt(0)); + position.set(Position.KEY_BATTERY, parser.nextDouble()); + position.set(Position.KEY_RPM, parser.nextInt()); + position.set(Position.KEY_OBD_SPEED, parser.nextInt()); + position.set(Position.KEY_THROTTLE, parser.nextDouble()); + position.set(Position.KEY_ENGINE_LOAD, parser.nextDouble()); + position.set(Position.KEY_COOLANT_TEMP, parser.nextInt()); + position.set(Position.KEY_FUEL_CONSUMPTION, parser.nextDouble()); + position.set("averageFuelConsumption", parser.nextDouble()); + 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_DTCS, parser.nextInt()); + position.set("harshAcelerationNo", parser.nextInt()); + position.set("harshBreakerNo", parser.nextInt()); return position; } |