From 7899f1ffbb0e00243d2b4cf72ffe9bc59bb920bc Mon Sep 17 00:00:00 2001 From: wkhaksar <31837615+wkhaksar@users.noreply.github.com> Date: Wed, 29 Jun 2022 09:02:15 +0200 Subject: time advance moved to inner block added a check for 0 mac address on wifi networks. --- src/main/java/org/traccar/protocol/WatchProtocolDecoder.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java b/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java index 35fdc3ca5..a71c5606d 100644 --- a/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java @@ -142,8 +142,8 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder { Network network = new Network(); int cellCount = Integer.parseInt(values[index++]); - index += 1; // timing advance if (cellCount > 0) { + index += 1; // timing advance int mcc = !values[index].isEmpty() ? Integer.parseInt(values[index++]) : 0; int mnc = !values[index].isEmpty() ? Integer.parseInt(values[index++]) : 0; @@ -164,8 +164,11 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder { for (int i = 0; i < wifiCount; i++) { index += 1; // wifi name - network.addWifiAccessPoint(WifiAccessPoint.from( - values[index++], Integer.parseInt(values[index++]))); + String macAddress = values[index++]; + String rssi = values[index++]; + if (!macAddress.isEmpty() && !macAddress.equals("0") && !rssi.isEmpty()) { + network.addWifiAccessPoint(WifiAccessPoint.from(macAddress, Integer.parseInt(rssi))); + } } } -- cgit v1.2.3