This example demonstrates the Power Resource Manager user side APIs.
The example shows how to use the Power Resource Manager user side APIs provided by the RBusDevResManUs class.
The use cases demonstrated are:How to get information about power resources.
How to get information about other clients registered with the Power Resource Manager.
How to change the state of a resource.
How to get notification when a resource changes state.
Click on the following link to download the example: resourcemanager.zip.
Click: browse to view the example code.
This example
builds a console application called resourcemanager.exe
. It requests user input, and prints information to the console.
The following menu options are presented to the user:
Get Power Resource information
This option gets and displays information about the clients of the Power Resource Manager framework and about the available resources.
The following sub-menu options are presented:
1. Get the number of available resources.
2. Get information about a particular resource.
3. Get information about all the available resources.
4. Get the state of a particular resource.
5. Get the number of clients using a particular resource.
6. Get the number of resources used by a particular client.
7. Get information about all the resources in use by a particular client.
8. Get information on all clients using a particular resource.
9. Get the names of all clients.
Change the state of a resource
This option allows the user to change the state of a resource.
Notify any change of resource state
This option changes the state of a resource and notifies the user about the change.
To build the example:
You can build the example from your IDE or the command line.
If you use
an IDE, import the bld.inf
file of the example
into your IDE, and use the build command of the IDE.
If you use the command line, open a command prompt, and set the current directory to the source code directory of the example. You can then build the example with the SBSv1 build tools with the following commands:
bldmake bldfiles
abld build
For the emulator,
the example builds an executable called resourcemanager.exe
in the epoc32\release\winscw\<udeb or
urel>\
folder.
To run the example,
launch the executable resourcemanager.exe
, then
choose from the menu options. Press Esc to
quit.
Note: this example requires an LDD, a PDD and a PSL (platform specific layer). If these are not provided on the platform you are using, the example will not run.