From b0618103672508fb16194afb1b14714a54373585 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 25 Nov 2020 18:15:22 -0800 Subject: Support fuel and GSM data --- .../org/traccar/protocol/KhdProtocolDecoder.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src') diff --git a/src/main/java/org/traccar/protocol/KhdProtocolDecoder.java b/src/main/java/org/traccar/protocol/KhdProtocolDecoder.java index 0dd5b085a..343b78cb5 100644 --- a/src/main/java/org/traccar/protocol/KhdProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/KhdProtocolDecoder.java @@ -26,6 +26,8 @@ import org.traccar.helper.BcdUtil; import org.traccar.helper.Checksum; import org.traccar.helper.DateBuilder; import org.traccar.helper.UnitsConverter; +import org.traccar.model.CellTower; +import org.traccar.model.Network; import org.traccar.model.Position; import java.net.SocketAddress; @@ -139,6 +141,26 @@ public class KhdProtocolDecoder extends BaseProtocolDecoder { position.set(Position.PREFIX_TEMP + 1, buf.readUnsignedByte() * 100 + buf.readUnsignedByte()); break; + case 0x18: + for (int i = 1; i <= 4; i++) { + double value = buf.readUnsignedShort(); + if (value > 0x0000 && value < 0xFFFF) { + position.set("fuel" + i, value / 0xFFFE); + } + } + break; + case 0x23: + Network network = new Network(); + int count = buf.readUnsignedByte(); + for (int i = 0; i < count; i++) { + network.addCellTower(CellTower.from( + buf.readUnsignedShort(), buf.readUnsignedByte(), + buf.readUnsignedShort(), buf.readUnsignedShort(), buf.readUnsignedByte())); + } + if (count > 0) { + position.setNetwork(network); + } + break; default: break; } -- cgit v1.2.3