<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License
"Eclipse Public License v1.0" which accompanies this distribution,
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
Nokia Corporation - initial contribution.
Contributors:
-->
<!DOCTYPE concept
PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-16A42EB3-4F45-5623-9981-1DEE3234471E" xml:lang="en"><title>Power
State API</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>Power State API provides the Publish and Subscribe (P&S) power state
keys that are updated by HWRM server. </p>
<p>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 <xref href="GUID-A81C65CF-CF4E-571C-8080-9D387F46AAD6.dita">Publish
and Subscribe documentation</xref>. </p>
<p>P&S is used by HW Resource Manager to globally publish the power state
information. The P&S UID is <codeph>KPSUidHWRMPowerState</codeph> and
provides the following keys: </p>
<ul>
<li id="GUID-B0F5D317-6B63-52C0-85A8-EC30053866BB"><p><xref href="GUID-16A42EB3-4F45-5623-9981-1DEE3234471E.dita#GUID-16A42EB3-4F45-5623-9981-1DEE3234471E/GUID-576EAE06-666F-5903-B006-EA923B7000B5">KHWRMBatteryLevel</xref> </p> </li>
<li id="GUID-5E41F5AE-C3C2-54AA-8959-0A90E4785E90"><p><xref href="GUID-16A42EB3-4F45-5623-9981-1DEE3234471E.dita#GUID-16A42EB3-4F45-5623-9981-1DEE3234471E/GUID-5C7D4483-D58A-522B-8B38-D30117698381">KHWRMBatteryStatus</xref> </p> </li>
<li id="GUID-A3C5C6AF-EDB6-5EFD-A713-802F6E8A8DD7"><p><xref href="GUID-16A42EB3-4F45-5623-9981-1DEE3234471E.dita#GUID-16A42EB3-4F45-5623-9981-1DEE3234471E/GUID-C4B24C0C-762F-5319-90B9-5BE8C8E94ABC">KHWRMChargingStatus</xref> </p> </li>
</ul>
<section id="GUID-576EAE06-666F-5903-B006-EA923B7000B5"><title>KHWRMBatteryLevel</title> <p>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 <codeph>EPSHWRMBatteryLevel</codeph> enumeration
and ranges from -1 to 7. </p> <p>If an error occurs or the battery level is
not initialized, the enumeration value of <codeph>EBatteryLevelUnknown</codeph> 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). </p> <p>Refer
to the <xref href="GUID-16A42EB3-4F45-5623-9981-1DEE3234471E.dita#GUID-16A42EB3-4F45-5623-9981-1DEE3234471E/GUID-CD1197EA-3FDF-53A5-B808-F01F18468121">Keys</xref> and <xref href="GUID-16A42EB3-4F45-5623-9981-1DEE3234471E.dita#GUID-16A42EB3-4F45-5623-9981-1DEE3234471E/GUID-AC5B84A9-1393-5473-8C87-A226CFDB6544">Enumerations</xref> section
for more information. </p> </section>
<section id="GUID-5C7D4483-D58A-522B-8B38-D30117698381"><title>KHWRMBatteryStatus</title> <p>P&S
key to represent the battery status of the device. For example, <b>Uninitialized</b>, <b>Ok</b>, <b>Low</b>, <b>Empty</b>.
This property may be updated to same status as previously, to indicate that
the note in question must be displayed again. </p> <p> <codeph>EPSHWRMBatteryStatus</codeph> enumeration
defines the valid values as shown in the following table: </p> <table id="GUID-A339E622-0E97-5020-94A8-18DAED60D8C3">
<tgroup cols="2"><colspec colname="col0"/><colspec colname="col1"/>
<thead>
<row>
<entry>EPSHWRMBatteryStatus</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><p> <codeph>EBatteryStatusUnknown</codeph> </p> </entry>
<entry><p>Battery status is unknown or some error has occurred in retrieving
the battery status. </p> </entry>
</row>
<row>
<entry><p> <codeph>EBatteryStatusOk</codeph> </p> </entry>
<entry><p>Battery level is normal. </p> </entry>
</row>
<row>
<entry><p> <codeph>EBatteryStatusLow</codeph> </p> </entry>
<entry><p>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. </p> </entry>
</row>
<row>
<entry><p> <codeph>EBatteryStatusEmpty</codeph> </p> </entry>
<entry><p>Battery level is empty. This value is updated slightly before the
phone must be powered down automatically because of insufficient battery power. </p> </entry>
</row>
</tbody>
</tgroup>
</table> <p>Refer to the <xref href="GUID-16A42EB3-4F45-5623-9981-1DEE3234471E.dita#GUID-16A42EB3-4F45-5623-9981-1DEE3234471E/GUID-CD1197EA-3FDF-53A5-B808-F01F18468121">Keys</xref> and <xref href="GUID-16A42EB3-4F45-5623-9981-1DEE3234471E.dita#GUID-16A42EB3-4F45-5623-9981-1DEE3234471E/GUID-AC5B84A9-1393-5473-8C87-A226CFDB6544">Enumerations</xref> section
for more information. </p> </section>
<section id="GUID-C4B24C0C-762F-5319-90B9-5BE8C8E94ABC"><title>KHWRMChargingStatus</title> <p>P&S
key to represent the charging status of the device. For example, <b>Charging</b>, <b>NotCharging</b>, <b>ChargingComplete</b>.
This property is updated only when charging status changes. </p> <p> <codeph>EPSHWRMChargingStatus</codeph> enumeration
defines the valid values as shown in the following table: </p> <table id="GUID-EE9B5750-B531-5AE4-8FA3-6997105CDB72">
<tgroup cols="2"><colspec colname="col0"/><colspec colname="col1"/>
<thead>
<row>
<entry>EPSHWRMChargingStatus</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><p> <codeph>EChargingStatusError</codeph> </p> </entry>
<entry><p>An error occurred when the charger is connected to the device. </p> </entry>
</row>
<row>
<entry><p> <codeph>EChargingStatusNotConnected</codeph> </p> </entry>
<entry><p>A charger has not been connected to the device. This also represents
the uninitialized value if no charger has been initialized. </p> </entry>
</row>
<row>
<entry><p> <codeph>EChargingStatusCharging</codeph> </p> </entry>
<entry><p>Charger is connected to the device and charging is ongoing. </p> </entry>
</row>
<row>
<entry><p> <codeph>EChargingStatusNotCharging</codeph> </p> </entry>
<entry><p>Charger is connected to the device but the device is not charging,
for example, due to battery being full. </p> </entry>
</row>
<row>
<entry><p> <codeph>EChargingStatusAlmostComplete</codeph> </p> </entry>
<entry><p>Device is charging and the battery is almost full. </p> </entry>
</row>
<row>
<entry><p> <codeph>EChargingStatusChargingComplete</codeph> </p> </entry>
<entry><p>Charging has just been completed, and hence a notification may be
shown to the user if required. </p> </entry>
</row>
<row>
<entry><p> <codeph>EChargingStatusChargingContinued</codeph> </p> </entry>
<entry><p>Special case where charging was interrupted briefly but is now continuing,
for example, when a dynamo type of charger is used. </p> </entry>
</row>
</tbody>
</tgroup>
</table> <p>Refer to the <xref href="GUID-16A42EB3-4F45-5623-9981-1DEE3234471E.dita#GUID-16A42EB3-4F45-5623-9981-1DEE3234471E/GUID-CD1197EA-3FDF-53A5-B808-F01F18468121">Keys</xref> and <xref href="GUID-16A42EB3-4F45-5623-9981-1DEE3234471E.dita#GUID-16A42EB3-4F45-5623-9981-1DEE3234471E/GUID-AC5B84A9-1393-5473-8C87-A226CFDB6544">Enumerations</xref> section
for more information. </p> </section>
<section id="GUID-CD1197EA-3FDF-53A5-B808-F01F18468121"><title>Keys </title> <table id="GUID-99D595A4-685F-5ABA-A684-4AB137368F10">
<tgroup cols="3"><colspec colname="col0"/><colspec colname="col1"/><colspec colname="col2"/>
<thead>
<row>
<entry> Keys </entry>
<entry>Valid Values</entry>
<entry> Description </entry>
</row>
</thead>
<tbody>
<row>
<entry><p> <codeph>KHWRMBatteryLevel</codeph> </p> </entry>
<entry><p>0x00000001 </p> </entry>
<entry><p>P&S key representing battery level of device. </p> </entry>
</row>
<row>
<entry><p> <codeph>KHWRMBatteryStatus</codeph> </p> </entry>
<entry><p>0x00000002 </p> </entry>
<entry><p>P&S key representing battery status of device. </p> </entry>
</row>
<row>
<entry><p> <codeph>KHWRMChargingStatus</codeph> </p> </entry>
<entry><p>0x00000003 </p> </entry>
<entry><p>P&S key representing charging status of device. </p> </entry>
</row>
</tbody>
</tgroup>
</table> </section>
<section id="GUID-AC5B84A9-1393-5473-8C87-A226CFDB6544"><title> Enumerations</title> <p> <b>Battery
level of device</b> </p> <p>Interpreted as <codeph>EPSHWRMBatteryLevel</codeph> enumeration
and can be related to the number of battery bars displayed by the device. </p> <table id="GUID-9DB20436-D945-5363-9089-1B312FE2AD86">
<tgroup cols="3"><colspec colname="col0"/><colspec colname="col1"/><colspec colname="col2"/>
<thead>
<row>
<entry> EPSHWRMBatteryLevel </entry>
<entry>Valid Values</entry>
<entry> Description </entry>
</row>
</thead>
<tbody>
<row>
<entry><p> <codeph>EBatteryLevelUnknown</codeph> </p> </entry>
<entry><p>-1 </p> </entry>
<entry><p>Uninitialized or some other error. </p> </entry>
</row>
<row>
<entry><p> <codeph>EBatteryLevelLevel0</codeph> </p> </entry>
<entry><p>0</p> </entry>
<entry><p>Lowest battery level. </p> </entry>
</row>
<row>
<entry><p> <codeph>EBatteryLevelLevel1</codeph> </p> </entry>
<entry><p>1</p> </entry>
<entry><p>Battery Level 1. </p> </entry>
</row>
<row>
<entry><p> <codeph>EBatteryLevelLevel2</codeph> </p> </entry>
<entry><p>2</p> </entry>
<entry><p>Battery Level 2. </p> </entry>
</row>
<row>
<entry><p> <codeph>EBatteryLevelLevel3</codeph> </p> </entry>
<entry><p>3</p> </entry>
<entry><p>Intermediate levels </p> </entry>
</row>
<row>
<entry><p> <codeph>EBatteryLevelLevel4</codeph> </p> </entry>
<entry><p>4</p> </entry>
<entry><p>Battery Level 4. </p> </entry>
</row>
<row>
<entry><p> <codeph>EBatteryLevelLevel5</codeph> </p> </entry>
<entry><p>5</p> </entry>
<entry><p>Battery Level 5. </p> </entry>
</row>
<row>
<entry><p> <codeph>EBatteryLevelLevel6</codeph> </p> </entry>
<entry><p>6</p> </entry>
<entry><p>Battery Level 6. </p> </entry>
</row>
<row>
<entry><p> <codeph>EBatteryLevelLevel7</codeph> </p> </entry>
<entry><p>7</p> </entry>
<entry><p>Highest battery level. </p> </entry>
</row>
</tbody>
</tgroup>
</table> <p> <b>Battery status of device</b> </p> <p>Interpreted as <codeph>EPSHWRMBatteryStatus</codeph> enumeration
and can be related to the battery status of the device. </p> <table id="GUID-E8331299-6047-579D-B4AD-8DF3B0C7028E">
<tgroup cols="3"><colspec colname="col0"/><colspec colname="col1"/><colspec colname="col2"/>
<thead>
<row>
<entry> EPSHWRMBatteryStatus </entry>
<entry>Valid Values</entry>
<entry> Description </entry>
</row>
</thead>
<tbody>
<row>
<entry><p> <codeph>EBatteryStatusUnknown</codeph> </p> </entry>
<entry><p>-1 </p> </entry>
<entry><p> <systemoutput>Uninitialized</systemoutput> or some other error. </p> </entry>
</row>
<row>
<entry><p> <codeph>EBatteryStatusOk</codeph> </p> </entry>
<entry><p>0</p> </entry>
<entry><p>This can also be used during charging. </p> </entry>
</row>
<row>
<entry><p> <codeph>EBatteryStatusLow</codeph> </p> </entry>
<entry><p>1</p> </entry>
<entry><p>Show "<systemoutput>Battery low</systemoutput> " note to user . </p> </entry>
</row>
<row>
<entry><p> <codeph>EBatteryStatusEmpty</codeph> </p> </entry>
<entry><p>2</p> </entry>
<entry><p>Show "<systemoutput>Recharge battery</systemoutput> " note to user. </p> </entry>
</row>
</tbody>
</tgroup>
</table> <p> <b>Charging status of device</b> </p> <p>Interpreted as enumeration <codeph>EPSHWRMChargingStatus</codeph> and
can be related to the charging status of the device. </p> <table id="GUID-1BC438C0-8110-53C7-9F4E-77060CFE9202">
<tgroup cols="3"><colspec colname="col0"/><colspec colname="col1"/><colspec colname="col2"/>
<thead>
<row>
<entry> EPSHWRMChargingStatus </entry>
<entry>Valid Values</entry>
<entry> Description </entry>
</row>
</thead>
<tbody>
<row>
<entry><p> <codeph>EChargingStatusError</codeph> </p> </entry>
<entry><p>-1 </p> </entry>
<entry><p>Some error has occurred when charger is connected or charging. </p> </entry>
</row>
<row>
<entry><p> <codeph>EChargingStatusNotConnected</codeph> </p> </entry>
<entry><p>0</p> </entry>
<entry><p>Charger uninitialized or not connected. </p> </entry>
</row>
<row>
<entry><p> <codeph>EChargingStatusCharging</codeph> </p> </entry>
<entry><p>1</p> </entry>
<entry><p>Device is charging. </p> </entry>
</row>
<row>
<entry><p> <codeph> EChargingStatusNotCharging</codeph> </p> </entry>
<entry><p>2</p> </entry>
<entry><p>Charger is connected, device not charging. </p> </entry>
</row>
<row>
<entry><p> <codeph>EChargingStatusAlmostComplete</codeph> </p> </entry>
<entry><p>3</p> </entry>
<entry><p>Charging almost completed. </p> </entry>
</row>
<row>
<entry><p> <codeph>EChargingStatusChargingComplete</codeph> </p> </entry>
<entry><p>4</p> </entry>
<entry><p>Charging completed. </p> </entry>
</row>
<row>
<entry><p> <codeph>EChargingStatusChargingContinued</codeph> </p> </entry>
<entry><p>5</p> </entry>
<entry><p>Charging continued after brief interruption. </p> </entry>
</row>
</tbody>
</tgroup>
</table> </section>
</conbody><related-links>
<link href="GUID-C3B6E5F6-74DC-5C0E-94C8-B4822F4A2EB6.dita"><linktext>Power State
API Tutorial</linktext></link>
</related-links></concept>