34 #include "safec_lib.h"
36 #define STATUS_STRING "Status"
37 #define EEDID_STRING "EEDID"
38 #define COMCAST_EDID_STRING "X_COMCAST-COM_EDID"
39 #define EDID_BYTES_STRING "EDID_BYTES"
40 #define SUPPORTED_RES_STRING "SupportedResolutions"
41 #define PREF_RES_STRING "PreferredResolution"
42 #define VIDEO_LATENCY_STRING "VideoLatency"
43 #define CECSUPPORT_STRING "CECSupport"
44 #define AUTO_LIP_SYNC_STRING "AutoLipSyncSupport"
45 #define HDMI3D_STRING "HDMI3DPresent"
46 #define PRESENT_STRING "Present"
47 #define ABSENT_STRING "Absent"
50 #define UPDATE_FORMAT_STRING "%s.%d.%s%s"
64 rc=strcpy_s(backupDisplayDeviceStatus,
sizeof(backupDisplayDeviceStatus),
" ");
69 rc=strcpy_s(backupEDID,
sizeof(backupEDID),
" ");
74 rc=strcpy_s(backupEDIDBytes,
sizeof(backupEDIDBytes),
" ");
79 rc=strcpy_s(backupSupportedResolution,
sizeof(backupSupportedResolution),
" ");
84 rc=strcpy_s(backupPreferredResolution,
sizeof(backupPreferredResolution),
" ");
90 bCalledDisplayDeviceStatus =
false;
92 bCalledEDIDBytes =
false;
93 bCalledSupportedResolution =
false;
94 bCalledPreferredResolution =
false;
113 stMsgData->
faultCode = fcInvalidParameterName;
114 int ret = NOT_HANDLED;
134 int ret = NOT_HANDLED;
135 if (strcasecmp(paramName, STATUS_STRING) == 0)
137 ret = getStatus(stMsgData);
139 else if (strcasecmp(paramName, EEDID_STRING) == 0)
141 ret = getX_COMCAST_COM_EDID(stMsgData);
143 else if (strcasecmp(paramName, EDID_BYTES_STRING) == 0)
145 ret = getEDID_BYTES(stMsgData);
147 else if (strcasecmp(paramName, COMCAST_EDID_STRING) == 0)
149 ret = getX_COMCAST_COM_EDID(stMsgData);
151 else if (strcasecmp(paramName, SUPPORTED_RES_STRING) == 0)
153 ret = getSupportedResolutions(stMsgData);
155 else if (strcasecmp(paramName, PREF_RES_STRING) == 0)
157 ret = getPreferredResolution(stMsgData);
159 else if (strcasecmp(paramName, VIDEO_LATENCY_STRING) == 0)
163 stMsgData->
faultCode = fcInvalidParameterName;
165 else if (strcasecmp(paramName, CECSUPPORT_STRING) == 0)
169 stMsgData->
faultCode = fcInvalidParameterName;
171 else if (strcasecmp(paramName, AUTO_LIP_SYNC_STRING) == 0)
175 stMsgData->
faultCode = fcInvalidParameterName;
177 else if (strcasecmp(paramName, HDMI3D_STRING) == 0)
181 stMsgData->
faultCode = fcInvalidParameterName;
185 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%d] Parameter : \'%s\' is Not Supported \n", __FUNCTION__, __LINE__, stMsgData->
paramName);
186 stMsgData->
faultCode = fcInvalidParameterName;
204 char tmp_buff[PARAM_LEN];
206 memset(&msgData,0,
sizeof(msgData));
207 memset(tmp_buff,0,PARAM_LEN);
211 getStatus(&msgData,&bChanged);
214 snprintf(tmp_buff, PARAM_LEN, UPDATE_FORMAT_STRING, baseName, dev_id, DISPLAYDEVICE_OBJECT_NAME, STATUS_STRING);
221 memset(&msgData,0,
sizeof(msgData));
222 memset(tmp_buff,0,PARAM_LEN);
226 getX_COMCAST_COM_EDID(&msgData,&bChanged);
229 snprintf(tmp_buff, PARAM_LEN, UPDATE_FORMAT_STRING, baseName, dev_id, DISPLAYDEVICE_OBJECT_NAME, EEDID_STRING);
236 memset(&msgData,0,
sizeof(msgData));
237 memset(tmp_buff,0,PARAM_LEN);
241 getEDID_BYTES(&msgData,&bChanged);
244 snprintf(tmp_buff, PARAM_LEN, UPDATE_FORMAT_STRING, baseName, dev_id, DISPLAYDEVICE_OBJECT_NAME, EDID_BYTES_STRING);
251 memset(&msgData,0,
sizeof(msgData));
252 memset(tmp_buff,0,PARAM_LEN);
256 getSupportedResolutions(&msgData,&bChanged);
259 snprintf(tmp_buff, PARAM_LEN, UPDATE_FORMAT_STRING, baseName, dev_id, DISPLAYDEVICE_OBJECT_NAME, SUPPORTED_RES_STRING);
266 memset(&msgData,0,
sizeof(msgData));
267 memset(tmp_buff,0,PARAM_LEN);
271 getPreferredResolution(&msgData,&bChanged);
274 snprintf(tmp_buff, PARAM_LEN, UPDATE_FORMAT_STRING,baseName, dev_id, DISPLAYDEVICE_OBJECT_NAME, PREF_RES_STRING);
295 int hostIf_STBServiceDisplayDevice::getStatus(
HOSTIF_MsgData_t *stMsgData,
bool *pChanged)
300 strncpy(stMsgData->
paramValue, PRESENT_STRING, PARAM_LEN);
303 strncpy(stMsgData->
paramValue, ABSENT_STRING, PARAM_LEN);
306 stMsgData->
paramtype = hostIf_StringType;
308 if(bCalledDisplayDeviceStatus && pChanged && strcmp(backupDisplayDeviceStatus, stMsgData->
paramValue))
312 bCalledDisplayDeviceStatus =
true;
313 strncpy(backupDisplayDeviceStatus, stMsgData->
paramValue, _BUF_LEN_16-1);
314 backupDisplayDeviceStatus[_BUF_LEN_16-1] =
'\0';
315 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s] In getHDMIDisplayDeviceStatus(): Value: %s \n",__FUNCTION__, stMsgData->
paramValue);
317 catch (
const std::exception e) {
318 RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,
"[%s] Exception\n",__FUNCTION__);
337 int hostIf_STBServiceDisplayDevice::getX_COMCAST_COM_EDID(
HOSTIF_MsgData_t *stMsgData,
bool *pChanged)
351 snprintf(stMsgData->
paramValue, PARAM_LEN,
"pcode=0x%x,pserial=0x%x,year=%d,week=%d", productCode, serialNumber, manufactureYear, manufactureWeek);
355 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s] HDMI Display is NOT connected\n",__FUNCTION__);
357 stMsgData->
paramtype = hostIf_StringType;
359 if(bCalledEDID && pChanged && strcmp(backupEDID, stMsgData->
paramValue))
364 strncpy(backupEDID,stMsgData->
paramValue,_BUF_LEN_256-1);
365 backupEDID[_BUF_LEN_16-1] =
'\0';
366 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s] In getHDMIDisplayDeviceX_COMCAST_COM_EDID(): Value: %s \n",__FUNCTION__, stMsgData->
paramValue);
368 catch (
const std::exception e) {
369 RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,
"[%s] Exception\n",__FUNCTION__);
388 int hostIf_STBServiceDisplayDevice::getEDID_BYTES(
HOSTIF_MsgData_t *stMsgData,
bool *pChanged)
391 const size_t valueSize =
sizeof(stMsgData->
paramValue);
392 memset(stMsgData->
paramValue,
'\0', valueSize);
395 std::vector<unsigned char> bytes;
397 size_t len = bytes.size();
398 if (len > valueSize/2) {
399 RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,
"[%s] HDMI Display has EDID of %lu bytes. We only support %lu bytes!\n",__FUNCTION__, len, valueSize/2);
400 RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,
"[%s] Rest of EDID will be cut\n", __FUNCTION__);
403 for(
int j = 0; j < len; j++)
404 sprintf(&stMsgData->
paramValue[2*j],
"%02X", bytes[j]);
407 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s] HDMI Display is NOT connected\n",__FUNCTION__);
409 stMsgData->
paramtype = hostIf_StringType;
411 if(bCalledEDIDBytes && pChanged && strcmp(backupEDIDBytes, stMsgData->
paramValue))
415 bCalledEDIDBytes =
true;
416 strncpy(backupEDIDBytes,stMsgData->
paramValue,_BUF_LEN_256-1);
417 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s] In getHDMIDisplayDeviceEDIDBytes(): Value: %s \n",__FUNCTION__, stMsgData->
paramValue);
419 catch (
const std::exception e) {
420 RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,
"[%s] Exception\n",__FUNCTION__);
438 int hostIf_STBServiceDisplayDevice::getSupportedResolutions(
HOSTIF_MsgData_t *stMsgData,
bool *pChanged)
440 size_t iElementInList = 0;
441 size_t iResolutionsListSize = 0;
442 char aiResolution[MAX_RESOLUTION_LENGTH] = {
'\0'};
446 iResolutionsListSize = vResolutions.
size();
448 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s] : List Size: %d \n",__FUNCTION__, iResolutionsListSize);
449 memset(stMsgData->
paramValue, 0, TR69HOSTIFMGR_MAX_PARAM_LEN);
451 for(iElementInList = 0; iElementInList < iResolutionsListSize; iElementInList++)
454 snprintf(aiResolution, MAX_RESOLUTION_LENGTH,
"%s%s/%sHz",
458 strncat(stMsgData->
paramValue, aiResolution, TR69HOSTIFMGR_MAX_PARAM_LEN-strlen(stMsgData->
paramValue)-1);
459 if(iElementInList < (iResolutionsListSize-1))
460 strncat(stMsgData->
paramValue,
",", TR69HOSTIFMGR_MAX_PARAM_LEN-strlen(stMsgData->
paramValue)-1);
463 stMsgData->
paramtype = hostIf_StringType;
465 if(bCalledSupportedResolution && pChanged && strcmp(backupSupportedResolution, stMsgData->
paramValue))
469 bCalledSupportedResolution =
true;
470 strncpy(backupSupportedResolution,stMsgData->
paramValue,_BUF_LEN_16-1);
471 backupSupportedResolution[_BUF_LEN_16-1] =
'\0';
472 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s] : Value: %s \n",__FUNCTION__, stMsgData->
paramValue);
474 catch (
const std::exception e) {
475 RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,
"[%s] Exception\n",__FUNCTION__);
492 int hostIf_STBServiceDisplayDevice::getPreferredResolution(
HOSTIF_MsgData_t *stMsgData,
bool *pChanged)
497 snprintf(stMsgData->
paramValue, TR69HOSTIFMGR_MAX_PARAM_LEN,
"%s%s/%sHz",
501 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s] : Value: %s \n",__FUNCTION__, stMsgData->
paramValue);
502 stMsgData->
paramtype = hostIf_StringType;
504 if(bCalledPreferredResolution && pChanged && strcmp(stMsgData->
paramValue, backupPreferredResolution))
508 bCalledPreferredResolution =
true;
509 strncpy(backupPreferredResolution, stMsgData->
paramValue, _BUF_LEN_16-1);
510 backupPreferredResolution[_BUF_LEN_16-1] =
'\0';
512 catch (
const std::exception e) {
513 RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,
"[%s] Exception\n",__FUNCTION__);