aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar')
-rw-r--r--src/main/java/org/traccar/protocol/S168ProtocolDecoder.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/protocol/S168ProtocolDecoder.java b/src/main/java/org/traccar/protocol/S168ProtocolDecoder.java
index 685364483..921141698 100644
--- a/src/main/java/org/traccar/protocol/S168ProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/S168ProtocolDecoder.java
@@ -20,7 +20,10 @@ import org.traccar.BaseProtocolDecoder;
import org.traccar.DeviceSession;
import org.traccar.Protocol;
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.text.DateFormat;
@@ -48,6 +51,8 @@ public class S168ProtocolDecoder extends BaseProtocolDecoder {
Position position = new Position(getProtocolName());
position.setDeviceId(deviceSession.getDeviceId());
+ Network network = new Network();
+
String content = values[4];
String[] fragments = content.split(";");
for (String fragment : fragments) {
@@ -73,11 +78,32 @@ public class S168ProtocolDecoder extends BaseProtocolDecoder {
position.setCourse(Integer.parseInt(values[index++]));
position.setAltitude(Integer.parseInt(values[index++]));
break;
+ case "CELL":
+ int cellCount = Integer.parseInt(values[index++]);
+ int mcc = Integer.parseInt(values[index++], 16);
+ int mnc = Integer.parseInt(values[index++], 16);
+ for (int i = 0; i < cellCount; i++) {
+ network.addCellTower(CellTower.from(
+ mcc, mnc, Integer.parseInt(values[index++], 16), Integer.parseInt(values[index++], 16),
+ Integer.parseInt(values[index++], 16)));
+ }
+ break;
+ case "WIFI":
+ int wifiCount = Integer.parseInt(values[index++]);
+ for (int i = 0; i < wifiCount; i++) {
+ network.addWifiAccessPoint(WifiAccessPoint.from(
+ values[index++].replace('-', ':'), Integer.parseInt(values[index++])));
+ }
+ break;
default:
break;
}
}
+ if (network.getCellTowers() != null || network.getWifiAccessPoints() != null) {
+ position.setNetwork(network);
+ }
+
return position.getAttributes().containsKey(Position.KEY_SATELLITES) ? position : null;
}