--- /dev/null
+#ifndef __TIZEN_SYSTEM_DISPLAY_ENUM_H__
+#define __TIZEN_SYSTEM_DISPLAY_ENUM_H__
+
+/**
+ * @brief Enumeration for the available display states.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ */
+typedef enum
+{
+ DISPLAY_STATE_NORMAL, /**< Normal state */
+ DISPLAY_STATE_SCREEN_DIM, /**< Screen dim state */
+ DISPLAY_STATE_SCREEN_OFF, /**< Screen off state */
+} display_state_e;
+
+#endif
#ifndef __TIZEN_SYSTEM_DISPLAY_INTERNAL_H__
-#define __TIZEN_SYSTEM_LED_INTERNAL_H__
+#define __TIZEN_SYSTEM_DISPLAY_INTERNAL_H__
-#include "device-error.h"
+#include <gio/gio.h>
+#include "device-error.h"
+#include "display-enum.h"
#ifdef __cplusplus
extern "C" {
#endif
-
/**
* @brief Gets the display brightness value.
* @since_tizen @if MOBILE 5.0 @elseif WEARABLE 5.0 @endif
*/
int device_display_set_brightness_state(int display_index, display_state_e state, int brightness);
+typedef void (*dbus_pending_cb)(void *data, GVariant *result, GError *err);
+/**
+ * @brief Change display state by a specific reason
+ * @since_tizen @if MOBILE 5.0 @elseif WEARABLE 5.0 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/display
+ * @param[in] type The type is display state to change\n
+ * DISPLAY_STATE_NORMAL : change to normal\n
+ * DISPLAY_STATE_SCREEN_OFF: change to off\n
+ * @param[in] reason Reason that causes display chage state\n
+ * @param[in] timeout Timeout to change state\n
+ * @param[in] cb Callback function for handling result of dbus method call\n
+ * @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
+ * @see device_display_change_state_by_reason()
+ */
+int device_display_change_state_by_reason(display_state_e type, char *reason, int timeout, dbus_pending_cb cb);
#ifdef __cplusplus
}
#endif
#endif // __TIZEN_SYSTEM_DISPLAY_INTERNAL_H__
-
#include "device-error.h"
-
+#include "display-enum.h"
#ifdef __cplusplus
extern "C" {
/**
- * @brief Enumeration for the available display states.
- * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
- */
-typedef enum
-{
- DISPLAY_STATE_NORMAL, /**< Normal state */
- DISPLAY_STATE_SCREEN_DIM, /**< Screen dim state */
- DISPLAY_STATE_SCREEN_OFF, /**< Screen off state */
-} display_state_e;
-
-
-/**
* @brief Gets the current display state.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @remarks #DEVICE_ERROR_NOT_SUPPORTED is returned, when the following feature is not supported: %http://tizen.org/feature/display
#include <vconf.h>
#include "display.h"
+#include "display-internal.h"
#include "common.h"
#include "dbus.h"
-#define METHOD_GET_DISPLAY_COUNT "GetDisplayCount"
-#define METHOD_GET_MAX_BRIGHTNESS "GetMaxBrightness"
-#define METHOD_GET_BRIGHTNESS "GetBrightness"
-#define METHOD_SET_BRIGHTNESS "SetBrightness"
-#define METHOD_CHANGE_STATE "changestate"
+#define METHOD_GET_DISPLAY_COUNT "GetDisplayCount"
+#define METHOD_GET_MAX_BRIGHTNESS "GetMaxBrightness"
+#define METHOD_GET_BRIGHTNESS "GetBrightness"
+#define METHOD_SET_BRIGHTNESS "SetBrightness"
+#define METHOD_CHANGE_STATE "changestate"
+#define METHOD_CHANGE_STATE_BY_REASON "ChangeStateByReason"
#define STR_LCD_OFF "lcdoff"
#define STR_LCD_DIM "lcddim"
return DEVICE_ERROR_NONE;
}
+
+int device_display_change_state_by_reason(display_state_e type, char *reason, int timeout, dbus_pending_cb cb)
+{
+ char *arr[3];
+ char _type[32];
+ char _timeout[32];
+ int ret;
+
+ snprintf(_type, sizeof(_type), "%d", type);
+ snprintf(_timeout, sizeof(_timeout), "%d", timeout);
+
+ arr[0] = _type;
+ arr[1] = reason;
+ arr[2] = _timeout;
+
+ ret = dbus_method_async_with_reply(DEVICED_BUS_NAME,
+ DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY,
+ METHOD_CHANGE_STATE_BY_REASON, "isi", arr, cb, -1, NULL);
+
+ return errno_to_device_error(ret);
+}
+
//LCOV_EXCL_STOP