2 * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #ifndef __TIZEN_SYSTEM_POWER_H__
19 #define __TIZEN_SYSTEM_POWER_H__
23 #include "device-error.h"
32 * @addtogroup CAPI_SYSTEM_DEVICE_POWER_MODULE
38 * @brief Enumeration for lock type.
39 * @details Each enum ensures that the suitable device is on until all the lock requests have been released or after a timeout.
41 * <TR><TH>Enum Type</TH><TH>CPU</TH><TH>Brightness(Display)</TH></TR>
42 * <TR><TD>POWER_LOCK_CPU</TD><TD>ON</TD><TD>OFF</TD></TR>
43 * <TR><TD>POWER_LOCK_DISPLAY</TD><TD>ON</TD><TD>ON(Normal)</TD></TR>
44 * <TR><TD>POWER_LOCK_DISPLAY_DIM</TD><TD>ON</TD><TD>ON(Dim)</TD></TR>
47 * @remarks An application can lock the specific type.
48 * @remarks These enums are mutually exclusive.
49 * @remarks You cannot combine with an enum below.
50 * @remarks #POWER_LOCK_DISPLAY_DIM may be ignored if the DIM state is disabled on the platform.
53 POWER_LOCK_CPU, /**< CPU lock */
54 POWER_LOCK_DISPLAY, /**< Display normal lock */
55 POWER_LOCK_DISPLAY_DIM, /**< Display dim lock */
60 * @brief Locks the given lock state for a specified time.
61 * @details After the given @a timeout_ms (in milliseconds), unlock the given lock state automatically.
64 * @privilege %http://tizen.org/privilege/display
65 * @remarks If the process dies, then every lock will be removed.
66 * @param[in] type The power type to request lock
67 * @param[in] timeout_ms The positive number in milliseconds or @c 0 for permanent lock \n
68 * So you must release the permanent lock of power state with #device_power_release_lock() if @a timeout_ms is zero
69 * @return @c 0 on success,
70 * otherwise a negative error value
71 * @retval #DEVICE_ERROR_NONE Successful
72 * @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter
73 * @retval #DEVICE_ERROR_PERMISSION_DENIED Permission denied
74 * @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed
75 * @see device_power_release_lock()
77 int device_power_request_lock(power_lock_e type, int timeout_ms);
81 * @brief Releases the given lock state which was locked before.
84 * @privilege %http://tizen.org/privilege/display
85 * @param[in] type The power type to release lock
86 * @return @c 0 on success,
87 * otherwise a negative error value
88 * @retval #DEVICE_ERROR_NONE Successful
89 * @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter
90 * @retval #DEVICE_ERROR_PERMISSION_DENIED Permission denied
91 * @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed
92 * @see device_power_request_lock()
94 int device_power_release_lock(power_lock_e type);
98 * @deprecated Deprecated Since 2.4
99 * @brief Changes the current power state to the normal/dim state.
102 * @privilege %http://tizen.org/privilege/display
103 * @remarks This API triggers turn on process and then updates the status when it completes. While the operation is on-going, the device_display_get_state() function returns previous display state.
104 * @remarks #DEVICE_ERROR_NOT_SUPPORTED is returned, when the following feature is not supported: %http://tizen.org/feature/display.state.
105 * @param[in] dim Set @c true to set the dim state,
106 * otherwise set @c false to not set the dim state
107 * @return @c 0 on success,
108 * otherwise a negative error value
109 * @retval #DEVICE_ERROR_NONE Successful
110 * @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter
111 * @retval #DEVICE_ERROR_PERMISSION_DENIED Permission denied
112 * @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed
113 * @retval #DEVICE_ERROR_NOT_SUPPORTED Not supported device
114 * @post The device will be in #DISPLAY_STATE_NORMAL state.
116 int device_power_wakeup(bool dim) TIZEN_DEPRECATED_API;
121 * @brief Reboots the device.
122 * @details Will not return if the reboot is successful. \n
123 * It operates asynchronously.
125 * @privlevel platform
126 * @privilege %http://tizen.org/privilege/reboot
127 * @param[in] reason Pass to the platform and kernel to request special reboot reason, or null
128 * @return @c 0 on success,
129 * otherwise a negative error value
130 * @retval #DEVICE_ERROR_NONE Successful
131 * @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter
132 * @retval #DEVICE_ERROR_PERMISSION_DENIED Permission denied
133 * @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed
135 int device_power_reboot(const char *reason);
148 #endif // __TIZEN_SYSTEM_POWER_H__