Last active
February 2, 2020 22:01
-
-
Save tomiti/d69696564ea7cb1cb79a3d4e4cdd76a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bluepy import btle | |
from bluepy.btle import Scanner, DefaultDelegate | |
from ble_delegate import ble_delegate | |
# delegate instance | |
params = [None] | |
_ble_delegate = ble_delegate(params) # params is whatever you need | |
# assign the delegate to the scanner | |
scanner = Scanner().withDelegate(_ble_delegate) | |
devices = scanner.scan(10.0) | |
# print discovered devices | |
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)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment