diff options
author | Anton Tananaev <anton@traccar.org> | 2023-03-31 17:26:13 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-03-31 17:26:13 -0700 |
commit | 5c26f25b3b0afc509c76bfc4a111dbc383efee26 (patch) | |
tree | 3eeca0d6795e830c0f1de60bbfe8cc702c624603 /src/main/java/org/traccar | |
parent | c2dad387cb769284b279d8f0738a3f5b04c7819b (diff) | |
download | trackermap-server-5c26f25b3b0afc509c76bfc4a111dbc383efee26.tar.gz trackermap-server-5c26f25b3b0afc509c76bfc4a111dbc383efee26.tar.bz2 trackermap-server-5c26f25b3b0afc509c76bfc4a111dbc383efee26.zip |
Multiple battery levels
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r-- | src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java index 3f1f7f506..0f0d22021 100644 --- a/src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java @@ -554,15 +554,14 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { buf.skipBytes(length - 2); break; case 0xFEA8: - if (buf.readUnsignedByte() > 0) { - position.set(Position.KEY_BATTERY_LEVEL, buf.readUnsignedByte()); - } else { - buf.readUnsignedByte(); + for (int k = 1; k <= 3; k++) { + if (buf.readUnsignedByte() > 0) { + String key = k == 1 ? Position.KEY_BATTERY_LEVEL : "battery" + k + "Level"; + position.set(key, buf.readUnsignedByte()); + } else { + buf.readUnsignedByte(); + } } - buf.readUnsignedByte(); // battery 2 status - buf.readUnsignedByte(); // battery 2 level - buf.readUnsignedByte(); // battery 3 status - buf.readUnsignedByte(); // battery 3 level buf.readUnsignedByte(); // battery alert break; default: |