Java 类com.google.zxing.client.result.WifiParsedResult 实例源码

项目:keepass2android    文件:WifiResultHandler.java   
@Override
public void handleButtonPress(int index) {
  if (index == 0) {
    WifiParsedResult wifiResult = (WifiParsedResult) getResult();
    WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
    if (wifiManager == null) {
      Log.w(TAG, "No WifiManager available from device");
      return;
    }
    final Activity activity = getActivity();
    activity.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        Toast.makeText(activity.getApplicationContext(), R.string.wifi_changing_network, Toast.LENGTH_SHORT).show();
      }
    });
    new WifiConfigManager(wifiManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
    parent.restartPreviewAfterDelay(0L);
  }
}
项目:weex-3d-map    文件:WifiResultHandler.java   
@Override
public void handleButtonPress(int index) {
  if (index == 0) {
    WifiParsedResult wifiResult = (WifiParsedResult) getResult();
    WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
    if (wifiManager == null) {
      Log.w(TAG, "No WifiManager available from device");
      return;
    }
    final Activity activity = getActivity();
    activity.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        Toast.makeText(activity.getApplicationContext(), R.string.wifi_changing_network, Toast.LENGTH_SHORT).show();
      }
    });
    new WifiConfigManager(wifiManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
    parent.restartPreviewAfterDelay(0L);
  }
}
项目:ZXingAndroidExt    文件:WifiResultHandler.java   
@Override
public void handleButtonPress(int index) {
    if (index == 0) {
        WifiParsedResult wifiResult = (WifiParsedResult) getResult();
        WifiManager wifiManager = (WifiManager) getActivity().getApplicationContext().getSystemService(Context.WIFI_SERVICE);
        if (wifiManager == null) {
            Log.w(TAG, "No WifiManager available from device");
            return;
        }
        final Activity activity = getActivity();
        activity.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(activity.getApplicationContext(), R.string.wifi_changing_network, Toast.LENGTH_SHORT).show();
            }
        });
        new WifiConfigManager(wifiManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
        parent.restartPreviewAfterDelay(0L);
    }
}
项目:KeePass2Android    文件:WifiResultHandler.java   
@Override
public void handleButtonPress(int index) {
  if (index == 0) {
    WifiParsedResult wifiResult = (WifiParsedResult) getResult();
    WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
    if (wifiManager == null) {
      Log.w(TAG, "No WifiManager available from device");
      return;
    }
    final Activity activity = getActivity();
    activity.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        Toast.makeText(activity.getApplicationContext(), R.string.wifi_changing_network, Toast.LENGTH_SHORT).show();
      }
    });
    new WifiConfigManager(wifiManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
    parent.restartPreviewAfterDelay(0L);
  }
}
项目:QRCodeUtility    文件:WifiResultHandler.java   
@Override
public void handleButtonPress(int index) {
    if (index == 0) {
        WifiParsedResult wifiResult = (WifiParsedResult) getResult();
        WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
        if (wifiManager == null) {
            Log.w(TAG, "No WifiManager available from device");
            return;
        }
        final Activity activity = getActivity();
        activity.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(activity.getApplicationContext(), R.string.wifi_changing_network, Toast.LENGTH_SHORT).show();
            }
        });
        new WifiConfigManager(wifiManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
        //parent.restartPreviewAfterDelay(0L);
    }
}
项目:weex-analyzer-android    文件:WifiResultHandler.java   
@Override
public void handleButtonPress(int index) {
  if (index == 0) {
    WifiParsedResult wifiResult = (WifiParsedResult) getResult();
    WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
    if (wifiManager == null) {
      Log.w(TAG, "No WifiManager available from device");
      return;
    }
    final Activity activity = getActivity();
    activity.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        Toast.makeText(activity.getApplicationContext(), R.string.wifi_changing_network, Toast.LENGTH_SHORT).show();
      }
    });
    new WifiConfigManager(wifiManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
    parent.restartPreviewAfterDelay(0L);
  }
}
项目:weex-3d-map    文件:WifiResultHandler.java   
@Override
public void handleButtonPress(int index) {
  if (index == 0) {
    WifiParsedResult wifiResult = (WifiParsedResult) getResult();
    WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
    if (wifiManager == null) {
      Log.w(TAG, "No WifiManager available from device");
      return;
    }
    final Activity activity = getActivity();
    activity.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        Toast.makeText(activity.getApplicationContext(), R.string.wifi_changing_network, Toast.LENGTH_SHORT).show();
      }
    });
    new WifiConfigManager(wifiManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
    parent.restartPreviewAfterDelay(0L);
  }
}
项目:Weex-TestDemo    文件:WifiResultHandler.java   
@Override
public void handleButtonPress(int index) {
  if (index == 0) {
    WifiParsedResult wifiResult = (WifiParsedResult) getResult();
    WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
    if (wifiManager == null) {
      Log.w(TAG, "No WifiManager available from device");
      return;
    }
    final Activity activity = getActivity();
    activity.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        Toast.makeText(activity.getApplicationContext(), R.string.wifi_changing_network, Toast.LENGTH_SHORT).show();
      }
    });
    new WifiConfigManager(wifiManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
    parent.restartPreviewAfterDelay(0L);
  }
}
项目:weex    文件:WifiResultHandler.java   
@Override
public void handleButtonPress(int index) {
  if (index == 0) {
    WifiParsedResult wifiResult = (WifiParsedResult) getResult();
    WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
    if (wifiManager == null) {
      Log.w(TAG, "No WifiManager available from device");
      return;
    }
    final Activity activity = getActivity();
    activity.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        Toast.makeText(activity.getApplicationContext(), R.string.wifi_changing_network, Toast.LENGTH_SHORT).show();
      }
    });
    new WifiConfigManager(wifiManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
    parent.restartPreviewAfterDelay(0L);
  }
}
项目:faims-android    文件:WifiResultHandler.java   
@Override
public void handleButtonPress(int index) {
  if (index == 0) {
    WifiParsedResult wifiResult = (WifiParsedResult) getResult();
    WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
    if (wifiManager == null) {
      Log.w(TAG, "No WifiManager available from device");
      return;
    }
    final Activity activity = getActivity();
    activity.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        Toast.makeText(activity.getApplicationContext(), R.string.wifi_changing_network, Toast.LENGTH_SHORT).show();
      }
    });
    new WifiConfigManager(wifiManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
    parent.restartPreviewAfterDelay(0L);
  }
}
项目:Discounty    文件:WifiResultHandler.java   
@Override
public void handleButtonPress(int index) {
    if (index == 0) {
        WifiParsedResult wifiResult = (WifiParsedResult) getResult();
        WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
        final Activity activity = getActivity();
        activity.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                Toast.makeText(activity.getApplicationContext(), R.string.wifi_changing_network, Toast.LENGTH_SHORT).show();
            }
        });
        taskExec.execute(new WifiConfigManager(wifiManager), wifiResult);
        parent.restartPreviewAfterDelay(0L);
    }
}
项目:zxing-bsplus    文件:WifiResultHandler.java   
@Override
public void handleClick(int buttonID) {
  if (buttonID == R.id.button_wifi) {
    WifiParsedResult wifiResult = (WifiParsedResult) getResult();
    WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
    if (wifiManager == null) {
      Log.w(TAG, "No WifiManager available from device");
      return;
    }
    final Activity activity = getActivity();
    activity.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        Toast.makeText(activity.getApplicationContext(), R.string.wifi_changing_network, Toast.LENGTH_SHORT).show();
      }
    });
    new WifiConfigManager(wifiManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
    parent.restartPreviewAfterDelay(0L);
  }
}
项目:zxing-android-portrait    文件:WifiResultHandler.java   
@Override
public void handleButtonPress(int index) {
  if (index == 0) {
    WifiParsedResult wifiResult = (WifiParsedResult) getResult();
    WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
    if (wifiManager == null) {
      Log.w(TAG, "No WifiManager available from device");
      return;
    }
    final Activity activity = getActivity();
    activity.runOnUiThread(new Runnable() {
      @Override
      public void run() {
        Toast.makeText(activity.getApplicationContext(), R.string.wifi_changing_network, Toast.LENGTH_SHORT).show();
      }
    });
    new WifiConfigManager(wifiManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
    parent.restartPreviewAfterDelay(0L);
  }
}
项目:keepass2android    文件:WifiConfigManager.java   
private static WifiConfiguration changeNetworkCommon(WifiParsedResult wifiResult) {
  WifiConfiguration config = new WifiConfiguration();
  config.allowedAuthAlgorithms.clear();
  config.allowedGroupCiphers.clear();
  config.allowedKeyManagement.clear();
  config.allowedPairwiseCiphers.clear();
  config.allowedProtocols.clear();
  // Android API insists that an ascii SSID must be quoted to be correctly handled.
  config.SSID = quoteNonHex(wifiResult.getSsid());
  config.hiddenSSID = wifiResult.isHidden();
  return config;
}
项目:keepass2android    文件:WifiConfigManager.java   
private static void changeNetworkWEP(WifiManager wifiManager, WifiParsedResult wifiResult) {
  WifiConfiguration config = changeNetworkCommon(wifiResult);
  config.wepKeys[0] = quoteNonHex(wifiResult.getPassword(), 10, 26, 58);
  config.wepTxKeyIndex = 0;
  config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED);
  config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104);
  updateNetwork(wifiManager, config);
}
项目:keepass2android    文件:WifiConfigManager.java   
private static void changeNetworkWPA(WifiManager wifiManager, WifiParsedResult wifiResult) {
  WifiConfiguration config = changeNetworkCommon(wifiResult);
  // Hex passwords that are 64 bits long are not to be quoted.
  config.preSharedKey = quoteNonHex(wifiResult.getPassword(), 64);
  config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
  config.allowedProtocols.set(WifiConfiguration.Protocol.WPA); // For WPA
  config.allowedProtocols.set(WifiConfiguration.Protocol.RSN); // For WPA2
  config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
  config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_EAP);
  config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
  config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
  updateNetwork(wifiManager, config);
}
项目:keepass2android    文件:WifiResultHandler.java   
@Override
public CharSequence getDisplayContents() {
  WifiParsedResult wifiResult = (WifiParsedResult) getResult();
  StringBuilder contents = new StringBuilder(50);
  String wifiLabel = parent.getString(R.string.wifi_ssid_label);
  ParsedResult.maybeAppend(wifiLabel + '\n' + wifiResult.getSsid(), contents);
  String typeLabel = parent.getString(R.string.wifi_type_label);
  ParsedResult.maybeAppend(typeLabel + '\n' + wifiResult.getNetworkEncryption(), contents);
  return contents.toString();
}
项目:weex-3d-map    文件:WifiConfigManager.java   
private static WifiConfiguration changeNetworkCommon(WifiParsedResult wifiResult) {
  WifiConfiguration config = new WifiConfiguration();
  config.allowedAuthAlgorithms.clear();
  config.allowedGroupCiphers.clear();
  config.allowedKeyManagement.clear();
  config.allowedPairwiseCiphers.clear();
  config.allowedProtocols.clear();
  // Android API insists that an ascii SSID must be quoted to be correctly handled.
  config.SSID = quoteNonHex(wifiResult.getSsid());
  config.hiddenSSID = wifiResult.isHidden();
  return config;
}
项目:weex-3d-map    文件:WifiConfigManager.java   
private static void changeNetworkWEP(WifiManager wifiManager, WifiParsedResult wifiResult) {
  WifiConfiguration config = changeNetworkCommon(wifiResult);
  config.wepKeys[0] = quoteNonHex(wifiResult.getPassword(), 10, 26, 58);
  config.wepTxKeyIndex = 0;
  config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED);
  config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104);
  updateNetwork(wifiManager, config);
}
项目:weex-3d-map    文件:WifiConfigManager.java   
private static void changeNetworkWPA(WifiManager wifiManager, WifiParsedResult wifiResult) {
  WifiConfiguration config = changeNetworkCommon(wifiResult);
  // Hex passwords that are 64 bits long are not to be quoted.
  config.preSharedKey = quoteNonHex(wifiResult.getPassword(), 64);
  config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
  config.allowedProtocols.set(WifiConfiguration.Protocol.WPA); // For WPA
  config.allowedProtocols.set(WifiConfiguration.Protocol.RSN); // For WPA2
  config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
  config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_EAP);
  config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
  config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
  updateNetwork(wifiManager, config);
}
项目:ZXingAndroidExt    文件:WifiConfigManager.java   
private static WifiConfiguration changeNetworkCommon(WifiParsedResult wifiResult) {
    WifiConfiguration config = new WifiConfiguration();
    config.allowedAuthAlgorithms.clear();
    config.allowedGroupCiphers.clear();
    config.allowedKeyManagement.clear();
    config.allowedPairwiseCiphers.clear();
    config.allowedProtocols.clear();
    // Android API insists that an ascii SSID must be quoted to be correctly handled.
    config.SSID = quoteNonHex(wifiResult.getSsid());
    config.hiddenSSID = wifiResult.isHidden();
    return config;
}
项目:ZXingAndroidExt    文件:WifiConfigManager.java   
private static void changeNetworkWEP(WifiManager wifiManager, WifiParsedResult wifiResult) {
    WifiConfiguration config = changeNetworkCommon(wifiResult);
    config.wepKeys[0] = quoteNonHex(wifiResult.getPassword(), 10, 26, 58);
    config.wepTxKeyIndex = 0;
    config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED);
    config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104);
    updateNetwork(wifiManager, config);
}
项目:ZXingAndroidExt    文件:WifiConfigManager.java   
private static void changeNetworkWPA(WifiManager wifiManager, WifiParsedResult wifiResult) {
    WifiConfiguration config = changeNetworkCommon(wifiResult);
    // Hex passwords that are 64 bits long are not to be quoted.
    config.preSharedKey = quoteNonHex(wifiResult.getPassword(), 64);
    config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
    config.allowedProtocols.set(WifiConfiguration.Protocol.WPA); // For WPA
    config.allowedProtocols.set(WifiConfiguration.Protocol.RSN); // For WPA2
    config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
    config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_EAP);
    config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
    config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
    updateNetwork(wifiManager, config);
}
项目:KeePass2Android    文件:WifiConfigManager.java   
private static WifiConfiguration changeNetworkCommon(WifiParsedResult wifiResult) {
  WifiConfiguration config = new WifiConfiguration();
  config.allowedAuthAlgorithms.clear();
  config.allowedGroupCiphers.clear();
  config.allowedKeyManagement.clear();
  config.allowedPairwiseCiphers.clear();
  config.allowedProtocols.clear();
  // Android API insists that an ascii SSID must be quoted to be correctly handled.
  config.SSID = quoteNonHex(wifiResult.getSsid());
  config.hiddenSSID = wifiResult.isHidden();
  return config;
}
项目:KeePass2Android    文件:WifiConfigManager.java   
private static void changeNetworkWEP(WifiManager wifiManager, WifiParsedResult wifiResult) {
  WifiConfiguration config = changeNetworkCommon(wifiResult);
  config.wepKeys[0] = quoteNonHex(wifiResult.getPassword(), 10, 26, 58);
  config.wepTxKeyIndex = 0;
  config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED);
  config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104);
  updateNetwork(wifiManager, config);
}
项目:KeePass2Android    文件:WifiConfigManager.java   
private static void changeNetworkWPA(WifiManager wifiManager, WifiParsedResult wifiResult) {
  WifiConfiguration config = changeNetworkCommon(wifiResult);
  // Hex passwords that are 64 bits long are not to be quoted.
  config.preSharedKey = quoteNonHex(wifiResult.getPassword(), 64);
  config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
  config.allowedProtocols.set(WifiConfiguration.Protocol.WPA); // For WPA
  config.allowedProtocols.set(WifiConfiguration.Protocol.RSN); // For WPA2
  config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
  config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_EAP);
  config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
  config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
  config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
  updateNetwork(wifiManager, config);
}
项目:KeePass2Android    文件:WifiResultHandler.java   
@Override
public CharSequence getDisplayContents() {
  WifiParsedResult wifiResult = (WifiParsedResult) getResult();
  StringBuilder contents = new StringBuilder(50);
  String wifiLabel = parent.getString(R.string.wifi_ssid_label);
  ParsedResult.maybeAppend(wifiLabel + '\n' + wifiResult.getSsid(), contents);
  String typeLabel = parent.getString(R.string.wifi_type_label);
  ParsedResult.maybeAppend(typeLabel + '\n' + wifiResult.getNetworkEncryption(), contents);
  return contents.toString();
}
项目:PortraitZXing    文件:WifiConfigManager.java   
private static WifiConfiguration changeNetworkCommon(WifiParsedResult wifiResult) {
    WifiConfiguration config = new WifiConfiguration();
    config.allowedAuthAlgorithms.clear();
    config.allowedGroupCiphers.clear();
    config.allowedKeyManagement.clear();
    config.allowedPairwiseCiphers.clear();
    config.allowedProtocols.clear();
    // Android API insists that an ascii SSID must be quoted to be correctly
    // handled.
    config.SSID = quoteNonHex(wifiResult.getSsid());
    config.hiddenSSID = wifiResult.isHidden();
    return config;
}
项目:PortraitZXing    文件:WifiConfigManager.java   
private static void changeNetworkWEP(WifiManager wifiManager, WifiParsedResult wifiResult) {
    WifiConfiguration config = changeNetworkCommon(wifiResult);
    config.wepKeys[0] = quoteNonHex(wifiResult.getPassword(), 10, 26, 58);
    config.wepTxKeyIndex = 0;
    config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED);
    config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104);
    updateNetwork(wifiManager, config);
}
项目:PortraitZXing    文件:WifiConfigManager.java   
private static void changeNetworkWPA(WifiManager wifiManager, WifiParsedResult wifiResult) {
    WifiConfiguration config = changeNetworkCommon(wifiResult);
    // Hex passwords that are 64 bits long are not to be quoted.
    config.preSharedKey = quoteNonHex(wifiResult.getPassword(), 64);
    config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
    config.allowedProtocols.set(WifiConfiguration.Protocol.WPA); // For WPA
    config.allowedProtocols.set(WifiConfiguration.Protocol.RSN); // For WPA2
    config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
    config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_EAP);
    config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
    config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
    updateNetwork(wifiManager, config);
}
项目:PortraitZXing    文件:WifiResultHandler.java   
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
    @Override
    public void handleButtonPress(int index) {
        if (index == 0) {
            WifiParsedResult wifiResult = (WifiParsedResult) getResult();
            WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
            if (wifiManager == null) {
                Log.w(TAG, "No WifiManager available from device");
                return;
            }
            final Activity activity = getActivity();
            activity.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    Toast.makeText(activity.getApplicationContext(), R.string.wifi_changing_network, Toast.LENGTH_SHORT)
                            .show();
                }
            });

//          new WifiConfigManager(wifiManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
            /**
             * @author MichaelX(xiong_it)modified.{@link https://github.com/xiong-it}
             * 
             * {@link http://stackoverflow.com/questions/12227682/android-2-3-3-asynctask-call-throws-nosuchfielderror}
             * THREAD_POOL_EXECUTOR were added in API Level 11
             */
            AsyncTask task = new WifiConfigManager(wifiManager);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
                task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
            } else {
                task.execute(wifiResult);
            }
            parent.restartPreviewAfterDelay(0L);
        }
    }
项目:PortraitZXing    文件:WifiConfigManager.java   
private static WifiConfiguration changeNetworkCommon(WifiParsedResult wifiResult) {
    WifiConfiguration config = new WifiConfiguration();
    config.allowedAuthAlgorithms.clear();
    config.allowedGroupCiphers.clear();
    config.allowedKeyManagement.clear();
    config.allowedPairwiseCiphers.clear();
    config.allowedProtocols.clear();
    // Android API insists that an ascii SSID must be quoted to be correctly
    // handled.
    config.SSID = quoteNonHex(wifiResult.getSsid());
    config.hiddenSSID = wifiResult.isHidden();
    return config;
}
项目:PortraitZXing    文件:WifiConfigManager.java   
private static void changeNetworkWEP(WifiManager wifiManager, WifiParsedResult wifiResult) {
    WifiConfiguration config = changeNetworkCommon(wifiResult);
    config.wepKeys[0] = quoteNonHex(wifiResult.getPassword(), 10, 26, 58);
    config.wepTxKeyIndex = 0;
    config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED);
    config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104);
    updateNetwork(wifiManager, config);
}
项目:PortraitZXing    文件:WifiConfigManager.java   
private static void changeNetworkWPA(WifiManager wifiManager, WifiParsedResult wifiResult) {
    WifiConfiguration config = changeNetworkCommon(wifiResult);
    // Hex passwords that are 64 bits long are not to be quoted.
    config.preSharedKey = quoteNonHex(wifiResult.getPassword(), 64);
    config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
    config.allowedProtocols.set(WifiConfiguration.Protocol.WPA); // For WPA
    config.allowedProtocols.set(WifiConfiguration.Protocol.RSN); // For WPA2
    config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
    config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_EAP);
    config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
    config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
    updateNetwork(wifiManager, config);
}
项目:PortraitZXing    文件:WifiResultHandler.java   
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
    @Override
    public void handleButtonPress(int index) {
        if (index == 0) {
            WifiParsedResult wifiResult = (WifiParsedResult) getResult();
            WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
            if (wifiManager == null) {
                Log.w(TAG, "No WifiManager available from device");
                return;
            }
            final Activity activity = getActivity();
            activity.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    Toast.makeText(activity.getApplicationContext(), R.string.wifi_changing_network, Toast.LENGTH_SHORT)
                            .show();
                }
            });

//          new WifiConfigManager(wifiManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
            /**
             * @author MichaelX(xiong_it)modified.{@link https://github.com/xiong-it}
             * 
             * {@link http://stackoverflow.com/questions/12227682/android-2-3-3-asynctask-call-throws-nosuchfielderror}
             * THREAD_POOL_EXECUTOR were added in API Level 11
             */
            AsyncTask task = new WifiConfigManager(wifiManager);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
                task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
            } else {
                task.execute(wifiResult);
            }
            parent.restartPreviewAfterDelay(0L);
        }
    }
项目:PortraitZXing    文件:WifiConfigManager.java   
private static WifiConfiguration changeNetworkCommon(WifiParsedResult wifiResult) {
    WifiConfiguration config = new WifiConfiguration();
    config.allowedAuthAlgorithms.clear();
    config.allowedGroupCiphers.clear();
    config.allowedKeyManagement.clear();
    config.allowedPairwiseCiphers.clear();
    config.allowedProtocols.clear();
    // Android API insists that an ascii SSID must be quoted to be correctly
    // handled.
    config.SSID = quoteNonHex(wifiResult.getSsid());
    config.hiddenSSID = wifiResult.isHidden();
    return config;
}
项目:PortraitZXing    文件:WifiConfigManager.java   
private static void changeNetworkWEP(WifiManager wifiManager, WifiParsedResult wifiResult) {
    WifiConfiguration config = changeNetworkCommon(wifiResult);
    config.wepKeys[0] = quoteNonHex(wifiResult.getPassword(), 10, 26, 58);
    config.wepTxKeyIndex = 0;
    config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED);
    config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104);
    updateNetwork(wifiManager, config);
}
项目:PortraitZXing    文件:WifiConfigManager.java   
private static void changeNetworkWPA(WifiManager wifiManager, WifiParsedResult wifiResult) {
    WifiConfiguration config = changeNetworkCommon(wifiResult);
    // Hex passwords that are 64 bits long are not to be quoted.
    config.preSharedKey = quoteNonHex(wifiResult.getPassword(), 64);
    config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
    config.allowedProtocols.set(WifiConfiguration.Protocol.WPA); // For WPA
    config.allowedProtocols.set(WifiConfiguration.Protocol.RSN); // For WPA2
    config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
    config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_EAP);
    config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
    config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
    updateNetwork(wifiManager, config);
}
项目:PortraitZXing    文件:WifiResultHandler.java   
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
    @Override
    public void handleButtonPress(int index) {
        if (index == 0) {
            WifiParsedResult wifiResult = (WifiParsedResult) getResult();
            WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE);
            if (wifiManager == null) {
                Log.w(TAG, "No WifiManager available from device");
                return;
            }
            final Activity activity = getActivity();
            activity.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    Toast.makeText(activity.getApplicationContext(), R.string.wifi_changing_network, Toast.LENGTH_SHORT)
                            .show();
                }
            });

//          new WifiConfigManager(wifiManager).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
            /**
             * @author MichaelX(xiong_it)modified.{@link https://github.com/xiong-it}
             * 
             * {@link http://stackoverflow.com/questions/12227682/android-2-3-3-asynctask-call-throws-nosuchfielderror}
             * THREAD_POOL_EXECUTOR were added in API Level 11
             */
            AsyncTask task = new WifiConfigManager(wifiManager);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
                task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, wifiResult);
            } else {
                task.execute(wifiResult);
            }
            parent.restartPreviewAfterDelay(0L);
        }
    }
项目:PortraitZXing    文件:WifiConfigManager.java   
private static WifiConfiguration changeNetworkCommon(WifiParsedResult wifiResult) {
    WifiConfiguration config = new WifiConfiguration();
    config.allowedAuthAlgorithms.clear();
    config.allowedGroupCiphers.clear();
    config.allowedKeyManagement.clear();
    config.allowedPairwiseCiphers.clear();
    config.allowedProtocols.clear();
    // Android API insists that an ascii SSID must be quoted to be correctly
    // handled.
    config.SSID = quoteNonHex(wifiResult.getSsid());
    config.hiddenSSID = wifiResult.isHidden();
    return config;
}