diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2022-06-29 07:03:28 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-29 07:03:28 -0700 |
commit | cd8ac19111d704e0257acc07ce104d47c857f778 (patch) | |
tree | 148519c356dc9bf2192466433d23b09dc69f8c13 /src/main/java | |
parent | 9345f8e086105ba30e9e9cf87b3fc5b0740d68e8 (diff) | |
parent | 627c077b4134b9ed31236b1c4dbd219091c22a77 (diff) | |
download | trackermap-server-cd8ac19111d704e0257acc07ce104d47c857f778.tar.gz trackermap-server-cd8ac19111d704e0257acc07ce104d47c857f778.tar.bz2 trackermap-server-cd8ac19111d704e0257acc07ce104d47c857f778.zip |
Merge pull request #4877 from wkhaksar/watch-protocol-and-no-cell-towers
Fix for watch protocol with no cell towers
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/org/traccar/protocol/WatchProtocolDecoder.java | 9 |
1 files changed, 6 insertions, 3 deletions
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))); + } } } |