aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/HuaShengProtocolDecoder.java
diff options
context:
space:
mode:
authorKieran Dodson <128472473+K-J-Dod24@users.noreply.github.com>2023-05-05 09:21:44 +0100
committerGitHub <noreply@github.com>2023-05-05 09:21:44 +0100
commit4178fd23d49be268633a4ba933af72a28685280c (patch)
treed48b6bf6e4c0266c35ba484e64f31f379bb1e0db /src/main/java/org/traccar/protocol/HuaShengProtocolDecoder.java
parent442806299eb328b5b41882d04c3dd65650715647 (diff)
parent3dad196b882c031e4ed36536c3b2deeb1b3bbff6 (diff)
downloadtrackermap-server-4178fd23d49be268633a4ba933af72a28685280c.tar.gz
trackermap-server-4178fd23d49be268633a4ba933af72a28685280c.tar.bz2
trackermap-server-4178fd23d49be268633a4ba933af72a28685280c.zip
Merge branch 'traccar:master' into Teltonika-io30-faultCount
Diffstat (limited to 'src/main/java/org/traccar/protocol/HuaShengProtocolDecoder.java')
-rw-r--r--src/main/java/org/traccar/protocol/HuaShengProtocolDecoder.java5
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) {