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

ble_db_discovery_start INVALID_STATE

Hi

I am receiving INVALID_STATE (error code 8) from ble_db_discovery_start. According to documentation, this error can be returned "If this function is called without calling the ble_db_discovery_init, or without calling ble_db_discovery_evt_register." I am calling ble_db_discovery_init in my project, but not ble_db_discovery_evt_register.

Do I need to call both functions before calling ble_db_discovery_start? In the ble_app_cts_c example, I can't find ble_db_discovery_evt_register. If it is required, is it called in a library function somewhere?

Thanks

PCA10040 nRF52832 SDK13

  • Hi,

    Yes, both ble_db_discovery_init() and ble_db_discovery_evt_register() are needed before calling ble_db_discovery_start().

    Both are called in the ble_app_cts_c example. In main, from db_discovery_init() there is a call to ble_db_discovery_init(). Also in main, from services_init() there is a call to ble_cts_c_init(), found in ble_cts_c.c, which calls ble_db_discovery_evt_register().

    Regards,

    Terje

  • Thanks Terje.

    Also, I believe you meant to say "Also in main, from services_init() there is a call to ble_cts_c_init(), found in ble_cts_c.c, which calls ble_db_discovery_evt_register()

  • Indeed. Thank you. I updated the answer.

    (Initially I wrote "...which calls ble_db_discovery_start()")

Related