Skip to content

Commit

Permalink
Merge pull request rdkcentral#5668 from ssitar583/sprint/24Q3
Browse files Browse the repository at this point in the history
DELIA-65834 : Skipped new mode request
  • Loading branch information
anand-ky authored Aug 30, 2024
2 parents a41ccc7 + f1f7af2 commit ca30878
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
13 changes: 11 additions & 2 deletions SystemServices/SystemServices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1390,13 +1390,22 @@ namespace WPEFramework {
JsonObject param;
std::string oldMode = m_currentMode;
bool result = true;

if(m_remainingDuration>0)
{
populateResponseWithError(SysSrv_ModeChangeInProgress, response);
LOGERR("Mode change is already in progress.current mode is %s and it will be in progress for next %d seconds. Please try again later.\n",m_currentMode.c_str(),m_remainingDuration);
returnResponse(false);
}
if (parameters.HasLabel("modeInfo")) {
param.FromString(parameters["modeInfo"].String());
if (param.HasLabel("duration") && param.HasLabel("mode")) {
int duration = param["duration"].Number();
std::string newMode = param["mode"].String();

if(duration>86400)
{
LOGWARN("Duration is more than 24 hours. Setting duration to 24 hours,which is maximum allowed duration to set\n");
duration = 86400;
}
LOGWARN("request to switch to mode '%s' from mode '%s' \
with duration %d\n", newMode.c_str(),
oldMode.c_str(), duration);
Expand Down
3 changes: 2 additions & 1 deletion SystemServices/SystemServicesHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ static const std::map<int, std::string> ErrCodeMap = {
{SysSrv_LibcurlError, "LIbCurl service error"},
{SysSrv_DynamicMemoryAllocationFailed, "Dynamic Memory Allocation Failed"},
{SysSrv_ManufacturerDataReadFailed, "Manufacturer Data Read Failed"},
{SysSrv_KeyNotFound, "Key not found"}
{SysSrv_KeyNotFound, "Key not found"},
{SysSrv_ModeChangeInProgress, "Mode change is in progress"}
};

std::string getErrorDescription(int errCode)
Expand Down
3 changes: 2 additions & 1 deletion SystemServices/SystemServicesHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ enum SysSrv_ErrorCode {
SysSrv_LibcurlError,
SysSrv_DynamicMemoryAllocationFailed,
SysSrv_ManufacturerDataReadFailed,
SysSrv_KeyNotFound
SysSrv_KeyNotFound,
SysSrv_ModeChangeInProgress
};

enum FirmwareUpdateState {
Expand Down

0 comments on commit ca30878

Please sign in to comment.