Ejemplo n.º 1
0
    def access_points(self):
        global apcache, cachetime

        if time.time() - cachetime > 10:
            cachetime = time.time()  # keep anyone else from processing
            aps = iwscan.candidates()
            aps = [x for x in aps if x['ssid'] != states.hotspot_name]
            apcache = aps
            cachetime = time.time()  # cache time actually starts now

        return apcache
Ejemplo n.º 2
0
    def access_points(self):
        global apcache, cachetime

        if time.time() - cachetime > 5:
            cachetime = time.time()  # keep anyone else from processing
            aps = iwscan.candidates()
            aps = [x for x in aps if x['ssid'] != states.hotspot_name]
            apcache = aps

            # set a timeout, if we got something
            if len(apcache):
                cachetime = time.time()  # cache time actually starts now
            else:
                cachetime = 0

        return apcache
Ejemplo n.º 3
0
def get_candidate_connections(device):
    candidates = []

    for conn in get_all_connections():
        settings = conn.GetSettings()
        ssid = get_ssid_from_connection(conn)

        try:
            if ssid \
               and settings['connection']['type'] == '802-11-wireless' \
               and settings['802-11-wireless']['mode'] == 'infrastructure':

                candidates.append(ssid)
        except KeyError:
            log.debug("Unexpected connection format for %s" % ssid)

    points = [x.Ssid for x in get_access_points(device)]
    iwpoints = [x['ssid'] for x in iwscan.candidates()]

    return list(set(candidates) & (set(points) | set(iwpoints)))
Ejemplo n.º 4
0
def get_candidate_connections(device=None):
    if not device:
        device = get_wifi_device()

    candidates = []

    for conn in get_all_connections():
        settings = conn.GetSettings()
        ssid = get_ssid_from_connection(conn)

        try:
            if ssid \
               and settings['connection']['type'] == '802-11-wireless' \
               and settings['802-11-wireless']['mode'] == 'infrastructure':

                candidates.append(ssid)
        except KeyError:
            log.debug("Unexpected connection format for %s" % ssid)

    points = [x.Ssid for x in get_access_points()]
    iwpoints = [x['ssid'] for x in iwscan.candidates()]

    return list(set(candidates) & (set(points) | set(iwpoints)))
Ejemplo n.º 5
0
 def access_points(self):
     return iwscan.candidates()