pc_ble_driver_py.exceptions.NordicSemiException: Characteristic value handler not found

Using the pc_ble_driver_py.ble_driver I'm able to subscribe to notifications, but unable to get the values upon connection. The error is:

 "/home/marc/dev/src/<redacted>/v2/./gui.py", line 258, in connect_and_discover
status, data = self.adapter.read_req(new_conn, build_uuid('button'))
File "/home/marc/.local/lib/python3.9/site-packages/pc_ble_driver_py/ble_adapter.py", line 528, in read_req
raise NordicSemiException("Characteristic value handler not found")
pc_ble_driver_py.exceptions.NordicSemiException: Characteristic value handler not foundFile

I do not know how to install a value handler and could not find documentation about it. The code looks like:

new_conn = self.conn_q.get(timeout=scan_duration)
self.adapter.service_discovery(new_conn)
self.adapter.enable_notification(new_conn, build_uuid('button'))
def read_value(adapter, conn_handle, handle, offset):
    logging.debug(f"Readvalue({conn_handle} {handle} {offset}")
status, data = self.adapter.read_req(new_conn, build_uuid('button'))
logging.info('button_status: {} status: {}'.format(data, status))

and fails in read_req().

Any help would be helpful ; thanks.

Marc.

Parents
  • Hello Marc,

    I do not know how to install a value handler and could not find documentation about it.

    Yes, unfortunately the documentation for the pc-ble-driver-py is very sparse. Fortunately, both it and the the pc-ble-driver are very similar, since they both just expose the serial interface to the connectivity device, so a lot of the time it can be helpful to take a look at the usage and inline comments from the pc-ble-driver too.

    status, data = self.adapter.read_req(new_conn, build_uuid('button'))

    Could you show where you set the new_conn value, and the contents of the build_uuid function?

    Best regards,
    Karl

Reply
  • Hello Marc,

    I do not know how to install a value handler and could not find documentation about it.

    Yes, unfortunately the documentation for the pc-ble-driver-py is very sparse. Fortunately, both it and the the pc-ble-driver are very similar, since they both just expose the serial interface to the connectivity device, so a lot of the time it can be helpful to take a look at the usage and inline comments from the pc-ble-driver too.

    status, data = self.adapter.read_req(new_conn, build_uuid('button'))

    Could you show where you set the new_conn value, and the contents of the build_uuid function?

    Best regards,
    Karl

Children
No Data
Related