This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Is it safe to use conn_handle as an index to an array?

In other words, is it safe to assume that in various BLE events, conn_handle is either invalid (0xFFFF) or between 0 and (CENTRAL_LINK_COUNT + PERIPHERAL_LINK_COUNT - 1), as used in softdevice_enable_get_default_config()?

I've seen this used in nRF5_SDK_12.2.0_f012efa\examples\ble_central\ble_app_multilink_central\main.c, but not in the documents.

Parents
  • Hi Martin,

    I aim to support multiple, simultaneous connections as done in the example I mentioned. In my case, I need to keep an array of NUS service contexts (m_nus_cs).

    Regarding the scenario you mentioned, won't I get an event if the link is lost? If so - I will use it to clear the corresponding context.

    Just to make sure - can conn_handle for a given connection change without the application being notified? If so this poses a real problem to any client relying on the softdevice.

Reply
  • Hi Martin,

    I aim to support multiple, simultaneous connections as done in the example I mentioned. In my case, I need to keep an array of NUS service contexts (m_nus_cs).

    Regarding the scenario you mentioned, won't I get an event if the link is lost? If so - I will use it to clear the corresponding context.

    Just to make sure - can conn_handle for a given connection change without the application being notified? If so this poses a real problem to any client relying on the softdevice.

Children
Related