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/aedb8e665ad2bcc6ac711be925d442d6 to your computer and use it in GitHub Desktop.
Save tomiti/aedb8e665ad2bcc6ac711be925d442d6 to your computer and use it in GitHub Desktop.
def enable_notify(peripheral, service_uuid, char_uuid):
setup_data = b"\x01\x00"
svc = peripheral.getServiceByUUID(service_uuid)
print(svc)
ch = peripheral.getCharacteristics(uuid=char_uuid)[0]
print(ch)
print('Characteristic handle: %d' % ch.valHandle)
notify_handle = ch.getHandle() + 1
peripheral.writeCharacteristic(notify_handle, setup_data, withResponse=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment