Class PowerUsage
Definition
- Assembly:
- Tizen.System.PowerUsage.dll
Provides information related to the power consumption by applications or by hardware resources on a battery-powered device for a given duration of time.
public static class PowerUsage
- Inheritance
-
objectPowerUsage
Methods
View SourceGetPowerUsage(string, IList<PowerUsageResourceType>, DateTime, DateTime)
Gets the battery consumption in mAh(milli-Ampere hour) for the resources specified by the application in custom interval.
Declaration
public static IDictionary<PowerUsageResourceType, double> GetPowerUsage(string appID, IList<PowerUsageResourceType> rtypes, DateTime start, DateTime end)
Parameters
| Type | Name | Description |
|---|---|---|
| string | appID | Application ID of the application for which battery usage is required. |
| System.Collections.Generic.IList<T><PowerUsageResourceType> | rtypes | list of resource type identifiers like BLE, WiFi, CPU etc. |
| System.DateTime | start | Start Time for data in DateTime. |
| System.DateTime | end | End Time for data in DateTime. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IDictionary<TKey, TValue><PowerUsageResourceType, double> | Returns the battery consumption in mAh(milli-Ampere hour) for the resources specified by the application in custom interval. |
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. |
| System.NotSupportedException | In case power usage is not supported |
GetPowerUsage(string, DateTime, DateTime)
Gets the total battery usage in mAh(milli-Ampere hour) by an application for certain time interval.
Declaration
public static double GetPowerUsage(string appID, DateTime start, DateTime end)
Parameters
| Type | Name | Description |
|---|---|---|
| string | appID | Application ID of the application for which battery usage is required. |
| System.DateTime | start | Start Time for data in DateTime. |
| System.DateTime | end | End Time for data in DateTime. |
Returns
| Type | Description |
|---|---|
| double | Returns the total battery usage in mAh(milli-Ampere hour) by an application for certain time interval. |
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. |
| System.NotSupportedException | In case power usage is not supported |
GetPowerUsage(string, PowerUsageResourceType, DateTime, DateTime)
Gets the battery consumption in mAh(milli-Ampere hour) for the specific resource for the given application in custom interval.
Declaration
public static double GetPowerUsage(string appID, PowerUsageResourceType rtype, DateTime start, DateTime end)
Parameters
| Type | Name | Description |
|---|---|---|
| string | appID | Application ID of the application for which battery usage is required. |
| PowerUsageResourceType | rtype | Identifier of resource type. BLE, WiFi, CPU etc. |
| System.DateTime | start | Start Time for data in DateTime. |
| System.DateTime | end | End Time for data in DateTime. |
Returns
| Type | Description |
|---|---|
| double | Returns the battery consumption in mAh(milli-Ampere hour) for the specific resource for the given application in custom interval. |
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. |
| System.NotSupportedException | In case power usage is not supported |
GetPowerUsage(PowerUsageResourceType, DateTime, DateTime)
Gets the battery usage in mAh(milli-Ampere hour) by a resource for certain time interval.
Declaration
public static double GetPowerUsage(PowerUsageResourceType rtype, DateTime start, DateTime end)
Parameters
| Type | Name | Description |
|---|---|---|
| PowerUsageResourceType | rtype | Identifier of resource type. BLE, WiFi, CPU etc. |
| System.DateTime | start | Start Time for data in DateTime. |
| System.DateTime | end | End Time for data in DateTime. |
Returns
| Type | Description |
|---|---|
| double | Returns the battery usage in mAh(milli-Ampere hour) by a resource for certain time interval. |
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. |
| System.NotSupportedException | In case power usage is not supported |