diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2019-04-20 15:15:30 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2019-04-20 15:15:30 -0700 |
commit | 570ece9e288d55b4986f59e6d1407666dda94bcb (patch) | |
tree | c382e33b0ba9e5b00a11b11eb05fb236eed14deb /src/main/java/org/traccar | |
parent | 6b93bac13dc044c3155794226a670257d841554e (diff) | |
download | traccar-server-570ece9e288d55b4986f59e6d1407666dda94bcb.tar.gz traccar-server-570ece9e288d55b4986f59e6d1407666dda94bcb.tar.bz2 traccar-server-570ece9e288d55b4986f59e6d1407666dda94bcb.zip |
Decode level 2 battery
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r-- | src/main/java/org/traccar/protocol/H02ProtocolDecoder.java | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/main/java/org/traccar/protocol/H02ProtocolDecoder.java b/src/main/java/org/traccar/protocol/H02ProtocolDecoder.java index c4443a00b..6f1a4f01e 100644 --- a/src/main/java/org/traccar/protocol/H02ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/H02ProtocolDecoder.java @@ -88,19 +88,16 @@ public class H02ProtocolDecoder extends BaseProtocolDecoder { } private Integer decodeBattery(int value) { - switch (value) { - case 6: - return 100; - case 5: - return 80; - case 4: - return 60; - case 3: - return 20; - case 2: - return 10; - default: - return null; + if (value <= 3) { + return (value - 1) * 10; + } else if (value <= 6) { + return (value - 1) * 20; + } else if (value <= 100) { + return value; + } else if (value >= 0xF1 && value <= 0xF6) { + return value - 0xF0; + } else { + return null; } } |