ANSC_STATUS DslhDmagntEngage ( ANSC_HANDLE hThisObject ) { ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; PDSLH_DATAMODEL_AGENT_OBJECT pMyObject = (PDSLH_DATAMODEL_AGENT_OBJECT)hThisObject; PANSC_ATOM_TABLE_OBJECT pAtomFunctions = (PANSC_ATOM_TABLE_OBJECT)pMyObject->hAtomFunctions; PDSLH_CPE_CONTROLLER_OBJECT pDslhCpeController = (PDSLH_CPE_CONTROLLER_OBJECT)pMyObject->hDslhCpeController; PSLAP_OBJECT_DESCRIPTOR pObjDescriptor = (PSLAP_OBJECT_DESCRIPTOR )NULL; PPOAM_IREP_FOLDER_OBJECT pPoamIrepFoRoot = (PPOAM_IREP_FOLDER_OBJECT )NULL; PPOAM_IREP_FOLDER_OBJECT pPoamIrepFoProvision = (PPOAM_IREP_FOLDER_OBJECT )NULL; PPOAM_IREP_FOLDER_OBJECT pPoamIrepFoCOSA = (PPOAM_IREP_FOLDER_OBJECT )pMyObject->hIrepFolderCOSA; PDSLH_MWS_INTERFACE pDslhMwsIf = (PDSLH_MWS_INTERFACE )pMyObject->hDslhMwsIf; if ( pMyObject->bActive ) { return ANSC_STATUS_SUCCESS; } if( pDslhMwsIf != NULL) { pDslhCpeController->AddInterface(pDslhCpeController, pMyObject->hDslhMwsIf); } pMyObject->hDslhCcdIf = pDslhCpeController->GetInterfaceByName(pDslhCpeController, CCSP_CCD_INTERFACE_NAME); pMyObject->hDslhLcbIf = pDslhCpeController->GetInterfaceByName(pDslhCpeController, CCSP_LIBCBK_INTERFACE_NAME); /* register internal apis */ if( pAtomFunctions == NULL) { pMyObject->hAtomFunctions = AnscCreateAtomTable ( pMyObject->hContainerContext, (ANSC_HANDLE)pMyObject, NULL ); pAtomFunctions = (PANSC_ATOM_TABLE_OBJECT)pMyObject->hAtomFunctions; } if( pAtomFunctions != NULL) { /* Register the API exported by framework */ pMyObject->RegisterInternalApi(pMyObject, "COSANotifyValueChange", COSANotifyValueChange); pMyObject->RegisterInternalApi(pMyObject, "COSANotifyDiagComplete", COSANotifyDiagComplete); pMyObject->RegisterInternalApi(pMyObject, "COSAValidateHierarchyInterface", COSAValidateHierarchyInterface); pMyObject->RegisterInternalApi(pMyObject, "COSAGetParamValueBool", COSAGetParamValueBool); pMyObject->RegisterInternalApi(pMyObject, "COSAGetParamValueInt", COSAGetParamValueInt); pMyObject->RegisterInternalApi(pMyObject, "COSAGetParamValueUlong", COSAGetParamValueUlong); pMyObject->RegisterInternalApi(pMyObject, "COSAGetParamValueString", COSAGetParamValueString); pMyObject->RegisterInternalApi(pMyObject, "COSAGetParamValue", COSAGetParamValue); pMyObject->RegisterInternalApi(pMyObject, "COSASetParamValueBool", COSASetParamValueBool); pMyObject->RegisterInternalApi(pMyObject, "COSASetParamValueInt", COSASetParamValueInt); pMyObject->RegisterInternalApi(pMyObject, "COSASetParamValueUlong", COSASetParamValueUlong); pMyObject->RegisterInternalApi(pMyObject, "COSASetParamValueString", COSASetParamValueString); pMyObject->RegisterInternalApi(pMyObject, "COSAGetRegistryRootFolder", COSAGetRegistryRootFolder); pMyObject->RegisterInternalApi(pMyObject, "COSAGetInstanceNumberByIndex", COSAGetInstanceNumberByIndex); pMyObject->RegisterInternalApi(pMyObject, "COSAGetInterfaceByName", COSAGetInterfaceByName); pMyObject->RegisterInternalApi(pMyObject, "COSAGetMessageBusHandle", COSAGetMessageBusHandle); pMyObject->RegisterInternalApi(pMyObject, "COSARegisterCallBackAfterInitDml", COSARegisterCallBackAfterInitDml); pMyObject->RegisterInternalApi(pMyObject, "COSAGetSubsystemPrefix", COSAGetSubsystemPrefix); pMyObject->RegisterInternalApi(pMyObject, "COSARepopulateTable", COSARepopulateTable); pMyObject->RegisterInternalApi(pMyObject, "COSAGetParamValueByPathName", COSAGetParamValueByPathName); pMyObject->RegisterInternalApi(pMyObject, "COSASetParamValueByPathName", COSASetParamValueByPathName); pMyObject->RegisterInternalApi(pMyObject, "COSAGetInstanceNumbers", COSAGetInstanceNumbers); /* Register the API for CCSP Common Components*/ #if 0 pMyObject->RegisterInternalApi(pMyObject, "CcspComp_GetParamUlongValue", CcspComp_GetParamUlongValue); pMyObject->RegisterInternalApi(pMyObject, "CcspComp_GetParamStringValue", CcspComp_GetParamStringValue); #endif pMyObject->RegisterInternalApi(pMyObject, "CcspComp_GetBulkParamValues", CcspComp_GetBulkParamValues); pMyObject->RegisterInternalApi(pMyObject, "CcspComp_SetParamBoolValue", CcspComp_SetParamBoolValue); pMyObject->RegisterInternalApi(pMyObject, "CcspLog_GetParamBoolValue", CcspLog_GetParamBoolValue); pMyObject->RegisterInternalApi(pMyObject, "CcspLog_GetParamUlongValue", CcspLog_GetParamUlongValue); pMyObject->RegisterInternalApi(pMyObject, "CcspLog_SetParamBoolValue", CcspLog_SetParamBoolValue); pMyObject->RegisterInternalApi(pMyObject, "CcspLog_SetParamUlongValue", CcspLog_SetParamUlongValue); pMyObject->RegisterInternalApi(pMyObject, "CcspLog_Validate", CcspLog_Validate ); pMyObject->RegisterInternalApi(pMyObject, "CcspLog_Commit", CcspLog_Commit ); pMyObject->RegisterInternalApi(pMyObject, "CcspLog_Rollback", CcspLog_Rollback ); pMyObject->RegisterInternalApi(pMyObject, "CcspMem_GetParamUlongValue", CcspMem_GetParamUlongValue); pMyObject->RegisterInternalApi(pMyObject, "CcspLog_GetBulkParamValues", CcspLog_GetBulkParamValues); pMyObject->RegisterInternalApi(pMyObject, "CcspLog_SetBulkParamValues", CcspLog_SetBulkParamValues); } /* * Enroll and create PoamIrepFolder object. */ if ( TRUE ) { pPoamIrepFoRoot = (PPOAM_IREP_FOLDER_OBJECT)PoamIrepFoCreate(NULL, NULL, ""); if ( !pPoamIrepFoRoot ) { AnscTrace("DslhDataModelAgent: Cannot access Root Folder!!\n"); returnStatus = ANSC_STATUS_FAILURE; goto EXIT2; } pPoamIrepFoProvision = (PPOAM_IREP_FOLDER_OBJECT)pPoamIrepFoRoot->GetFolder ( (ANSC_HANDLE)pPoamIrepFoRoot, "Provision" ); if ( !pPoamIrepFoProvision ) { AnscTrace("DslhDataModelAgent: Cannot access /Configuration/Provision folder!!\n"); returnStatus = ANSC_STATUS_FAILURE; goto EXIT3; } pPoamIrepFoCOSA = (PPOAM_IREP_FOLDER_OBJECT)pPoamIrepFoProvision->GetFolder ( (ANSC_HANDLE)pPoamIrepFoProvision, COSA_IREP_FOLDER_NAME ); if ( !pPoamIrepFoCOSA ) { pPoamIrepFoCOSA = pPoamIrepFoProvision->AddFolder ( (ANSC_HANDLE)pPoamIrepFoProvision, COSA_IREP_FOLDER_NAME, 0 ); } if ( !pPoamIrepFoCOSA ) { AnscTrace("DslhDataModelAgent: Cannot access /Configuration/Provision/%s folder!!\n", COSA_IREP_FOLDER_NAME); returnStatus = ANSC_STATUS_FAILURE; goto EXIT4; } else { pMyObject->hIrepFolderCOSA = (ANSC_HANDLE)pPoamIrepFoCOSA; } } pMyObject->bActive = TRUE; returnStatus = ANSC_STATUS_SUCCESS; /****************************************************************** GRACEFUL ROLLBACK PROCEDURES AND EXIT DOORS ******************************************************************/ EXIT4: if ( pPoamIrepFoProvision ) { pPoamIrepFoProvision->Remove((ANSC_HANDLE)pPoamIrepFoProvision); } EXIT3: if ( pPoamIrepFoRoot ) { pPoamIrepFoRoot->Remove((ANSC_HANDLE)pPoamIrepFoRoot); } EXIT2: return returnStatus; }
ANSC_STATUS ssp_engage_wifi ( PCCSP_COMPONENT_CFG pStartCfg ) { ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; char CrName[256] = {0}; PCCSP_DM_XML_CFG_LIST pXmlCfgList = NULL; g_pComponent_Common_Dm->Health = CCSP_COMMON_COMPONENT_HEALTH_Yellow; if ( pWifiCcdIf ) { pWifiFcContext->hCcspCcdIf = (ANSC_HANDLE)pWifiCcdIf; pWifiFcContext->hMessageBus = bus_handle; } g_DslhDataModelAgent->SetFcContext((ANSC_HANDLE)g_DslhDataModelAgent, (ANSC_HANDLE)pWifiFcContext); pDslhCpeController->AddInterface((ANSC_HANDLE)pDslhCpeController, (ANSC_HANDLE)MsgHelper_CreateCcdMbiIf((void*)bus_handle,g_Subsystem)); pDslhCpeController->AddInterface((ANSC_HANDLE)pDslhCpeController, (ANSC_HANDLE)pWifiCcdIf); pDslhCpeController->SetDbusHandle((ANSC_HANDLE)pDslhCpeController, bus_handle); pDslhCpeController->Engage((ANSC_HANDLE)pDslhCpeController); if ( g_Subsystem[0] != 0 ) { _ansc_sprintf(CrName, "%s%s", g_Subsystem, CCSP_DBUS_INTERFACE_CR); } else { _ansc_sprintf(CrName, "%s", CCSP_DBUS_INTERFACE_CR); } returnStatus = CcspComponentLoadDmXmlList(pStartCfg->DmXmlCfgFileName, &pXmlCfgList); if ( returnStatus != ANSC_STATUS_SUCCESS ) { return returnStatus; } returnStatus = pDslhCpeController->RegisterCcspDataModel ( (ANSC_HANDLE)pDslhCpeController, CrName, /* CCSP CR ID */ pXmlCfgList->FileList[0], /* Data Model XML file. Can be empty if only base data model supported. */ pStartCfg->ComponentName, /* Component Name */ pStartCfg->Version, /* Component Version */ pStartCfg->DbusPath, /* Component Path */ g_Subsystem /* Component Prefix */ ); if ( returnStatus == ANSC_STATUS_SUCCESS || returnStatus == CCSP_SUCCESS ) { /* System is fully initialized */ g_pComponent_Common_Dm->Health = CCSP_COMMON_COMPONENT_HEALTH_Green; } AnscFreeMemory(pXmlCfgList); return ANSC_STATUS_SUCCESS; }
ANSC_STATUS ssp_engage_tad ( ) { ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; char CrName[256]; g_pComponent_Common_Dm->Health = CCSP_COMMON_COMPONENT_HEALTH_Yellow; if ( pTadCcdIf ) { pTadFcContext->hCcspCcdIf = (ANSC_HANDLE)pTadCcdIf; pTadFcContext->hMessageBus = bus_handle; } g_DslhDataModelAgent->SetFcContext((ANSC_HANDLE)g_DslhDataModelAgent, (ANSC_HANDLE)pTadFcContext); /*RDKB-7459, CID-33428, null check before use */ if(!pDslhCpeController) { pDslhCpeController = DslhCreateCpeController(NULL, NULL, NULL); if ( !pDslhCpeController ) { CcspTraceWarning(("Null Value, CANNOT Create pDslhCpeController... Exit!\n")); return ANSC_STATUS_RESOURCES; } } pDslhCpeController->AddInterface((ANSC_HANDLE)pDslhCpeController, (ANSC_HANDLE)MsgHelper_CreateCcdMbiIf((void*)bus_handle, g_Subsystem)); pDslhCpeController->AddInterface((ANSC_HANDLE)pDslhCpeController, (ANSC_HANDLE)pTadCcdIf); pDslhCpeController->SetDbusHandle((ANSC_HANDLE)pDslhCpeController, bus_handle); pDslhCpeController->Engage((ANSC_HANDLE)pDslhCpeController); if ( g_Subsystem[0] != 0 ) { _ansc_sprintf(CrName, "%s%s", g_Subsystem, CCSP_DBUS_INTERFACE_CR); } else { _ansc_sprintf(CrName, "%s", CCSP_DBUS_INTERFACE_CR); } if ( TRUE ) { /*RDKB-7459, CID-33428, Load Lib if handle is null */ if( hDiagPlugin == NULL) { hDiagPlugin = (ANSC_HANDLE)AnscLoadLibrary(COSA_DIAG_PLUGIN_LIBRARY_NAME); } if( hDiagPlugin == NULL) { CcspTraceWarning(("Unable to load library -- %s\n", COSA_DIAG_PLUGIN_LIBRARY_NAME)); #ifdef _ANSC_LINUX CcspTraceWarning(("cause:%s\n", dlerror() )); #endif g_CosaDiagPluginInfo.uLoadStatus = COSA_STATUS_ERROR_LOAD_LIBRARY; } else { g_CosaDiagPluginInfo.InitProc = (COSADiagInitProc) AnscGetProcAddress ( hDiagPlugin, COSA_DIAG_PLUGIN_INIT_PROC ); if ( g_CosaDiagPluginInfo.InitProc == NULL ) { AnscTraceWarning(("Unable to Get ProcAddress of '%s'\n", COSA_DIAG_PLUGIN_INIT_PROC)); g_CosaDiagPluginInfo.uLoadStatus = COSA_STATUS_ERROR_LOAD_LIBRARY; } else { g_CosaDiagPluginInfo.UnloadProc = (COSADiagUnloadProc) AnscGetProcAddress ( hDiagPlugin, COSA_DIAG_PLUGIN_UNLOAD_PROC ); if ( g_CosaDiagPluginInfo.UnloadProc == NULL ) { AnscTraceWarning(("Unable to Get ProcAddress of '%s'\n", COSA_DIAG_PLUGIN_UNLOAD_PROC)); g_CosaDiagPluginInfo.uLoadStatus = COSA_STATUS_ERROR_LOAD_LIBRARY; } else { g_CosaDiagPluginInfo.GetResultsProc = (CosaDiagGetResultsProc) AnscGetProcAddress ( hDiagPlugin, COSA_DIAG_PLUGIN_GETRESULTS_PROC ); if ( g_CosaDiagPluginInfo.GetResultsProc == NULL ) { AnscTraceWarning(("Unable to Get ProcAddress of '%s'\n", COSA_DIAG_PLUGIN_GETRESULTS_PROC)); g_CosaDiagPluginInfo.uLoadStatus = COSA_STATUS_ERROR_LOAD_LIBRARY; } else { g_CosaDiagPluginInfo.ScheduleDiagnosticProc = (CosaDiagScheduleDiagnosticProc) AnscGetProcAddress ( hDiagPlugin, COSA_DIAG_PLUGIN_SCHEDIAG_PROC ); if ( g_CosaDiagPluginInfo.ScheduleDiagnosticProc == NULL ) { AnscTraceWarning(("Unable to Get ProcAddress of '%s'\n", COSA_DIAG_PLUGIN_SCHEDIAG_PROC)); g_CosaDiagPluginInfo.uLoadStatus = COSA_STATUS_ERROR_LOAD_LIBRARY; } else { g_CosaDiagPluginInfo.SetDiagParamsProc = (CosaDiagSetDiagParamsProc) AnscGetProcAddress ( hDiagPlugin, COSA_DIAG_PLUGIN_SETDIAGPARAMS_PROC ); if ( g_CosaDiagPluginInfo.SetDiagParamsProc == NULL ) { AnscTraceWarning(("Unable to Get ProcAddress of '%s'\n", COSA_DIAG_PLUGIN_SETDIAGPARAMS_PROC)); g_CosaDiagPluginInfo.uLoadStatus = COSA_STATUS_ERROR_LOAD_LIBRARY; } else { g_CosaDiagPluginInfo.SetDiagStateProc = (CosaDiagSetDiagStateProc) AnscGetProcAddress ( hDiagPlugin, COSA_DIAG_PLUGIN_SETDIAGSTATE_PROC ); if ( g_CosaDiagPluginInfo.SetDiagStateProc == NULL ) { AnscTraceWarning(("Unable to Get ProcAddress of '%s'\n", COSA_DIAG_PLUGIN_SETDIAGSTATE_PROC)); g_CosaDiagPluginInfo.uLoadStatus = COSA_STATUS_ERROR_LOAD_LIBRARY; } else { g_CosaDiagPluginInfo.CancelDiagnosticProc = (CosaDiagCancelDiagnosticProc) AnscGetProcAddress ( hDiagPlugin, COSA_DIAG_PLUGIN_CANCELDIAG_PROC ); if ( g_CosaDiagPluginInfo.CancelDiagnosticProc == NULL ) { AnscTraceWarning(("Unable to Get ProcAddress of '%s'\n", COSA_DIAG_PLUGIN_CANCELDIAG_PROC)); g_CosaDiagPluginInfo.uLoadStatus = COSA_STATUS_ERROR_LOAD_LIBRARY; } else { g_CosaDiagPluginInfo.MemoryUsageProc = (CosaDiagMemoryUsageProc) AnscGetProcAddress ( hDiagPlugin, COSA_DIAG_PLUGIN_MEMORYUSAGE_PROC ); if ( g_CosaDiagPluginInfo.MemoryUsageProc == NULL ) { AnscTraceWarning(("Unable to Get ProcAddress of '%s'\n", COSA_DIAG_PLUGIN_MEMORYUSAGE_PROC)); g_CosaDiagPluginInfo.uLoadStatus = COSA_STATUS_ERROR_LOAD_LIBRARY; } else { g_CosaDiagPluginInfo.MemoryTableProc = (CosaDiagMemoryTableProc) AnscGetProcAddress ( hDiagPlugin, COSA_DIAG_PLUGIN_MEMORYTABLE_PROC ); if ( g_CosaDiagPluginInfo.MemoryTableProc == NULL ) { AnscTraceWarning(("Unable to Get ProcAddress of '%s'\n", COSA_DIAG_PLUGIN_MEMORYTABLE_PROC)); g_CosaDiagPluginInfo.uLoadStatus = COSA_STATUS_ERROR_LOAD_LIBRARY; } else { g_CosaDiagPluginInfo.GetConfigsProc = (CosaDiagGetConfigsProc) AnscGetProcAddress ( hDiagPlugin, COSA_DIAG_PLUGIN_GETCONFIGS_PROC ); if ( g_CosaDiagPluginInfo.GetConfigsProc == NULL ) { AnscTraceWarning(("Unable to Get ProcAddress of '%s'\n", COSA_DIAG_PLUGIN_GETCONFIGS_PROC)); g_CosaDiagPluginInfo.uLoadStatus = COSA_STATUS_ERROR_LOAD_LIBRARY; } else { g_CosaDiagPluginInfo.ExportFuncProc = (CosaDiagExportFuncProc) AnscGetProcAddress ( hDiagPlugin, COSA_DIAG_PLUGIN_EXPORTFUNC_PROC ); if ( g_CosaDiagPluginInfo.ExportFuncProc == NULL ) { AnscTraceWarning(("Unable to Get ProcAddress of '%s'\n", COSA_DIAG_PLUGIN_EXPORTFUNC_PROC)); g_CosaDiagPluginInfo.uLoadStatus = COSA_STATUS_ERROR_LOAD_LIBRARY; } } } } } } } } } } } } if ( g_CosaDiagPluginInfo.uLoadStatus == COSA_STATUS_SUCCESS ) { /* COSA Diagnostic library loaded successfully */ g_CosaDiagPluginInfo.uPluginVersion = 1; returnStatus = g_CosaDiagPluginInfo.InitProc(bus_handle); if ( returnStatus != ANSC_STATUS_SUCCESS ) { g_CosaDiagPluginInfo.uLoadStatus = COSA_STATUS_ERROR_INIT; } g_DslhDataModelAgent->RegisterInternalApi(g_DslhDataModelAgent, "COSAGetDiagPluginInfo", COSAGetDiagPluginInfo); } } if ( g_GetParamValueByPathNameProc == NULL ) { g_GetParamValueByPathNameProc = (COSAGetParamValueByPathNameProc)COSAAcquireFunction("COSAGetParamValueByPathName"); if ( !g_GetParamValueByPathNameProc ) { printf("Test and Diagnostic - failed to load the function COSAGetParamValueByPathName!\n"); } } returnStatus = pDslhCpeController->RegisterCcspDataModel ( (ANSC_HANDLE)pDslhCpeController, CrName, /*CCSP_DBUS_INTERFACE_CR,*/ /* CCSP CR ID */ COSA_PLUGIN_XML_FILE, /* Data Model XML file. Can be empty if only base data model supported. */ CCSP_COMPONENT_NAME_TAD, /* Component Name */ CCSP_COMPONENT_VERSION_TAD, /* Component Version */ CCSP_COMPONENT_PATH_TAD, /* Component Path */ g_Subsystem /* Component Prefix */ ); if ( returnStatus == ANSC_STATUS_SUCCESS || CCSP_SUCCESS == returnStatus) { /* System is fully initialized */ g_pComponent_Common_Dm->Health = CCSP_COMMON_COMPONENT_HEALTH_Green; } pollTime(); return ANSC_STATUS_SUCCESS; }