Hello,
I have a project with custom service 1 , and now I want to add a new service, so since custom service 2 is already there, I just added it to my project, but when I disable custom 1 and enable only custom 2 , I could not see it when connecting with my nRF Connect application, and if I enable both custom 1 and custom 2 , connection takes a long time in service discovering then the device is disconnected.
I verified that the database is created in custs2_create_db_req_handler() : status == ATT_ERR_NO_ERROR , and I added the database structure and initialization in user_custs_config.h as custom 1 , is there anything missing ?
Thanks,
--Saif
Keywords:
Device:
Hi bensalemsaif,
In order for the custs2 to be functional it requires come changes to the SDK, please follow the steps below:
1: add a missing header file (#include "user_custs_config.h") in the custs2_task.c.
2: in the app_db_init_next(void) change the #if BLE_CUSTOM1_SERVER with #if BLE_CUSTOM_SERVER
3: in the app_entry_point.c place the following snippet in the app_process_handlers[]
#if ((BLE_CUSTOM2_SERVER) && (!EXCLUDE_DLG_CUSTS2))
(process_event_func_t) app_custs2_process_handler,
# endif
and add the app_custs2_process_handler just below the app_custs1_process_handler (its above the app_process_handlers() definition).
4: In the custs2_task.c add the following snippets just below the last inclusion:
#include "app_prf_types.h"......
#if (BLE_CUSTOM_SERVER)
#include "user_custs_config.h"
# endif
5: Also dont forget to fill the cust_prf_funcs structure with the proper info for your second custom service, you can take the first service as an example.
6: And of course provide to the second service the required characteristics, messages etc.
That should be enough to get your second service up and running.
Thanks MT_dialog
Hello,
Thanks MT_dialog, now it's working fine !
Regards,
--Saif