예제 #1
0
  private void getWifiList() {
    boolean isCanConnect = false;
    List<String> wifiSSIDList = new ArrayList<>();
    final List<ScanResult> scanResults = admin.getWifiList();
    if (newSacn != null) {
      newSacn.clear();
    } else {
      newSacn = new ArrayList<>();
    }
    for (ScanResult scanResult : scanResults) {
      if (WifiAdmin.isConnectCamera(getActivity(), scanResult.SSID, scanResult.BSSID)) {
        newSacn.add(scanResult);
        wifiSSIDList.add(scanResult.SSID.replace("\"", ""));
      }
    }

    wifiName =
        SpUtils.getInstance(mActivity)
            .getStringValue(com.leautolink.leautocamera.config.Constant.WIFI_SSID);
    String wifiPassword = "******";
    if (!TextUtils.isEmpty(wifiName)) {
      wifiPassword =
          SpUtils.getInstance(mActivity)
              .getStringValue(com.leautolink.leautocamera.config.Constant.WIFI_PWD);
    }

    Logger.d(
        TAG,
        "wifiName -->| "
            + wifiName
            + " wifipwd -->| "
            + wifiPassword
            + " isContains -->| "
            + wifiSSIDList.contains(wifiName));

    if (wifiSSIDList.contains(wifiName)) {
      isCanConnect = connectWifi(wifiName, wifiPassword);
      tempSSID = wifiName;
    } else if (newSacn.size() == 1) {
      inputWifiPassword(newSacn.get(0));
      return;
    }
    Logger.e(TAG, wifiName + " isCanConnect  -->| " + isCanConnect);
    if (!isCanConnect) {
      // TODO 显示wifi列表
      showWifiList(true);
    }
  }
예제 #2
0
  public void onEventMainThread(UDPTimeOutEvent event) {
    Logger.e(
        "CameraFragment UDPTimeOutEvent CheckUDPServiceIsOk="
            + LeautoCameraAppLication.CheckUDPServiceIsOk);
    isPhoneIsAp = false;
    FRAGMENTISHIDEN = false;

    SpUtils.getInstance(mActivity.getApplicationContext())
        .getStringValue(com.leautolink.leautocamera.config.Constant.WIFI_SSID);

    new Thread(
            new Runnable() {
              @Override
              public void run() {
                admin.forget(ssid);
              }
            })
        .start();

    if (LeautoCameraAppLication.CheckUDPServiceIsOk) {
      //            mActivity.stopService(new Intent(mActivity, CheckUDPService.class));
    }
  }