diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-11-29 08:38:12 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2020-11-29 08:38:12 -0800 |
commit | 2810e724193fac01e06e8412dae7bde3955fb46b (patch) | |
tree | ad4ab95db572f81ba6c698a12f48921e4b7016e2 | |
parent | 8d2df830d61243333d6785e179caa80592f1e970 (diff) | |
download | trackermap-server-2810e724193fac01e06e8412dae7bde3955fb46b.tar.gz trackermap-server-2810e724193fac01e06e8412dae7bde3955fb46b.tar.bz2 trackermap-server-2810e724193fac01e06e8412dae7bde3955fb46b.zip |
Decode battery level
-rw-r--r-- | src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java | 1 | ||||
-rw-r--r-- | src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java index 6d57c3339..b0cd1ab8c 100644 --- a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java @@ -317,6 +317,7 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.1); break; case 0xD4: + case 0xFE: position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte()); break; case 0xD5: diff --git a/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java index 8e9e8c1d4..b4a5148d6 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( "7E01000021013345678906000F002C012F373031313142534A2D4D3742203030303030303001D4C1423838383838B47E")); + verifyAttribute(decoder, binary( + "7e02000033202011200010001300020000000400020158b30006c93ee5002000000000201127162937010400000000fe0145ff0c01cc00000000263300000f3e627e"), + Position.KEY_BATTERY_LEVEL, 69); + verifyPosition(decoder, binary( "7e0200002e202000129707001c0000000000001c0601a2f0a8091f0bf00000000000ed201103031733000000000000000000780000000018000000267e")); |