|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept id="GUID-C3B6E5F6-74DC-5C0E-94C8-B4822F4A2EB6" xml:lang="en"><title>Power |
|
13 API Tutorial </title><shortdesc>This tutorial explains how to use the Power API of the HWRM. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <section><title>Introduction</title> <p>Power API methods can be used by constructing |
|
15 an instance of <xref href="GUID-4A98138C-4C68-3399-80E8-25CB41E43D5C.dita"><apiname>CHWRMPower</apiname></xref> and calling |
|
16 its functions. However, to use its full functionality write a class which |
|
17 implements one or more of the observer interfaces described in the following |
|
18 table. Then, construct an instance of <xref href="GUID-4A98138C-4C68-3399-80E8-25CB41E43D5C.dita"><apiname>CHWRMPower</apiname></xref> and |
|
19 provide it with pointers to observers. </p> <table id="GUID-CC645CB8-B78E-5624-B669-31B5A08F77C2"> |
|
20 <tgroup cols="3"><colspec colname="col0"/><colspec colname="col1"/><colspec colname="col2"/> |
|
21 <thead> |
|
22 <row> |
|
23 <entry>Interface</entry> |
|
24 <entry>Notification</entry> |
|
25 <entry>Method to override</entry> |
|
26 </row> |
|
27 </thead> |
|
28 <tbody> |
|
29 <row> |
|
30 <entry><p> <xref href="GUID-4A98138C-4C68-3399-80E8-25CB41E43D5C.dita"><apiname>MHWRMBatteryPowerObserver</apiname></xref> </p> </entry> |
|
31 <entry><p>Average battery voltage and current consumption </p> </entry> |
|
32 <entry><p> <xref href="GUID-4A98138C-4C68-3399-80E8-25CB41E43D5C.dita"><apiname>PowerMeasurement</apiname></xref> </p> </entry> |
|
33 </row> |
|
34 <row> |
|
35 <entry><p> <xref href="GUID-4A98138C-4C68-3399-80E8-25CB41E43D5C.dita"><apiname>MHWRMBatteryChargingStatusObserver</apiname></xref> </p> </entry> |
|
36 <entry><p>Charging status </p> </entry> |
|
37 <entry><p> <xref href="GUID-4A98138C-4C68-3399-80E8-25CB41E43D5C.dita"><apiname>ChargingStatusChange</apiname></xref> </p> </entry> |
|
38 </row> |
|
39 <row> |
|
40 <entry><p> <xref href="GUID-4A98138C-4C68-3399-80E8-25CB41E43D5C.dita"><apiname>MHWRMBatteryChargingCurrentObserver</apiname></xref> </p> </entry> |
|
41 <entry><p>Average charging current </p> </entry> |
|
42 <entry><p> <xref href="GUID-4A98138C-4C68-3399-80E8-25CB41E43D5C.dita"><apiname>AverageChargingCurrentChange</apiname></xref> </p> </entry> |
|
43 </row> |
|
44 <row> |
|
45 <entry><p> <xref href="GUID-4A98138C-4C68-3399-80E8-25CB41E43D5C.dita"><apiname>MHWRMBatteryFullChargingTimeObserver</apiname></xref> </p> </entry> |
|
46 <entry><p>Remaining charging time </p> </entry> |
|
47 <entry><p> <xref href="GUID-4A98138C-4C68-3399-80E8-25CB41E43D5C.dita"><apiname>BatteryFullChargingTimeChange</apiname></xref> </p> </entry> |
|
48 </row> |
|
49 </tbody> |
|
50 </tgroup> |
|
51 </table> <p>For example, if the application requires periodic measurements |
|
52 of average battery voltage and current consumption, it must implement <xref href="GUID-4A98138C-4C68-3399-80E8-25CB41E43D5C.dita"><apiname>MHWRMBatteryPowerObserver</apiname></xref> and instantiate a <xref href="GUID-4A98138C-4C68-3399-80E8-25CB41E43D5C.dita"><apiname>CHWRMPower</apiname></xref> object using the <xref href="GUID-4A98138C-4C68-3399-80E8-25CB41E43D5C.dita"><apiname>CHWRMPower::NewL(NULL, |
|
53 MHWRMBatteryPowerObserver *)</apiname></xref> method. </p> <p> <b>Note:</b> The battery |
|
54 charging observers cannot be passed to <xref href="GUID-4A98138C-4C68-3399-80E8-25CB41E43D5C.dita"><apiname>CHWRMPower</apiname></xref> using |
|
55 a <xref href="GUID-4A98138C-4C68-3399-80E8-25CB41E43D5C.dita"><apiname>NewL()</apiname></xref> function. Call the dedicated |
|
56 function, <xref href="GUID-4A98138C-4C68-3399-80E8-25CB41E43D5C.dita"><apiname>CHRMPower::SetBatteryChargingObserver()</apiname></xref>. </p> </section> |
|
57 <section><title>Procedure</title> <ol id="GUID-8FD35358-CFCD-5010-AFD8-C277463B2970"> |
|
58 <li id="GUID-E7A8616C-DA3A-5CC7-831F-3BA977F7C129-GENID-1-6-1-8-1-1-5-1-4-1-5-1-6-1-3-2-2-1"><p><xref href="GUID-047E3462-F806-4C54-9DC5-6B78907CA949.dita">Derive |
|
59 a class from one or more of the above interfaces</xref>. </p> </li> |
|
60 <li id="GUID-E7A8616C-DA3A-5CC7-831F-3BA977F7C129-GENID-1-6-1-8-1-1-5-1-4-1-5-1-6-1-3-2-2-2"><p><xref href="GUID-047E3462-F806-4C54-9DC5-6B78907CA949.dita">Implement |
|
61 the appropriate observer functions.</xref></p> </li> |
|
62 <li id="GUID-6DF35505-CA49-56AB-94E2-4291E2DFF232"><p><xref href="GUID-BC627588-E8C7-4DDB-8313-7C57E0CCD93B.dita">Create |
|
63 a power client using <apiname keyref="CHWRMPower">CHWRMPower::NewL()</apiname> or <apiname keyref="CHWRMPower">NewLC()</apiname>.</xref> </p><p><xref href="GUID-7CF7D29B-14A4-432E-BBB2-E3AF283E45E3.dita">You |
|
64 can retrieve the battery voltage or consumption information.</xref></p> </li> |
|
65 <li id="GUID-300E10F0-5414-55CB-8D9C-2B78E3782C34"><p><xref href="GUID-6CF00375-0A3E-4B85-9BA3-307BBB4ECFC7.dita">Call <apiname keyref="CHWRMPower">CHRMPower::SetBatteryChargingObserver()</apiname>, if |
|
66 necessary.</xref></p> </li> |
|
67 <li id="GUID-76E7EFB8-0464-5887-B144-1ACDFDE1D7F6"><p><xref href="GUID-FC7F8CFE-F9AD-4442-9289-CCEFEC62DF68.dita">Start |
|
68 receiving notification using the appropriate start function(s).</xref> </p> </li> |
|
69 <li id="GUID-209732A3-E374-54D2-87F7-5C3C45A23E85"><p><xref href="GUID-6A0D353D-A9B0-46EA-8FDC-1FBBD4A20CFB.dita">Stop |
|
70 receiving notification using the appropriate stop function(s).</xref></p> </li> |
|
71 </ol> <p> <b>Note: </b> If the notification period exceeds the maximum reporting |
|
72 period, set when the HWRM server starts, notification is cancelled. </p> </section> |
|
73 </conbody><related-links> |
|
74 <link href="GUID-1E55DD3C-D699-5062-88C1-C826F06CD48C.dita"><linktext>Power API</linktext> |
|
75 </link> |
|
76 </related-links></concept> |