Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions FirmwareUpdate/FirmwareUpdateImplementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

#include "FirmwareUpdateImplementation.h"

#define TR181_FW_DELAY_REBOOT "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.AutoReboot.fwDelayReboot"
#define MAX_REBOOT_DELAY 86400 /* 24Hr = 86400 sec */

std::atomic<bool> isFlashingInProgress(false);
std::mutex flashMutex;
std::mutex logMutex;
Expand Down Expand Up @@ -835,6 +838,39 @@ namespace WPEFramework {
return status;
}

Core::hresult FirmwareUpdateImplementation::SetFirmwareRebootDelay (const uint32_t delaySeconds, bool& success)
{
bool result = false;
Core::hresult status = Core::ERROR_GENERAL;

/* we can delay with max 24 Hrs = 86400 sec */
if (delaySeconds > 0 && delaySeconds <= MAX_REBOOT_DELAY ){

std::string delay_in_sec = std::to_string(delaySeconds);
const char * set_rfc_val = delay_in_sec.c_str();

LOGINFO("set_rfc_value %s\n",set_rfc_val);

/*set tr181Set command from here*/
WDMP_STATUS rfcStatus = setRFCParameter((char*)"thunderapi",
TR181_FW_DELAY_REBOOT, set_rfc_val, WDMP_INT);

if ( WDMP_SUCCESS == rfcStatus){
result=true;
status = Core::ERROR_NONE;
LOGINFO("Success Setting setFirmwareRebootDelay value\n");
}
else {
LOGINFO("Failed Setting setFirmwareRebootDelay value %s\n",getRFCErrorString(rfcStatus));
}
}
else {
/* we didnt get a valid Auto Reboot delay */
LOGERR("Invalid setFirmwareRebootDelay Value Max.Value is 86400 sec\n");
}
success = result;
return status;
}

} // namespace Plugin
} // namespace WPEFramework
Expand Down
1 change: 1 addition & 0 deletions FirmwareUpdate/FirmwareUpdateImplementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ namespace Plugin {
Core::hresult Unregister(Exchange::IFirmwareUpdate::INotification *notification ) ;
Core::hresult UpdateFirmware(const string& firmwareFilepath , const string& firmwareType , Result &result ) override ;
Core::hresult GetUpdateState(GetUpdateStateResult& getUpdateStateResult ) override;
Core::hresult SetFirmwareRebootDelay (const uint32_t delaySeconds, bool& success) override;
void startProgressTimer() ;
int flashImage(const char *server_url, const char *upgrade_file, const char *reboot_flag, const char *proto, int upgrade_type, const char *maint ,const char *initiated_type ,const char * codebig) ;
void flashImageThread(std::string firmwareFilepath,std::string firmwareType) ;
Expand Down
Loading