diff options
author | Kevin Goos <kevingoos@telenet.be> | 2018-03-16 13:35:11 +0100 |
---|---|---|
committer | Kevin Goos <kevingoos@telenet.be> | 2018-03-16 13:35:11 +0100 |
commit | 3b7c9c56e198ce213d3e113a2fbc4148b5d85558 (patch) | |
tree | a04b64fc484c6832b8f023412db020e3e5e9a657 /src/org/traccar/helper/ObdDecoder.java | |
parent | b34cf25b5ac1f178d783a512d3b95faed4bdb010 (diff) | |
parent | 25a36fe2fb8045e455de5e936c286c4db8b40563 (diff) | |
download | trackermap-server-3b7c9c56e198ce213d3e113a2fbc4148b5d85558.tar.gz trackermap-server-3b7c9c56e198ce213d3e113a2fbc4148b5d85558.tar.bz2 trackermap-server-3b7c9c56e198ce213d3e113a2fbc4148b5d85558.zip |
Merge branch 'master' of https://github.com/kevingoos/traccar
Diffstat (limited to 'src/org/traccar/helper/ObdDecoder.java')
-rw-r--r-- | src/org/traccar/helper/ObdDecoder.java | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/src/org/traccar/helper/ObdDecoder.java b/src/org/traccar/helper/ObdDecoder.java index 4bc3bcdfb..1bdcce352 100644 --- a/src/org/traccar/helper/ObdDecoder.java +++ b/src/org/traccar/helper/ObdDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 - 2016 Anton Tananaev (anton@traccar.org) + * Copyright 2015 - 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. @@ -29,15 +29,6 @@ public final class ObdDecoder { private static final int MODE_FREEZE_FRAME = 0x02; private static final int MODE_CODES = 0x03; - private static final int PID_ENGINE_LOAD = 0x04; - private static final int PID_COOLANT_TEMPERATURE = 0x05; - private static final int PID_ENGINE_RPM = 0x0C; - private static final int PID_VEHICLE_SPEED = 0x0D; - private static final int PID_THROTTLE_POSITION = 0x11; - private static final int PID_MIL_DISTANCE = 0x21; - private static final int PID_FUEL_LEVEL = 0x2F; - private static final int PID_DISTANCE_CLEARED = 0x31; - public static Map.Entry<String, Object> decode(int mode, String value) { switch (mode) { case MODE_CURRENT: @@ -86,21 +77,25 @@ public final class ObdDecoder { public static Map.Entry<String, Object> decodeData(int pid, int value, boolean convert) { switch (pid) { - case PID_ENGINE_LOAD: + case 0x04: return createEntry(Position.KEY_ENGINE_LOAD, convert ? value * 100 / 255 : value); - case PID_COOLANT_TEMPERATURE: + case 0x05: return createEntry(Position.KEY_COOLANT_TEMP, convert ? value - 40 : value); - case PID_ENGINE_RPM: + case 0x0B: + return createEntry("mapIntake", value); + case 0x0C: return createEntry(Position.KEY_RPM, convert ? value / 4 : value); - case PID_VEHICLE_SPEED: + case 0x0D: return createEntry(Position.KEY_OBD_SPEED, value); - case PID_THROTTLE_POSITION: + case 0x0F: + return createEntry("intakeTemp", convert ? value - 40 : value); + case 0x11: return createEntry(Position.KEY_THROTTLE, convert ? value * 100 / 255 : value); - case PID_MIL_DISTANCE: + case 0x21: return createEntry("milDistance", value); - case PID_FUEL_LEVEL: + case 0x2F: return createEntry(Position.KEY_FUEL_LEVEL, convert ? value * 100 / 255 : value); - case PID_DISTANCE_CLEARED: + case 0x31: return createEntry("clearedDistance", value); default: return null; |