diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-13 11:24:32 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-13 11:24:32 +1300 |
commit | 8d1e3f1f7e35e5bc0c2898ca9c9d840ef9676cd8 (patch) | |
tree | bf00317718de4a715ebf058b3ae0d6992b2d45a3 /src/org/traccar/protocol/TytanProtocolDecoder.java | |
parent | 43a64fc359f8acf08f97d70ebdb93dafa607dc08 (diff) | |
download | trackermap-server-8d1e3f1f7e35e5bc0c2898ca9c9d840ef9676cd8.tar.gz trackermap-server-8d1e3f1f7e35e5bc0c2898ca9c9d840ef9676cd8.tar.bz2 trackermap-server-8d1e3f1f7e35e5bc0c2898ca9c9d840ef9676cd8.zip |
Fix last reported FindBugs issues
Diffstat (limited to 'src/org/traccar/protocol/TytanProtocolDecoder.java')
-rw-r--r-- | src/org/traccar/protocol/TytanProtocolDecoder.java | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/org/traccar/protocol/TytanProtocolDecoder.java b/src/org/traccar/protocol/TytanProtocolDecoder.java index be9a9afed..d1fdd99d0 100644 --- a/src/org/traccar/protocol/TytanProtocolDecoder.java +++ b/src/org/traccar/protocol/TytanProtocolDecoder.java @@ -174,16 +174,13 @@ public class TytanProtocolDecoder extends BaseProtocolDecoder { break; case 107: int fuel = buf.readUnsignedShort(); - switch (fuel >> 14) { - case 1: - position.set(Event.KEY_FUEL, (fuel & 0x3fff) * 0.4 + "%"); - break; - case 2: - position.set(Event.KEY_FUEL, (fuel & 0x3fff) * 0.5 + " l"); - break; - case 3: - position.set(Event.KEY_FUEL, (fuel & 0x3fff) * -0.5 + " l"); - break; + int fuelFormat = fuel >> 14; + if (fuelFormat == 1) { + position.set(Event.KEY_FUEL, (fuel & 0x3fff) * 0.4 + "%"); + } else if (fuelFormat == 2) { + position.set(Event.KEY_FUEL, (fuel & 0x3fff) * 0.5 + " l"); + } else if (fuelFormat == 3) { + position.set(Event.KEY_FUEL, (fuel & 0x3fff) * -0.5 + " l"); } break; case 108: |