-
Notifications
You must be signed in to change notification settings - Fork 14
/
findMambo.py
24 lines (20 loc) · 882 Bytes
/
findMambo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from bluepy.btle import Scanner, DefaultDelegate
class ScanDelegate(DefaultDelegate):
def __init__(self):
DefaultDelegate.__init__(self)
def handleDiscovery(self, dev, isNewDev, isNewData):
if isNewDev:
print "Discovered device", dev.addr
elif isNewData:
print "Received new data from", dev.addr
scanner = Scanner().withDelegate(ScanDelegate())
devices = scanner.scan(10.0)
for dev in devices:
#print "Device %s (%s), RSSI=%d dB" % (dev.addr, dev.addrType, dev.rssi)
for (adtype, desc, value) in dev.getScanData():
#print " %s = %s" % (desc, value)
if (desc == "Complete Local Name"):
if ("Mambo" in value):
print "FOUND A MAMBO!"
print "Device %s (%s), RSSI=%d dB" % (dev.addr, dev.addrType, dev.rssi)
print " %s = %s" % (desc, value)