Nokia N97 SDK
Example Applications Guide

HWRMTestApp Example

1. About this Example
2. Prerequisites
3. Design and Implemention


1. About this Example

HWRMTestApp is an example application that demonstrates HW Resource Manager API functionality. HW Resource Manager provides client APIs for controlling lights and vibra of the device. It also has additional responsibillty of publishing certain power state related Publish & Subscribe properties.


2. Prerequisites


3. Design and Implemention

HWRMTestApp is a simple Symbian S60 based UI application. The core functionality is implemented in CHWRMTestAppAppUi class, which instantiates the HW Resource Manager API objects that used for controlling light and vibra settings. User input is received from menus that are configured in application's resource file, and eventually HandleCommandL method of CHWRMTestAppAppUi class receives commands entered by user and directs the service requests to the right method that handles them. CHWRMTestAppContainer instantiates the editor control that is used for displaying information to the user.

The following sections explain the capabilities of the application, the current state of scalableUI support, the module dependencies and finally, steps required to build and use the application..

3.1 Capabilities

The program capabilities are defined in HWRMTestApp.mmp file: CAPABILITY ReadDeviceData.

3.2 ScalableUI

The program takes screen parameters in the start of the application. The program does not support changing the screen layout while the program is running.

3.3 Module dependencies

At build time there exists following module dependencies:

In addition, several UI related libraries provided by SDK are required: euser, apparc, cone, eikcore, eikcoctl, avkon, efsrv, bafl, eikdlg.

3.4 Building the example application

Application can be built in directory hwrmtestapp\group by running the following commands:

In addition it is possible to create project from CodeWarrior IDE by running the following command:

After succesful build, application can be found and started from

3.5 Using the application

In the following is described a typical use case scenario for the HWRMTestApp application. The scenario is as follows:

The rest of the sub sections describe how individual scenario steps are performed.

3.5.1 User starts the application

When the GUI is being constructed following instances of classes are being constructed:

In order to receive vibra and light status change information the CHWRTestAppAppUi class inherits interfaces MHWRMVibraObserver and MHWRMLightObserver.

3.5.2 User changes vibra settings

CHWRMVibra instance is used for:

Depending on the function used, the following parameters may be queried from the user:

Information on usage of a function, its parameters and the result data is passed to the CHWRMTestAppContainer instance which presents the data to the user.

3.5.3 User changes light settings

CHWRMLight instance is used for:

Depending on the function used, the following parameters may be queried from the user:

Information on usage of a function, its parameters and the result data is passed to the CHWRMTestAppContainer instance which presents the data to the user.

3.5.4 User receives information about power state changes

CHWRMTestAppAppUi class contains three instances of class CHWRMTestAppPropertyObserver, which is a generic class for receiving notifications on changes on a specified Publish&Subscribe key. All the instances are registered to listen to the category KPSUIDHWRMPowerState which contains keys for battery status changes (KHWRMBatteryStatus), battery level changes (KHWRMBatteryLevel) and charging status changes (KHWRMChargingStatus). Whenever a power state parameter that is monitored by HW Resource Manager changes, e.g. battery level drops, it is written to the specific Publis&Subscribe key. Each CHWRMTestAppPropertyObserver instance reports change in key it is listening to by adding a message to CHWRMTestAppContainer instance, which presents the information to the user.

3.5.5 User exits from the application

Exiting the application releases all the dynamic data of the application. Deleting CHWRMVibra and CHWRLight instances closes connections to the HW Resource Manager. Deleting CHWRMTestAppPropertyObserver instances cancels subscriptions on power state Publish&Subscribe keys.

© Nokia 2009

Back to top