/********************************************************************** caller: owner of this object prototype: BOOL SelfHeal_SetParamUlongValue ( ANSC_HANDLE hInsContext, char* ParamName, ULONG uValue ); description: This function is called to set ULONG parameter value; argument: ANSC_HANDLE hInsContext, The instance handle; char* ParamName, The parameter name; ULONG uValue The updated ULONG value; return: TRUE if succeeded. **********************************************************************/ BOOL SelfHeal_SetParamUlongValue ( ANSC_HANDLE hInsContext, char* ParamName, ULONG uValue ) { PCOSA_DATAMODEL_SELFHEAL pMyObject = (PCOSA_DATAMODEL_SELFHEAL)g_pCosaBEManager->hSelfHeal; if( AnscEqualString(ParamName, "X_RDKCENTRAL-COM_MaxRebootCount", TRUE)) { if( pMyObject->MaxRebootCnt == uValue ) { return TRUE; } char buf[8]; memset(buf, 0, sizeof(buf)); snprintf(buf,sizeof(buf),"%d",uValue); if (syscfg_set(NULL, "max_reboot_count", buf) != 0) { CcspTraceWarning(("%s: syscfg_set failed for %s\n", __FUNCTION__, ParamName)); return FALSE; } if (syscfg_commit() != 0) { CcspTraceWarning(("%s: syscfg commit failed for %s\n", __FUNCTION__, ParamName)); return FALSE; } pMyObject->MaxRebootCnt = uValue; return TRUE; } if( AnscEqualString(ParamName, "X_RDKCENTRAL-COM_MaxResetCount", TRUE)) { if( pMyObject->MaxResetCnt == uValue ) { return TRUE; } char buf[8]; memset(buf, 0, sizeof(buf)); snprintf(buf,sizeof(buf),"%d",uValue); if (syscfg_set(NULL, "max_reset_count", buf) != 0) { CcspTraceWarning(("%s: syscfg_set failed for %s\n", __FUNCTION__, ParamName)); return FALSE; } if (syscfg_commit() != 0) { CcspTraceWarning(("%s: syscfg commit failed for %s\n", __FUNCTION__, ParamName)); return FALSE; } pMyObject->MaxResetCnt = uValue; return TRUE; } return FALSE; }
/********************************************************************** caller: owner of this object prototype BOOL ConnectivityTest_SetParamBoolValue ( ANSC_HANDLE hInsContext, char* ParamName, BOOL bValue ); description: This function is called to set BOOL parameter value; argument: ANSC_HANDLE hInsContext, The instance handle; char* ParamName, The parameter name; BOOL bValue The buffer of returned BOOL value; return: TRUE if succeeded. **********************************************************************/ BOOL ConnectivityTest_SetParamBoolValue ( ANSC_HANDLE hInsContext, char* ParamName, BOOL bValue ) { PCOSA_DATAMODEL_SELFHEAL pMyObject = (PCOSA_DATAMODEL_SELFHEAL)g_pCosaBEManager->hSelfHeal; if( AnscEqualString(ParamName, "X_RDKCENTRAL-COM_CorrectiveAction", TRUE)) { if ( pMyObject->pConnTest->CorrectiveAction == bValue ) { return TRUE; } CcspTraceWarning(("%s Changing X_RDKCENTRAL-COM_CorrectiveAction state to %d \n",__FUNCTION__,bValue)); /* save update to backup */ char buf[128]; memset(buf, 0, sizeof(buf)); snprintf(buf,sizeof(buf),"%s",bValue ? "true" : "false"); if (syscfg_set(NULL, "ConnTest_CorrectiveAction", buf) != 0) { CcspTraceWarning(("%s syscfg set failed for ConnTest_CorrectiveAction\n",__FUNCTION__)); return FALSE; } if (syscfg_commit() != 0) { CcspTraceWarning(("%s syscfg commit failed for ConnTest_CorrectiveAction\n",__FUNCTION__)); return FALSE; } pMyObject->pConnTest->CorrectiveAction = bValue; return TRUE; } return FALSE; }
int syscfg_save(void) { int ret; if (!confsvc.started) { DBG(DBG_WARNING, "Config service not started."); return -1; } pthread_mutex_lock(&confsvc.mutex); confsvc.save_req++; ret = syscfg_commit(); pthread_mutex_unlock(&confsvc.mutex); return ret; }
int syscfg_stop(void) { if (!confsvc.started) return -1; pthread_mutex_lock(&confsvc.mutex); /* commit any pending save request */ syscfg_commit(); pthread_mutex_unlock(&confsvc.mutex); pthread_mutex_destroy(&confsvc.mutex); DBG(DBG_TRACE, "Config service stopped."); confsvc.started = false; return 0; }
BOOL ConnectivityTest_SetParamIntValue ( ANSC_HANDLE hInsContext, char* ParamName, int pInt ) { PCOSA_DATAMODEL_SELFHEAL pMyObject = (PCOSA_DATAMODEL_SELFHEAL)g_pCosaBEManager->hSelfHeal; if( AnscEqualString(ParamName, "X_RDKCENTRAL-COM_RebootInterval", TRUE)) { if ( pMyObject->pConnTest->RouterRebootInterval == pInt ) { return TRUE; } char cValue[10]; memset(cValue, 0, sizeof(cValue)); snprintf(cValue, sizeof(cValue), "%d", pInt); if (syscfg_set(NULL, "router_reboot_Interval", cValue) != 0) { CcspTraceWarning(("%s syscfg set failed for X_RDKCENTRAL-COM_RebootInterval\n",__FUNCTION__)); return FALSE; } if (syscfg_commit() != 0) { CcspTraceWarning(("%s syscfg commit failed for X_RDKCENTRAL-COM_RebootInterval\n",__FUNCTION__)); return FALSE; } /* save update to backup */ pMyObject->pConnTest->RouterRebootInterval = pInt; return TRUE; } return FALSE; }
ANSC_STATUS CosaUsersBackendGetUserInfo ( ANSC_HANDLE hThisObject ) { ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; PCOSA_DATAMODEL_USERS pMyObject = (PCOSA_DATAMODEL_USERS)hThisObject; PCOSA_DML_USER pCosaUser = NULL; ULONG clientCount = 0; ULONG count = 0; ULONG ulIndex = 0; PCOSA_CONTEXT_LINK_OBJECT pUserCxtLink = NULL; PCOSA_CONTEXT_LINK_OBJECT pUserCxtLink2 = NULL; PCOSA_CONTEXT_LINK_OBJECT pCxtLink = NULL; BOOL bNeedSave = FALSE; /* Get Users.user.{i} */ clientCount = CosaDmlUserGetNumberOfEntries(NULL); for ( ulIndex = 0; ulIndex < clientCount; ulIndex++ ) { pCosaUser = (PCOSA_DML_USER)AnscAllocateMemory( sizeof(COSA_DML_USER) ); if ( !pCosaUser ) { break; } USERS_USER_SET_DEFAULTVALUE(pCosaUser); pCosaUser->NumOfFailedAttempts=0; returnStatus = CosaDmlUserGetEntry(NULL, ulIndex, pCosaUser); if ( returnStatus != ANSC_STATUS_SUCCESS ) { AnscFreeMemory(pCosaUser); break; } if (ulIndex == 2) { char buff[128]={'\0'}; syscfg_get( NULL, "hash_password_3",buff, sizeof(buff)); if( buff[0] != '\0' && pCosaUser->HashedPassword[0]== '\0') { _ansc_strncpy(pCosaUser->HashedPassword,buff,sizeof(pCosaUser->HashedPassword)); } } #if defined(_COSA_FOR_BCI_) if (ulIndex == 1) { char buff[128]={'\0'}; syscfg_get( NULL, "hash_password_2",buff, sizeof(buff)); if( buff[0] != '\0' && pCosaUser->HashedPassword[0]== '\0') { _ansc_strncpy(pCosaUser->HashedPassword,buff,sizeof(pCosaUser->HashedPassword)); } pCosaUser->LockOutRemainingTime = 0 ; memset(buff,0,sizeof(buff)); syscfg_get( NULL, "PasswordLockoutAttempts", buff, sizeof(buff)); if( atoi ( buff ) != 10 ) { memset(buff,0,sizeof(buff)); sprintf(buff, "%d", 10); syscfg_set(NULL, "PasswordLockoutAttempts", buff) ; syscfg_commit() ; } memset(buff,0,sizeof(buff)); syscfg_get( NULL, "NumOfFailedAttempts_2", buff, sizeof(buff)); if( buff[0] != '\0' ) { pCosaUser->NumOfFailedAttempts = atoi(buff) ; } memset(buff,0,sizeof(buff)); syscfg_get( NULL, "PasswordLoginCounts_2", buff, sizeof(buff)); if( buff[0] != '\0' ) { pCosaUser->LoginCounts = atoi(buff) ; } } #endif pUserCxtLink = (PCOSA_CONTEXT_LINK_OBJECT)AnscAllocateMemory( sizeof(COSA_CONTEXT_LINK_OBJECT) ); if ( !pUserCxtLink ) { AnscFreeMemory(pCosaUser); break; } COSA_CONTEXT_LINK_INITIATION_CONTENT(pUserCxtLink) pUserCxtLink->hContext = (ANSC_HANDLE)pCosaUser; pUserCxtLink->bNew = FALSE; if ( !pCosaUser->InstanceNumber ) { if ( !++pMyObject->maxInstanceOfUser ) { pMyObject->maxInstanceOfUser = 1; } bNeedSave = TRUE; pCosaUser->InstanceNumber = pMyObject->maxInstanceOfUser; pUserCxtLink->InstanceNumber = pCosaUser->InstanceNumber; _ansc_sprintf(pCosaUser->Username, "Username%d", pCosaUser->InstanceNumber); returnStatus = CosaDmlUserSetValues ( NULL, ulIndex, pCosaUser->InstanceNumber ); if ( returnStatus != ANSC_STATUS_SUCCESS ) { AnscFreeMemory(pCosaUser); AnscFreeMemory(pUserCxtLink); break; } /* Put into our list */ CosaSListPushEntryByInsNum(&pMyObject->UserList, pUserCxtLink); } else { pUserCxtLink->InstanceNumber = pCosaUser->InstanceNumber; if ( pMyObject->maxInstanceOfUser < pUserCxtLink->InstanceNumber ) { pMyObject->maxInstanceOfUser = pUserCxtLink->InstanceNumber; bNeedSave = TRUE; } /* if this entry is in link tree already because it's the parent of delay_added table. */ pUserCxtLink2 = (PCOSA_CONTEXT_LINK_OBJECT)CosaSListGetEntryByInsNum(&pMyObject->UserList, pUserCxtLink->InstanceNumber); if ( !pUserCxtLink2 ) { CosaSListPushEntryByInsNum(&pMyObject->UserList, pUserCxtLink); } else { AnscFreeMemory( pUserCxtLink2->hContext ); pUserCxtLink2->hContext = (ANSC_HANDLE)pCosaUser; if ( pUserCxtLink2->bNew ) { pUserCxtLink2->bNew = FALSE; bNeedSave = TRUE; } AnscFreeMemory(pUserCxtLink); pUserCxtLink = pUserCxtLink2; pUserCxtLink2 = NULL; } } } /* Max InstanceNumber is changed. Save now.*/ if (bNeedSave) { CosaUsersRegSetUserInfo(pMyObject); } return returnStatus; }
ANSC_HANDLE IPv4PingServerTable_AddEntry ( ANSC_HANDLE hInsContext, ULONG* pInsNumber ) { PCOSA_DATAMODEL_SELFHEAL pSelfHeal = (PCOSA_DATAMODEL_SELFHEAL)g_pCosaBEManager->hSelfHeal; PCOSA_DML_SELFHEAL_IPv4_SERVER_TABLE pServerIpv4 = NULL; PCOSA_CONTEXT_SELFHEAL_LINK_OBJECT pSelfHealCxtLink = NULL; PSINGLE_LINK_ENTRY pSListEntry = NULL; ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; CHAR tmpBuff[64] = {0}; CHAR buf[8]; BOOL bridgeMode; PCOSA_DATAMODEL_SELFHEAL pMyObject = (PCOSA_DATAMODEL_SELFHEAL)g_pCosaBEManager->hSelfHeal; int Qdepth = 0; pServerIpv4 = (PCOSA_DML_SELFHEAL_IPv4_SERVER_TABLE)AnscAllocateMemory(sizeof(COSA_DML_SELFHEAL_IPv4_SERVER_TABLE)); if ( !pServerIpv4 ) { CcspTraceWarning(("%s resource allocation failed\n",__FUNCTION__)); return NULL; } pSelfHealCxtLink = (PCOSA_CONTEXT_SELFHEAL_LINK_OBJECT)AnscAllocateMemory(sizeof(COSA_CONTEXT_SELFHEAL_LINK_OBJECT)); if ( !pSelfHealCxtLink ) { goto EXIT; } Qdepth = AnscSListQueryDepth( &pSelfHeal->IPV4PingServerList ); pSelfHealCxtLink->InstanceNumber = pSelfHeal->ulIPv4NextInstanceNumber; pServerIpv4->InstanceNumber = pSelfHeal->ulIPv4NextInstanceNumber; pSelfHeal->ulIPv4NextInstanceNumber++; if (pSelfHeal->ulIPv4NextInstanceNumber == 0) pSelfHeal->ulIPv4NextInstanceNumber = 1; /* now we have this link content */ pSelfHealCxtLink->hContext = (ANSC_HANDLE)pServerIpv4; pSelfHeal->pConnTest->IPv4EntryCount++; printf("*** pSelfHeal->pConnTest->IPv4EntryCount = %d ***\n",pSelfHeal->pConnTest->IPv4EntryCount); snprintf(buf,sizeof(buf),"%d",pSelfHeal->pConnTest->IPv4EntryCount); if (syscfg_set(NULL, "Ipv4PingServer_Count", buf) != 0) { CcspTraceWarning(("syscfg_set failed\n")); } else { if (syscfg_commit() != 0) { CcspTraceWarning(("syscfg_commit failed\n")); } } CosaSListPushEntryByInsNum(&pSelfHeal->IPV4PingServerList, (PCOSA_CONTEXT_LINK_OBJECT)pSelfHealCxtLink); return (ANSC_HANDLE)pSelfHealCxtLink; EXIT: AnscFreeMemory(pServerIpv4); return NULL; }
BOOL ConnectivityTest_SetParamUlongValue ( ANSC_HANDLE hInsContext, char* ParamName, ULONG uValue ) { PCOSA_DATAMODEL_SELFHEAL pMyObject = (PCOSA_DATAMODEL_SELFHEAL)g_pCosaBEManager->hSelfHeal; if( AnscEqualString(ParamName, "X_RDKCENTRAL-COM_PingInterval", TRUE)) { if ( pMyObject->pConnTest->PingInterval == uValue ) { return TRUE; } if ( uValue < 15 || uValue > 1440 ) { CcspTraceWarning(("%s PingInterval value passed is not in range\n",__FUNCTION__)); return FALSE; } /* save update to backup */ char value[10]; snprintf(value, sizeof(value), "%u", uValue); if (syscfg_set(NULL, "ConnTest_PingInterval", value) != 0) { CcspTraceWarning(("%s syscfg set failed for ConnTest_PingInterval\n",__FUNCTION__)); return FALSE; } if (syscfg_commit() != 0) { CcspTraceWarning(("%s syscfg commit failed for ConnTest_PingInterval\n",__FUNCTION__)); return FALSE; } pMyObject->pConnTest->PingInterval = uValue; return TRUE; } if( AnscEqualString(ParamName, "X_RDKCENTRAL-COM_NumPingsPerServer", TRUE)) { if ( pMyObject->pConnTest->PingCount == uValue ) { return TRUE; } char value[10]; snprintf(value, sizeof(value), "%u", uValue); if (syscfg_set(NULL, "ConnTest_NumPingsPerServer", value) != 0) { CcspTraceWarning(("%s syscfg set failed for ConnTest_NumPingsPerServer\n",__FUNCTION__)); return FALSE; } if (syscfg_commit() != 0) { CcspTraceWarning(("%s syscfg commit failed for ConnTest_NumPingsPerServer\n",__FUNCTION__)); return FALSE; } /* save update to backup */ pMyObject->pConnTest->PingCount = uValue; return TRUE; } if( AnscEqualString(ParamName, "X_RDKCENTRAL-COM_MinNumPingServer", TRUE)) { if ( pMyObject->pConnTest->MinPingServer == uValue ) { return TRUE; } char value[10]; snprintf(value, sizeof(value), "%u", uValue); if (syscfg_set(NULL, "ConnTest_MinNumPingServer", value) != 0) { CcspTraceWarning(("%s syscfg set failed for ConnTest_MinNumPingServer\n",__FUNCTION__)); return FALSE; } if (syscfg_commit() != 0) { CcspTraceWarning(("%s syscfg commit failed for ConnTest_MinNumPingServer\n",__FUNCTION__)); return FALSE; } /* save update to backup */ pMyObject->pConnTest->MinPingServer = uValue; return TRUE; } if( AnscEqualString(ParamName, "X_RDKCENTRAL-COM_PingRespWaitTime", TRUE)) { if ( pMyObject->pConnTest->WaitTime == uValue ) { return TRUE; } char value[10]; snprintf(value, sizeof(value), "%u", uValue); if (syscfg_set(NULL, "ConnTest_PingRespWaitTime", value) != 0) { CcspTraceWarning(("%s syscfg set failed for ConnTest_PingRespWaitTime\n",__FUNCTION__)); return FALSE; } if (syscfg_commit() != 0) { CcspTraceWarning(("%s syscfg commit failed for ConnTest_PingRespWaitTime\n",__FUNCTION__)); return FALSE; } /* save update to backup */ pMyObject->pConnTest->WaitTime = uValue; return TRUE; } return FALSE; }
/********************************************************************** caller: owner of this object prototype: BOOL ResourceMonitor_SetParamUlongValue ( ANSC_HANDLE hInsContext, char* ParamName, ULONG uValue ); description: This function is called to set ULONG parameter value; argument: ANSC_HANDLE hInsContext, The instance handle; char* ParamName, The parameter name; ULONG uValue The updated ULONG value; return: TRUE if succeeded. **********************************************************************/ BOOL ResourceMonitor_SetParamUlongValue ( ANSC_HANDLE hInsContext, char* ParamName, ULONG uValue ) { PCOSA_DATAMODEL_SELFHEAL pMyObject = (PCOSA_DATAMODEL_SELFHEAL)g_pCosaBEManager->hSelfHeal; PCOSA_DML_RESOUCE_MONITOR pRescMonitor = pMyObject->pResMonitor; if( AnscEqualString(ParamName, "X_RDKCENTRAL-COM_UsageComputeWindow", TRUE)) { if ( pRescMonitor->MonIntervalTime == uValue ) { return TRUE; } char buf[8]; memset(buf, 0, sizeof(buf)); snprintf(buf,sizeof(buf),"%d",uValue); if (syscfg_set(NULL, "resource_monitor_interval", buf) != 0) { CcspTraceWarning(("%s: syscfg_set failed for %s\n", __FUNCTION__, ParamName)); return FALSE; } if (syscfg_commit() != 0) { CcspTraceWarning(("%s: syscfg commit failed for %s\n", __FUNCTION__, ParamName)); return FALSE; } pRescMonitor->MonIntervalTime = uValue; return TRUE; } if( AnscEqualString(ParamName, "X_RDKCENTRAL-COM_AvgCPUThreshold", TRUE)) { if ( pRescMonitor->MonIntervalTime == uValue ) { return TRUE; } char buf[8]; memset(buf, 0, sizeof(buf)); snprintf(buf,sizeof(buf),"%d",uValue); if (syscfg_set(NULL, "avg_cpu_threshold", buf) != 0) { CcspTraceWarning(("%s: syscfg_set failed for %s\n", __FUNCTION__, ParamName)); return FALSE; } if (syscfg_commit() != 0) { CcspTraceWarning(("%s: syscfg commit failed for %s\n", __FUNCTION__, ParamName)); return FALSE; } pRescMonitor->AvgCpuThreshold = uValue; return TRUE; } if( AnscEqualString(ParamName, "X_RDKCENTRAL-COM_AvgMemoryThreshold", TRUE)) { if ( pRescMonitor->MonIntervalTime == uValue ) { return TRUE; } char buf[8]; memset(buf, 0, sizeof(buf)); snprintf(buf,sizeof(buf),"%d",uValue); if (syscfg_set(NULL, "avg_memory_threshold", buf) != 0) { CcspTraceWarning(("%s: syscfg_set failed for %s\n", __FUNCTION__, ParamName)); return FALSE; } if (syscfg_commit() != 0) { CcspTraceWarning(("%s: syscfg commit failed for %s\n", __FUNCTION__, ParamName)); return FALSE; } pRescMonitor->AvgMemThreshold = uValue; return TRUE; } return FALSE; }
/********************************************************************** caller: owner of this object prototype BOOL SelfHeal_SetParamBoolValue ( ANSC_HANDLE hInsContext, char* ParamName, BOOL bValue ); description: This function is called to set BOOL parameter value; argument: ANSC_HANDLE hInsContext, The instance handle; char* ParamName, The parameter name; BOOL bValue The buffer of returned BOOL value; return: TRUE if succeeded. **********************************************************************/ BOOL SelfHeal_SetParamBoolValue ( ANSC_HANDLE hInsContext, char* ParamName, BOOL bValue ) { PCOSA_DATAMODEL_SELFHEAL pMyObject = (PCOSA_DATAMODEL_SELFHEAL)g_pCosaBEManager->hSelfHeal; if( AnscEqualString(ParamName, "X_RDKCENTRAL-COM_Enable", TRUE)) { if( pMyObject->Enable == bValue ) { return TRUE; } char buf[128]; memset(buf, 0, sizeof(buf)); snprintf(buf,sizeof(buf),"%s",bValue ? "true" : "false"); if (syscfg_set(NULL, "selfheal_enable", buf) != 0) { CcspTraceWarning(("%s: syscfg_set failed for %s\n", __FUNCTION__, ParamName)); return FALSE; } else { if (syscfg_commit() != 0) { CcspTraceWarning(("%s: syscfg commit failed for %s\n", __FUNCTION__, ParamName)); return FALSE; } char cmd[128]; if ( bValue == TRUE ) { memset(cmd, 0, sizeof(cmd)); memset(buf, 0, sizeof(buf)); sprintf(cmd, "pidof process_monitor.sh"); copy_command_output(cmd, buf, sizeof(buf)); buf[strlen(buf)] = '\0'; if (!strcmp(buf, "")) { CcspTraceWarning(("%s: Process Monitor script is not running\n", __FUNCTION__)); } else { CcspTraceWarning(("%s: Stop Process Monitor script\n", __FUNCTION__)); sprintf(cmd, "kill -9 %s", buf); system(cmd); } memset(cmd, 0, sizeof(cmd)); AnscCopyString(cmd, "/fss/gw/usr/ccsp/tad/self_heal_connectivity_test.sh &"); system(cmd); /*memset(cmd, 0, sizeof(cmd)); AnscCopyString(cmd, "/fss/gw/usr/ccsp/tad/resource_monitor.sh &"); system(cmd); */ //RDKB-EMU } else { memset(cmd, 0, sizeof(cmd)); memset(buf, 0, sizeof(buf)); sprintf(cmd, "pidof self_heal_connectivity_test.sh"); copy_command_output(cmd, buf, sizeof(buf)); buf[strlen(buf)] = '\0'; if (!strcmp(buf, "")) { CcspTraceWarning(("%s: SelfHeal Monitor script is not running\n", __FUNCTION__)); } else { CcspTraceWarning(("%s: Stop SelfHeal Monitor script\n", __FUNCTION__)); sprintf(cmd, "kill -9 %s", buf); system(cmd); } /* memset(cmd, 0, sizeof(cmd)); memset(buf, 0, sizeof(buf)); sprintf(cmd, "pidof resource_monitor.sh"); copy_command_output(cmd, buf, sizeof(buf)); buf[strlen(buf)] = '\0'; if (!strcmp(buf, "")) { CcspTraceWarning(("%s: Resource Monitor script is not running\n", __FUNCTION__)); } else { CcspTraceWarning(("%s: Stop Resource Monitor script\n", __FUNCTION__)); sprintf(cmd, "kill -9 %s", buf); system(cmd); }*/ //RDKB-EMU memset(cmd, 0, sizeof(cmd)); AnscCopyString(cmd, "/etc/process_monitor.sh &"); CcspTraceWarning(("%s: Starting process Monitor script\n", __FUNCTION__)); system(cmd); } pMyObject->Enable = bValue; } return TRUE; } return FALSE; }
BOOL VideoService_SetParamBoolValue ( ANSC_HANDLE hInsContext, char* ParamName, BOOL bValue ) { if (AnscEqualString(ParamName, "Enabled", TRUE)) { char bval[2] = {0}; if( bValue == TRUE ) { char buf[5] = {0}; syscfg_get( NULL, "X_RDKCENTRAL-COM_VIDEOSERVICE", buf, sizeof(buf)); if( buf != NULL ) { if (strcmp(buf,"1") == 0) { return TRUE; } } if(videoServiceEnableInProgress==FALSE) { bval[0] = '1'; pthread_mutex_lock(&g_videoservice_mutex); videoServiceEnableInProgress = TRUE; pthread_t videoServiceThread; if (pthread_create(&videoServiceThread, NULL, &SetVideoServiceConfig, NULL)) { CcspTraceError(("RDK_LOG_ERROR, CcspPandM %s : Failed to Start Thread to start SetVideoServiceConfig \n", __FUNCTION__ )); return FALSE; } pthread_mutex_unlock(&g_videoservice_mutex); CcspTraceWarning(("VIDEOSERVICE is ENABLED\n")); } } else { bval[0] = '0'; CcspTraceWarning(("VIDEOSERVICE is DISABLED\n")); } if (syscfg_set(NULL, "X_RDKCENTRAL-COM_VIDEOSERVICE", bval) != 0) { AnscTraceWarning(("[VideoService] syscfg_set X_RDKCENTRAL-COM_VIDEOSERVICE failed!\n")); } else { if (syscfg_commit() != 0) { AnscTraceWarning(("[VideoService] syscfg_commit X_RDKCENTRAL-COM_VIDEOSERVICE failed!\n")); } } return TRUE; } return FALSE; }
BOOL DeviceInfo_SetParamBoolValue_Custom ( ANSC_HANDLE hInsContext, char* ParamName, BOOL bValue ) { PCOSA_DATAMODEL_DEVICEINFO pMyObject = (PCOSA_DATAMODEL_DEVICEINFO)g_pCosaBEManager->hDeviceInfo; #ifdef CONFIG_INTERNET2P0 if (AnscEqualString(ParamName, "X_RDKCENTRAL-COM_ConfigureWiFi", TRUE)) { if ( bValue == TRUE ) { CcspTraceWarning(("CaptivePortal:Wi-Fi SSID and Passphrase are not configured,setting ConfigureWiFi to true ...\n")); CcspTraceWarning(("RDKB_GW_MODE:Setting RDKB GW to CaptivePortal ...\n")); printf("Wi-Fi SSID and Passphrase are not configured,setting ConfigureWiFi to true ...\n"); pMyObject->bWiFiConfigued = bValue; printf("%s calling redirect_url.sh script to start redirection\n",__FUNCTION__); system("source /etc/redirect_url.sh &"); return TRUE; } else if ( bValue == FALSE ) { CcspTraceWarning(("CaptivePortal:Wi-Fi SSID and Passphrase are configured,setting ConfigureWiFi to false ...\n")); CcspTraceWarning(("RDKB_GW_MODE:Setting RDKB GW to Online ...\n")); printf("Wi-Fi SSID and Passphrase are configured,setting ConfigureWiFi to false ...\n"); pMyObject->bWiFiConfigued = bValue; printf("%s calling revert_redirect.sh script to remove the redirection changes\n",__FUNCTION__); system("source /etc/revert_redirect.sh &"); return TRUE; } return FALSE; } if (AnscEqualString(ParamName, "X_RDKCENTRAL-COM_CaptivePortalEnable", TRUE)) { if( pMyObject->bCaptivePortalEnable == bValue ) { return TRUE; } if (CosaDmlSetCaptivePortalEnable(bValue) != ANSC_STATUS_SUCCESS) return FALSE; pMyObject->bCaptivePortalEnable = bValue; return TRUE; } if (AnscEqualString(ParamName, "X_RDKCENTRAL-COM_CloudUICapable", TRUE)) { // We should not allow SET of Capable flag. #if 0 if( bValue == TRUE) { if (syscfg_set(NULL, "cloud_capable_flag", "1") != 0) { AnscTraceWarning(("syscfg_set failed\n")); } else { if (syscfg_commit() != 0) { AnscTraceWarning(("syscfg_commit failed\n")); } pMyObject->bCloudCapable = bValue; } } else { if (syscfg_set(NULL, "cloud_capable_flag", "0") != 0) { AnscTraceWarning(("syscfg_set failed\n")); } else { if (syscfg_commit() != 0) { AnscTraceWarning(("syscfg_commit failed\n")); } pMyObject->bCloudCapable = bValue; } } #endif return TRUE; } if (AnscEqualString(ParamName, "X_RDKCENTRAL-COM_CloudUIEnable", TRUE)) { if ( pMyObject->bCloudCapable == TRUE ) { if( bValue == TRUE) { if (syscfg_set(NULL, "cloud_enable_flag", "1") != 0) { AnscTraceWarning(("syscfg_set failed\n")); } else { if (syscfg_commit() != 0) { AnscTraceWarning(("syscfg_commit failed\n")); } pMyObject->bCloudEnable = bValue; CcspTraceWarning(("CaptivePortal:Enabling CloudUIEnable to start redirection to Cloud URL ...\n")); } } else { if (syscfg_set(NULL, "cloud_enable_flag", "0") != 0) { AnscTraceWarning(("syscfg_set failed\n")); } else { if (syscfg_commit() != 0) { AnscTraceWarning(("syscfg_commit failed\n")); } pMyObject->bCloudEnable = bValue; CcspTraceWarning(("CaptivePortal:Disabling CloudUIEnable to stop redirection to Cloud URL ...\n")); } } } else { printf("First enable cloud capable to modify this parameter\n"); return FALSE; } return TRUE; } #endif #ifdef CONFIG_CISCO_HOTSPOT /* check the parameter name and return the corresponding value */ if (AnscEqualString(ParamName, "X_COMCAST_COM_xfinitywifiEnable", TRUE)) { if (CosaDmlDiSetXfinityWiFiEnable(bValue) != ANSC_STATUS_SUCCESS) return FALSE; pMyObject->bxfinitywifiEnable = bValue; printf("%s : bxfinitywifiEnable value is : %d\n",__FUNCTION__,pMyObject->bxfinitywifiEnable); return TRUE; } #endif /* CcspTraceWarning(("Unsupported parameter '%s'\n", ParamName)); */ return FALSE; }