diff options
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/traccar/protocol/HuaShengProtocolDecoder.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/protocol/HuaShengProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuaShengProtocolDecoder.java index 3ad70bdca..2e1ddf5f2 100644 --- a/src/main/java/org/traccar/protocol/HuaShengProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/HuaShengProtocolDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2016 - 2020 Anton Tananaev (anton@traccar.org) + * Copyright 2016 - 2021 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -234,8 +234,14 @@ public class HuaShengProtocolDecoder extends BaseProtocolDecoder { int length = buf.readUnsignedShort() - 4; switch (subtype) { case 0x0001: - position.set(Position.KEY_COOLANT_TEMP, buf.readUnsignedByte() - 40); - position.set(Position.KEY_RPM, buf.readUnsignedShort()); + int coolantTemperature = buf.readUnsignedByte() - 40; + if (coolantTemperature <= 215) { + position.set(Position.KEY_COOLANT_TEMP, coolantTemperature); + } + int rpm = buf.readUnsignedShort(); + if (rpm <= 65535) { + position.set(Position.KEY_RPM, rpm); + } position.set("averageSpeed", buf.readUnsignedByte()); buf.readUnsignedShort(); // interval fuel consumption position.set(Position.KEY_FUEL_CONSUMPTION, buf.readUnsignedShort() * 0.01); |