aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2020-11-25 18:15:22 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2020-11-25 18:15:22 -0800
commitb0618103672508fb16194afb1b14714a54373585 (patch)
tree699d20051b64deffc0edef4b2f38e742096f9531
parent146a4c1c0d9c4e80454d9ed382db226af41670a0 (diff)
downloadtraccar-server-b0618103672508fb16194afb1b14714a54373585.tar.gz
traccar-server-b0618103672508fb16194afb1b14714a54373585.tar.bz2
traccar-server-b0618103672508fb16194afb1b14714a54373585.zip
Support fuel and GSM data
-rw-r--r--src/main/java/org/traccar/protocol/KhdProtocolDecoder.java22
1 files changed, 22 insertions, 0 deletions
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;
}