python绝技 — 搜寻蓝牙设备

mac2022-06-30  115

需要安装蓝牙模块: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)

 

 

  

转载于:https://www.cnblogs.com/ssooking/p/6108219.html

相关资源:蓝牙耳机系统的原理与实现
最新回复(0)