diff options
author | Anton Tananaev <anton@traccar.org> | 2024-05-16 15:30:36 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2024-05-16 15:30:42 -0700 |
commit | f1a3367864fde22c1df3ee1a5a5e886be496031d (patch) | |
tree | 6c4fab4648535c5ab195ed3db560045631029280 | |
parent | 39d0cb2f449c3fcd3ac28f2cd5ead8054c256b4e (diff) | |
download | trackermap-server-f1a3367864fde22c1df3ee1a5a5e886be496031d.tar.gz trackermap-server-f1a3367864fde22c1df3ee1a5a5e886be496031d.tar.bz2 trackermap-server-f1a3367864fde22c1df3ee1a5a5e886be496031d.zip |
Support JT/T808 temperature sensors
-rw-r--r-- | src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java | 7 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java index fd3015e66..d010a8fe0 100644 --- a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java @@ -492,6 +492,13 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_BATTERY, Integer.parseInt(lockStatus.substring(2, 5)) * 0.01); } break; + case 0x51: + if (length == 16) { + for (int i = 1; i <= 8; i++) { + position.set(Position.PREFIX_TEMP + i, buf.readShort()); + } + } + break; case 0x56: position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte() * 10); buf.readUnsignedByte(); // reserved diff --git a/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java index 425c88785..2ba37ab09 100644 --- a/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java @@ -12,6 +12,10 @@ public class HuabaoProtocolDecoderTest extends ProtocolTest { var decoder = inject(new HuabaoProtocolDecoder(null)); verifyAttribute(decoder, binary( + "7e020000520198080908740af300000000000c000f016602a302c662f802fc000000cc24051618132401040000020f30011e310109f30100610204b056020acd5d0b0102d40379b8011423033c51108017ffffffffffffffffffffffffffffc87e"), + Position.PREFIX_TEMP + 1, -32745); + + verifyAttribute(decoder, binary( "7e020000460100503769640002000001000000001a01b9eaf804d8ee86001800000000240507035152010400000000300100310107eb1c00060089fffffffe000400ce0000000c00b28942310221007544309f5f7e"), Position.KEY_ICCID, "8942310221007544309"); |