|
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-34614E31-45F1-5BD8-963D-9526AAD31734" xml:lang="en"><title>resourcemanager: |
|
13 Power Resource Manager Framework example</title><shortdesc>This example demonstrates the Power Resource Manager user side |
|
14 APIs. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
15 <section><title>Purpose</title> <p>The example shows how to use the <xref href="GUID-6E1DE1E4-1B09-541C-8708-9126E69B42CE.dita">Power Resource Manager user |
|
16 side APIs</xref> provided by the <xref href="GUID-FD3DEFC1-DA39-3A1A-8E00-A46B34B78899.dita"><apiname>RBusDevResManUs</apiname></xref> class. </p> The |
|
17 use cases demonstrated are:<ul> |
|
18 <li><p>How to get information about power resources.</p></li> |
|
19 <li><p>How to get information about other clients registered with the Power |
|
20 Resource Manager. </p></li> |
|
21 <li><p> How to change the state of a resource.</p></li> |
|
22 <li><p>How to get notification when a resource changes state.</p></li> |
|
23 </ul></section> |
|
24 <section><title>Class summary</title><ol> |
|
25 <li id="GUID-BF6BF1A4-061C-4643-95D8-C89388675B91"><p><xref href="GUID-FD3DEFC1-DA39-3A1A-8E00-A46B34B78899.dita"><apiname>RBusDevResManUs</apiname></xref></p></li> |
|
26 <li id="GUID-4DD7C3AC-048E-446D-8D52-EE6CFCEB8227"><p><xref href="GUID-A1DDD3E3-C009-3C02-895B-0B2D0EE67A9D.dita"><apiname>TResourceInfo</apiname></xref></p></li> |
|
27 <li id="GUID-D1CD4D8A-B58E-46DC-AB17-E19EEC0C7714"><p><xref href="GUID-3BC432D9-6C37-35C0-BE85-DA21E6E520C7.dita"><apiname>TClientInfo</apiname></xref></p></li> |
|
28 </ol></section> |
|
29 <section><title>Download</title> <p>Click on the following link to download |
|
30 the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-bca7fbc0-b2fc-48da-adf3-3f0961ac9f88.zip" scope="external">resourcemanager.zip</xref>.</p><p>Click: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-bca7fbc0-b2fc-48da-adf3-3f0961ac9f88.html" scope="peer">browse</xref> to view the example code.</p> </section> |
|
31 <section><title>Design and implementation</title> <p>This example builds a |
|
32 console application called <filepath>resourcemanager.exe</filepath>. It requests |
|
33 user input, and prints information to the console. </p> <p>The following menu |
|
34 options are presented to the user: </p> <ul> |
|
35 <li id="GUID-D5D0980D-140F-5142-B002-4986476AB082"><p>Get Power Resource information. </p> </li> |
|
36 <li id="GUID-90DE75D2-2F4C-5FEC-BFC0-89BC65A68EA1"><p>Change the state of |
|
37 a resource. </p> </li> |
|
38 <li id="GUID-AA262888-404A-58B8-85BA-EC10E523F8DD"><p>Notify a change of resource |
|
39 state. </p> </li> |
|
40 </ul> <p><b>Get Power Resource information</b> </p> <p>This option gets and |
|
41 displays information about the clients of the Power Resource Manager framework |
|
42 and about the available resources. </p> <p>The following sub-menu options |
|
43 are presented: </p> <ul> |
|
44 <li id="GUID-0C71EA91-4622-568F-B909-F48E453E3261"><p>1. Get the number of |
|
45 available resources. </p> </li> |
|
46 <li id="GUID-83B6CD7A-6830-58EE-9AC1-DD59E1320FAA"><p>2. Get information about |
|
47 a particular resource. </p> </li> |
|
48 <li id="GUID-85B710BA-7EA7-5A6A-8389-34115D094044"><p>3. Get information about |
|
49 all the available resources. </p> </li> |
|
50 <li id="GUID-D92401B4-0F81-5FF4-A413-1AB3DE0E4EAF"><p>4. Get the state of |
|
51 a particular resource. </p> </li> |
|
52 <li id="GUID-B7E8C908-5AF7-5C3A-9CD9-4E812BE446A1"><p>5. Get the number of |
|
53 clients using a particular resource. </p> </li> |
|
54 <li id="GUID-90A8D835-F4D4-5B4E-831A-F4BB6B8D36C7"><p>6. Get the number of |
|
55 resources used by a particular client. </p> </li> |
|
56 <li id="GUID-CF511B2E-A7A4-5435-8878-8F9332EBEF8C"><p>7. Get information about |
|
57 all the resources in use by a particular client. </p> </li> |
|
58 <li id="GUID-4E7F9E93-1FFF-56DD-9970-87EAF45CDB7A"><p>8. Get information on |
|
59 all clients using a particular resource. </p> </li> |
|
60 <li id="GUID-85D80BC5-99E1-5AA9-AE0C-573CAD798B6D"><p>9. Get the names of |
|
61 all clients. </p> </li> |
|
62 </ul> <p><b>Change the state of a resource</b> </p> <p>This option allows |
|
63 the user to change the state of a resource. </p> <p><b>Notify any change of |
|
64 resource state</b> </p> <p>This option changes the state of a resource and |
|
65 notifies the user about the change. </p> </section> |
|
66 <section><title>Building and configuring</title> <p>To build the example: </p> <ul> |
|
67 <li id="GUID-1724170B-EEB9-5899-AB43-540035CE23F4"><p>You can build the example |
|
68 from your IDE or the command line. </p> <p>If you use an IDE, import the <filepath>bld.inf</filepath> file |
|
69 of the example into your IDE, and use the build command of the IDE. </p> <p>If |
|
70 you use the command line, open a command prompt, and set the current directory |
|
71 to the source code directory of the example. You can then build the example |
|
72 with the SBSv1 build tools with the following commands: </p> <p><userinput>bldmake |
|
73 bldfiles</userinput> </p> <p><userinput>abld build</userinput> </p> <p><xref href="GUID-793A5EF9-CC16-5EEB-9011-6431EA76EB15.dita">How to use bldmake</xref> and <xref href="GUID-B6B54E07-3B34-5D5C-8815-93383FA8FB4B.dita">How to use abld</xref> describe |
|
74 how to use the SBSv1 build tools. </p> </li> |
|
75 <li id="GUID-23AF0285-6E6B-55F4-BF08-49C6E41C1B7D"><p>For the emulator, the |
|
76 example builds an executable called <filepath>resourcemanager.exe</filepath> in |
|
77 the <filepath>epoc32\release\winscw\<udeb or urel>\</filepath> folder. </p> </li> |
|
78 </ul> </section> |
|
79 <section><title>Running the example</title> <p>To run the example, launch |
|
80 the executable <filepath>resourcemanager.exe</filepath>, then choose from |
|
81 the menu options. Press <userinput>Esc</userinput> to quit. </p> <p>Note: |
|
82 this example requires an LDD, a PDD and a PSL (platform specific layer). If |
|
83 these are not provided on the platform you are using, the example will not |
|
84 run. </p> </section> |
|
85 </conbody><related-links> |
|
86 <link href="GUID-6E1DE1E4-1B09-541C-8708-9126E69B42CE.dita"><linktext>Power Resource |
|
87 Manager Architecture Overview</linktext></link> |
|
88 </related-links></concept> |