Skip to content

Commit 7e0ef17

Browse files
aishwariya15ababu250
authored andcommitted
RDKServices changes - getHdmiVersion
1 parent 0dd73c6 commit 7e0ef17

File tree

4 files changed

+101
-1
lines changed

4 files changed

+101
-1
lines changed

AVInput/AVInput.cpp

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#define AVINPUT_METHOD_GET_EDID_VERSION "getEdidVersion"
4949
#define AVINPUT_METHOD_SET_EDID_ALLM_SUPPORT "setEdid2AllmSupport"
5050
#define AVINPUT_METHOD_GET_EDID_ALLM_SUPPORT "getEdid2AllmSupport"
51+
#define AVINPUT_METHOD_GET_HDMI_COMPATIBILITY_VERSION "getHdmiVersion"
5152
#define AVINPUT_METHOD_SET_MIXER_LEVELS "setMixerLevels"
5253
#define AVINPUT_METHOD_START_INPUT "startInput"
5354
#define AVINPUT_METHOD_STOP_INPUT "stopInput"
@@ -223,6 +224,7 @@ void AVInput::RegisterAll()
223224
Register<JsonObject, JsonObject>(_T(AVINPUT_METHOD_SET_MIXER_LEVELS), &AVInput::setMixerLevels, this);
224225
Register<JsonObject, JsonObject>(_T(AVINPUT_METHOD_SET_EDID_ALLM_SUPPORT), &AVInput::setEdid2AllmSupportWrapper, this);
225226
Register<JsonObject, JsonObject>(_T(AVINPUT_METHOD_GET_EDID_ALLM_SUPPORT), &AVInput::getEdid2AllmSupportWrapper, this);
227+
Register<JsonObject, JsonObject>(_T(AVINPUT_METHOD_GET_HDMI_COMPATIBILITY_VERSION), &AVInput::getHdmiVersionWrapper, this);
226228
Register<JsonObject, JsonObject>(_T(AVINPUT_METHOD_START_INPUT), &AVInput::startInput, this);
227229
Register<JsonObject, JsonObject>(_T(AVINPUT_METHOD_STOP_INPUT), &AVInput::stopInput, this);
228230
Register<JsonObject, JsonObject>(_T(AVINPUT_METHOD_SCALE_INPUT), &AVInput::setVideoRectangleWrapper, this);
@@ -1362,6 +1364,53 @@ uint32_t AVInput::setEdidVersionWrapper(const JsonObject& parameters, JsonObject
13621364
}
13631365
}
13641366

1367+
uint32_t AVInput::getHdmiVersionWrapper(const JsonObject& parameters, JsonObject& response)
1368+
{
1369+
LOGINFOMETHOD();
1370+
returnIfParamNotFound(parameters, "portId");
1371+
string sPortId = parameters["portId"].String();
1372+
int portId = 0;
1373+
1374+
try {
1375+
portId = stoi(sPortId);
1376+
}catch (const std::exception& err) {
1377+
LOGWARN("sPortId invalid paramater: %s ", sPortId.c_str());
1378+
returnResponse(false);
1379+
}
1380+
1381+
dsHdmiMaxCapabilityVersion_t hdmiCapVersion = HDMI_COMPATIBILITY_VERSION_14;
1382+
1383+
try {
1384+
device::HdmiInput::getInstance().getHdmiVersion(portId, &(hdmiCapVersion));
1385+
LOGWARN("AVInput::getHdmiVersion Hdmi Version:%d", hdmiCapVersion);
1386+
}
1387+
catch (const device::Exception& err) {
1388+
LOG_DEVICE_EXCEPTION1(std::to_string(portId));
1389+
returnResponse(false);
1390+
}
1391+
1392+
1393+
switch ((int)hdmiCapVersion){
1394+
case HDMI_COMPATIBILITY_VERSION_14:
1395+
response["HdmiCapabilityVersion"] = "1.4";
1396+
break;
1397+
case HDMI_COMPATIBILITY_VERSION_20:
1398+
response["HdmiCapabilityVersion"] = "2.0";
1399+
break;
1400+
case HDMI_COMPATIBILITY_VERSION_21:
1401+
response["HdmiCapabilityVersion"] = "2.1";
1402+
break;
1403+
}
1404+
1405+
1406+
if(hdmiCapVersion == HDMI_COMPATIBILITY_VERSION_MAX)
1407+
{
1408+
returnResponse(false);
1409+
}else{
1410+
returnResponse(true);
1411+
}
1412+
}
1413+
13651414
int AVInput::setEdidVersion(int iPort, int iEdidVer)
13661415
{
13671416
bool ret = true;

AVInput/AVInput.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ class AVInput: public PluginHost::IPlugin, public PluginHost::JSONRPC
8585
uint32_t getSupportedGameFeatures(const JsonObject& parameters, JsonObject& response);
8686
uint32_t getGameFeatureStatusWrapper(const JsonObject& parameters, JsonObject& response);
8787
uint32_t setMixerLevels(const JsonObject& parameters, JsonObject& response);
88+
uint32_t getHdmiVersionWrapper(const JsonObject& parameters, JsonObject& response);
8889
//End methods
8990

9091
JsonArray getInputDevices(int iType);

HdmiInput/HdmiInput.cpp

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#define HDMIINPUT_EVENT_ON_AVI_CONTENT_TYPE_CHANGED "hdmiContentTypeUpdate"
5757
#define HDMIINPUT_METHOD_GET_LOW_LATENCY_MODE "getTVLowLatencyMode"
5858
#define HDMIINPUT_METHOD_GET_AV_LATENCY "getAVLatency"
59+
#define HDMIINPUT_METHOD_GET_HDMI_COMPATIBILITY_VERSION "getHdmiVersion"
5960

6061
#define HDMICECSINK_CALLSIGN "org.rdk.HdmiCecSink"
6162
#define HDMICECSINK_CALLSIGN_VER HDMICECSINK_CALLSIGN".1"
@@ -126,7 +127,8 @@ namespace WPEFramework
126127
registerMethod(HDMIINPUT_METHOD_GAME_FEATURE_STATUS, &HdmiInput::getHdmiGameFeatureStatusWrapper, this);
127128
registerMethod(HDMIINPUT_METHOD_GET_AV_LATENCY, &HdmiInput::getAVLatency, this);
128129
registerMethod(HDMIINPUT_METHOD_GET_LOW_LATENCY_MODE, &HdmiInput::getTVLowLatencyMode, this);
129-
m_primVolume = DEFAULT_PRIM_VOL_LEVEL;
130+
registerMethod(HDMIINPUT_METHOD_GET_HDMI_COMPATIBILITY_VERSION, &HdmiInput::getHdmiVersionWrapper, this);
131+
m_primVolume = DEFAULT_PRIM_VOL_LEVEL;
130132
m_inputVolume = DEFAULT_INPUT_VOL_LEVEL;
131133
}
132134

@@ -1198,6 +1200,53 @@ namespace WPEFramework
11981200
}
11991201

12001202
}
1203+
uint32_t HdmiInput::getHdmiVersionWrapper(const JsonObject& parameters, JsonObject& response)
1204+
{
1205+
LOGINFOMETHOD();
1206+
returnIfParamNotFound(parameters, "portId");
1207+
string sPortId = parameters["portId"].String();
1208+
int portId = 0;
1209+
1210+
try {
1211+
portId = stoi(sPortId);
1212+
}catch (const std::exception& err) {
1213+
LOGWARN("sPortId invalid paramater: %s ", sPortId.c_str());
1214+
returnResponse(false);
1215+
}
1216+
1217+
dsHdmiMaxCapabilityVersion_t hdmiCapVersion = HDMI_COMPATIBILITY_VERSION_14;
1218+
1219+
try {
1220+
device::HdmiInput::getInstance().getHdmiVersion(portId, &(hdmiCapVersion));
1221+
LOGWARN("HdmiInput::getHdmiVersion Hdmi Version:%d", hdmiCapVersion);
1222+
}
1223+
catch (const device::Exception& err) {
1224+
LOG_DEVICE_EXCEPTION1(std::to_string(portId));
1225+
returnResponse(false);
1226+
}
1227+
1228+
1229+
switch ((int)hdmiCapVersion){
1230+
case HDMI_COMPATIBILITY_VERSION_14:
1231+
response["HdmiCapabilityVersion"] = "1.4";
1232+
break;
1233+
case HDMI_COMPATIBILITY_VERSION_20:
1234+
response["HdmiCapabilityVersion"] = "2.0";
1235+
break;
1236+
case HDMI_COMPATIBILITY_VERSION_21:
1237+
response["HdmiCapabilityVersion"] = "2.1";
1238+
break;
1239+
}
1240+
1241+
1242+
if(hdmiCapVersion == HDMI_COMPATIBILITY_VERSION_MAX)
1243+
{
1244+
returnResponse(false);
1245+
}else{
1246+
returnResponse(true);
1247+
}
1248+
}
1249+
12011250
uint32_t HdmiInput::getServiceState(PluginHost::IShell* shell, const string& callsign, PluginHost::IShell::state& state)
12021251
{
12031252
LOGINFO("entering getServiceState\n");

HdmiInput/HdmiInput.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ namespace WPEFramework {
7272
uint32_t getHdmiGameFeatureStatusWrapper(const JsonObject& parameters, JsonObject& response);
7373
uint32_t getAVLatency(const JsonObject& parameters, JsonObject& response);
7474
uint32_t getTVLowLatencyMode(const JsonObject& parameters, JsonObject& response);
75+
uint32_t getHdmiVersionWrapper(const JsonObject& parameters, JsonObject& response);
7576
//End methods
7677

7778
JsonArray getHDMIInputDevices();

0 commit comments

Comments
 (0)