aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2023-09-13 06:49:25 -0700
committerGitHub <noreply@github.com>2023-09-13 06:49:25 -0700
commit7b4d45cc476b80d02a4bbf4bc3a2b6f09fe9c7c3 (patch)
treee37ec8a040c4eea4ab8575bd67f5643df23b57b5 /src/main/java/org/traccar
parente000421d9e67960d28666471bf8ea8c7b629dd9d (diff)
parent2ac6fb3f0d6827733724d3d483d87a3ace0b839f (diff)
downloadtrackermap-server-7b4d45cc476b80d02a4bbf4bc3a2b6f09fe9c7c3.tar.gz
trackermap-server-7b4d45cc476b80d02a4bbf4bc3a2b6f09fe9c7c3.tar.bz2
trackermap-server-7b4d45cc476b80d02a4bbf4bc3a2b6f09fe9c7c3.zip
Merge pull request #5172 from berghdavid/master
Add Meitrack WiFi Aps, celltowers and network info
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r--src/main/java/org/traccar/protocol/MeitrackProtocolDecoder.java31
1 files changed, 31 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..8a1e14834 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,27 @@ 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)).replaceAll("(..)", "$1:");
+ network.addWifiAccessPoint(WifiAccessPoint.from(wifiMac.substring(0, wifiMac.length() - 1),
+ buf.readShortLE()));
+ break;
+ case 0x0E:
+ case 0x0F:
+ case 0x10:
+ case 0x12:
+ case 0x13:
+ network.addCellTower(CellTower.from(buf.readUnsignedShortLE(), buf.readUnsignedShortLE(),
+ buf.readUnsignedShortLE(), buf.readUnsignedIntLE(), buf.readShortLE()));
+ break;
case 0x2A:
case 0x2B:
case 0x2C:
@@ -548,6 +573,9 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
buf.readUnsignedByte(); // label
position.set(Position.PREFIX_TEMP + (id - 0x2A), buf.readShortLE() * 0.01);
break;
+ case 0x4B:
+ buf.skipBytes(length); // network information
+ break;
case 0xFE31:
buf.readUnsignedByte(); // alarm protocol
buf.readUnsignedByte(); // alarm type
@@ -570,6 +598,9 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder {
}
}
+ if (network.getCellTowers() != null || network.getWifiAccessPoints() != null) {
+ position.setNetwork(network);
+ }
positions.add(position);
}