aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2024-03-20 20:32:16 -0700
committerAnton Tananaev <anton@traccar.org>2024-03-20 20:32:16 -0700
commitb6be94fef718926f5575257ab2724f5e538e215f (patch)
tree65f6397012e2f05d9d9be683066a26228d6d3a0b
parent5b8b40faebf6996f1d2f5aef4c733dfe13d73b1b (diff)
downloadtrackermap-server-b6be94fef718926f5575257ab2724f5e538e215f.tar.gz
trackermap-server-b6be94fef718926f5575257ab2724f5e538e215f.tar.bz2
trackermap-server-b6be94fef718926f5575257ab2724f5e538e215f.zip
Support 4G TK905B-G battery level
-rw-r--r--src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java3
-rw-r--r--src/test/java/org/traccar/protocol/HuabaoProtocolDecoderTest.java4
2 files changed, 6 insertions, 1 deletions
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
@@ -12,6 +12,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);