diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-01-10 22:25:57 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2021-01-10 22:25:57 -0800 |
commit | 9d91c66d6364f664832ebb7219841a2c7832c943 (patch) | |
tree | 2821b3a3a52d9904389e26346c8b95adb80a9580 /src/main | |
parent | 16c5d573e6a748a59d8eab261078e68a42f29337 (diff) | |
download | trackermap-server-9d91c66d6364f664832ebb7219841a2c7832c943.tar.gz trackermap-server-9d91c66d6364f664832ebb7219841a2c7832c943.tar.bz2 trackermap-server-9d91c66d6364f664832ebb7219841a2c7832c943.zip |
Add Space10X temperature
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java | 27 |
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)) { |