(self)
return devices
Scan for bluetooth devices.
Scan for bluetooth devices.
Scan for bluetooth devices .
def scan(self):
        """Scan for bluetooth devices."""
        try:
            res = subprocess.check_output(["hcitool", "scan", "--flush"],
                                          stderr=subprocess.STDOUT)
        except subprocess.CalledProcessError:
             raise BackendError("'hcitool scan' returned error. Make sure "
                                "your bluetooth device is powered up with "
                                "'hciconfig hciX up'.")

        devices = []
        res = res.splitlines()[1:]
        for _, bdaddr, name in map(lambda l: l.split(b"\t"), res):
            devices.append((bdaddr.decode("utf8"), name.decode("utf8")))

        return devices
def scan ( self ) : try : res = subprocess . check_output ( [ "hcitool" , "scan" , "--flush" ] , stderr = subprocess . STDOUT ) except subprocess . CalledProcessError : raise BackendError ( "'hcitool scan' returned error. Make sure " "your bluetooth device is powered up with " "'hciconfig hciX up'." ) devices = [ ] res = res . splitlines ( ) [ 1 : ] for _ , bdaddr , name in map ( lambda l : l . split ( b"\t" ) , res ) : devices . append ( ( bdaddr . decode ( "utf8" ) , name . decode ( "utf8" ) ) ) return devices