From bb78e15201e88fba4c71bb08d98d0f0bc5acecbf Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 5 Oct 2022 08:52:25 -0700 Subject: Decode RFTRACK WiFi info --- src/main/java/org/traccar/protocol/RfTrackProtocolDecoder.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/main/java/org/traccar') diff --git a/src/main/java/org/traccar/protocol/RfTrackProtocolDecoder.java b/src/main/java/org/traccar/protocol/RfTrackProtocolDecoder.java index be9b23e37..28a3ac29c 100644 --- a/src/main/java/org/traccar/protocol/RfTrackProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/RfTrackProtocolDecoder.java @@ -26,6 +26,7 @@ import org.traccar.model.CellTower; import org.traccar.model.Command; import org.traccar.model.Network; import org.traccar.model.Position; +import org.traccar.model.WifiAccessPoint; import org.traccar.session.DeviceSession; import javax.json.Json; @@ -126,6 +127,14 @@ public class RfTrackProtocolDecoder extends BaseHttpProtocolDecoder { case "cob": position.set("pressureChanges", value); break; + case "wifi": + JsonArray wifiInfo = Json.createReader(new StringReader(value)).readArray(); + for (int i = 0; i < wifiInfo.size(); i++) { + JsonObject wifi = wifiInfo.getJsonObject(i); + network.addWifiAccessPoint(WifiAccessPoint.from( + wifi.getString("m").replace('-', ':'), wifi.getInt("l"))); + } + break; case "u_ids": position.set("unpairedIds", value); break; -- cgit v1.2.3