This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How is BLE_CONN_HANDLE_INVALID changed in multiple services

How is BLE_CONN_HANDLE_INVALID changed in multiple services

I modified the ble_sdk_app_proximity example. I added x3 services, based on the BLE Characteristics, a beginner's tutorial, and it seems to be working fine. (nrf5-ble-tutorial-characteristic-CompletedCode ported for SDK 13.zip)

The first service, our_service.c from the turorial, works ok. The characteristic gets updated. The additional two (2) services did not until.......

It seems BLE_CONN_HANDLE_INVALID does not get changed to "VALID" or whatever.

So my service 2 and 3 does not update the characteristic.

When I comment out //p_our_service->conn_handle = BLE_CONN_HANDLE_INVALID; both the characteristics of the two additional services are updated.

So it seems the first service determines the connection state. Once it is connected, conn_handle ... stays .... BLE_CONN_HANDLE_INVALID for the other services?

How / where can I change BLE_CONN_HANDLE_INVALID to be "VALID"? (BLE_CONN_HANDLE_ALL)???

Any help appreciated

Parents
  • Martin, FIXED the problem Your mentioning of ".. called from the function ble_evt_dispatch() .." made me re-check, and I had the calls for the two new services commented out. (Left over from testing). in ble_evt_dispatch(ble_evt_t * p_ble_evt)

    So I uncommented the 2 new services, and it worked!! Thanks (I also removed the comment for //p_sr2_service->conn_handle = BLE_CONN_HANDLE_INVALID; and //p_sr3_service->conn_handle = BLE_CONN_HANDLE_INVALID;

    // OUR_JOB: Step 3.C, Call ble_our_service_on_ble_evt() to do housekeeping of ble connections related to our service and characteristic
    ble_our_service_on_ble_evt(&m_our_service, p_ble_evt);
    ble_sr2_service_on_ble_evt(&m_sr2_service, p_ble_evt);
    ble_sr3_service_on_ble_evt(&m_sr3_service, p_ble_evt);
    
  • Yes, Thanks. I just wanted to show the fix, incase someone else runs into the same. Sorry, I should have closed this.

Reply Children
No Data
Related