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

ble_app_multilink_central db discovery handler problem with multiple peripherials

Hello, I have a problem with db_discovery_event_handlerexecution when having multiple S110 peripherials present when turning S120 central on. I have two different types of peripherials, and two different db_discovery handlers registered for these two peripherial types. When i turn on S120 central and both peripherial devices are already on, both peripherial devices are connected to central, but db_discovery_event_handler is called only for one of them. When i turn peripherials on, one after another with few second delay between them, and S120 central is already switched on, everything works OK - both handlers are called and peripherial characteristics from both S110's are discovered properly.

Is it possible that when two S110 peripherials are connecting to S120 at nearly the same time, some interrupt handlers related to BLE events preempt second db_discovery, and prevent it from being executed at all? How to deal with this issue?

Thanks, Wojtek

  • Yes, this is a limitation with the DB discovery module. That is the DB discovery uses m_ble_db_discovery to keep track of the conn_handle. Since this is update by ble_db_discovery_start, usually when you connect to a device, there is a risk that the conn_handle is updated before you have finished service discovery for the first device. This is something we will look into in the near future. Not sure if we will end up handling this in the discovery module, or in the application.

    For now I suggest that you implement a workaround, either by delay service discovery for new device until the first one is completed, or by adding support for multiple conn_handles.

  • Hi, i see, thanks for clarification. For now my solution is to restart ble scan only after current db_discovery handler finishes - this seems to fix the problem.

Related