| 83 | |
| 84 | |
| 85 | def testwifi(ifaces, ssidname, password): |
| 86 | profile = pywifi.Profile() # create a wifi connection file |
| 87 | profile.ssid = ssidname # define wifissid |
| 88 | profile.auth = open(const.AUTH_ALG_OPEN) # NIC |
| 89 | profile.akm.append(const.AKM_TYPE_WPA2PSK) # wifi encryption algorithm |
| 90 | # encrypting unit |
| 91 | profile.cipher = const.CIPHER_TYPE_CCMP # |
| 92 | profile.key = password # wifi password |
| 93 | ifaces.remove_all_network_profiles() # delete all other configuration files |
| 94 | tmp_profile = ifaces.add_network_profile(profile) # load the configuration file |
| 95 | ifaces.connect(tmp_profile) # wifi connection |
| 96 | # You can connect to the inner (5) # 5 seconds time.sleep |
| 97 | if ifaces.status() == const.IFACE_CONNECTED: |
| 98 | return True |
| 99 | else: |
| 100 | return False |
| 101 | |
| 102 | |
| 103 | def beginwork(wifinamelist): |