Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

DIS client ble_dis_c_on_db_disc_evt never fire due to error in source code

HI !
I found an error in the source code because of which the db discovery event handler on DIS client does not work, namely:
in the function ble_dis_c_on_db_disc_evt ()

in code:

if ((p_ble_dis_c->evt_handler == NULL) ||
    (p_ble_dis_c->conn_handle == p_evt->conn_handle))
{
    return;
}

function always return here.

Condition  "p_ble_dis_c->conn_handle == p_evt->conn_handle"  is correct to continue the function, and not to exit it.
For the code to work correctly, need to set the condition non equally like this:

p_ble_dis_c->conn_handle != p_evt->conn_handle

and get the following code:

if ((p_ble_dis_c->evt_handler == NULL) ||
    (p_ble_dis_c->conn_handle != p_evt->conn_handle))
{
    return;
}

All health and good luck!

Related