Tizen Native API
5.0
|
The Power API provides functions to control the power service.
#include <device/power.h>
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.
This API is related with the following features:
It is recommended to design feature related codes in your application for reliability.
You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.
To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
More details on featuring your application can be found from feature element description.
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 which was locked before. | |
int | device_power_wakeup (bool dim) TIZEN_DEPRECATED_API |
Changes the current power state to the normal/dim state. | |
int | device_power_reboot (const char *reason) |
Reboots the device. |
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.
Enum Type | CPU | Brightness(Display) |
---|---|---|
POWER_LOCK_CPU | ON | OFF |
POWER_LOCK_DISPLAY | ON | ON(Normal) |
POWER_LOCK_DISPLAY_DIM | ON | ON(Dim) |
int device_power_reboot | ( | const char * | reason | ) |
Reboots the device.
Will not return if the reboot is successful.
It operates asynchronously.
[in] | reason | Pass to the platform and kernel to request special reboot reason, or null |
0
on success, otherwise a negative error value DEVICE_ERROR_NONE | Successful |
DEVICE_ERROR_INVALID_PARAMETER | Invalid parameter |
DEVICE_ERROR_PERMISSION_DENIED | Permission denied |
DEVICE_ERROR_OPERATION_FAILED | Operation failed |
int device_power_release_lock | ( | power_lock_e | type | ) |
Releases the given lock state which was locked before.
[in] | type | The power type to release lock |
0
on success, otherwise a negative error value DEVICE_ERROR_NONE | Successful |
DEVICE_ERROR_INVALID_PARAMETER | Invalid parameter |
DEVICE_ERROR_PERMISSION_DENIED | Permission denied |
DEVICE_ERROR_OPERATION_FAILED | Operation failed |
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.
[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 |
0
on success, otherwise a negative error value DEVICE_ERROR_NONE | Successful |
DEVICE_ERROR_INVALID_PARAMETER | Invalid parameter |
DEVICE_ERROR_PERMISSION_DENIED | Permission denied |
DEVICE_ERROR_OPERATION_FAILED | Operation failed |
int device_power_wakeup | ( | bool | dim | ) |
Changes the current power state to the normal/dim state.
[in] | dim | Set true to set the dim state, otherwise set false to not set the dim state |
0
on success, otherwise a negative error value DEVICE_ERROR_NONE | Successful |
DEVICE_ERROR_INVALID_PARAMETER | Invalid parameter |
DEVICE_ERROR_PERMISSION_DENIED | Permission denied |
DEVICE_ERROR_OPERATION_FAILED | Operation failed |
DEVICE_ERROR_NOT_SUPPORTED | Not supported device |