static eEsifError EsifApp_RegisterParticipantsWithApp( EsifAppPtr self ) { eEsifError rc = ESIF_OK; EsifUpPtr upPtr = NULL; UInt8 i = 0; ESIF_ASSERT(self != NULL); /* Skip 0 ESIF treats this as a participant no one else does :) */ /* TODO: Use iterator here. This function shouldn't know the number of participants */ for (i = 1; i < MAX_PARTICIPANT_ENTRY; i++) { upPtr = EsifUpPm_GetAvailableParticipantByInstance(i); if (NULL == upPtr) { continue; } rc = EsifAppCreateParticipant(self, upPtr); EsifUp_PutRef(upPtr); if (ESIF_OK != rc) { break; } } ESIF_TRACE_INFO("Register participants with App, status = %s\n", esif_rc_str(rc)); return rc; }
eEsifError EsifUpManagerRegisterParticipantsWithApp(EsifAppPtr aAppPtr) { eEsifError rc = ESIF_OK; UInt8 i = 0; if (NULL == aAppPtr) { ESIF_TRACE_ERROR("Esif app pointer is NULL\n"); return ESIF_E_PARAMETER_IS_NULL; } esif_ccb_read_lock(&g_uppMgr.fLock); /* Skip 0 ESIF treats this as a participant no one else does :) */ for (i = 1; i < MAX_PARTICIPANT_ENTRY; i++) { EsifUpPtr up_ptr = g_uppMgr.fEntries[i].fUpPtr; if ((NULL != up_ptr) && (g_uppMgr.fEntries[i].fState > ESIF_PM_PARTICIPANT_REMOVED)) { rc = EsifAppCreateParticipant(aAppPtr, up_ptr); if (ESIF_OK != rc) { break; } } } esif_ccb_read_unlock(&g_uppMgr.fLock); ESIF_TRACE_INFO("Register participants with App, status = %s\n", esif_rc_str(rc)); return rc; }
/* Creates the participant in each running application */ eEsifError EsifAppMgrCreateParticipantInAllApps(const EsifUpPtr upPtr) { eEsifError rc = ESIF_OK; EsifAppPtr app_ptr = NULL; UInt8 i; if (NULL == upPtr) { ESIF_TRACE_ERROR("The prticipant data pointer is NULL\n"); rc = ESIF_E_PARAMETER_IS_NULL; goto exit; } /* Now offer this participant to each running application */ esif_ccb_read_lock(&g_appMgr.fLock); for (i = 0; i < ESIF_MAX_APPS; i++) { app_ptr = &g_appMgr.fEntries[i]; if (NULL != app_ptr->fHandle) { EsifAppCreateParticipant(app_ptr, upPtr); } } esif_ccb_read_unlock(&g_appMgr.fLock); exit: return rc; }