public WiFi(String bssid, int rssi, Integer channel, Integer frequency) { this.bssid = wellFormedMac(bssid); this.rssi = rssi; this.channel = channel; this.frequency = frequency; } }
@Override public void onCreate() { super.onCreate(); addHelper(backendHelper = new WiFiBackendHelper(this, this)); }
report(calculate(backendHelper.getWiFis())); } catch (Exception e) { Log.w(TAG, e);
private synchronized boolean loadWiFis() { wiFis.clear(); currentDataUsed = false; List<ScanResult> scanResults = wifiManager.getScanResults(); for (ScanResult scanResult : scanResults) { if (ignoreNomap && scanResult.SSID.toLowerCase(Locale.US).endsWith("_nomap")) continue; wiFis.add(new WiFi(scanResult.BSSID, scanResult.level, frequencyToChannel(scanResult.frequency), scanResult.frequency)); } if (state == State.DISABLING) state = State.DISABLED; switch (state) { default: case DISABLED: return false; case SCANNING: state = State.WAITING; return true; } }
private synchronized boolean scanWiFis() { if (state == State.DISABLED) return false; if (wifiManager.isWifiEnabled() || isScanAlwaysAvailable()) { state = State.SCANNING; wifiManager.startScan(); return true; } return false; }
private void reloadSettings() { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); removeHelpers(); if (preferences.getBoolean("use_cells", true) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { addHelper(new CellBackendHelper(this, this)); } else { cells = null; } if (preferences.getBoolean("use_wifis", true)) { addHelper(new WiFiBackendHelper(this, this)); } else { wiFis = null; } }