Skip to content

Commit

Permalink
Support 900E fuel level
Browse files Browse the repository at this point in the history
  • Loading branch information
tananaev committed Jul 8, 2021
1 parent 55b07ac commit c915753
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/java/org/traccar/protocol/KhdProtocolDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,13 @@ protected Object decode(

if (type != MSG_ALARM) {

position.set(Position.KEY_ODOMETER, buf.readUnsignedMedium());
int odometer = buf.readUnsignedMedium();
if (BitUtil.to(odometer, 16) > 0) {
position.set(Position.KEY_ODOMETER, odometer);
} else if (odometer > 0) {
position.set(Position.KEY_FUEL_LEVEL, BitUtil.from(odometer, 16));
}

position.set(Position.KEY_STATUS, buf.readUnsignedInt());

buf.readUnsignedShort();
Expand Down

0 comments on commit c915753

Please sign in to comment.