def connect_preconditions(): print "checking preconditions for WiFi connection" # get list of saved networks savedssids = wpa_cli_mod.listsavednetwork("wlan0") print "Saved ssID =", savedssids if savedssids: # get all cells from the air ssids = [] ssids = wifilist_ssid(3) print "ssID on air =", ssids logger.info("Final Number of scan SSID: %d", len(ssids)) for ssid in savedssids: #print " Scheme ", scheme if ssid in ssids: print "At least one of WIFI network detected have saved credentials, ssid=", ssid logger.info( "At least one of WIFI network can be connected, ssid=%s", ssid) return ssid else: print "No Saved wifi network to connect to" logger.info("No Saved wifi network to connect to") print "No conditions to connect to wifi network" logger.info("No conditions to connect to wifi network") return ""
def connect_preconditions(): print "checking preconditions for WiFi connection" # get all cells from the air ssids = [] i = 0 while (len(ssids) == 0 and i < 3): i = i + 1 ssids = wifilist_ssid() print "ssID on air =", ssids logger.info("Number of scan SSID: %d", len(ssids)) savedssids = wpa_cli_mod.listsavednetwork("wlan0") for ssid in savedssids: #print " Scheme ", scheme if ssid in ssids: print "At least one of WIFI network detected have saved credentials, ssid=", ssid return ssid print "No conditions to connect to wifi network" return ""
def connect_preconditions(): print "checking preconditions for WiFi connection" # get all cells from the air ssids=[] i=0 while (len(ssids)==0 and i<3): i=i+1 ssids=wifilist_ssid() print "ssID on air =", ssids logger.info("Number of scan SSID: %d",len(ssids)) savedssids = wpa_cli_mod.listsavednetwork("wlan0") for ssid in savedssids: #print " Scheme ", scheme if ssid in ssids: print "At least one of WIFI network detected have saved credentials, ssid=" , ssid logger.info("At least one of WIFI network can be connected, ssid=%s" , ssid) return ssid print "No conditions to connect to wifi network" logger.info("No conditions to connect to wifi network") return ""
def savedwifilist_ssid(): # get all setting from interfaces file return wpa_cli_mod.listsavednetwork('wlan0')