/** **************************************************************************************** * @brief Handles reception of the APP_MODULE_INIT_CMP_EVT messgage * @param[in] msgid Id of the message received. * @param[in] param Pointer to the parameters of the message. * @param[in] dest_id ID of the receiving task instance * @param[in] src_id ID of the sending task instance. * * @return If the message was consumed or not. **************************************************************************************** */ int app_module_init_cmp_evt_handler(ke_msg_id_t const msgid, const struct app_module_init_cmp_evt *param, ke_task_id_t const dest_id, ke_task_id_t const src_id) { if (ke_state_get(dest_id) == APP_DB_INIT) { if (param->status == CO_ERROR_NO_ERROR) { // Add next required service in the database if (app_db_init()) { // No more service to add in the database, start application app_db_init_complete_func(); } } else { // An error has occurred during database creation ASSERT_ERR(0); } } else { // APP_DB_INIT state is used to wait the APP_MODULE_INIT_CMP_EVT message ASSERT_ERR(0); } return (KE_MSG_CONSUMED); }
/** **************************************************************************************** * @brief Called upon device's configuration completion. Starts advertsing or scanning. * * @return void. **************************************************************************************** */ void app_set_dev_config_complete_func(void) { // We are now in Initialization State ke_state_set(TASK_APP, APP_DB_INIT); // Add the first required service in the database if (app_db_init()) { // When the data base is already made start advertising app_scanning(); } }
void app_set_dev_config_complete_func(void) { /************************************************** Handle device configuration complete event. Start required Profiles' Database procedure. If no profiles supported or database initialization is completed starts advertising. ***************************************************/ // We are now in Initialization State ke_state_set(TASK_APP, APP_DB_INIT); // Add the first required service in the database if (app_db_init()) { // No service to add in the DB -> Start Advertising //app_adv_start(); } return; }