I wish to automate the nRF connect tool using python, e.g. perform a scan, connect to a device, discover the services and write some data. Is this possible? I have stumbled across this tool but I'm not sure what exactly I can do with this.
I wish to automate the nRF connect tool using python, e.g. perform a scan, connect to a device, discover the services and write some data. Is this possible? I have stumbled across this tool but I'm not sure what exactly I can do with this.
Hi,
pc-ble-driver-py is made for this purpose, it is a serialization library for the softdevice API over a serial interface. nRF Connect use the Node.JS bindings version of pc-ble-driver, pc-ble-driver-js, for its BLE operations. You can find some examples of how to use pc-ble-driver-py in this directory.
Best regards,
Jørgen
Hi Jørgen,
I have the same goal as mr_ji : "to automate the nRF connect tool using python, e.g. perform a scan, connect to a device, discover the services and write some data."
The examples you gave in your response don't connect to a device, they don't discover the services and they don't read/write some data. So I'm looking for a documentation to understand how to do it myself. I couldn't find any, could you tell where to search ?
Best regards,
Bowi
The Heart Rate collector example does connect and discovery, and write the characteristics descriptor to enable notifications. There are write and read functions available in the ble_adapter implementation.
Unfortunately, the documentation on the library is not very comprehensive yet, but you should get an ide of how to use it from the examples and the implementation of dfu_transport_ble in pc-nrfutil. If you have any issues, please create a new support request and we will help you resolve it!
Hi Jørgen, I've posted a new support request here. Thank you !