aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/protocol/MeitrackProtocolDecoder.java3
-rw-r--r--test/org/traccar/protocol/Gt06ProtocolDecoderTest.java6
2 files changed, 8 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);
}
}
diff --git a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
index a3c3f71f3..188282bd6 100644
--- a/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
+++ b/test/org/traccar/protocol/Gt06ProtocolDecoderTest.java
@@ -17,6 +17,12 @@ public class Gt06ProtocolDecoderTest extends ProtocolTest {
"78780D01086471700328358100093F040D0A"));
verifyNotNull(decoder, binary(
+ "78781f12110616091835d0024bb93007d3fb783dd4c501940500f2006c8504a6e0370d0a"));
+
+ verifyPosition(decoder, binary(
+ "787822221106160a1016c60278019407c7783800040001940504700046fc01030100065f570d0a"));
+
+ verifyNotNull(decoder, binary(
"7878661500000000004459443d537563636573732100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010009e82b0d0a"));
verifyAttributes(decoder, binary(