This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

pc-ble_driver_py how to receive notification

I use nrf52840 dongle on windows 10 to connect to ble devices, I can connect and send msg to the ble device ,but I tried "att_res, data = self.adapter.read_req(new_conn,BLEUUID(BLEUUID.Standard.DOORSENSORNotify))" to receive the notifications from the ble device with UUID DOORSENSORNotify. but it failed. what should I do? thanks!

Parents
  • Hi,

    Notifications are enabled through self.adapter.enable_notification(), and then the notifications are handled (when received) in the on_notification() callback.

    See the pc_ble_driver_py/examples/heart_rate_collector.py example for details, where notifications are enabled in the function connect_and_discover(), and notification contents is printed from the on_notification() callback, both implemented in the HRCollector class which builds on BLEDriverObserver and BLEAdapterObserver.

    Regards,
    Terje

Reply
  • Hi,

    Notifications are enabled through self.adapter.enable_notification(), and then the notifications are handled (when received) in the on_notification() callback.

    See the pc_ble_driver_py/examples/heart_rate_collector.py example for details, where notifications are enabled in the function connect_and_discover(), and notification contents is printed from the on_notification() callback, both implemented in the HRCollector class which builds on BLEDriverObserver and BLEAdapterObserver.

    Regards,
    Terje

Children
No Data
Related