How can I notify a handle defined by myself in pc-ble-driver-py?

Hi,

I try to use nrf52840 dongle and pc-ble-driver-py to connect nrf5340 and get the data from it. The handle and uuid is obtained from nRF Connect for Desktop BLE and the data sent by nrf5340 also can be obtained by notifying the Nordic Uart Tx handle. However, I get an "NordicSemiException: CCCD not found" error when trying to notify the hanle in pc-ble-driver-py.

Here are my error logs:

BLE Connection:2619629865808:
  role: BLEGapRoles.central
  peer_addr: [238, 248, 228, 219, 104, 37] (1)
  services:
    Service uuid(0x1801) start handle(1) end handle(8)
    Service uuid(0x1800) start handle(9) end handle(15)
    Service uuid(0x0001) start handle(16) end handle(21)
<Standard.cccd: 10498>
Traceback (most recent call last):
  File "D:/zhaoyuan_data/dsp/brain_usb/pc-ble-driver-py-master/pc_ble_driver_py/examples/heart_rate_collector.py", line 119, in connect_and_discover
    self.adapter.enable_notification(
  File "D:\zhaoyuan_data\dsp\brain_usb\pc-ble-driver-py-master\pc_ble_driver_py\ble_driver.py", line 104, in wrapper
    err_code = wrapped(*args, **kwargs)
  File "D:\zhaoyuan_data\dsp\brain_usb\pc-ble-driver-py-master\pc_ble_driver_py\ble_adapter.py", line 415, in enable_notification
    raise NordicSemiException("CCCD not found")
pc_ble_driver_py.exceptions.NordicSemiException: CCCD not found
python-BaseException

Process finished with exit code 1

the error is occured in the command:

self.adapter.enable_notification(
    new_conn, BLEUUID(0x2902),4
)

Parents Reply
  • I find that I get a wrong uuid and handle. What I need is the uuid and handle of UART Tx but I took CCCD's uuid and handle. I can get the data from enable_notification now. However, the speed is much lower than the speed by the desktop tool, which is 10kbps contrast to 100kbps. 

    And the function "self.adapter.enable_notification" seems to get data and print it as log, but I want to store the data in a variable and process it in the future. I wonder if there is any other appropriate function or api in pc-ble-driver-py. Thank you.

Children
Related