aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java
index 0f0d22021..eb0a80e05 100644
--- a/src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java
@@ -16,6 +16,7 @@
package org.traccar.protocol;
import io.netty.buffer.ByteBuf;
+import io.netty.buffer.ByteBufUtil;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import org.traccar.BaseProtocolDecoder;
@@ -30,6 +31,7 @@ import org.traccar.helper.UnitsConverter;
import org.traccar.model.CellTower;
import org.traccar.model.Network;
import org.traccar.model.Position;
+import org.traccar.model.WifiAccessPoint;
import java.net.SocketAddress;
import java.nio.charset.StandardCharsets;
@@ -394,6 +396,8 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
+ Network network = new Network();
+
buf.readUnsignedShortLE(); // length
buf.readUnsignedShortLE(); // index
@@ -537,6 +541,32 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
int id = extension ? buf.readUnsignedShort() : buf.readUnsignedByte();
int length = buf.readUnsignedByte();
switch (id) {
+ case 0x1D:
+ case 0x1E:
+ case 0x1F:
+ case 0x20:
+ case 0x21:
+ case 0x22:
+ case 0x23:
+ case 0x24:
+ case 0x25:
+ String wifiMAC = ByteBufUtil.hexDump(buf.readSlice(6));
+ int wifiRSSI = buf.readUnsignedShortLE();
+ network.addWifiAccessPoint(WifiAccessPoint.from(wifiMAC, wifiRSSI));
+ break;
+ case 0x0E:
+ case 0x0F:
+ case 0x10:
+ case 0x12:
+ case 0x13:
+ int stationMCC = buf.readUnsignedShortLE();
+ int stationMNC = buf.readUnsignedShortLE();
+ int stationLAC = buf.readUnsignedShortLE();
+ long stationID = buf.readUnsignedIntLE();
+ int stationRX_LEVEL = buf.readUnsignedShortLE();
+ network.addCellTower(CellTower.from(stationMCC, stationMNC, stationLAC, stationID,
+ stationRX_LEVEL));
+ break;
case 0x2A:
case 0x2B:
case 0x2C:
@@ -548,6 +578,13 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // label
position.set(Position.PREFIX_TEMP + (id - 0x2A), buf.readShortLE() * 0.01);
break;
+ case 0x4B:
+ position.set("networkVersion", buf.readUnsignedByte());
+ position.set("networkType", buf.readUnsignedByte());
+ int networkDescLen = buf.readUnsignedByte();
+ String networkDesc = buf.readSlice(networkDescLen).toString(StandardCharsets.US_ASCII);
+ network.setRadioType(networkDesc);
+ break;
case 0xFE31:
buf.readUnsignedByte(); // alarm protocol
buf.readUnsignedByte(); // alarm type
@@ -570,6 +607,9 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
}
}
+ if (network.getCellTowers() != null || network.getWifiAccessPoints() != null) {
+ position.setNetwork(network);
+ }
positions.add(position);
}