@@ -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 {
0 commit comments