diff --git a/FirmwareUpdate/FirmwareUpdateHelper.h b/FirmwareUpdate/FirmwareUpdateHelper.h index 1858e758..da2da9ce 100644 --- a/FirmwareUpdate/FirmwareUpdateHelper.h +++ b/FirmwareUpdate/FirmwareUpdateHelper.h @@ -113,6 +113,7 @@ #define RFC_MNG_NOTIFY "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.ManageableNotification.Enable" #define RFC_FW_REBOOT_NOTIFY "Device.DeviceInfo.X_RDKCENTRAL-COM_xOpsDeviceMgmt.RPC.RebootPendingNotification" +#define TR181_AUTOREBOOT_ENABLE "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.AutoReboot.Enable" //Firmware state #define _VALIDATION_FAILED "VALIDATION_FAILED" diff --git a/FirmwareUpdate/FirmwareUpdateImplementation.cpp b/FirmwareUpdate/FirmwareUpdateImplementation.cpp index 9610593a..18585d19 100644 --- a/FirmwareUpdate/FirmwareUpdateImplementation.cpp +++ b/FirmwareUpdate/FirmwareUpdateImplementation.cpp @@ -836,6 +836,28 @@ namespace WPEFramework { return status; } + /* + * @brief This function Enable/Disable the AutoReboot Feature (COMRPC). + * This will internally set the tr181 AutoReboot.Enable to True/False. + * @param[in] enable: Boolean to enable or disable AutoReboot + * @param[out] result: Result struct with success status + * @return: Core:: + */ + Core::hresult FirmwareUpdateImplementation::SetAutoReboot(const bool enable, Result& result) + { + Core::hresult status = Core::ERROR_GENERAL; + const char* set_rfc_val = enable ? "true" : "false"; + WDMP_STATUS ret = setRFCParameter((char*)"thunderapi", + TR181_AUTOREBOOT_ENABLE, set_rfc_val, WDMP_BOOLEAN); + if (WDMP_SUCCESS == ret) { + result.success = true; + LOGINFO("Success Setting the SetAutoReboot value\n"); + status = Core::ERROR_NONE; + } else { + LOGINFO("Failed Setting the SetAutoReboot value %s\n", getRFCErrorString(ret)); + } + return status; + } } // namespace Plugin } // namespace WPEFramework diff --git a/FirmwareUpdate/FirmwareUpdateImplementation.h b/FirmwareUpdate/FirmwareUpdateImplementation.h index c754db09..06dd1f61 100644 --- a/FirmwareUpdate/FirmwareUpdateImplementation.h +++ b/FirmwareUpdate/FirmwareUpdateImplementation.h @@ -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 SetAutoReboot(const bool enable, Result& result) 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) ;