Skip to content

Commit

Permalink
Merge branch 'sprint/24Q2' into defect/LLAMA-14513
Browse files Browse the repository at this point in the history
  • Loading branch information
gomathishankar37 authored May 27, 2024
2 parents 1cbda92 + 6644f86 commit 85caab4
Show file tree
Hide file tree
Showing 10 changed files with 270 additions and 3 deletions.
4 changes: 2 additions & 2 deletions NetworkManager/service/NetworkManagerImplementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ namespace WPEFramework

Stun()
: Core::JSON::Container()
, stunEndpoint(_T(""))
, port(19310)
, stunEndpoint(_T("stun.l.google.com"))
, port(19302)
, interval(30)
{
Add(_T("endpoint"), &stunEndpoint);
Expand Down
2 changes: 1 addition & 1 deletion SystemAudioPlayer/impl/AudioPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ void AudioPlayer::setVolume( int thisVol)
g_object_set(G_OBJECT(m_audioVolume), "stream-volume", (double)thisVol/100, NULL);
}
#elif defined(PLATFORM_REALTEK)
g_object_set(G_OBJECT(m_audioVolume), "volume", (double) 4.0 * (thisVol/100), NULL);
g_object_set(G_OBJECT(m_audioVolume), "volume", (double)thisVol/100, NULL);
#elif defined(PLATFORM_BROADCOM)
g_object_set(G_OBJECT(m_audioVolume), "volume", (double)thisVol/100, NULL);
#endif
Expand Down
22 changes: 22 additions & 0 deletions SystemServices/System.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
"type": "string",
"example": "My Device"
},
"path": {
"summary": "Path to the pre-downloaded splash screen file location. Full path with file name",
"type": "string",
"example": "/tmp/osd1"
},
"modeInfo": {
"summary": "The mode information",
"type": "object",
Expand Down Expand Up @@ -1859,6 +1864,23 @@
"$ref": "#/common/result"
}
},
"setBootLoaderSplashScreen":{
"summary": "Install or update the BootLoader Splash Screens. This is typically called by Resident Apps to configure the Splash Screen shown during device boot up.",
"params": {
"type":"object",
"properties": {
"path": {
"$ref": "#/definitions/path"
}
},
"required": [
"path"
]
},
"result": {
"$ref": "#/common/result"
}
},
"setTerritory":{
"summary": "Sets the system territory and region.Territory is a ISO-3166-1 alpha-3 standard (see https://en.wikipedia.org/wiki/ISO_3166-1). Region is a ISO-3166-2 alpha-2 standard (see https://en.wikipedia.org/wiki/ISO_3166-2).",
"events":{
Expand Down
44 changes: 44 additions & 0 deletions SystemServices/SystemServices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ namespace WPEFramework {
registerMethod("updateFirmware", &SystemServices::updateFirmware, this);
registerMethod("setMode", &SystemServices::setMode, this);
registerMethod("setBootLoaderPattern", &SystemServices::setBootLoaderPattern, this);
registerMethod("setBootLoaderSplashScreen", &SystemServices::setBootLoaderSplashScreen, this);
registerMethod("getFirmwareUpdateInfo",
&SystemServices::getFirmwareUpdateInfo, this);
registerMethod("setDeepSleepTimer", &SystemServices::setDeepSleepTimer,
Expand Down Expand Up @@ -1324,6 +1325,49 @@ namespace WPEFramework {
returnResponse(status);
}

/***
* @brief : To update bootloader splash screen.
* @param1[in] : {"path":"<string>"}
* @param2[out] : {"result":{"success":<bool>}}
* @return : Core::<StatusCode>
*/
uint32_t SystemServices::setBootLoaderSplashScreen(const JsonObject& parameters,
JsonObject& response)
{
bool status = false;
string strBLSplashScreenPath = parameters["path"].String();
bool fileExists = Utils::fileExists(strBLSplashScreenPath.c_str());
if((strBLSplashScreenPath != "") && fileExists)
{
IARM_Bus_MFRLib_SetBLSplashScreen_Param_t mfrparam;
std::strcpy(mfrparam.path, strBLSplashScreenPath.c_str());
IARM_Result_t result = IARM_Bus_Call(IARM_BUS_MFRLIB_NAME, IARM_BUS_MFRLIB_API_SetBlSplashScreen, (void *)&mfrparam, sizeof(mfrparam));
if (result != IARM_RESULT_SUCCESS){
LOGERR("Update failed. path: %s, fileExists %s, IARM result %d ",strBLSplashScreenPath.c_str(),fileExists ? "true" : "false",result);
JsonObject error;
error["message"] = "Update failed";
error["code"] = "-32002";
response["error"] = error;
status = false;
}
else
{
LOGINFO("BootLoaderSplashScreen updated successfully");
status =true;
}
}
else
{
LOGERR("Invalid path. path: %s, fileExists %s ",strBLSplashScreenPath.c_str(),fileExists ? "true" : "false");
JsonObject error;
error["message"] = "Invalid path";
error["code"] = "-32001";
response["error"] = error;
status = false;
}
returnResponse(status);
}

/***
* @brief : Sets the mode of the STB. The object consists of two properties, mode (String) and
* duration (Integer) mode can be one of following:
Expand Down
1 change: 1 addition & 0 deletions SystemServices/SystemServices.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ namespace WPEFramework {
uint32_t updateFirmware(const JsonObject& parameters, JsonObject& response);
uint32_t setMode(const JsonObject& parameters, JsonObject& response);
uint32_t setBootLoaderPattern(const JsonObject& parameters, JsonObject& response);
uint32_t setBootLoaderSplashScreen(const JsonObject& parameters, JsonObject& response);
static void firmwareUpdateInfoReceived(void);
uint32_t getFirmwareUpdateInfo(const JsonObject& parameters, JsonObject& response);
void reportFirmwareUpdateInfoReceived(string firmwareUpdateVersion,
Expand Down
84 changes: 84 additions & 0 deletions Tests/L1Tests/tests/test_SystemServices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,90 @@ TEST_F(SystemServicesTest, SystemVersions)
EXPECT_EQ(Core::ERROR_NONE, handler.Invoke(connection, _T("getSystemVersions"), _T("{}"), response));
EXPECT_EQ(response, string("{\"stbVersion\":\"PX051AEI_VBN_2203_sprint_20220331225312sdy_NG\",\"receiverVersion\":\"000.36.0.0\",\"stbTimestamp\":\"Fri 05 Aug 2022 16:14:54 UTC\",\"success\":true}"));
}
/*******************************************************************************************************************
* Test function for :setBootLoaderSplashScreen
* @brief : To update bootloader splash screen.
* @param1[in] : {"path":"<string>"}
* @param2[out] : {"result":{"success":<bool>}}
* @return : Core::<StatusCode>
* Use case coverage:
* @Success :1
* @Failure :3
********************************************************************************************************************/


TEST_F(SystemServicesTest, setBootLoaderSplashScreen_IARM_fail)
{
ofstream file("/tmp/osd1");
file << "testing setBootLoaderSplashScreen";
file.close();
EXPECT_CALL(*p_iarmBusImplMock, IARM_Bus_Call)
.Times(::testing::AnyNumber())
.WillRepeatedly(
[](const char* ownerName, const char* methodName, void* arg, size_t argLen) {
EXPECT_EQ(string(ownerName), string(_T(IARM_BUS_MFRLIB_NAME)));
EXPECT_EQ(string(methodName), string(_T(IARM_BUS_MFRLIB_API_SetBlSplashScreen)));
auto param = static_cast<IARM_Bus_MFRLib_SetBLSplashScreen_Param_t*>(arg);
std::string path = param->path;
EXPECT_EQ(path, "/tmp/osd1");
return IARM_RESULT_OOM;
});

EXPECT_EQ(Core::ERROR_GENERAL, handler.Invoke(connection, _T("setBootLoaderSplashScreen"), _T("{\"path\": \"/tmp/osd1\"}"), response));
if(response != "")
{
EXPECT_EQ(response, string("{\"error\":{\"message\":\"Update failed\",\"code\":\"-32002\"},\"success\":false}"));
}
}

TEST_F(SystemServicesTest, setBootLoaderSplashScreen_IARM_success)
{
ofstream file("/tmp/osd1");
file << "testing setBootLoaderSplashScreen";
file.close();

EXPECT_CALL(*p_iarmBusImplMock, IARM_Bus_Call)
.Times(::testing::AnyNumber())
.WillRepeatedly(
[](const char* ownerName, const char* methodName, void* arg, size_t argLen) {
EXPECT_EQ(string(ownerName), string(_T(IARM_BUS_MFRLIB_NAME)));
EXPECT_EQ(string(methodName), string(_T(IARM_BUS_MFRLIB_API_SetBlSplashScreen)));
auto param = static_cast<IARM_Bus_MFRLib_SetBLSplashScreen_Param_t*>(arg);
std::string path = param->path;
EXPECT_EQ(path, "/tmp/osd1");
return IARM_RESULT_SUCCESS;
});
EXPECT_EQ(Core::ERROR_NONE, handler.Invoke(connection, _T("setBootLoaderSplashScreen"), _T("{\"path\": \"/tmp/osd1\"}"), response));
if(response != "")
{
EXPECT_EQ(response, string("{\"success\":true}"));
}
}

TEST_F(SystemServicesTest, setBootLoaderSplashScreen_empty_path)
{
EXPECT_CALL(*p_iarmBusImplMock, IARM_Bus_Call)
.Times(0);

EXPECT_EQ(Core::ERROR_GENERAL, handler.Invoke(connection, _T("setBootLoaderSplashScreen"), _T("{\"path\": \"\"}"), response));
if(response != "")
{
EXPECT_EQ(response, string("{\"error\":{\"message\":\"Invalid path\",\"code\":\"-32001\"},\"success\":false}"));
}
}

TEST_F(SystemServicesTest, setBootLoaderSplashScreen_invalid_path)
{
EXPECT_CALL(*p_iarmBusImplMock, IARM_Bus_Call)
.Times(0);

EXPECT_EQ(Core::ERROR_GENERAL, handler.Invoke(connection, _T("setBootLoaderSplashScreen"), _T("{\"path\": \"/tmp/osd2\"}"), response));
if(response != "")
{
EXPECT_EQ(response, string("{\"error\":{\"message\":\"Invalid path\",\"code\":\"-32001\"},\"success\":false}"));
}
}


TEST_F(SystemServicesTest, MocaStatus)
{
Expand Down
104 changes: 104 additions & 0 deletions Tests/L2Tests/L2TestsPlugin/tests/SystemService_L2Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,3 +441,107 @@ TEST_F(SystemService_L2Test,SystemServiceUploadLogsAndSystemPowerStateChange)
jsonrpc.Unsubscribe(JSON_TIMEOUT, _T("onSystemPowerStateChanged"));

}
/********************************************************
************Test case Details **************************
** 1. setBootLoaderSplashScreen success
** 2. setBootLoaderSplashScreen fail
** 3. setBootLoaderSplashScreen invalid path
** 4. setBootLoaderSplashScreen empty path
*******************************************************/

TEST_F(SystemService_L2Test,setBootLoaderSplashScreen)
{
JSONRPC::LinkType<Core::JSON::IElement> jsonrpc(SYSTEM_CALLSIGN,L2TEST_CALLSIGN);
StrictMock<AsyncHandlerMock> async_handler;
uint32_t status = Core::ERROR_GENERAL;
JsonObject params;
JsonObject result;
uint32_t signalled = SYSTEMSERVICEL2TEST_STATE_INVALID;
std::string message;
JsonObject expected_status;
params["path"] = "/tmp/osd1";


std::ofstream file("/tmp/osd1");
file << "testing setBootLoaderSplashScreen";
file.close();

EXPECT_CALL(*p_iarmBusImplMock, IARM_Bus_Call)
.Times(::testing::AnyNumber())
.WillRepeatedly(
[](const char* ownerName, const char* methodName, void* arg, size_t argLen) {
EXPECT_EQ(string(ownerName), string(_T(IARM_BUS_MFRLIB_NAME)));
EXPECT_EQ(string(methodName), string(_T(IARM_BUS_MFRLIB_API_SetBlSplashScreen)));
auto param = static_cast<IARM_Bus_MFRLib_SetBLSplashScreen_Param_t*>(arg);
std::string path = param->path;
EXPECT_EQ(path, "/tmp/osd1");
return IARM_RESULT_SUCCESS;
});

status = InvokeServiceMethod("org.rdk.System.1", "setBootLoaderSplashScreen", params, result);
EXPECT_EQ(Core::ERROR_NONE, status);
EXPECT_TRUE(result["success"].Boolean());


EXPECT_CALL(*p_iarmBusImplMock, IARM_Bus_Call)
.Times(::testing::AnyNumber())
.WillRepeatedly(
[](const char* ownerName, const char* methodName, void* arg, size_t argLen) {
EXPECT_EQ(string(ownerName), string(_T(IARM_BUS_MFRLIB_NAME)));
EXPECT_EQ(string(methodName), string(_T(IARM_BUS_MFRLIB_API_SetBlSplashScreen)));
auto param = static_cast<IARM_Bus_MFRLib_SetBLSplashScreen_Param_t*>(arg);
std::string path = param->path;
EXPECT_EQ(path, "/tmp/osd1");
return IARM_RESULT_OOM;
});

status = InvokeServiceMethod("org.rdk.System.1", "setBootLoaderSplashScreen", params, result);
EXPECT_EQ(Core::ERROR_GENERAL, status);
EXPECT_FALSE(result["success"].Boolean());
if (result.HasLabel("error")) {
EXPECT_STREQ("{\"message\":\"Update failed\",\"code\":\"-32002\"}", result["error"].String().c_str());
}


params["path"] = "/tmp/osd2";
EXPECT_CALL(*p_iarmBusImplMock, IARM_Bus_Call)
.Times(::testing::AnyNumber())
.WillRepeatedly(
[](const char* ownerName, const char* methodName, void* arg, size_t argLen) {
EXPECT_EQ(string(ownerName), string(_T(IARM_BUS_MFRLIB_NAME)));
EXPECT_EQ(string(methodName), string(_T(IARM_BUS_MFRLIB_API_SetBlSplashScreen)));
auto param = static_cast<IARM_Bus_MFRLib_SetBLSplashScreen_Param_t*>(arg);
std::string path = param->path;
EXPECT_EQ(path, "/tmp/osd2");
return IARM_RESULT_OOM;
});

status = InvokeServiceMethod("org.rdk.System.1", "setBootLoaderSplashScreen", params, result);
EXPECT_EQ(Core::ERROR_GENERAL, status);
EXPECT_FALSE(result["success"].Boolean());
if (result.HasLabel("error")) {
EXPECT_STREQ("{\"message\":\"Invalid path\",\"code\":\"-32001\"}", result["error"].String().c_str());
}


params["path"] = "";
EXPECT_CALL(*p_iarmBusImplMock, IARM_Bus_Call)
.Times(::testing::AnyNumber())
.WillRepeatedly(
[](const char* ownerName, const char* methodName, void* arg, size_t argLen) {
EXPECT_EQ(string(ownerName), string(_T(IARM_BUS_MFRLIB_NAME)));
EXPECT_EQ(string(methodName), string(_T(IARM_BUS_MFRLIB_API_SetBlSplashScreen)));
auto param = static_cast<IARM_Bus_MFRLib_SetBLSplashScreen_Param_t*>(arg);
std::string path = param->path;
EXPECT_EQ(path, "");
return IARM_RESULT_OOM;
});

status = InvokeServiceMethod("org.rdk.System.1", "setBootLoaderSplashScreen", params, result);
EXPECT_EQ(Core::ERROR_GENERAL, status);
EXPECT_FALSE(result["success"].Boolean());
if (result.HasLabel("error")) {
EXPECT_STREQ("{\"message\":\"Invalid path\",\"code\":\"-32001\"}", result["error"].String().c_str());
}

}
5 changes: 5 additions & 0 deletions Tests/mocks/Iarm.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ typedef struct _DeepSleepMgr_WakeupKeyCode_Param_t {

#define IARM_BUS_MFRLIB_NAME "MFRLib"
#define IARM_BUS_MFRLIB_API_SetBootLoaderPattern "mfrSetBootloaderPattern"
#define IARM_BUS_MFRLIB_API_SetBlSplashScreen "mfrSetBlSplashScreen"
#define IARM_BUS_MFRLIB_API_GetSerializedData "mfrGetManufacturerData"

typedef enum _mfrSerializedType_t {
Expand Down Expand Up @@ -919,6 +920,10 @@ typedef struct _IARM_Bus_CECMgr_Status_Updated_Param_t
int logicalAddress;
}IARM_Bus_CECMgr_Status_Updated_Param_t;

typedef struct _IARM_Bus_MFRLib_SetBLSplashScreen_Param{
char path[255];
} IARM_Bus_MFRLib_SetBLSplashScreen_Param_t;

#define IARM_BUS_CECMGR_API_isAvailable "isAvailable"
#define IARM_BUS_DSMGR_API_dsHdmiInGetNumberOfInputs "dsHdmiInGetNumberOfInputs"
#define IARM_BUS_DSMGR_API_dsHdmiInGetStatus "dsHdmiInGetStatus"
Expand Down
3 changes: 3 additions & 0 deletions UserSettings/UserSettingsImplementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ UserSettingsImplementation::UserSettingsImplementation()
}
else
{

#if ((THUNDER_VERSION == 2) || ((THUNDER_VERSION == 4) && (THUNDER_VERSION_MINOR == 2)))
_engine->Announcements(_communicatorClient->Announcement());
#endif

LOGINFO("Connect the COM-RPC socket\n");
_controller = _communicatorClient->Open<PluginHost::IShell>(_T("org.rdk.PersistentStore"), ~0, 3000);
Expand Down
4 changes: 4 additions & 0 deletions WebKitBrowser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,10 @@ if(NOT WEBKIT_GLIB_API)
target_sources(${PLUGIN_WEBKITBROWSER_IMPLEMENTATION} PRIVATE InjectedBundle/Utils.cpp)
endif()

# This is a temporary solution. Normally we should leave this to the framework.
# Do not replicate for other plugins.
target_link_options(${PLUGIN_WEBKITBROWSER_IMPLEMENTATION} PRIVATE "-Wl,-z,nodelete")

target_link_libraries(${PLUGIN_WEBKITBROWSER_IMPLEMENTATION}
PRIVATE
${NAMESPACE}Plugins::${NAMESPACE}Plugins
Expand Down

0 comments on commit 85caab4

Please sign in to comment.