#define METHOD_UNLOCK_STATE "unlockstate"
#define METHOD_CHANGE_STATE "changestate"
#define METHOD_REBOOT "Reboot"
+#define METHOD_REBOOT_WITH_OPTION "RebootWithOption"
+
+#define TYPE_REBOOT "reboot"
+#define REBOOT_REASON_NONE ""
#define STR_STAYCURSTATE "staycurstate"
#define STR_GOTOSTATENOW "gotostatenow"
//LCOV_EXCL_START Not available to test(Reboot during TCT)
int device_power_reboot(const char *reason)
{
- char *arr[1];
+ char *arr[2];
+ char *method, *sig;
int ret;
- if (!reason)
- return DEVICE_ERROR_INVALID_PARAMETER;
+ if (reason) {
+ arr[0] = TYPE_REBOOT;
+ arr[1] = (char *)reason;
+ method = METHOD_REBOOT_WITH_OPTION;
+ sig = "ss";
+ } else {
+ arr[0] = REBOOT_REASON_NONE;
+ method = METHOD_REBOOT;
+ sig = "s";
+ }
- arr[0] = (char *)reason;
ret = dbus_method_sync(DEVICED_BUS_NAME,
DEVICED_PATH_POWER,
DEVICED_INTERFACE_POWER,
- METHOD_REBOOT, "s", arr);
+ method, sig, arr);
return errno_to_device_error(ret);
}
//LCOV_EXCL_STOP