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

Discovery service dosen't work always

When I keep this function :

static void vMain_iInitDeviceManager_Exe(bool erase_bonds)
{
    uint32_t               err_code;
    dm_init_param_t        init_param = {.clear_persistent_data = erase_bonds};
    dm_application_param_t register_param;

// Initialize persistent storage module.
err_code = pstorage_init();
APP_ERROR_CHECK(err_code);

err_code = dm_init(&init_param);
APP_ERROR_CHECK(err_code);

memset(&register_param.sec_param, 0, sizeof(ble_gap_sec_params_t));

register_param.sec_param.bond         = SEC_PARAM_BOND;
register_param.sec_param.mitm         = SEC_PARAM_MITM;
register_param.sec_param.lesc         = SEC_PARAM_LESC;
register_param.sec_param.keypress     = SEC_PARAM_KEYPRESS;
register_param.sec_param.io_caps      = SEC_PARAM_IO_CAPABILITIES;
register_param.sec_param.oob          = SEC_PARAM_OOB;
register_param.sec_param.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
register_param.sec_param.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
register_param.evt_handler            = device_manager_evt_handler;
register_param.service_type           = DM_PROTOCOL_CNTXT_GATT_SRVR_ID;

err_code = dm_register(&m_app_handle, &register_param);
APP_ERROR_CHECK(err_code);
}

the discovery service works, if not it dosen't work.

SDK11 , hrs_app image description

Parents
  • Yes you have to "handle the event BLE_GATTS_EVT_SYS_ATTR_MISSING and call that function under it". But this is only applied if you don't store bond information and system attribute belong to that central. If you store bond information and want to re-init the system attribute (for example remember and automatically allow notification when the same central re-connect) you need to use the correct data instead of NULL. Other than that you can use NULL. Please look for BLE_GATTS_EVT_SYS_ATTR_MISSING event in the ble_app_uart to see how we handled it.

Reply
  • Yes you have to "handle the event BLE_GATTS_EVT_SYS_ATTR_MISSING and call that function under it". But this is only applied if you don't store bond information and system attribute belong to that central. If you store bond information and want to re-init the system attribute (for example remember and automatically allow notification when the same central re-connect) you need to use the correct data instead of NULL. Other than that you can use NULL. Please look for BLE_GATTS_EVT_SYS_ATTR_MISSING event in the ble_app_uart to see how we handled it.

Children
No Data
Related