aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-05-23 11:26:54 -0700
committerAnton Tananaev <anton.tananaev@gmail.com>2021-05-23 11:26:54 -0700
commit410260640a5e58b6f3816e987470da0143337490 (patch)
tree44e707584913c63b92e7c6fba7faa3856387c727 /src/main
parent8b29c4b31db0a9552ed2106ca8d2030fca6edea9 (diff)
downloadtraccar-server-410260640a5e58b6f3816e987470da0143337490.tar.gz
traccar-server-410260640a5e58b6f3816e987470da0143337490.tar.bz2
traccar-server-410260640a5e58b6f3816e987470da0143337490.zip
Fix temperature decoding
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
index f60cead10..6d49be0ce 100644
--- a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -295,7 +295,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
return true;
}
- private boolean decodeStatus(Position position, ByteBuf buf) {
+ private boolean decodeStatus(Position position, ByteBuf buf, boolean batteryLevel) {
int status = buf.readUnsignedByte();
@@ -324,7 +324,11 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
break;
}
- position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte() * 100 / 6);
+ if (batteryLevel) {
+ position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte() * 100 / 6);
+ } else {
+ position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01);
+ }
position.set(Position.KEY_RSSI, buf.readUnsignedByte());
position.set(Position.KEY_ALARM, decodeAlarm(buf.readUnsignedByte()));
@@ -866,7 +870,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
}
if (hasStatus(type)) {
- decodeStatus(position, buf);
+ decodeStatus(position, buf, true);
}
if (type == MSG_GPS_LBS_1 && buf.readableBytes() > 75 + 6) {
@@ -878,7 +882,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
}
if (type == MSG_GPS_LBS_1 && buf.readableBytes() == 18) {
- decodeStatus(position, buf);
+ decodeStatus(position, buf, false);
position.set("oil", buf.readUnsignedShort());
int temperature = buf.readUnsignedByte();
if (BitUtil.check(temperature, 7)) {