aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
index 193452a3f..48d9c813a 100644
--- a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -758,7 +758,11 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
} else if (isSupported(type)) {
- decodeBasicUniversal(buf, deviceSession, type, position);
+ if (type == MSG_STATUS && buf.readableBytes() == 22) {
+ decodeHeartbeat(buf, position);
+ } else {
+ decodeBasicUniversal(buf, deviceSession, type, position);
+ }
} else if (type == MSG_ALARM) {
boolean extendedAlarm = dataLength > 7;
@@ -822,6 +826,27 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
return position;
}
+ private void decodeHeartbeat(ByteBuf buf, Position position) {
+
+ getLastLocation(position, null);
+
+ buf.readUnsignedByte(); // information content
+ buf.readUnsignedShort(); // satellites
+ buf.readUnsignedByte(); // alarm
+ buf.readUnsignedByte(); // language
+ buf.readUnsignedByte(); // battery
+ buf.readUnsignedByte(); // working mode
+ buf.readUnsignedShort(); // working voltage
+ buf.readUnsignedByte(); // reserved
+ buf.readUnsignedShort(); // working times
+ buf.readUnsignedShort(); // working time
+
+ int value = buf.readUnsignedShort();
+ double temperature = BitUtil.to(value, 15) * 0.1;
+ position.set(Position.PREFIX_TEMP + 1, BitUtil.check(value, 15) ? temperature : -temperature);
+
+ }
+
private void decodeBasicUniversal(ByteBuf buf, DeviceSession deviceSession, int type, Position position) {
if (hasGps(type)) {