Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

How to reconnect when Disconnection appear : BLEHci.conn_failed_to_be_established [pc_ble_driver_py]

Hello, I am using the nordic nRF52840-DK with the package pc-ble-driver-py and the example heart_rate_collector.py.

My problem is that sometimes the Bluetooth connection can't connect to the device with this error : 

New connection, conn_handle: 0

Disconnected, conn_handle: 0, reason: BLEHci.conn_failed_to_be_established

I know that this error can sometimes occurred. But I would like to know how can I reconnect automatically just after this error ? 

Knowing that this error is problematic because it stop my python script lunched from a batch file.

Thanks in advance.

Gaetan

  • Try replacing the

     

                    raise NordicSemiException(
                        "conn_handle not available. common cause is disconnect after"
                        "starting service_discovery")

    with 

    break

    Or even better, with something that starts scanning again. 

    I am not familiar enough with pc-ble-driver-py to tell you exactly what that needs to be. 

    Try to read from the logs when you start the application if you can deduct what functions that are called to start the scanning.

    Best regards,

    Edvin

Related