Reboot api request to deviced with command string.
It only valids with reboot privilege.
Change-Id: I3fcf252ad64b1256c9787f04f2fbda7470d281b8
Signed-off-by: Jiyoung Yun <jy910.yun@samsung.com>
int device_power_wakeup(bool dim);
/**
+ * @platform
+ * @brief Reboots the device.
+ * @details Will not return if the reboot is successful. \n
+ * It operates asynchronously.
+ *
+ * @since_tizen 2.3.1
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/reboot
+ *
+ * @param[in] reason Pass to the platform and kernel to request special reboot reason, or null.
+ *
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ *
+ * @retval #DEVICE_ERROR_NONE Successful
+ * @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #DEVICE_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed
+ */
+int device_power_reboot(const char *reason);
+
+/**
* @}
*/
#define DEVICED_PATH_LED DEVICED_OBJECT_PATH"/Led"
#define DEVICED_INTERFACE_LED DEVICED_INTERFACE_NAME".Led"
+/* Power service: request to reboot */
+#define DEVICED_PATH_POWER DEVICED_OBJECT_PATH"/Power"
+#define DEVICED_INTERFACE_POWER DEVICED_INTERFACE_NAME".power"
+
int dbus_method_sync(const char *dest, const char *path,
const char *interface, const char *method,
const char *sig, char *param[]);
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2015 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#define METHOD_LOCK_STATE "lockstate"
#define METHOD_UNLOCK_STATE "unlockstate"
#define METHOD_CHANGE_STATE "changestate"
+#define METHOD_REBOOT "Reboot"
#define STR_STAYCURSTATE "staycurstate"
#define STR_GOTOSTATENOW "gotostatenow"
return device_display_change_state(DISPLAY_STATE_NORMAL);
}
+
+int device_power_reboot(const char *reason)
+{
+ char *arr[1];
+ int ret;
+
+ if (!reason)
+ return DEVICE_ERROR_INVALID_PARAMETER;
+
+ arr[0] = (char *)reason;
+ ret = dbus_method_sync(DEVICED_BUS_NAME,
+ DEVICED_PATH_POWER,
+ DEVICED_INTERFACE_POWER,
+ METHOD_REBOOT, "s", arr);
+ return errno_to_device_error(ret);
+}