Skip to content

Commit

Permalink
RDK-32623 - Add Query Parameter to resident app (rdkcentral#1289) (rd…
Browse files Browse the repository at this point in the history
…kcentral#1347)

Co-authored-by: mthiru270 <[email protected]>
Co-authored-by: Michael Fiess <[email protected]>

Co-authored-by: madanagopalt <[email protected]>
Co-authored-by: mthiru270 <[email protected]>
  • Loading branch information
3 people authored Jun 8, 2021
1 parent 89a2ddb commit de7c7b1
Showing 1 changed file with 45 additions and 2 deletions.
47 changes: 45 additions & 2 deletions RDKShell/RDKShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4157,13 +4157,43 @@ namespace WPEFramework {
std::cout << "stopHdmiStatus status: " << stopHdmiStatus << std::endl;

sForceResidentAppLaunch = true;
auto thunderController = getThunderControllerClient();
WPEFramework::Core::JSON::String configString;

int32_t status = 0;
string method = "configuration@ResidentApp";
Core::JSON::ArrayType<PluginHost::MetaData::Service> joResult;
status = thunderController->Get<WPEFramework::Core::JSON::String>(RDKSHELL_THUNDER_TIMEOUT, method.c_str(), configString);

std::cout << "config resident app status: " << status << std::endl;
std::string updatedUrl;
if (status > 0)
{
std::cout << "trying resident app config status one more time...\n";
status = thunderController->Get<WPEFramework::Core::JSON::String>(RDKSHELL_THUNDER_TIMEOUT, method.c_str(), configString);
std::cout << "trying resident app config status: " << status << std::endl;
}
else
{
JsonObject configSet;
configSet.FromString(configString.Value());
updatedUrl = configSet["url"].String();
if (updatedUrl.find("?") != -1)
{
updatedUrl.append("&adjustPowerStateAtStartup=false");
}
else
{
updatedUrl.append("?adjustPowerStateAtStartup=false");
}
}

bool ret = true;
std::string callsign("ResidentApp");
JsonObject activateParams;
activateParams.Set("callsign",callsign.c_str());
JsonObject activateResult;
auto thunderController = getThunderControllerClient();
int32_t status = thunderController->Invoke(3500, "activate", activateParams, activateResult);
status = thunderController->Invoke(3500, "activate", activateParams, activateResult);

std::cout << "activate resident app status: " << status << std::endl;
if (status > 0)
Expand All @@ -4181,6 +4211,19 @@ namespace WPEFramework {
ret = true;
}
}

if (!updatedUrl.empty())
{
WPEFramework::Core::JSON::String urlString;
urlString = updatedUrl;
status = JSONRPCDirectLink(mCurrentService, "ResidentApp").Set<WPEFramework::Core::JSON::String>(RDKSHELL_THUNDER_TIMEOUT, "url",urlString);
std::cout << "set url status " << updatedUrl << " " << status << std::endl;
if (status > 0)
{
std::cout << "failed to set url to " << updatedUrl << " with status code " << status << std::endl;
}
}

JsonObject joFactoryModeParams;
JsonObject joFactoryModeResult;
joFactoryModeParams.Set("namespace","FactoryTest");
Expand Down

0 comments on commit de7c7b1

Please sign in to comment.