aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-03-22 19:21:07 -0700
committerAnton Tananaev <anton@traccar.org>2023-03-22 19:21:07 -0700
commitee3cbd4aba2e7df2ac2da4292caa87a63b171a87 (patch)
tree1708728a4ab7d0eb9b1a4fc7eab3f442503ada92 /src/main/java/org
parentf8fb3f67bc0bc44f9da89c3dabbec7406751e3c6 (diff)
downloadtrackermap-server-ee3cbd4aba2e7df2ac2da4292caa87a63b171a87.tar.gz
trackermap-server-ee3cbd4aba2e7df2ac2da4292caa87a63b171a87.tar.bz2
trackermap-server-ee3cbd4aba2e7df2ac2da4292caa87a63b171a87.zip
Decode JT705A tilt
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java14
1 files changed, 13 insertions, 1 deletions
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);