aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-09-20 21:21:06 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-09-20 21:21:06 +1200
commit411edf2fecc6f5d2cceba20f06958f729ebcca54 (patch)
tree89a7aa88134312136238c202eda85371fc5ba642 /src
parentb14c80aff0d102fa8189697ea70a53a3bd3f200e (diff)
downloadtraccar-server-411edf2fecc6f5d2cceba20f06958f729ebcca54.tar.gz
traccar-server-411edf2fecc6f5d2cceba20f06958f729ebcca54.tar.bz2
traccar-server-411edf2fecc6f5d2cceba20f06958f729ebcca54.zip
Don't convert Castel OBD values
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/helper/ObdDecoder.java14
-rw-r--r--src/org/traccar/protocol/CastelProtocolDecoder.java2
2 files changed, 8 insertions, 8 deletions
diff --git a/src/org/traccar/helper/ObdDecoder.java b/src/org/traccar/helper/ObdDecoder.java
index 8383a2b1a..3196c25e4 100644
--- a/src/org/traccar/helper/ObdDecoder.java
+++ b/src/org/traccar/helper/ObdDecoder.java
@@ -44,7 +44,7 @@ public final class ObdDecoder {
case MODE_FREEZE_FRAME:
return decodeData(
Integer.parseInt(value.substring(0, 2), 16),
- Integer.parseInt(value.substring(2), 16));
+ Integer.parseInt(value.substring(2), 16), true);
case MODE_CODES:
return decodeCodes(value);
default:
@@ -84,22 +84,22 @@ public final class ObdDecoder {
}
}
- public static Map.Entry<String, Object> decodeData(int pid, int value) {
+ public static Map.Entry<String, Object> decodeData(int pid, int value, boolean convert) {
switch (pid) {
case PID_ENGINE_LOAD:
- return createEntry("engineLoad", value * 100 / 255);
+ return createEntry("engineLoad", convert ? value * 100 / 255 : value);
case PID_COOLANT_TEMPERATURE:
- return createEntry("coolantTemperature", value - 40);
+ return createEntry("coolantTemperature", convert ? value - 40 : value);
case PID_ENGINE_RPM:
- return createEntry(Position.KEY_RPM, value / 4);
+ 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", value * 100 / 255);
+ return createEntry("throttle", convert ? value * 100 / 255 : value);
case PID_MIL_DISTANCE:
return createEntry("milDistance", value);
case PID_FUEL_LEVEL:
- return createEntry(Position.KEY_FUEL, value * 100 / 255);
+ return createEntry(Position.KEY_FUEL, convert ? value * 100 / 255 : value);
case PID_DISTANCE_CLEARED:
return createEntry("clearedDistance", value);
default:
diff --git a/src/org/traccar/protocol/CastelProtocolDecoder.java b/src/org/traccar/protocol/CastelProtocolDecoder.java
index ee5fac5e6..47df3735c 100644
--- a/src/org/traccar/protocol/CastelProtocolDecoder.java
+++ b/src/org/traccar/protocol/CastelProtocolDecoder.java
@@ -167,7 +167,7 @@ public class CastelProtocolDecoder extends BaseProtocolDecoder {
value = 0;
break;
}
- position.add(ObdDecoder.decodeData(pids[i], value));
+ position.add(ObdDecoder.decodeData(pids[i], value, false));
}
}