59 #include "illegalArgumentException.hpp"
67 #include "edid-parser.hpp"
128 uint8_t numHdmiInputs;
137 return (numHdmiInputs);
345 std::string resolutionStr;
350 resolutionStr =
"480";
354 resolutionStr =
"576";
358 resolutionStr =
"720";
362 resolutionStr =
"1080";
366 resolutionStr =
"3840x2160";
370 resolutionStr =
"4096x2160";
374 resolutionStr =
"unknown";
378 printf (
"%s:%d - ResolutionStr: %s\n", __PRETTY_FUNCTION__,__LINE__, resolutionStr.c_str());
379 return resolutionStr;
384 std::string FrameRateStr;
405 FrameRateStr =
"23.98";
409 FrameRateStr =
"29.97";
417 FrameRateStr =
"59.94";
425 printf (
"%s:%d - FrameRateStr: %s\n", __PRETTY_FUNCTION__,__LINE__, FrameRateStr.c_str());
429 static std::string getInterlacedStr (
bool interlaced)
431 std::string InterlacedStr = (interlaced) ?
"i" :
"p";
432 printf (
"%s:%d - InterlacedStr: %s\n", __PRETTY_FUNCTION__,__LINE__, InterlacedStr.c_str());
433 return InterlacedStr;
438 printf(
"%s ---> \n", __PRETTY_FUNCTION__);
440 std::string resolutionStr = getResolutionStr(resolution.
pixelResolution);
441 if(resolutionStr.compare(
"unknown") != 0){
446 printf (
"%s <--- %s\n", __PRETTY_FUNCTION__, resolutionStr.c_str());
447 return resolutionStr;
463 memset(&resolution, 0,
sizeof(resolution));
473 std::string resolutionStr = CreateResolutionStr (resolution);
474 printf(
"%s:%d - Resolution =%s\n", __PRETTY_FUNCTION__,__LINE__, resolutionStr.c_str());
475 return resolutionStr;
481 memset(&resolution, 0,
sizeof(resolution));
491 printf(
"%s:%d - pixelResolution =%d interlaced:%d frameRate:%d\n", __PRETTY_FUNCTION__, __LINE__, resolution.
pixelResolution, resolution.
interlaced, resolution.
frameRate);
494 void HdmiInput::getEDIDBytesInfo (
int iHdmiPort, std::vector<uint8_t> &edidArg)
const
497 printf(
"HdmiInput::getEDIDBytesInfo \r\n");
501 unsigned char* edid = NULL;
503 const char* exceptionstr =
"";
504 ret = dsGetEDIDBytesInfo (iHdmiPort, (
unsigned char**)(&edid), &length);
506 printf(
"HdmiInput::getEDIDBytesInfo dsGetEDIDBytesInfo returned NULL \r\n");
507 exceptionstr =
"EDID is NULL";
511 printf(
"HdmiInput::getEDIDBytesInfo has ret %d\r\n", ret);
513 if (length <= MAX_EDID_BYTES_LEN) {
514 printf(
"HdmiInput::getEDIDBytesInfo has %d bytes\r\n", length);
515 if (edid_parser::EDID_STATUS_OK == edid_parser::EDID_Verify(edid, length)) {
517 edidArg.insert(edidArg.begin(), edid, edid + length);
520 exceptionstr =
"EDID verification failed";
524 exceptionstr =
"EDID length > MAX_EDID_BYTES_LEN";
527 exceptionstr =
"dsGetEDIDBytesInfo failed";
535 void HdmiInput::getHDMISPDInfo (
int iHdmiPort, std::vector<uint8_t> &data) {
536 printf(
"HdmiInput::getHDMISPDInfo \r\n");
538 unsigned char* spdinfo = NULL;
539 const char* exceptionstr =
"";
540 dsError_t ret = dsGetHDMISPDInfo (iHdmiPort, (
unsigned char**)(&spdinfo));
541 if (NULL == spdinfo) {
542 printf(
"HdmiInput::dsGetHDMISPDInfo returned NULL \r\n");
543 exceptionstr =
"SPDInfo is NULL";
547 printf(
"HdmiInput::getHDMISPDInfo has ret %d\r\n", ret);
551 printf(
"HdmiInput::getHDMISPDInfo has %d bytes\r\n",
sizeof(spdinfo));
555 exceptionstr =
"size is greater";
558 exceptionstr =
"getHDMISPDInfo failed";
560 printf(
"HdmiInput::getHDMISPDInfo data: \r\n");
561 for (
int itr = 0; itr < data.size(); itr++) {
562 printf(
"%02X ", data[itr]);
572 void HdmiInput::setEdidVersion (
int iHdmiPort,
int iEdidVersion) {
573 printf (
"HdmiInput::setEdidVersion \r\n");
574 dsError_t ret = dsSetEdidVersion (iHdmiPort, iEdidVersion);
579 printf (
"%s:%d - Set EDID Version = %d\n", __PRETTY_FUNCTION__, __LINE__, iEdidVersion);
582 void HdmiInput::getEdidVersion (
int iHdmiPort,
int *iEdidVersion) {
583 printf (
"HdmiInput::getEdidVersion \r\n");
584 dsError_t ret = dsGetEdidVersion (iHdmiPort, iEdidVersion);
589 printf (
"%s:%d - EDID Version = %d\n", __PRETTY_FUNCTION__, __LINE__, *iEdidVersion);
592 void HdmiInput::getHdmiALLMStatus (
int iHdmiPort,
bool *allmStatus) {
593 printf (
"HdmiInput::getHdmiALLMStatus \r\n");
594 dsError_t ret = dsGetAllmStatus (iHdmiPort, allmStatus);
599 printf (
"%s:%d - ALLM Status = %d\n", __FUNCTION__, __LINE__, *allmStatus);
602 void HdmiInput::getSupportedGameFeatures (std::vector<std::string> &featureList) {
606 ret = dsGetSupportedGameFeaturesList(&feList);
614 token = strtok(feList.gameFeatureList,
",");
615 while(token != NULL) {
616 featureList.emplace_back(token);
617 token = strtok(NULL,
",");
620 if(featureList.size() != feList.gameFeatureCount){
621 printf (
"%s:%d - Number of Supported Game Features in list doesn't match with count from HAL", __FUNCTION__, __LINE__);