Android Open Source - wifiManager Wifi Hot Config Admin






From Project

Back to project page wifiManager.

License

The source code is released under:

Apache License

If you think the Android project wifiManager listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.txmcu.WifiManager;
//from w w w . j  a v a  2  s.co m
import android.net.wifi.WifiConfiguration;
import android.util.Log;

public class WifiHotConfigAdmin {

  private static String TAG = "WifiConfigurationAdmin";

  // ?????????????????
  public static WifiConfiguration createWifiNoPassInfo(String SSID, String password) {

    Log.v(TAG, "into nopass  SSID = " + SSID + "  Password = " + password + " Type = ");
    WifiConfiguration config = new WifiConfiguration();
    config = createWifiInfo(config, SSID, password);
    // ??????????????????
    config.wepKeys[0] = "\"" + "" + "\"";
    config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
    config.wepTxKeyIndex = 0;
    config.status = WifiConfiguration.Status.ENABLED;
    Log.v(TAG, "out nopass  SSID = " + SSID + "  Password = " + password + " Type = ");
    return config;
  }

  // Wep
  public static WifiConfiguration createWifiWepInfo(String SSID, String password) {

    Log.v(TAG, "into WIFICIPHER_WEP   SSID = " + SSID + "  Password = " + password);
    WifiConfiguration config = new WifiConfiguration();
    config = createWifiInfo(config, SSID, password);
    config.hiddenSSID = true;
    config.wepKeys[0] =   password ;
    config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104);
    config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
    config.wepTxKeyIndex = 0;
    Log.v(TAG, "out WIFICIPHER_WEP   SSID = " + SSID + "  Password = " + password);
    return config;

  }

  // WPA
  public static WifiConfiguration createWifiWpaInfo(String SSID, String password) {

    Log.v(TAG, "into WIFICIPHER_WPA   SSID = " + SSID + "  Password = " + password);
    WifiConfiguration config = new WifiConfiguration();
    config = createWifiInfo(config, SSID, password);
    config.preSharedKey =  password ;
    config.hiddenSSID = false;
    config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
    config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
    config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
    // config.allowedProtocols.set(WifiConfiguration.Protocol.WPA);
    //WifiConfiguration.Protocol.WPA;
    config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
    config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
    config.status = WifiConfiguration.Status.ENABLED;
    Log.v(TAG, "out WIFICIPHER_WPA   SSID = " + SSID + "  Password = " + password);
    return config;

  }

  private static WifiConfiguration createWifiInfo(WifiConfiguration config, String SSID,
      String password) {

    Log.v(TAG, "into wifi???????????????   SSID = " + SSID + "  Password = " + password);
    config.allowedAuthAlgorithms.clear();
    config.allowedGroupCiphers.clear();
    config.allowedKeyManagement.clear();
    config.allowedPairwiseCiphers.clear();
    config.allowedProtocols.clear();
    config.SSID =  SSID;
    config.priority = 0;
    Log.v(TAG, "into wifi???????????????   config.SSID = " + config.SSID + "  Password = " + password);
    return config;
  }
}




Java Source Code List

com.txmcu.WifiManager.Global.java
com.txmcu.WifiManager.WifiConnectBroadCast.java
com.txmcu.WifiManager.WifiHotAdmin.java
com.txmcu.WifiManager.WifiHotConfigAdmin.java
com.txmcu.WifiManager.WifiHotManager.java
com.txmcu.WifiManager.WifiScanRsultBroadCast.java
com.txmcu.WifiManager.WifiStateBroadCast.java
com.txmcu.wifimanagerdemo.AddDeviceActivity.java
com.txmcu.wifimanagerdemo.MainActivity.java
com.txmcu.wifimanagerdemo.SettingActivity.java
com.txmcu.wifimanagerdemo.XiaoXinAdapter.java
com.txmcu.wifimanagerdemo.XiaoxinInfo.java
com.txmcu.xiaoxin.Udpclient.java
com.txmcu.xiaoxin.XinStateManager.java