aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2023-03-09 09:26:32 -0800
committerAnton Tananaev <anton@traccar.org>2023-03-09 09:26:32 -0800
commit2749e520c9ea1ba778c120739e2b67a9fe5e119c (patch)
tree6a3b468c57777836fdabc07a2a85a1733b457949 /src
parent785933bc74b2530ed36b4d5fae364284e28cf5d9 (diff)
downloadtrackermap-server-2749e520c9ea1ba778c120739e2b67a9fe5e119c.tar.gz
trackermap-server-2749e520c9ea1ba778c120739e2b67a9fe5e119c.tar.bz2
trackermap-server-2749e520c9ea1ba778c120739e2b67a9fe5e119c.zip
Add JT705A gyro axis
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java16
-rw-r--r--src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java4
2 files changed, 20 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
index d6deafe17..d3336b60c 100644
--- a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
@@ -753,6 +753,22 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_STATUS, status);
+ while (buf.readableBytes() > 2) {
+ int id = buf.readUnsignedByte();
+ int length = buf.readUnsignedByte();
+ switch (id) {
+ case 0x02:
+ position.setAltitude(buf.readShort());
+ break;
+ case 0x0C:
+ position.set("gyro", ByteBufUtil.hexDump(buf.readSlice(6)));
+ break;
+ default:
+ buf.skipBytes(length);
+ break;
+ }
+ }
+
return position;
}
diff --git a/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java
index 95abc43a7..9590f7732 100644
--- a/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java
+++ b/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java
@@ -14,6 +14,10 @@ public class HuabaoProtocolDecoderTest extends ProtocolTest {
verifyNull(decoder, binary(
"7e010200204f07788ef67601824f4459344f544d314d4459774d4441314d444977626d5633553235536457786cba7e"));
+ verifyAttribute(decoder, binary(
+ "7e55019c3b8571110003399a07032310302029538631031015370500001a0c000000265700440001233703080000001001020202000a0a04028f000af401040c06ff98ffa8007e707e"),
+ "gyro", "ff98ffa8007e");
+
verifyPosition(decoder, binary(
"7e0900001f4f07788ef87d000cf0230223150215010203013800000c000b029dc58c04b99b60230223171822507e"));