Power State API provides the Publish and Subscribe (P&S) power state keys that are updated by HWRM server.
The P&S power state keys provide up-to-date information on the charging status, battery level and battery state of the device. Any application may subscribe to these keys that are updated to receive notifications for any change in state. This interface is provided by three Publish and Subscribe keys. For details on using the P&S API, refer to the Publish and Subscribe documentation.
P&S is used by HW Resource Manager to globally publish the power state
information. The P&S UID is KPSUidHWRMPowerState
and
provides the following keys:
P&S
key to represent the battery level of the device. It also relates to the number
of battery bars displayed. This property is updated only when battery level
changes. Valid values are defined by the EPSHWRMBatteryLevel
enumeration
and ranges from -1 to 7.
If an error occurs or the battery level is
not initialized, the enumeration value of EBatteryLevelUnknown
is
used. In all other scenarios, the battery level is used with level 0 being
the lowest (battery empty) and level 7 the highest (battery full).
Refer to the Keys and Enumerations section for more information.
P&S key to represent the battery status of the device. For example, Uninitialized, Ok, Low, Empty. This property may be updated to same status as previously, to indicate that the note in question must be displayed again.
EPSHWRMBatteryStatus
enumeration
defines the valid values as shown in the following table:
EPSHWRMBatteryStatus | Description |
---|---|
|
Battery status is unknown or some error has occurred in retrieving the battery status. |
|
Battery level is normal. |
|
Battery level is low, and the user can be notified with a message warning them that battery is low. This value is updated approximately ten times before battery is completely empty and updated comes at approximately 10-minute intervals. If phone is in-call mode, update comes at approximately 1-minute intervals. |
|
Battery level is empty. This value is updated slightly before the phone must be powered down automatically because of insufficient battery power. |
Refer to the Keys and Enumerations section for more information.
P&S key to represent the charging status of the device. For example, Charging, NotCharging, ChargingComplete. This property is updated only when charging status changes.
EPSHWRMChargingStatus
enumeration
defines the valid values as shown in the following table:
EPSHWRMChargingStatus | Description |
---|---|
|
An error occurred when the charger is connected to the device. |
|
A charger has not been connected to the device. This also represents the uninitialized value if no charger has been initialized. |
|
Charger is connected to the device and charging is ongoing. |
|
Charger is connected to the device but the device is not charging, for example, due to battery being full. |
|
Device is charging and the battery is almost full. |
|
Charging has just been completed, and hence a notification may be shown to the user if required. |
|
Special case where charging was interrupted briefly but is now continuing, for example, when a dynamo type of charger is used. |
Refer to the Keys and Enumerations section for more information.
Battery level of device
Interpreted as EPSHWRMBatteryLevel
enumeration
and can be related to the number of battery bars displayed by the device.
EPSHWRMBatteryLevel | Valid Values | Description |
---|---|---|
|
-1 |
Uninitialized or some other error. |
|
0 |
Lowest battery level. |
|
1 |
Battery Level 1. |
|
2 |
Battery Level 2. |
|
3 |
Intermediate levels |
|
4 |
Battery Level 4. |
|
5 |
Battery Level 5. |
|
6 |
Battery Level 6. |
|
7 |
Highest battery level. |
Battery status of device
Interpreted as EPSHWRMBatteryStatus
enumeration
and can be related to the battery status of the device.
EPSHWRMBatteryStatus | Valid Values | Description |
---|---|---|
|
-1 |
Uninitialized or some other error. |
|
0 |
This can also be used during charging. |
|
1 |
Show "Battery low " note to user . |
|
2 |
Show "Recharge battery " note to user. |
Charging status of device
Interpreted as enumeration EPSHWRMChargingStatus
and
can be related to the charging status of the device.
EPSHWRMChargingStatus | Valid Values | Description |
---|---|---|
|
-1 |
Some error has occurred when charger is connected or charging. |
|
0 |
Charger uninitialized or not connected. |
|
1 |
Device is charging. |
|
2 |
Charger is connected, device not charging. |
|
3 |
Charging almost completed. |
|
4 |
Charging completed. |
|
5 |
Charging continued after brief interruption. |