From b6be94fef718926f5575257ab2724f5e538e215f Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 20 Mar 2024 20:32:16 -0700 Subject: Support 4G TK905B-G battery level --- src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java | 3 ++- src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java index 0a8540543..2186fb91f 100644 --- a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java @@ -678,7 +678,8 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder { buf.readUnsignedShort(), buf.readUnsignedInt())); position.setNetwork(network); break; - case 0xE1: + case 0x00A8: + case 0x00E1: position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte()); break; default: diff --git a/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java b/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java index 164635109..7fd7cc599 100644 --- a/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java +++ b/src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java @@ -11,6 +11,10 @@ public class HuabaoProtocolDecoderTest extends ProtocolTest { var decoder = inject(new HuabaoProtocolDecoder(null)); + verifyAttribute(decoder, binary( + "7E0200005300959000194400080000000000000003015DA64806CCB4A8001100000000230816014137010400005B3F30011F310112EB29000C00B28986049910219020787400060089FFFFFFFF000600C5FFFFFFEF0004002D0F4E000300A84CE07E"), + Position.KEY_BATTERY_LEVEL, 76); + verifyAttribute(decoder, binary( "7e55018c418560090010174701022106242122348476113550490700001c06000000074e0000000000000308100000100102020200000a030000000b0803363839363037650c0600000001000afa7e"), "unlockResult", 0x65); -- cgit v1.2.3