Skip to content

Commit

Permalink
Merge pull request #5785 from hgfell683/24Q4_sprint
Browse files Browse the repository at this point in the history
RDK-49854 : fsr iarmmgr support
  • Loading branch information
apatel859 authored Oct 14, 2024
2 parents f60dfb5 + 335575b commit 491028c
Show file tree
Hide file tree
Showing 8 changed files with 176 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/L1-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:
jobs:
l1-tests:
name: Build and run unit tests
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
matrix:
compiler: [ gcc, clang ]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/L2-tests-R4-4-1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:
jobs:
L2-tests-R4-4-1:
name: L2 tests with Thunder R4.4.1
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
matrix:
compiler: [ gcc, clang ]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/L2-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:
jobs:
l2-tests:
name: Build and run L2 tests
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
matrix:
compiler: [ gcc, clang ]
Expand Down
40 changes: 40 additions & 0 deletions SystemServices/System.json
Original file line number Diff line number Diff line change
Expand Up @@ -2385,6 +2385,46 @@
"privacyMode"
]
}
},
"setFSRFlag":{
"summary": "Set the FSR flag into the emmc raw area. This API will fail if you attempt to set the same value.",
"result": {
"type": "object",
"properties": {
"fsrFlag": {
"summary": "FSR flag",
"type": "boolean",
"example": true
},
"success":{
"$ref": "#/common/success"
}
},
"required": [
"fsrFlag",
"success"
]
}
},
"getFSRFlag":{
"summary": "Get the FSR flag from the emmc raw area.",
"result": {
"type": "object",
"properties": {
"fsrFlag": {
"summary": "FSR flag.",
"type": "boolean",
"example": true
},
"success":{
"$ref": "#/common/success"
}
},
"required": [
"fsrFlag",
"success"
]
}
}
}
}
65 changes: 65 additions & 0 deletions SystemServices/SystemServices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,8 @@ namespace WPEFramework {
registerMethod("getFriendlyName", &SystemServices::getFriendlyName, this);
registerMethod("setFriendlyName", &SystemServices::setFriendlyName, this);
registerMethod("getThunderStartReason", &SystemServices::getThunderStartReason, this);
registerMethod("setFSRFlag", &SystemServices::setFSRFlag, this);
registerMethod("getFSRFlag", &SystemServices::getFSRFlag, this);

registerMethod("setPrivacyMode", &SystemServices::setPrivacyMode, this);
registerMethod("getPrivacyMode", &SystemServices::getPrivacyMode, this);
Expand Down Expand Up @@ -4772,6 +4774,69 @@ namespace WPEFramework {
returnResponse(true);
}



/***
* @brief : To set the fsr flag into the emmc raw area.
* @param1[in] : {"params":{"fsrFlag":<bool>}
* @param2[out] : {"result":{"success":<bool>}}
* @return : Core::<StatusCode>
*/
uint32_t SystemServices::setFSRFlag(const JsonObject& parameters,
JsonObject& response)
{
LOGINFOMETHOD();
bool fsrFlag = 0;
bool status = false;

if(parameters.HasLabel("fsrFlag"))
{
fsrFlag = parameters["fsrFlag"].Boolean();
IARM_Bus_MFRLib_FsrFlag_Param_t param;
param = fsrFlag;

LOGINFO("Param %d \n", param);
IARM_Result_t res = IARM_Bus_Call(IARM_BUS_MFRLIB_NAME,
IARM_BUS_MFRLIB_API_SetFsrFlag, (void *)&param,
sizeof(param));
if (IARM_RESULT_SUCCESS == res) {
status = true;
} else {
status = false;
}
}

returnResponse(status);
}

/***
* @brief : To get the fsr flag from emmc
* @param1[out] : {"params":{"params":{"fsrFlag":<bool>}
* @param2[out] : {"result":{"success":<bool>}}
* @return : Core::<StatusCode>
*/
uint32_t SystemServices::getFSRFlag(const JsonObject& parameters,
JsonObject& response)
{
LOGINFOMETHOD();
bool fsrFlag = 0;
bool status = false;
IARM_Bus_MFRLib_FsrFlag_Param_t param;

IARM_Result_t res = IARM_Bus_Call(IARM_BUS_MFRLIB_NAME,
IARM_BUS_MFRLIB_API_GetFsrFlag, (void *)&param,
sizeof(param));
if (IARM_RESULT_SUCCESS == res) {
fsrFlag = param;
status = true;
} else {
status = false;
}
response["fsrFlag"] = fsrFlag;
returnResponse(status);
}


} /* namespace Plugin */
} /* namespace WPEFramework */

2 changes: 2 additions & 0 deletions SystemServices/SystemServices.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ namespace WPEFramework {
uint32_t getThunderStartReason(const JsonObject& parameters, JsonObject& response);
uint32_t setPrivacyMode(const JsonObject& parameters, JsonObject& response);
uint32_t getPrivacyMode(const JsonObject& parameters, JsonObject& response);
uint32_t setFSRFlag(const JsonObject& parameters, JsonObject& response);
uint32_t getFSRFlag(const JsonObject& parameters, JsonObject& response);
}; /* end of system service class */
} /* end of plugin */
} /* end of wpeframework */
Expand Down
64 changes: 64 additions & 0 deletions Tests/L1Tests/tests/test_SystemServices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ TEST_F(SystemServicesTest, TestedAPIsShouldExist)
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("uploadLogs")));
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("uploadLogsAsync")));
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("abortLogUpload")));
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("setFSRFlag")));
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("getFSRFlag")));
}

TEST_F(SystemServicesTest, SystemUptime)
Expand Down Expand Up @@ -6229,3 +6231,65 @@ TEST_F(SystemServicesEmptyTest, system_service_settings_conf_as_dir)

EXPECT_TRUE(Core::Directory("/opt/system_service_settings.conf").Destroy(true));
}

TEST_F(SystemServicesTest, setFSRSuccess){
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_SetFsrFlag)));
auto param = static_cast<IARM_Bus_MFRLib_FsrFlag_Param_t>(arg);
EXPECT_EQ(param, (1));
return IARM_RESULT_SUCCESS;
});

EXPECT_EQ(Core::ERROR_NONE, handler.Invoke(connection, _T("setFSRFlag"), _T("{\"fsrFlag\":0}"), response));
EXPECT_EQ(response, string("{\"success\":true}"));
}

TEST_F(SystemServicesTest, setFSRFailure){
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_SetFsrFlag)));
auto param = static_cast<IARM_Bus_MFRLib_FsrFlag_Param_t>(arg);
EXPECT_EQ(param, (1));
return IARM_RESULT_INVALID_STATE;
});

EXPECT_EQ(Core::ERROR_GENERAL, handler.Invoke(connection, _T("setFSRFlag"), _T("{\"fsrFlag\":1}"), response));
}

TEST_F(SystemServicesTest, getFSRSuccess){
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_GetFsrFlag)));
auto param = static_cast<IARM_Bus_MFRLib_FsrFlag_Param_t>(arg);
EXPECT_EQ(param, (1));
return IARM_RESULT_SUCCESS;
});

EXPECT_EQ(Core::ERROR_NONE, handler.Invoke(connection, _T("getFSRFlag"), _T("{}"), response));
EXPECT_EQ(response, string("{\"fsrFlag\":true,\"success\":true}"));
}

TEST_F(SystemServicesTest, getFSRFailure){
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_GetFsrFlag)));
auto param = static_cast<IARM_Bus_MFRLib_FsrFlag_Param_t>(arg);
EXPECT_EQ(param, (1));
return IARM_RESULT_INVALID_STATE;
});

EXPECT_EQ(Core::ERROR_GENERAL, handler.Invoke(connection, _T("getFSRFlag"), _T("{}"), response));
}
2 changes: 2 additions & 0 deletions Tests/mocks/Iarm.h
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,8 @@ typedef struct _IARM_Bus_MFRLib_SetBLSplashScreen_Param{
char path[255];
} IARM_Bus_MFRLib_SetBLSplashScreen_Param_t;

typedef bool IARM_Bus_MFRLib_FsrFlag_Param_t; // true or false

#define IARM_BUS_CECMGR_API_isAvailable "isAvailable"
#define IARM_BUS_DSMGR_API_dsHdmiInGetNumberOfInputs "dsHdmiInGetNumberOfInputs"
#define IARM_BUS_DSMGR_API_dsHdmiInGetStatus "dsHdmiInGetStatus"
Expand Down

0 comments on commit 491028c

Please sign in to comment.