Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomiti/d69696564ea7cb1cb79a3d4e4cdd76a7 to your computer and use it in GitHub Desktop.
Save tomiti/d69696564ea7cb1cb79a3d4e4cdd76a7 to your computer and use it in GitHub Desktop.
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