private void logNetworkState(Intent intent, JSONObject json) throws JSONException {
    String bssid = intent.getStringExtra(WifiManager.EXTRA_BSSID);
    NetworkInfo networkInfo =
        (NetworkInfo) intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);
    WifiInfo wifiInfo = (WifiInfo) intent.getParcelableExtra(WifiManager.EXTRA_WIFI_INFO);

    if (bssid != null) {
      json.put("BSSID", "bssid");
    }
    if (networkInfo != null) {
      json.put("networkInfo", LocalUtils.toJSONObject(networkInfo));
    }
    if (wifiInfo != null) {
      json.put("wifiInfo", LocalUtils.toJSONObject(wifiInfo));
    }
  }
 private void logScanResult(Intent intent, JSONObject json) throws JSONException {
   JSONArray array = new JSONArray();
   for (ScanResult entry : mWifiManager.getScanResults()) {
     array.put(LocalUtils.toJSONObject(entry));
   }
   json.put("results", array);
 }