diff options
author | Anton Tananaev <anton@traccar.org> | 2022-05-27 19:28:31 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-05-27 19:28:31 -0700 |
commit | bb50a4178d171d40734b94fccf52b72733f1f04c (patch) | |
tree | bc49709d4b6c9275928ebe4b422e42b2eeacc7d0 /src/main/java/org | |
parent | 950a35723b8ad3e9383c55d8b84812d012da3085 (diff) | |
download | trackermap-server-bb50a4178d171d40734b94fccf52b72733f1f04c.tar.gz trackermap-server-bb50a4178d171d40734b94fccf52b72733f1f04c.tar.bz2 trackermap-server-bb50a4178d171d40734b94fccf52b72733f1f04c.zip |
Watch zero cell towers
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/traccar/protocol/WatchProtocolDecoder.java | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java b/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java index 4ab7875b7..b25a15f93 100644 --- a/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/WatchProtocolDecoder.java @@ -145,17 +145,19 @@ public class WatchProtocolDecoder extends BaseProtocolDecoder { int cellCount = Integer.parseInt(values[index++]); index += 1; // timing advance - int mcc = !values[index].isEmpty() ? Integer.parseInt(values[index++]) : 0; - int mnc = !values[index].isEmpty() ? Integer.parseInt(values[index++]) : 0; - - for (int i = 0; i < cellCount; i++) { - int lac = Integer.parseInt(values[index++]); - int cid = Integer.parseInt(values[index++]); - String rssi = values[index++]; - if (!rssi.isEmpty()) { - network.addCellTower(CellTower.from(mcc, mnc, lac, cid, Integer.parseInt(rssi))); - } else { - network.addCellTower(CellTower.from(mcc, mnc, lac, cid)); + if (cellCount > 0) { + int mcc = !values[index].isEmpty() ? Integer.parseInt(values[index++]) : 0; + int mnc = !values[index].isEmpty() ? Integer.parseInt(values[index++]) : 0; + + for (int i = 0; i < cellCount; i++) { + int lac = Integer.parseInt(values[index++]); + int cid = Integer.parseInt(values[index++]); + String rssi = values[index++]; + if (!rssi.isEmpty()) { + network.addCellTower(CellTower.from(mcc, mnc, lac, cid, Integer.parseInt(rssi))); + } else { + network.addCellTower(CellTower.from(mcc, mnc, lac, cid)); + } } } |