From ee3cbd4aba2e7df2ac2da4292caa87a63b171a87 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 22 Mar 2023 19:21:07 -0700 Subject: Decode JT705A tilt --- .../java/org/traccar/protocol/HuabaoProtocolDecoder.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/main/java/org') diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java index d3336b60c..22c39c2da 100644 --- a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java @@ -761,7 +761,19 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder { position.setAltitude(buf.readShort()); break; case 0x0C: - position.set("gyro", ByteBufUtil.hexDump(buf.readSlice(6))); + int x = buf.readUnsignedShort(); + if (x > 0x8000) { + x -= 0x10000; + } + int y = buf.readUnsignedShort(); + if (y > 0x8000) { + y -= 0x10000; + } + int z = buf.readUnsignedShort(); + if (z > 0x8000) { + z -= 0x10000; + } + position.set("tilt", String.format("[%d,%d,%d]", x, y, z)); break; default: buf.skipBytes(length); -- cgit v1.2.3