diff options
author | Anton Tananaev <anton@traccar.org> | 2023-05-04 16:07:52 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2023-05-04 16:07:52 -0700 |
commit | 3dad196b882c031e4ed36536c3b2deeb1b3bbff6 (patch) | |
tree | 57dbfd54f3bd8c51fa93a46322166b92e1ccaf69 /src/main/java | |
parent | e73f36db83b9dc00a5dfe0a9625f40bd2698c3fa (diff) | |
download | trackermap-server-3dad196b882c031e4ed36536c3b2deeb1b3bbff6.tar.gz trackermap-server-3dad196b882c031e4ed36536c3b2deeb1b3bbff6.tar.bz2 trackermap-server-3dad196b882c031e4ed36536c3b2deeb1b3bbff6.zip |
Extend HS-5000G OBD support
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/traccar/protocol/HuaShengProtocolDecoder.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/HuaShengProtocolDecoder.java b/src/main/java/org/traccar/protocol/HuaShengProtocolDecoder.java index 2d952c759..2fb7c6e92 100644 --- a/src/main/java/org/traccar/protocol/HuaShengProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/HuaShengProtocolDecoder.java @@ -236,6 +236,7 @@ public class HuaShengProtocolDecoder extends BaseProtocolDecoder { while (buf.readableBytes() > 4) { int subtype = buf.readUnsignedShort(); int length = buf.readUnsignedShort() - 4; + int endIndex = buf.readerIndex() + length; switch (subtype) { case 0x0001: int coolantTemperature = buf.readUnsignedByte() - 40; @@ -253,6 +254,9 @@ public class HuaShengProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01); position.set(Position.KEY_FUEL_LEVEL, buf.readUnsignedByte() * 0.4); buf.readUnsignedInt(); // trip id + if (buf.readerIndex() < endIndex) { + position.set("adBlueLevel", buf.readUnsignedByte() * 0.4); + } break; case 0x0005: position.set(Position.KEY_RSSI, buf.readUnsignedByte()); @@ -295,6 +299,7 @@ public class HuaShengProtocolDecoder extends BaseProtocolDecoder { buf.skipBytes(length); break; } + buf.readerIndex(endIndex); } if (network.getCellTowers() != null || network.getWifiAccessPoints() != null) { |