Tizen Native API
|
The Power API provides functions to control the power service.
Required Header
#include <device/power.h>
Overview
The Power API provides the way to control the power service. It can be made to hold the specific state to avoid changing display and CPU state internally.
Functions | |
int | device_power_request_lock (power_lock_e type, int timeout_ms) |
Locks the given lock state for a specified time. | |
int | device_power_release_lock (power_lock_e type) |
Releases the given lock state locked before. | |
int | device_power_wakeup (bool dim) |
Changes the current power state to the normal/dim state. |
Enumeration Type Documentation
enum power_lock_e |
Enumeration for lock type.
Each enum ensures that the suitable device is on until all the lock requests have been released or after a timeout.
CPU Brightness
POWER_LOCK_CPU ON OFF
POWER_LOCK_DISPLAY ON ON(normal)
POWER_LOCK_DISPLAY_DIM ON ON(dim)
- Since :
- 2.3.1
- Remarks:
- An application can lock the specific type.
- These enums are mutually exclusive.
- You cannot combine with an enum below.
Function Documentation
int device_power_release_lock | ( | power_lock_e | type | ) |
Releases the given lock state locked before.
- Since :
- 2.3.1
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/display
- Parameters:
-
[in] type The power type to release lock
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DEVICE_ERROR_NONE Successful DEVICE_ERROR_INVALID_PARAMETER Invalid parameter DEVICE_ERROR_PERMISSION_DENIED Permission denied DEVICE_ERROR_OPERATION_FAILED Operation failed
- See also:
- device_power_request_lock()
int device_power_request_lock | ( | power_lock_e | type, |
int | timeout_ms | ||
) |
Locks the given lock state for a specified time.
After the given timeout_ms (in milliseconds), unlock the given lock state automatically.
- Since :
- 2.3.1
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/display
- Remarks:
- If the process dies, then every lock will be removed.
- Parameters:
-
[in] type The power type to request lock [in] timeout_ms The positive number in milliseconds or 0
for permanent lock
So you must release the permanent lock of power state with device_power_release_lock() if timeout_ms is zero.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DEVICE_ERROR_NONE Successful DEVICE_ERROR_INVALID_PARAMETER Invalid parameter DEVICE_ERROR_PERMISSION_DENIED Permission denied DEVICE_ERROR_OPERATION_FAILED Operation failed
- See also:
- device_power_release_lock()
int device_power_wakeup | ( | bool | dim | ) |
Changes the current power state to the normal/dim state.
- Since :
- 2.3.1
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/display
- Parameters:
-
[in] dim Set true
to set the dim state, otherwise setfalse
to not set the dim state
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DEVICE_ERROR_NONE Successful DEVICE_ERROR_INVALID_PARAMETER Invalid parameter DEVICE_ERROR_PERMISSION_DENIED Permission denied DEVICE_ERROR_OPERATION_FAILED Operation failed
- Postcondition:
- The device will be in DISPLAY_STATE_NORMAL state.