python绝技 — 搜寻蓝牙设备
需要安装蓝牙模块:pybluez
sudo pip install pybluez
代码
#!/usr/bin/env python #--*--coding=utf-8--*-- #P191 #sudo pip install pybluez import time from bluetooth import * alreadyFound = [] def findDevs(): foundDevs = discover_devices(lookup_names=True) for(addr,name) in foundDevs: if addr not in alreadyFound: print "[*] Found Bluetooth Device : " +str(name) print "[+] MAC address : " +str(addr) alreadyFound.append(addr) while True: findDevs() time.sleep(5)
声明:
作者:ssooking 联系邮箱:c3Nvb2tpbmdAeWVhaC5uZXQ=
若无特殊说明,所发博文皆为原创,转载请务必注明出处、保留原文地址。欢迎交流分享!如果您有任何问题,请联系我!
作者:ssooking 联系邮箱:c3Nvb2tpbmdAeWVhaC5uZXQ=
若无特殊说明,所发博文皆为原创,转载请务必注明出处、保留原文地址。欢迎交流分享!如果您有任何问题,请联系我!