aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-06-25 14:16:01 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-06-25 14:16:01 +1200
commitc771f3b021780b5a48ebd5998b27803456794c9e (patch)
tree27f7ef4f4dd5a0e18f0f384f998e4951c43856fe
parentac8f8ec9d7f20f130bd1ff9d8117447363db0b63 (diff)
downloadtraccar-server-c771f3b021780b5a48ebd5998b27803456794c9e.tar.gz
traccar-server-c771f3b021780b5a48ebd5998b27803456794c9e.tar.bz2
traccar-server-c771f3b021780b5a48ebd5998b27803456794c9e.zip
Correctly decode Meitrack temperature (fix #3287)
-rw-r--r--src/org/traccar/protocol/MeitrackProtocolDecoder.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
index 11ecb5d72..38ecde519 100644
--- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java
@@ -218,7 +218,8 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
if (parser.hasNext()) {
for (String temp : parser.next().split("\\|")) {
int index = Integer.valueOf(temp.substring(0, 2), 16);
- int value = Integer.valueOf(temp.substring(2), 16);
+ double value = Byte.valueOf(temp.substring(2, 4), 16);
+ value += (value < 0 ? -0.01 : 0.01) * Integer.valueOf(temp.substring(4), 16);
position.set(Position.PREFIX_TEMP + index, value);
}
}