def ssid_to_utf8(nm_ap): """ Convert binary ssid to utf-8 """ ssid = nm_ap.get_ssid() if not ssid: return "" ret = NM.utils_ssid_to_utf8(ssid.get_data()) return ret
def ssid_to_utf8(ap): """Convert access point's binary ssid to utf-8 """ ssid = ap.get_ssid() if not ssid: return "" else: return NM.utils_ssid_to_utf8(ssid.get_data())
def ssid_to_utf8(nm_ap): """ Convert binary ssid to utf-8 """ ssid = nm_ap.get_ssid() if not ssid: return "" ret = NM.utils_ssid_to_utf8(ssid.get_data()) if sys.version_info.major < 3: return ret.decode(ENC) return ret
def _ssid_to_utf8(ap): """ Convert ssid to utf8 for human readability. An SSID can contain non-printable characters, NM has a util to convert. :param: ap NMAccessPoint :return: utf8 string containing the SSID """ ssid = ap.get_ssid() if not ssid: return "" return NM.utils_ssid_to_utf8(ssid.get_data())
def scan_ap(self): # todo: call internet for wifi dev nmc = NM.Client.new(None) devs = nmc.get_devices() ssids = []; dev = internet.get_active_device("wifi", self) for ap in dev.get_access_points(): ssid = ap.get_ssid() if not ssid: continue ssids.append(NM.utils_ssid_to_utf8(ap.get_ssid().get_data())) if self.ap1_ssid not in ssids: self.fail("First AP not found {0}".format(self.ap1_ssid)) if self.ap2_ssid not in ssids: self.fail("Second AP not found {0}".format(self.ap2_ssid)) self.log.debug("Both APs can be found")
def ssid_to_utf8(ap): ssid = ap.get_ssid() if not ssid: return "" return NM.utils_ssid_to_utf8(ap.get_ssid().get_data())