Class Power
Definition
- Assembly:
- Tizen.System.dll
The Power class provides methods to control the power service.
public static class Power
- Inheritance
-
objectPower
Remarks
The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.
Methods
View SourceReleaseCpuLock()
[Obsolete("Please do not use! this will be deprecated")]
Declaration
[Obsolete("Please do not use! This will be deprecated! Please use ReleaseLock instead!")]
public static void ReleaseCpuLock()
Remarks
The Power API provides the way to control the power service. It can be made to hold the specific state to avoid the CPU state internally.
Exceptions
Type | Condition |
---|---|
System.UnauthorizedAccessException | If the privilege is not set. |
System.InvalidOperationException | In case of any system error. |
ReleaseLock(PowerLock)
Releases the given specific power lock type which was locked before.
Declaration
public static void ReleaseLock(PowerLock type)
Parameters
Type | Name | Description |
---|---|---|
PowerLock | type | The power type to request lock. |
Remarks
If display feature(http://tizen.org/feature/display) is false, then only the type POWER_LOCK_CPU is effective,
and the other type returns DEVICE_ERROR_NOT_SUPPORTED.
And even thoguh the display feature is false,
it requires display privilege(http://tizen.org/privilege/display).
Examples
Tizen.System.Power.ReleaseLock(Tizen.System.Power.PowerLock.Cpu);
Exceptions
Type | Condition |
---|---|
System.ArgumentException | When an invalid parameter value is set. |
System.UnauthorizedAccessException | If the privilege is not set. |
System.InvalidOperationException | In case of any system error. |
See Also
View SourceRequestCpuLock(int)
[Obsolete("Please do not use! this will be deprecated")]
Declaration
[Obsolete("Please do not use! This will be deprecated! Please use RequestLock instead!")]
public static void RequestCpuLock(int timeout)
Parameters
Type | Name | Description |
---|---|---|
int | timeout | The positive number in milliseconds or 0 for the permanent lock. So you must release the permanent lock of the power state with ReleaseCpuLock() if timeout_ms is zero. |
Remarks
If the process dies, then every lock will be removed.
Exceptions
Type | Condition |
---|---|
System.ArgumentException | When an invalid parameter value is set. |
System.UnauthorizedAccessException | If the privilege is not set. |
System.InvalidOperationException | In case of any system error. |
RequestLock(PowerLock, int)
Locks the given lock state for a specified time. After the given timeout (in milliseconds), unlock the given lock state automatically.
Declaration
public static void RequestLock(PowerLock type, int timeout)
Parameters
Type | Name | Description |
---|---|---|
PowerLock | type | The power type to request lock. |
int | timeout | The positive number in milliseconds or 0 for the permanent lock. So you must release the permanent lock of the power state with ReleaseLock() if timeout_ms is zero. |
Remarks
If display feature(http://tizen.org/feature/display) is false, then only the type POWER_LOCK_CPU is effective,
and the other type returns DEVICE_ERROR_NOT_SUPPORTED.
And even thoguh the display feature is false,
it requires display privilege(http://tizen.org/privilege/display).
Scenario 1. If the same application requests the same power lock more than twice before it is released or expired,
the timeout will be updated to the latest requested time.
For example:
The first request has a timeout of 5000ms.
The second request has a timeout of 1000ms.
If the second request is made before the first request is released or expired,
the timeout will be updated to the latest requested time, which is 1000ms.
Scenario 2. If different applications request the same power lock type,
the power state timeout will be set to the maximum of the requested timeouts.
For example:
Application A requests POWER_LOCK_CPU with a timeout of 5000ms.
Application B requests the same POWER_LOCK_CPU with a timeout of 1000ms.
Unless Application A releases the POWER_LOCK_CPU lock,
the timeout for POWER_LOCK_CPU will remain at the maximum requested time, which is 5000ms.
Examples
Tizen.System.Power.RequestLock(Tizen.System.Power.PowerLock.Cpu, 2000);
Exceptions
Type | Condition |
---|---|
System.ArgumentException | When an invalid parameter value is set. |
System.UnauthorizedAccessException | If the privilege is not set. |
System.InvalidOperationException | In case of any system error. |