Logo Search packages:      
Sourcecode: wicd version File versions

def wicd::networking::Wireless::Scan (   self,
  essid = None 
)

Scan for available wireless networks.

Keyword arguments:
essid -- The essid of a hidden network

Returns:
A list of available networks sorted by strength.

Definition at line 368 of file networking.py.

00368                               :
        """ Scan for available wireless networks.

        Keyword arguments:
        essid -- The essid of a hidden network

        Returns:
        A list of available networks sorted by strength.

        """
        def comp(x, y):
            if x.has_key('quality'):
                if x['quality'] > y['quality']:
                    return 1
                elif x['quality'] < y['quality']:
                    return -1
                else:
                    return 0
            else:
                if x['strength'] < y['strength']:
                    return 1
                elif x['strength'] > y['strength']:
                    return -1
                else:
                    return 0
                
        wiface = self.wiface

        # Prepare the interface for scanning
        wiface.Up()

        # If there is a hidden essid then set it now, so that when it is
        # scanned it will be recognized.
        essid = misc.Noneify(essid)
        if essid is not None:
            print 'Setting hidden essid' + essid
            wiface.SetEssid(essid)

        aps = wiface.GetNetworks()
        aps.sort(cmp=comp, reverse=True)
        
        return aps

    def Connect(self, network, debug=False):


Generated by  Doxygen 1.6.0   Back to index