aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2024-03-02 08:03:13 -0800
committerAnton Tananaev <anton@traccar.org>2024-03-02 08:03:13 -0800
commitef2fea79f0346d253647e9ba92a0926b0530d49b (patch)
tree077ca476c6a5971fa43b470d89e69f4adf535a0e /src/main/java/org
parent16909b99647f969f4b9c2d3e34a7ada6fc220b94 (diff)
downloadtrackermap-server-ef2fea79f0346d253647e9ba92a0926b0530d49b.tar.gz
trackermap-server-ef2fea79f0346d253647e9ba92a0926b0530d49b.tar.bz2
trackermap-server-ef2fea79f0346d253647e9ba92a0926b0530d49b.zip
Support additional G106 attributes
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/traccar/protocol/KhdProtocolDecoder.java22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/protocol/KhdProtocolDecoder.java b/src/main/java/org/traccar/protocol/KhdProtocolDecoder.java
index dd2e1dbfd..e88b34478 100644
--- a/src/main/java/org/traccar/protocol/KhdProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/KhdProtocolDecoder.java
@@ -20,6 +20,7 @@ import io.netty.buffer.ByteBufUtil;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
+import org.traccar.helper.BufferUtil;
import org.traccar.session.DeviceSession;
import org.traccar.NetworkMessage;
import org.traccar.Protocol;
@@ -169,7 +170,9 @@ public class KhdProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.KEY_FUEL_LEVEL, BitUtil.from(odometer, 16));
}
- position.set(Position.KEY_STATUS, buf.readUnsignedInt());
+ long status = buf.readUnsignedInt();
+ position.set(Position.KEY_IGNITION, BitUtil.check(status, 7 + 3 * 8));
+ position.set(Position.KEY_STATUS, status);
buf.readUnsignedShort();
buf.readUnsignedByte();
@@ -185,8 +188,7 @@ public class KhdProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedShort(); // data length
int dataType = buf.readUnsignedByte();
-
- buf.readUnsignedByte(); // content length
+ int dataLength = buf.readUnsignedByte();
switch (dataType) {
case 0x01:
@@ -197,6 +199,20 @@ public class KhdProtocolDecoder extends BaseProtocolDecoder {
position.set(Position.PREFIX_TEMP + 1,
buf.readUnsignedByte() * 100 + buf.readUnsignedByte());
break;
+ case 0x05:
+ int sign = buf.readUnsignedByte();
+ switch (sign) {
+ case 1:
+ position.set("sign", true);
+ break;
+ case 2:
+ position.set("sign", false);
+ break;
+ default:
+ break;
+ }
+ position.set(Position.KEY_DRIVER_UNIQUE_ID, BufferUtil.readString(buf, dataLength - 1));
+ break;
case 0x18:
for (int i = 1; i <= 4; i++) {
double value = buf.readUnsignedShort();