Exemple #1
0
    def _wifi_scanner(self):
        # reset the known access points
        self.access_points = []
        # walk through all known wireless interfaces to get complete coverage
        for interface in self.wireless_interfaces:
            # create a card instance to work with
            card = pyw.getcard(interface)
            # check if the card is still valid
            if pyw.validcard(card):
                # skip the card if it is hard blocked
                if pyw.isblocked(card)[1]:
                    continue
                else:
                    # try to unblock a softblock, put the card up and disable the powersave mode
                    try:
                        pyw.unblock(card)
                        pyw.up(card)
                        pyw.pwrsaveset(card, False)
                    except:
                        # ignore failures
                        pass
                    # start scanning
                    wifi_scanner = get_scanner(interface)
                    # extend the access point list
                    self.access_points.extend(wifi_scanner.get_access_points())

        # the first scan has been completed
        self.first_scan_complete = True
 def set_power_management(self, iface, value):
     '''
     Sets power management
     '''
     w0 = self.get_wifi_chard(iface)  # get a card for interface
     pyw.pwrsaveset(w0, value)
Exemple #3
0
 def test_getsetpwrsave(self):
     pyw.pwrsaveset(self.card, True)
     self.assertTrue(pyw.pwrsaveget(self.card))
     pyw.pwrsaveset(self.card, False)
     self.assertFalse(pyw.pwrsaveget(self.card))
     pyw.pwrsaveset(self.card, True)
Exemple #4
0
 def test_getsetpwrsave(self):
     pyw.pwrsaveset(self.card,True)
     self.assertTrue(pyw.pwrsaveget(self.card))
     pyw.pwrsaveset(self.card, False)
     self.assertFalse(pyw.pwrsaveget(self.card))
     pyw.pwrsaveset(self.card,True)