aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
index 335dcd796..841e2235d 100644
--- a/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/HuabaoProtocolDecoder.java
@@ -335,8 +335,13 @@ public class HuabaoProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_RSSI, buf.readUnsignedByte());
position.set(Position.KEY_SATELLITES, buf.readUnsignedByte());
position.set(Position.KEY_ODOMETER, buf.readUnsignedInt() * 1000L);
- position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte());
- position.set(Position.KEY_CHARGE, buf.readUnsignedByte() == 0xAA);
+
+ int battery = buf.readUnsignedByte();
+ if (battery <= 100) {
+ position.set(Position.KEY_BATTERY_LEVEL, battery);
+ } else if (battery == 0xAA) {
+ position.set(Position.KEY_CHARGE, true);
+ }
position.setNetwork(new Network(CellTower.fromCidLac(buf.readUnsignedInt(), buf.readUnsignedShort())));