Skip to content

Commit 94ad199

Browse files
benjaminqcoxlw-storey
authored andcommitted
RDKTV-38695: Adding missing AVOutput functions
Reason for change: Adding in missing AVOutput apis from documentation Test Procedure: As in Jira Risks: None Priority: P1
1 parent ab30e86 commit 94ad199

File tree

3 files changed

+161
-3
lines changed

3 files changed

+161
-3
lines changed

AVOutput/AVOutputTV.cpp

Lines changed: 121 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,11 @@ namespace Plugin {
358358
registerMethod("resetAutoBacklightMode", &AVOutputTV::resetAutoBacklightMode, this);
359359
registerMethod("getAutoBacklightModeCaps", &AVOutputTV::getAutoBacklightModeCaps, this);
360360

361+
registerMethod("getFadeDisplayCaps", &AVOutputTV::getFadeDisplayCaps, this);
362+
registerMethod("fadeDisplay", &AVOutputTV::fadeDisplay, this);
363+
registerMethod("getWBMode", &AVOutputTV::getWBMode, this);
364+
registerMethod("setWBMode", &AVOutputTV::setWBMode, this);
365+
361366
LOGINFO("Exit\n");
362367
}
363368

@@ -3890,7 +3895,7 @@ namespace Plugin {
38903895

38913896
tvError_t ret = tvERROR_NONE;
38923897

3893-
if (isPlatformSupport("AutoBacklightMode") != 0) {
3898+
if (isPlatformSupport("AutoBacklightMode") != 0) {
38943899
returnResponse(false);
38953900
}
38963901

@@ -3945,7 +3950,121 @@ namespace Plugin {
39453950
{
39463951
returnResponse(true);
39473952
}
3948-
}
3953+
}
3954+
3955+
uint32_t AVOutputTV::getFadeDisplayCaps(const JsonObject& parameters, JsonObject& response)
3956+
{
3957+
LOGINFO("Entry");
3958+
capVectors_t info;
3959+
JsonObject rangeObj;
3960+
3961+
tvError_t ret = getParamsCaps("BacklightFade",info);
3962+
if(ret != tvERROR_NONE) {
3963+
returnResponse(false);
3964+
}
3965+
3966+
response["platformSupport"] = (info.isPlatformSupportVector[0].compare("true") == 0 ) ? true : false;
3967+
response["from"] = stoi(info.rangeVector[0]);
3968+
response["to"] = stoi(info.rangeVector[1]);
3969+
rangeObj["from"] = stoi(info.rangeVector[2]);
3970+
rangeObj["to"] = stoi(info.rangeVector[3]);
3971+
response["durationInfo"] = rangeObj;
3972+
LOGINFO("Exit\n");
3973+
returnResponse(true);
3974+
}
3975+
3976+
uint32_t AVOutputTV::fadeDisplay(const JsonObject& parameters, JsonObject& response)
3977+
{
3978+
LOGINFO("Entry\n");
3979+
std::string from,to,duration;
3980+
int fromValue = 0,toValue = 0, durationValue = 0;
3981+
3982+
if (isPlatformSupport("BacklightFade") != 0) {
3983+
LOGERR("Platform Support (%s) false", __FUNCTION__);
3984+
returnResponse(false);
3985+
}
3986+
from = parameters.HasLabel("from") ? parameters["from"].String() : "";
3987+
if (from.empty() || validateFadeDisplayInputParameter("BacklightFade", "Range", std::stoi(from)) != 0) {
3988+
LOGERR("%s: Range validation failed for BacklightFade From\n", __FUNCTION__);
3989+
LOGWARN("%s: Using default value, from = 100\n", __FUNCTION__);
3990+
fromValue = 100;
3991+
} else
3992+
fromValue = std::stoi(from);
3993+
3994+
to = parameters.HasLabel("to") ? parameters["to"].String() : "";
3995+
if(to.empty() || validateFadeDisplayInputParameter("BacklightFade", "Range", std::stoi(to)) != 0) {
3996+
LOGERR("%s: Range validation failed for BacklightFade To\n", __FUNCTION__);
3997+
LOGWARN("%s: Using default value, to = 0\n", __FUNCTION__);
3998+
toValue = 0;
3999+
} else
4000+
toValue = std::stoi(to);
4001+
4002+
duration = parameters.HasLabel("duration") ? parameters["duration"].String() : "";
4003+
if(duration.empty() || validateFadeDisplayInputParameter("BacklightFade", "Duration", std::stoi(duration)) != 0) {
4004+
LOGERR("%s: Range validation failed for BacklightFade Duration\n", __FUNCTION__);
4005+
LOGWARN("%s: Using default value, duration = 0\n", __FUNCTION__);
4006+
durationValue = 0;
4007+
} else
4008+
durationValue = std::stoi(duration);
4009+
4010+
LOGINFO("from = %d to = %d duration = %d\n" ,fromValue,toValue,durationValue);
4011+
tvError_t ret = SetBacklightFade(fromValue,toValue,durationValue);
4012+
if(ret != tvERROR_NONE) {
4013+
LOGERR("Failed to set BacklightFade \n");
4014+
returnResponse(false);
4015+
}
4016+
else {
4017+
LOGINFO("Exit : backlightFade Success \n");
4018+
returnResponse(true);
4019+
}
4020+
}
4021+
4022+
uint32_t AVOutputTV::getWBMode(const JsonObject& parameters, JsonObject& response)
4023+
{
4024+
LOGINFO("Entry - Is stubbed api will return 0'\n");
4025+
bool mode = 0;
4026+
tvError_t ret = GetCurrentWBCalibrationMode(&mode);
4027+
if(ret != tvERROR_NONE) {
4028+
LOGERR("Failed to get WBCalibrationMode \n");
4029+
returnResponse(false);
4030+
}
4031+
else
4032+
{
4033+
response["wbMode"] = (mode);
4034+
returnResponse(true);
4035+
}
4036+
}
4037+
4038+
uint32_t AVOutputTV::setWBMode(const JsonObject& parameters, JsonObject& response)
4039+
{
4040+
LOGINFO("Entry\n");
4041+
std::string value;
4042+
tvError_t ret = tvERROR_NONE;
4043+
bool mode = 0;
4044+
if(parameters.HasLabel("wbMode")) {
4045+
value = parameters["wbMode"].String();
4046+
if(value == "true") {
4047+
mode = 1;
4048+
} else if(value == "false") {
4049+
mode = 0;
4050+
} else {
4051+
LOGERR("Invalid WBMode param value\n");
4052+
returnResponse(false);
4053+
}
4054+
ret = EnableWBCalibrationMode(mode);
4055+
if(ret != tvERROR_NONE) {
4056+
LOGERR("enableWBmode failed\n");
4057+
returnResponse(false);
4058+
}
4059+
else{
4060+
LOGINFO("setWBmode to %s\n", mode ? "true" : "false");
4061+
returnResponse(true);
4062+
}
4063+
} else {
4064+
LOGERR("Invalid Param\n");
4065+
returnResponse(false);
4066+
}
4067+
}
39494068

39504069
uint32_t AVOutputTV::getVideoSource(const JsonObject& parameters,JsonObject& response)
39514070
{

AVOutput/AVOutputTV.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ class AVOutputTV : public AVOutputBase {
204204
DECLARE_JSON_RPC_METHOD(getHDRMode)
205205
DECLARE_JSON_RPC_METHOD(get2PointWB)
206206
DECLARE_JSON_RPC_METHOD(getAutoBacklightMode)
207+
DECLARE_JSON_RPC_METHOD(getWBMode)
207208

208209

209210
/*Get Capability API's*/
@@ -227,6 +228,7 @@ class AVOutputTV : public AVOutputBase {
227228
DECLARE_JSON_RPC_METHOD(get2PointWBCaps)
228229
DECLARE_JSON_RPC_METHOD(getHDRModeCaps)
229230
DECLARE_JSON_RPC_METHOD(getAutoBacklightModeCaps)
231+
DECLARE_JSON_RPC_METHOD(getFadeDisplayCaps)
230232

231233
/*Set API's*/
232234
DECLARE_JSON_RPC_METHOD(setBacklight)
@@ -247,6 +249,8 @@ class AVOutputTV : public AVOutputBase {
247249
DECLARE_JSON_RPC_METHOD(set2PointWB )
248250
DECLARE_JSON_RPC_METHOD(signalFilmMakerMode)
249251
DECLARE_JSON_RPC_METHOD(setAutoBacklightMode)
252+
DECLARE_JSON_RPC_METHOD(fadeDisplay)
253+
DECLARE_JSON_RPC_METHOD(setWBMode)
250254

251255
/*Reset API's*/
252256
DECLARE_JSON_RPC_METHOD(resetBacklight)
@@ -289,6 +293,7 @@ class AVOutputTV : public AVOutputBase {
289293
void spliltCapablities( capVectors_t& vectorInfo, capDetails_t stringInfo);
290294
void spliltStringsAndConvertToSet( std::string pqmodeInfo,std::string formatInfo,std::string sourceInfo,std::set<string> &pqmode, std::set<string> &format, std::set<string> &source);
291295
int validateIntegerInputParameter(std::string param, int inputValue);
296+
int validateFadeDisplayInputParameter(std::string param, std::string name, int inputValue);
292297
int fetchCapablities(string pqparam, capDetails_t& info);
293298
int validateInputParameter(std::string param, std::string inputValue);
294299
int validateWBParameter(std::string param,std::string control,int inputValue);

AVOutput/AVOutputTVHelper.cpp

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,30 @@ namespace Plugin {
615615
return 0;
616616
}
617617

618+
int AVOutputTV::validateFadeDisplayInputParameter(std::string param, std::string name, int inputValue)
619+
{
620+
capVectors_t info;
621+
tvError_t ret = getParamsCaps(param, info);
622+
623+
if (ret != tvERROR_NONE) {
624+
LOGERR("Failed to fetch the range capability[%s] \n", param.c_str());
625+
return -1;
626+
}
627+
if ( (name == "Range")){
628+
if (inputValue < std::stoi(info.rangeVector[0]) || inputValue > std::stoi(info.rangeVector[1])){
629+
LOGERR("wrong Input Value[%d]", inputValue);
630+
return -1;
631+
}
632+
}
633+
if ( (name == "Duration")){
634+
if (inputValue > std::stoi(info.rangeVector[2]) || inputValue < std::stoi(info.rangeVector[3])){
635+
LOGERR("wrong Input Value[%d]", inputValue);
636+
return -1;
637+
}
638+
}
639+
return 0;
640+
}
641+
618642
int AVOutputTV::fetchCapablities(string pqparam, capDetails_t& info) {
619643

620644
capVectors_t vectorInfo;
@@ -2309,7 +2333,7 @@ namespace Plugin {
23092333

23102334
}
23112335

2312-
if ((param == "DolbyVisionMode") || (param == "Backlight") || (param == "CMS") || (param == "CustomWhiteBalance") || (param == "HDRMode") || (param == "BacklightControl") || (param == "DimmingMode")) {
2336+
if ((param == "DolbyVisionMode") || (param == "Backlight") || (param == "CMS") || (param == "CustomWhiteBalance") || (param == "HDRMode") || (param == "BacklightControl") || (param == "DimmingMode") || (param == "BacklightFade")) {
23132337
configString = param + ".platformsupport";
23142338
info.isPlatformSupport = inFile.Get<std::string>(configString);
23152339
printf(" platformsupport : %s\n",info.isPlatformSupport.c_str() );
@@ -2349,6 +2373,16 @@ namespace Plugin {
23492373
info.range += ","+inFile.Get<std::string>(configString);
23502374
configString = param + ".range_Offset_to";
23512375
info.range += ","+inFile.Get<std::string>(configString);
2376+
} else if ( (param == "BacklightFade")) {
2377+
configString = param + ".range_from";
2378+
info.range = inFile.Get<std::string>(configString);
2379+
configString = param + ".range_to";
2380+
info.range += ","+inFile.Get<std::string>(configString);
2381+
configString = param + ".duration_from";
2382+
info.range += ","+inFile.Get<std::string>(configString);
2383+
configString = param + ".duration_to";
2384+
info.range += ","+inFile.Get<std::string>(configString);
2385+
printf("%s: Full integer range info: %s\n", __PRETTY_FUNCTION__, info.range.c_str());
23522386
} else {
23532387
configString = param + ".range_from";
23542388
info.range = inFile.Get<std::string>(configString);

0 commit comments

Comments
 (0)