How to use on_notification fuction to get notification

I am a python beginner, I read a lot of related questions, but they all ask us to look heart_rate_collector.py , but heart_rate_collector.py did't not have any example, i really don't understand how to used it.

def on_notification(self, ble_adapter, conn_handle, uuid, data):
data should be the thing i want to get,is that right?
 

Parents Reply
  • self.nus_base = BLEUUIDBase([
    0x00, 0x00, 0xff, 0xf0, 0x00 ,0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb
    ])
    self.nus_tx = BLEUUID(0xfff6, self.nus_base)
    I think BLEUUID is to mix "0xfff6" and "self.nus_base",so self.nus_tx become[0x00, 0x00, 0xff, 0xf6, 0x00 ,0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb]?
    I also got the return form enable_notification() ,and get "None" so i think maybe my UUID is wrong
    this is the UUID I want to receive data
Children
No Data
Related