diff options
author | Anton Tananaev <anton@traccar.org> | 2023-06-15 05:53:04 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-06-15 05:53:04 -0700 |
commit | 4a64ef748e207406be4f7aa7538d59b7b0f9735c (patch) | |
tree | 105bc58f18dd3570fc71bb2ae07af5d554fd166a /src/main/java/org/traccar | |
parent | 03650fff8064b60ffcda75f9033fd44e66ef34b3 (diff) | |
download | trackermap-server-4a64ef748e207406be4f7aa7538d59b7b0f9735c.tar.gz trackermap-server-4a64ef748e207406be4f7aa7538d59b7b0f9735c.tar.bz2 trackermap-server-4a64ef748e207406be4f7aa7538d59b7b0f9735c.zip |
Decode JT808 battery level
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r-- | src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java index 3adfa7daf..beb1ec41a 100644 --- a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java @@ -484,6 +484,10 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_BATTERY, Integer.parseInt(lockStatus.substring(2, 5)) * 0.01); } break; + case 0x56: + position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte() * 10); + buf.readUnsignedByte(); // reserved + break; case 0x60: position.set(Position.KEY_EVENT, buf.readUnsignedShort()); buf.skipBytes(length - 2); @@ -692,6 +696,8 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder { case 0xFE: if (length == 1) { position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte()); + } else if (length == 2) { + position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.1); } else { int mark = buf.readUnsignedByte(); if (mark == 0x7C) { |