36 #include "hostIf_utils.h"
45 #include "safec_lib.h"
46 #ifdef SNMP_ADAPTER_ENABLED
50 #ifdef USE_XRDK_BT_PROFILE
55 int DeviceClientReqHandler::curNumOfProcess[100] = {0,};
56 int DeviceClientReqHandler::curNumOfProcessor[10] = {0,};
57 updateCallback DeviceClientReqHandler::mUpdateCallback = NULL;
59 msgHandler* DeviceClientReqHandler::getInstance()
67 void DeviceClientReqHandler::reset()
69 hostIf_DeviceInfo::getLock();
70 memset(curNumOfProcess,0,
sizeof(curNumOfProcess));
71 memset(curNumOfProcessor,0,
sizeof(curNumOfProcessor));
72 hostIf_DeviceInfo::releaseLock();
89 memset(curNumOfProcess,0,
sizeof(curNumOfProcess));
90 memset(curNumOfProcessor,0,
sizeof(curNumOfProcessor));
107 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s()] Device manager DeInitializing\n", __FUNCTION__);
108 hostIf_DeviceInfo::closeAllInstances();
109 hostIf_DeviceProcessorInterface::closeAllInstances();
110 hostIf_DeviceProcessStatusInterface::closeAllInstances();
129 int ret = NOT_HANDLED;
130 const char *pSetting;
131 int instanceNumber = 0;
132 hostIf_DeviceInfo::getLock();
133 RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,
"[%s:%s:%d] Found string as %s\n", __FUNCTION__, __FILE__, __LINE__, stMsgData->
paramName);
135 if (stMsgData->
bsUpdate != HOSTIF_NONE)
137 if ( (stMsgData->
bsUpdate == HOSTIF_SRC_RFC && stMsgData->
requestor == HOSTIF_SRC_RFC) ||
138 (stMsgData->
bsUpdate == HOSTIF_SRC_ALL && (stMsgData->
requestor == HOSTIF_SRC_RFC || stMsgData->
requestor == HOSTIF_SRC_WEBPA)) )
144 hostIf_DeviceInfo::releaseLock();
147 ret = pIface->set_xRDKCentralComBootstrap(stMsgData);
150 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s()] Not setting the bootstrap param:%s [bsUpdate=%d, requestor=%d]\n", __FUNCTION__, stMsgData->
paramName, stMsgData->
bsUpdate, stMsgData->
requestor);
152 #ifdef SNMP_ADAPTER_ENABLED
153 else if(strncasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_RDK_SNMP",strlen(
"Device.DeviceInfo.X_RDK_SNMP"))==0)
162 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%s:%d] hostIf_snmpAdapter::getInstance is NULL for %s\n", __FUNCTION__, __FILE__, __LINE__, stMsgData->
paramName);
166 else if(strncasecmp(stMsgData->
paramName,
"Device.DeviceInfo",strlen(
"Device.DeviceInfo"))==0)
172 hostIf_DeviceInfo::releaseLock();
176 if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_COMCAST-COM_Reset") == 0 ||
177 strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_RDKCENTRAL-COM_Reset") == 0)
181 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_COMCAST-COM_FirmwareToDownload") == 0 ||
182 strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareToDownload") == 0)
186 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_COMCAST-COM_FirmwareDownloadStatus") == 0 ||
187 strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareDownloadStatus") == 0)
192 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareDownloadProtocol") == 0)
194 ret = pIface->set_Device_DeviceInfo_X_COMCAST_COM_FirmwareDownloadProtocol (stMsgData);
196 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareDownloadURL") == 0)
198 ret = pIface->set_Device_DeviceInfo_X_COMCAST_COM_FirmwareDownloadURL (stMsgData);
200 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_RDKCENTRAL-COM_PreferredGatewayType") == 0)
202 ret = pIface->set_Device_DeviceInfo_X_RDKCENTRAL_COM_PreferredGatewayType(stMsgData);
204 else if (strcasecmp(stMsgData->
paramName, xOpsDMUploadLogsNow_STR) == 0)
208 else if (strcasecmp(stMsgData->
paramName, xOpsDMMoCALogEnabled) == 0)
212 else if (strcasecmp(stMsgData->
paramName, xOpsDMMoCALogPeriod) == 0)
216 else if (strcasecmp(stMsgData->
paramName,xOpsReverseSshTrigger_STR) == 0)
220 else if (strcasecmp(stMsgData->
paramName,xOpsReverseSshArgs_STR) == 0)
224 else if (strncmp(stMsgData->
paramName,X_OPS_RPC_PROFILE, strlen(X_OPS_RPC_PROFILE)) == 0)
226 ret = pIface->set_xOpsRPC_Profile(stMsgData);
228 else if (strncasecmp(stMsgData->
paramName,xOpsForwardSshEnable_STR,strlen(xOpsForwardSshEnable_STR)) == 0)
230 ret = pIface->set_xOpsDeviceMgmtForwardSSHEnable(stMsgData);
232 else if (strcasecmp(stMsgData->
paramName,X_RDKDownloadManager_InstallPackage) == 0)
234 ret = pIface->set_xRDKDownloadManager_InstallPackage(stMsgData);
236 else if (strcasecmp(stMsgData->
paramName,IPREMOTE_SUPPORT) == 0)
238 ret = pIface->set_Device_DeviceInfo_X_RDKCENTRAL_COM_IPRemoteSupportEnable(stMsgData);
240 else if (strcasecmp(stMsgData->
paramName,PARTNER_ID) == 0)
244 else if (strcasecmp(stMsgData->
paramName,XRPOLLING_ACTION) == 0)
246 ret = pIface->set_Device_DeviceInfo_X_RDKCENTRAL_COM_XRPollingAction(stMsgData);
251 else if (strstr(stMsgData->
paramName,TR181_RFC_PREFIX) != NULL)
253 RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,
"[%s] parameter %s is being set with value %s \n", __FUNCTION__, stMsgData->
paramName, stMsgData->
paramValue);
254 ret = pIface->set_xRDKCentralComRFC(stMsgData);
256 #ifdef USE_XRDK_BT_PROFILE
257 else if(strncasecmp(stMsgData->
paramName,X_BT_ROOT_OBJ,strlen(X_BT_ROOT_OBJ))==0)
259 hostIf_DeviceInfoRdk_xBT *pIface = hostIf_DeviceInfoRdk_xBT::getInstance();
262 hostIf_DeviceInfo::releaseLock();
265 ret = pIface->handleSetMsg(stMsgData);
268 #ifdef USE_HWSELFTEST_PROFILE
269 else if (!strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_RDKCENTRAL-COM_xOpsDeviceMgmt.hwHealthTest.ExecuteTest"))
271 ret = pIface->set_xOpsDeviceMgmt_hwHealthTest_ExecuteTest(stMsgData);
273 else if (!strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_RDKCENTRAL-COM_xOpsDeviceMgmt.hwHealthTest.SetTuneType"))
275 ret = pIface->set_xOpsDeviceMgmt_hwHealthTest_SetTuneType(stMsgData);
277 else if (!strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_RDKCENTRAL-COM_xOpsDeviceMgmt.hwHealthTest.ExecuteTuneTest"))
279 ret = pIface->set_xOpsDeviceMgmt_hwHealthTest_ExecuteTuneTest(stMsgData);
282 else if (!strcasecmp(stMsgData->
paramName, xFirmwareDownloadNow_STR))
284 ret = pIface->set_xFirmwareDownloadNow(stMsgData);
286 else if (!strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareDownloadUseCodebig"))
288 ret = pIface->set_Device_DeviceInfo_X_RDKCENTRAL_COM_FirmwareDownloadUseCodebig(stMsgData);
290 else if (!strcasecmp(stMsgData->
paramName, FWDNLD_DEFER_REBOOT))
292 ret = pIface->set_Device_DeviceInfo_X_RDKCENTRAL_COM_FirmwareDownloadDeferReboot(stMsgData);
297 stMsgData->
faultCode = fcAttemptToSetaNonWritableParameter;
298 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s] Failed, since Attempt To Set a NonWritable Parameter \"%s\"\n", __FUNCTION__, stMsgData->
paramName);
307 hostIf_DeviceInfo::releaseLock();
328 int ret = NOT_HANDLED;
329 const char *pSetting;
330 int instanceNumber = 0;
331 hostIf_DeviceInfo::getLock();
332 RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,
"[%s:%s:%d] Found string as %s\n", __FUNCTION__, __FILE__, __LINE__, stMsgData->
paramName);
334 if (stMsgData->
bsUpdate != HOSTIF_NONE)
340 hostIf_DeviceInfo::releaseLock();
343 ret = pIface->get_xRDKCentralComBootstrap(stMsgData);
345 else if(matchComponent(stMsgData->
paramName,
"Device.DeviceInfo.ProcessStatus.Process",&pSetting,instanceNumber))
351 hostIf_DeviceInfo::releaseLock();
354 if(strcasecmp(pSetting,
"PID") == 0)
358 else if(strcasecmp(pSetting,
"Command") == 0)
362 else if(strcasecmp(pSetting,
"Size") == 0)
366 else if(strcasecmp(pSetting,
"Priority") == 0)
370 else if(strcasecmp(pSetting,
"CPUTime") == 0)
374 else if(strcasecmp(pSetting,
"State") == 0)
380 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%d] Parameter : \'%s\' is Not Supported \n", __FUNCTION__, __LINE__, stMsgData->
paramName);
381 stMsgData->
faultCode = fcInvalidParameterName;
385 else if(matchComponent(stMsgData->
paramName,
"Device.DeviceInfo.Processor",&pSetting,instanceNumber))
390 hostIf_DeviceInfo::releaseLock();
394 if(strcasecmp(pSetting,
"Architecture")==0)
400 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%d] Parameter : \'%s\' is Not Supported \n", __FUNCTION__, __LINE__, stMsgData->
paramName);
401 stMsgData->
faultCode = fcInvalidParameterName;
405 else if(strncasecmp(stMsgData->
paramName,
"Device.DeviceInfo.ProcessStatus",strlen(
"Device.DeviceInfo.ProcessStatus"))==0)
411 hostIf_DeviceInfo::releaseLock();
414 if(strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.ProcessStatus.ProcessNumberOfEntries")==0)
418 else if(strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.ProcessStatus.CPUUsage")==0)
424 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%d] Parameter : \'%s\' is Not Supported \n", __FUNCTION__, __LINE__, stMsgData->
paramName);
425 stMsgData->
faultCode = fcInvalidParameterName;
429 else if(strncasecmp(stMsgData->
paramName,xOpsForwardSshEnable_STR,strlen(xOpsForwardSshEnable_STR)) == 0)
432 ret = pIface->get_xOpsDeviceMgmtForwardSSHEnable(stMsgData);
434 else if(strncasecmp(stMsgData->
paramName,xOpsReverseSshStatus_STR,strlen(xOpsReverseSshStatus_STR)) == 0)
440 else if(strncasecmp(stMsgData->
paramName,APPARMOR_BLOCKLIST_PROCESS,strlen(APPARMOR_BLOCKLIST_PROCESS)) == 0)
443 ret = pIface->get_ApparmorBlockListStatus(stMsgData);
446 #ifdef USE_XRDK_BT_PROFILE
447 else if(strncasecmp(stMsgData->
paramName,X_BT_ROOT_OBJ,strlen(X_BT_ROOT_OBJ))==0)
449 hostIf_DeviceInfoRdk_xBT *pIface = hostIf_DeviceInfoRdk_xBT::getInstance();
452 hostIf_DeviceInfo::releaseLock();
455 ret = pIface->handleGetMsg(stMsgData);
458 #ifdef SNMP_ADAPTER_ENABLED
459 else if(strncasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_RDK_SNMP",strlen(
"Device.DeviceInfo.X_RDK_SNMP"))==0)
468 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%s:%d] hostIf_snmpAdapter::getInstance is NULL for %s\n", __FUNCTION__, __FILE__, __LINE__, stMsgData->
paramName);
472 else if(strncasecmp(stMsgData->
paramName,
"Device.DeviceInfo",strlen(
"Device.DeviceInfo"))==0)
478 hostIf_DeviceInfo::releaseLock();
481 if(strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_RDKCENTRAL-COM.BootStatus") == 0)
485 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_RDKCENTRAL-COM_PreferredGatewayType") == 0)
489 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.Manufacturer") == 0)
493 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.ManufacturerOUI") == 0)
497 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.ModelName") == 0)
501 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.Description") == 0)
505 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.ProductClass") == 0)
509 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.SerialNumber") == 0)
513 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.HardwareVersion") == 0)
517 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.SoftwareVersion") == 0)
521 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.AdditionalHardwareVersion") == 0)
525 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.AdditionalSoftwareVersion") == 0)
529 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.ProvisioningCode") == 0)
533 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.UpTime") == 0)
537 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.FirstUseDate") == 0)
541 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_COMCAST-COM_STB_MAC") == 0)
545 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_COMCAST-COM_STB_IP") == 0)
549 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_COMCAST-COM_FirmwareFilename") == 0 ||
550 strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareFilename") == 0)
554 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_COMCAST-COM_FirmwareToDownload") == 0 ||
555 strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareToDownload") == 0)
559 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_COMCAST-COM_FirmwareDownloadStatus") == 0 ||
560 strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareDownloadStatus") == 0)
564 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareDownloadURL") == 0)
568 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareDownloadProtocol") == 0)
572 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareDownloadUseCodebig") == 0)
576 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareDownloadPercent") == 0)
578 ret = pIface->get_Device_DeviceInfo_X_COMCAST_COM_FirmwareDownloadPercent (stMsgData);
580 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_RDKCENTRAL-COM_FirmwareUpdateState") == 0)
582 ret = pIface->get_Device_DeviceInfo_X_RDKCENTRAL_COM_FirmwareUpdateState (stMsgData);
584 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_RDKCENTRAL-COM_RDKVersion") == 0)
588 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_COMCAST-COM_Reset") == 0 ||
589 strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_RDKCENTRAL-COM_Reset") == 0)
593 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_COMCAST-COM_PowerStatus") == 0)
597 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.VendorConfigFileNumberOfEntries") == 0)
601 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.SupportedDataModelNumberOfEntries") == 0)
605 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.ProcessorNumberOfEntries") == 0)
609 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.VendorLogFileNumberOfEntries") == 0)
613 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.MemoryStatus.Total") == 0)
617 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.MemoryStatus.Free") == 0)
621 else if (strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_RDKCENTRAL-COM.CPUTemp") == 0)
625 else if (strcasecmp(stMsgData->
paramName,xOpsDMLogsUploadStatus_STR) == 0)
629 else if (strcasecmp(stMsgData->
paramName, xOpsDMMoCALogEnabled) == 0)
633 else if (strcasecmp(stMsgData->
paramName, xOpsDMMoCALogPeriod) == 0)
637 else if (strcasecmp(stMsgData->
paramName,xOpsDMUploadLogsNow_STR) == 0)
641 else if (strcasecmp(stMsgData->
paramName,IPREMOTE_SUPPORT) == 0)
643 ret = pIface->get_Device_DeviceInfo_X_RDKCENTRAL_COM_IPRemoteSupportEnable(stMsgData);
645 else if (strcasecmp(stMsgData->
paramName,IPREMOTE_IPADDRESS) == 0)
647 ret= pIface->get_Device_DeviceInfo_X_RDKCENTRAL_COM_IPRemoteSupportIpaddress(stMsgData);
649 else if (strcasecmp(stMsgData->
paramName,IPREMOTE_MACADDRESS) == 0)
651 ret= pIface->get_Device_DeviceInfo_X_RDKCENTRAL_COM_IPRemoteSupportMACaddress(stMsgData);
653 else if ( !strcasecmp(stMsgData->
paramName, PARTNER_ID) )
655 ret= pIface->get_Device_DeviceInfo_X_RDKCENTRAL_COM_Syndication_PartnerId(stMsgData);
657 else if (strcasecmp(stMsgData->
paramName,XRPOLLING_ACTION) == 0)
659 ret = pIface->get_Device_DeviceInfo_X_RDKCENTRAL_COM_XRPollingAction(stMsgData);
661 else if (strcasecmp(stMsgData->
paramName,XRDK_BOOT_TIME) == 0)
663 ret = pIface->get_X_RDKCENTRAL_COM_BootTime(stMsgData);
664 }
else if (strstr(stMsgData->
paramName,TR181_RFC_PREFIX) != NULL)
667 ret = pIface->get_xRDKCentralComRFC(stMsgData);
670 #ifdef USE_HWSELFTEST_PROFILE
671 else if (!strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_RDKCENTRAL-COM_xOpsDeviceMgmt.hwHealthTest.Results"))
673 ret = pIface->get_xOpsDeviceMgmt_hwHealthTest_Results(stMsgData);
675 else if (!strcasecmp(stMsgData->
paramName,
"Device.DeviceInfo.X_RDKCENTRAL-COM_xOpsDeviceMgmt.hwHealthTestTune.TuneResults"))
677 ret = pIface->get_xOpsDeviceMgmt_hwHealthTestTune_TuneResults(stMsgData);
680 else if (strncmp(stMsgData->
paramName,X_OPS_RPC_PROFILE, strlen(X_OPS_RPC_PROFILE)) == 0)
684 else if (strncmp(stMsgData->
paramName,X_RDKCENTRAL_COM_LastRebootReason, strlen(X_RDKCENTRAL_COM_LastRebootReason)) == 0)
686 ret = pIface->get_X_RDKCENTRAL_COM_LastRebootReason(stMsgData);
688 else if(strncmp(stMsgData->
paramName,X_RDKCENTRAL_COM_Experience, strlen(X_RDKCENTRAL_COM_Experience)) == 0)
690 ret = pIface->get_X_RDKCENTRAL_COM_experience(stMsgData);
692 else if (!strcasecmp(stMsgData->
paramName, FWDNLD_DEFER_REBOOT))
694 ret = pIface->get_Device_DeviceInfo_X_RDKCENTRAL_COM_FirmwareDownloadDeferReboot(stMsgData);
696 else if (!strcasecmp(stMsgData->
paramName, X_RDK_FirmwareName))
702 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%d] Parameter : \'%s\' is Not Supported \n", __FUNCTION__, __LINE__, stMsgData->
paramName);
703 stMsgData->
faultCode = fcInvalidParameterName;
707 hostIf_DeviceInfo::releaseLock();
711 int DeviceClientReqHandler::handleGetAttributesMsg(
HOSTIF_MsgData_t *stMsgData)
713 int ret = NOT_HANDLED;
714 int instanceNumber = 0;
716 hostIf_DeviceInfo::getLock();
721 hostIf_DeviceInfo::releaseLock();
725 GHashTable* notifyhash = pIface->getNotifyHash();
726 if(notifyhash != NULL)
728 int* notifyvalue = (
int*) g_hash_table_lookup(notifyhash,stMsgData->
paramName);
730 stMsgData->
paramtype = hostIf_IntegerType;
737 hostIf_DeviceInfo::releaseLock();
741 int DeviceClientReqHandler::handleSetAttributesMsg(
HOSTIF_MsgData_t *stMsgData)
743 int ret = NOT_HANDLED;
745 int instanceNumber = 0;
746 const char *pSetting;
747 hostIf_DeviceInfo::getLock();
753 hostIf_DeviceInfo::releaseLock();
756 GHashTable* notifyhash = pIface->getNotifyHash();
757 if(notifyhash != NULL)
760 notifyValuePtr = (
int*) malloc(1 *
sizeof(
int));
765 char *notifyKey = NULL;
766 notifyKey = (
char*) calloc(
sizeof(
char),strlen(stMsgData->
paramName)+1);
767 if((NULL != notifyValuePtr) && (NULL != notifyKey))
775 g_hash_table_insert(notifyhash,notifyKey,notifyValuePtr);
781 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%s:%d] Not able to allocate Notify pointer %s\n", __FUNCTION__, __FILE__, __LINE__, stMsgData->
paramName);
784 free(notifyValuePtr);
789 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%s:%d] Not able to get notifyhash %s\n", __FUNCTION__, __FILE__, __LINE__, stMsgData->
paramName);
791 hostIf_DeviceInfo::releaseLock();
796 void DeviceClientReqHandler::registerUpdateCallback(updateCallback cb)
798 mUpdateCallback = cb;
803 void DeviceClientReqHandler::checkForUpdates()
809 const char *pSetting;
810 int instanceNumber = 0;
811 GHashTable* notifyhash = NULL;
812 char tmp_buff[TR69HOSTIFMGR_MAX_PARAM_LEN];
815 hostIf_DeviceProcess::getLock();
817 memset(&msgData,0,
sizeof(msgData));
818 memset(tmp_buff,0,TR69HOSTIFMGR_MAX_PARAM_LEN);
823 char tmp[TR69HOSTIFMGR_MAX_PARAM_LEN] =
"";
824 sprintf(tmp_buff,
"Device.DeviceInfo.ProcessStatus.Process");
825 while(curNumOfProcess[index] > tmpNoDev)
827 sprintf(tmp,
"%s.%d.",tmp_buff,tmpNoDev);
831 while(curNumOfProcess[index] < tmpNoDev)
833 sprintf(tmp,
"%s.",tmp_buff);
837 curNumOfProcess[index] = get_int(msgData.
paramValue);
839 hostIf_DeviceProcess::releaseLock();
840 hostIf_DeviceInfo::getLock();
844 char tmp[TR69HOSTIFMGR_MAX_PARAM_LEN] =
"";
845 sprintf(tmp_buff,
"Device.DeviceInfo.Processor");
846 while(curNumOfProcessor[index] > tmpNoDev)
848 sprintf(tmp,
"%s.%d.",tmp_buff,tmpNoDev);
852 while(curNumOfProcessor[index] < tmpNoDev)
854 sprintf(tmp,
"%s.",tmp_buff);
858 curNumOfProcessor[index] = get_int(msgData.
paramValue);
861 #ifdef HAVE_VALUE_CHANGE_EVENT
869 notifyhash = dIface->getNotifyHash();
873 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%s] Unable to get Device Info Instance\n", __FUNCTION__, __FILE__);
877 if(NULL != notifyhash)
879 GHashTableIter notifyHashIterator;
881 gpointer notifyEnable;
884 g_hash_table_iter_init (¬ifyHashIterator, notifyhash);
885 while (g_hash_table_iter_next (¬ifyHashIterator, ¶mName, ¬ifyEnable))
887 int* isNotifyEnabled = (
int *)notifyEnable;
890 if(matchComponent((
const char*)paramName,
"Device.DeviceInfo.ProcessStatus.Process",&pSetting,instanceNumber))
895 if (strcasecmp(pSetting,
"PID") == 0)
897 memset(&msgData,0,
sizeof(msgData));
902 if(mUpdateCallback && (*isNotifyEnabled == 1))
908 if (strcasecmp(pSetting,
"Command") == 0)
910 memset(&msgData,0,
sizeof(msgData));
915 if(mUpdateCallback && (*isNotifyEnabled == 1))
921 if (strcasecmp(pSetting,
"Size") == 0)
923 memset(&msgData,0,
sizeof(msgData));
928 if(mUpdateCallback && (*isNotifyEnabled == 1))
934 if (strcasecmp(pSetting,
"Size") == 0)
936 memset(&msgData,0,
sizeof(msgData));
941 if(mUpdateCallback && (*isNotifyEnabled == 1))
947 if (strcasecmp(pSetting,
"Priority") == 0)
949 memset(&msgData,0,
sizeof(msgData));
954 if(mUpdateCallback && (*isNotifyEnabled == 1))
960 if (strcasecmp(pSetting,
"CPUTime") == 0)
962 memset(&msgData,0,
sizeof(msgData));
967 if(mUpdateCallback && (*isNotifyEnabled == 1))
973 if (strcasecmp(pSetting,
"State") == 0)
975 memset(&msgData,0,
sizeof(msgData));
980 if(mUpdateCallback && (*isNotifyEnabled == 1))
988 else if(matchComponent((
const char*)paramName,
"Device.DeviceInfo.Processor",&pSetting,instanceNumber))
993 if (strcasecmp(pSetting,
"Architecture") == 0)
995 memset(&msgData,0,
sizeof(msgData));
1000 if(mUpdateCallback && (*isNotifyEnabled == 1))
1008 else if(matchComponent((
const char*)paramName,
"Device.DeviceInfo.ProcessStatus",&pSetting,instanceNumber))
1013 if (strcasecmp(pSetting,
"CPUUsage") == 0)
1015 memset(&msgData,0,
sizeof(msgData));
1020 if(mUpdateCallback && (*isNotifyEnabled == 1))
1028 else if(matchComponent((
const char*)paramName,
"Device.DeviceInfo",&pSetting,instanceNumber))
1033 if (strcasecmp(pSetting,
"Manufacturer") == 0)
1035 memset(&msgData,0,
sizeof(msgData));
1040 if(mUpdateCallback && (*isNotifyEnabled == 1))
1046 if (strcasecmp(pSetting,
"ModelName") == 0)
1048 memset(&msgData,0,
sizeof(msgData));
1053 if(mUpdateCallback && (*isNotifyEnabled == 1))
1059 if (strcasecmp(pSetting,
"Description") == 0)
1061 memset(&msgData,0,
sizeof(msgData));
1066 if(mUpdateCallback && (*isNotifyEnabled == 1))
1072 if (strcasecmp(pSetting,
"ProductClass") == 0)
1074 memset(&msgData,0,
sizeof(msgData));
1079 if(mUpdateCallback && (*isNotifyEnabled == 1))
1085 if (strcasecmp(pSetting,
"SerialNumber") == 0)
1087 memset(&msgData,0,
sizeof(msgData));
1092 if(mUpdateCallback && (*isNotifyEnabled == 1))
1098 if (strcasecmp(pSetting,
"HardwareVersion") == 0)
1100 memset(&msgData,0,
sizeof(msgData));
1105 if(mUpdateCallback && (*isNotifyEnabled == 1))
1111 if (strcasecmp(pSetting,
"SoftwareVersion") == 0)
1113 memset(&msgData,0,
sizeof(msgData));
1118 if(mUpdateCallback && (*isNotifyEnabled == 1))
1124 if (strcasecmp(pSetting,
"AdditionalSoftwareVersion") == 0)
1126 memset(&msgData,0,
sizeof(msgData));
1131 if(mUpdateCallback && (*isNotifyEnabled == 1))
1137 if (strcasecmp(pSetting,
"ProvisioningCode") == 0)
1139 memset(&msgData,0,
sizeof(msgData));
1144 if(mUpdateCallback && (*isNotifyEnabled == 1))
1150 if (strcasecmp(pSetting,
"UpTime") == 0)
1152 memset(&msgData,0,
sizeof(msgData));
1157 if(mUpdateCallback && (*isNotifyEnabled == 1))
1163 if (strcasecmp(pSetting,
"FirstUseDate") == 0)
1165 memset(&msgData,0,
sizeof(msgData));
1170 if(mUpdateCallback && (*isNotifyEnabled == 1))
1176 if (strcasecmp(pSetting,
"X_COMCAST-COM_STB_MAC") == 0)
1178 memset(&msgData,0,
sizeof(msgData));
1183 if(mUpdateCallback && (*isNotifyEnabled == 1))
1189 if (strcasecmp(pSetting,
"X_COMCAST-COM_STB_IP") == 0)
1191 memset(&msgData,0,
sizeof(msgData));
1196 if(mUpdateCallback && (*isNotifyEnabled == 1))
1202 if (strcasecmp(pSetting,
"X_COMCAST-COM_FirmwareFilename") == 0 ||
1203 strcasecmp(pSetting,
"X_RDKCENTRAL-COM_FirmwareFilename") == 0)
1205 memset(&msgData,0,
sizeof(msgData));
1210 if(mUpdateCallback && (*isNotifyEnabled == 1))
1216 if (strcasecmp(pSetting,
"X_COMCAST-COM_Reset") == 0 ||
1217 strcasecmp(pSetting,
"X_RDKCENTRAL-COM_Reset") == 0)
1219 memset(&msgData,0,
sizeof(msgData));
1224 if(mUpdateCallback && (*isNotifyEnabled == 1))
1230 if (strcasecmp(pSetting,
"VendorConfigFileNumberOfEntries") == 0)
1232 memset(&msgData,0,
sizeof(msgData));
1237 if(mUpdateCallback && (*isNotifyEnabled == 1))
1243 if (strcasecmp(pSetting,
"SupportedDataModelNumberOfEntries") == 0)
1245 memset(&msgData,0,
sizeof(msgData));
1250 if(mUpdateCallback && (*isNotifyEnabled == 1))
1256 if (strcasecmp(pSetting,
"VendorLogFileNumberOfEntries") == 0)
1258 memset(&msgData,0,
sizeof(msgData));
1263 if(mUpdateCallback && (*isNotifyEnabled == 1))
1269 if (strcasecmp(pSetting,
"VendorLogFileNumberOfEntries") == 0)
1271 memset(&msgData,0,
sizeof(msgData));
1276 if(mUpdateCallback && (*isNotifyEnabled == 1))
1288 hostIf_DeviceInfo::releaseLock();
1294 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%s] DeviceClientReqHandler Notify for Parameter :- %s..\n", __FILE__, __FUNCTION__,paramName);
1295 strncpy(eventData.paramName,paramName,
sizeof(eventData.paramName) -1);
1296 eventData.paramName[
sizeof(eventData.paramName) -1] =
'\0';
1300 strncpy(eventData.paramValue, paramValue,
sizeof(eventData.paramValue) -1);
1301 eventData.paramValue[
sizeof(eventData.paramValue) -1] =
'\0';