?? index.html
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>HWRMTestApp Example</title><link href="style.css" rel="stylesheet" type="text/css"></head><table border="0" width="100%" height="8" bgcolor="#eeeeee"><tr> <td width="100%" height="1"><b><font size="2" color="#000000" face="Arial, Helvetica, sans-serif"><strong><a name=Top></a>S60 5th Edition SDK for Symbian OS </strong></font></b><br><i>Example Applications Guide</i></td></tr> </table><!-- Generated by Doxygen 1.4.5 --><div class="tabs"> <ul> <li id="current"><a href="index.html"><span>Main Page</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul></div><h1>HWRMTestApp Example</h1><p><a class="el" href="index.html#intro_sec">1. About this Example</a> <br><a class="el" href="index.html#Pre_sec">2. Prerequisites</a> <br><a class="el" href="index.html#Design_sec">3. Design and Implemention</a><p><hr><h2><a class="anchor" name="intro_sec">1. About this Example</a></h2>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.<p><hr><h2><a class="anchor" name="Pre_sec">2. Prerequisites</a></h2><ul><li>Symbian 9.1 platform.</li></ul><p><hr><h2><a class="anchor" name="Design_sec">3. Design and Implemention</a></h2>HWRMTestApp is a simple Symbian Series 60 based UI application. The core functionality is implemented in <a class="el" href="class_c_h_w_r_m_test_app_app_ui.html">CHWRMTestAppAppUi</a> 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 <code>HandleCommandL</code> method of <a class="el" href="class_c_h_w_r_m_test_app_app_ui.html">CHWRMTestAppAppUi</a> class receives commands entered by user and directs the service requests to the right method that handles them. <a class="el" href="class_c_h_w_r_m_test_app_container.html">CHWRMTestAppContainer</a> instantiates the editor control that is used for displaying information to the user.<p>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..<h3><a class="anchor" name="Sub31">3.1 Capabilities</a></h3>The program capabilities are defined in HWRMTestApp.mmp file: CAPABILITY ReadDeviceData.<h3><a class="anchor" name="Sub32">3.2 ScalableUI</a></h3>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.<h3><a class="anchor" name="Sub33">3.3 Module dependencies</a></h3>At build time there exists following module dependencies:<ul><li><em>HWRMTestApp</em> requires <em>HWRMLightClient.lib</em> and <em>HWRMVibraClient.lib</em>.</li></ul><p>In addition, several UI related libraries provided by SDK are required: euser, apparc, cone, eikcore, eikcoctl, avkon, efsrv, bafl, eikdlg.<h3><a class="anchor" name="Sub34">3.4 Building the example application</a></h3>Application can be built in directory <code>hwrmtestapp\group</code> by running the following commands:<ul><li><code>bldmake bldfiles</code></li><li><code>abld build winscw udeb</code></li></ul><p>In addition it is possible to create project from <em>CodeWarrior</em> IDE by running the following command:<ul><li><code>abld makefile cw_ide</code></li></ul><p>After succesful build, application can be found and started from<ul><li><b>Applications > Installed > HWRMTestApp</b>.</li></ul><h3><a class="anchor" name="Sub35">3.5 Using the application</a></h3>In the following is described a typical use case scenario for the HWRMTestApp application. The scenario is as follows:<p><ul><li>User starts the application</li><li>User changes vibra settings</li><li>User changes light settings</li><li>User receives information about power state changes</li><li>User exits from the application</li></ul><p>The rest of the sub sections describe how individual scenario steps are performed.<h4><a class="anchor" name="Subsub351">3.5.1 User starts the application</a></h4>When the GUI is being constructed following instances of classes are being constructed:<p><ul><li>CHWRMLight instance for controlling light settings</li><li>CHWRMVibra instance for controlling vibra settings</li><li><a class="el" href="class_c_h_w_r_m_test_app_property_observer.html">CHWRMTestAppPropertyObserver</a> instance for receiving notifications on battery status changes</li><li><a class="el" href="class_c_h_w_r_m_test_app_property_observer.html">CHWRMTestAppPropertyObserver</a> instance for receiving notifications on battery level changes</li><li><a class="el" href="class_c_h_w_r_m_test_app_property_observer.html">CHWRMTestAppPropertyObserver</a> instance for receiving notifications on charging status changes</li></ul><p>In order to receive vibra and light status change information the CHWRTestAppAppUi class inherits interfaces MHWRMVibraObserver and MHWRMLightObserver.<h4><a class="anchor" name="Subsub352">3.5.2 User changes vibra settings</a></h4>CHWRMVibra instance is used for:<p><ul><li>reserving and releasing vibra</li><li>setting vibra on and off</li><li>querying vibra state i.e. is vibra on or off</li></ul><p>Depending on the function used, the following parameters may be queried from the user:<p><ul><li>duration: time in milliseconds vibra will be active</li><li>intensity: percentage of full vibra rotation speed. Sign digit dictates the vibra motor rotation direction.</li><li>restore: if ETrue is selected, the vibration state on last release will be restored upon successful reservation.</li><li>NoCCoeEnv: if EFalse is selected vibra will be automatically released when the application goes to background and reserved when the application is restored to foreground.</li></ul><p>Information on usage of a function, its parameters and the result data is passed to the <a class="el" href="class_c_h_w_r_m_test_app_container.html">CHWRMTestAppContainer</a> instance which presents the data to the user.<h4><a class="anchor" name="Subsub353">3.5.3 User changes light settings</a></h4>CHWRMLight instance is used for:<p><ul><li>reserving and releasing a light target</li><li>setting light target on and off</li><li>setting light target blinking</li><li>querying light target status i.e. is light target on, off or blinking</li></ul><p>Depending on the function used, the following parameters may be queried from the user:<p><ul><li>target: the light device that should be controlled (display, keyboard, hardware specific custom target)</li><li>duration: time in milliseconds light target will be active</li><li>intensity: percentage of full light intensity</li><li>restore: if ETrue is selected, the light state on last release will be restored upon successful reservation.</li><li>fade: if ETrue is selected, the light target will be turned on/off gradually (fade-in/fade-out)</li></ul><p>Information on usage of a function, its parameters and the result data is passed to the <a class="el" href="class_c_h_w_r_m_test_app_container.html">CHWRMTestAppContainer</a> instance which presents the data to the user.<h4><a class="anchor" name="Subsub354">3.5.4 User receives information about power state changes</a></h4><a class="el" href="class_c_h_w_r_m_test_app_app_ui.html">CHWRMTestAppAppUi</a> class contains three instances of class <a class="el" href="class_c_h_w_r_m_test_app_property_observer.html">CHWRMTestAppPropertyObserver</a>, 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 <a class="el" href="class_c_h_w_r_m_test_app_property_observer.html">CHWRMTestAppPropertyObserver</a> instance reports change in key it is listening to by adding a message to <a class="el" href="class_c_h_w_r_m_test_app_container.html">CHWRMTestAppContainer</a> instance, which presents the information to the user.<h4><a class="anchor" name="Subsub355">3.5.5 User exits from the application</a></h4>Exiting the application releases all the dynamic data of the application. Deleting CHWRMVibra and CHWRLight instances closes connections to the HW Resource Manager. Deleting <a class="el" href="class_c_h_w_r_m_test_app_property_observer.html">CHWRMTestAppPropertyObserver</a> instances cancels subscriptions on power state Publish&Subscribe keys. <hr><table x-use-null-cells style="x-cell-content-align: top; width: 100%; border-spacing: 0px; border-spacing: 0px;" cellspacing=0 width=100%> <col style="width: 50%;"> <col style="width: 50%;"> <tr style="x-cell-content-align: top;" valign=top> <td style="width: 50%; padding-right: 10px; padding-left: 10px; border-right-style: None; border-left-style: None; border-top-style: None; border-bottom-style: None;" width=50%> <p style="font-family: Arial;"><small style="font-size: smaller;">
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -