aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2022-06-29 07:03:28 -0700
committerGitHub <noreply@github.com>2022-06-29 07:03:28 -0700
commitcd8ac19111d704e0257acc07ce104d47c857f778 (patch)
tree148519c356dc9bf2192466433d23b09dc69f8c13 /src/main
parent9345f8e086105ba30e9e9cf87b3fc5b0740d68e8 (diff)
parent627c077b4134b9ed31236b1c4dbd219091c22a77 (diff)
downloadtrackermap-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')
-rw-r--r--src/main/java/org/traccar/protocol/WatchProtocolDecoder.java9
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)));
+ }
}
}