diff options
author | David Bergh <berghdavid@hotmail.com> | 2023-09-07 16:13:12 +0200 |
---|---|---|
committer | David Bergh <berghdavid@hotmail.com> | 2023-09-08 13:20:41 +0200 |
commit | 6d8061f868ca142018581d38410dcff80256c9cd (patch) | |
tree | 2c04c79dff806ab62cb1dd1e063392e7a98121c3 /src/main/java/org/traccar | |
parent | 599494fed9953976d9b27f5319b6bcd8268b2f48 (diff) | |
download | trackermap-server-6d8061f868ca142018581d38410dcff80256c9cd.tar.gz trackermap-server-6d8061f868ca142018581d38410dcff80256c9cd.tar.bz2 trackermap-server-6d8061f868ca142018581d38410dcff80256c9cd.zip |
Add Meitrack WiFi Aps, celltowers and network info
Includes WiFi aps, celltowers and network information.
Based on page 8-10 of Meitrack protocol:
https://www.meitrack.com/cd-download/Protocols/MEITRACK_P88L_GPRS_Protocol.pdf
Closes #5171
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r-- | src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java | 40 |
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); } |