zoukankan      html  css  js  c++  java
  • 配置WifiConfiguration

    1. public WifiConfiguration CreateWifiInfo(String SSID, String Password, int Type)     
    2.    {     
    3.          WifiConfiguration config = new WifiConfiguration();       
    4.           config.allowedAuthAlgorithms.clear();     
    5.           config.allowedGroupCiphers.clear();     
    6.           config.allowedKeyManagement.clear();     
    7.           config.allowedPairwiseCiphers.clear();     
    8.           config.allowedProtocols.clear();     
    9.          config.SSID = """ + SSID + """;       
    10.              
    11.          WifiConfiguration tempConfig = this.IsExsits(SSID);               
    12.          if(tempConfig != null) {      
    13.              mWifiManager.removeNetwork(tempConfig.networkId);      
    14.          }    
    15.              
    16.          if(Type == 1) //WIFICIPHER_NOPASS    
    17.          {     
    18.               config.wepKeys[0] = "";     
    19.               config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);     
    20.               config.wepTxKeyIndex = 0;     
    21.          }     
    22.          if(Type == 2) //WIFICIPHER_WEP    
    23.          {     
    24.              config.hiddenSSID = true;    
    25.              config.wepKeys[0]= """+Password+""";     
    26.              config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED);     
    27.              config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);     
    28.              config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);     
    29.              config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);     
    30.              config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104);     
    31.              config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);     
    32.              config.wepTxKeyIndex = 0;     
    33.          }     
    34.          if(Type == 3) //WIFICIPHER_WPA    
    35.          {     
    36.          config.preSharedKey = """+Password+""";     
    37.          config.hiddenSSID = true;       
    38.          config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);       
    39.          config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);                             
    40.          config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);                             
    41.          config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);                        
    42.          //config.allowedProtocols.set(WifiConfiguration.Protocol.WPA);      
    43.          config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);    
    44.          config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);    
    45.          config.status = WifiConfiguration.Status.ENABLED;       
    46.          }    
    47.           return config;     
    48.    }     
  • 相关阅读:
    JS阻止鼠标滚动
    仿淘宝订单列表下标指针
    自己动手模拟百分百<select>下拉列表
    专门用来存地址
    JS手动触发事件,转载
    刷新页面让显示区域回到顶部
    解决表格边框问题
    读书笔记 effective c++ Item 43 了解如何访问模板化基类中的名字
    读书笔记 effective c++ Item 42 理解typename的两种涵义
    读书笔记 effective c++ Item 41 理解隐式接口和编译期多态
  • 原文地址:https://www.cnblogs.com/dongweiq/p/4795201.html
Copyright © 2011-2022 走看看