Nokia N97 SDK
Example Applications Guide

CHWRMTestAppAppUi Class Reference

#include <HWRMTestAppAppUi.h>

Inheritance diagram for CHWRMTestAppAppUi:

List of all members.

Detailed Description

Application UI class. Provides support for the following features:

HWRMTestApp.exe

Since:
Series S60 3.0

Definition at line 41 of file HWRMTestAppAppUi.h.


Public Member Functions

void  ConstructL ()
  ~CHWRMTestAppAppUi ()

Private Member Functions

void  DynInitMenuPaneL (TInt aResourceId, CEikMenuPane *aMenuPane)
void  HandleCommandL (TInt aCommand)
virtual TKeyResponse  HandleKeyEventL (const TKeyEvent &aKeyEvent, TEventCode aType)
void  VibraReserveL ()
void  VibraReleaseL ()
void  VibraStartL ()
void  VibraStopL ()
void  VibraStatus ()
void  VibraSettings ()
void  LightsReserveL ()
void  LightsReleaseL ()
void  LightsOnL ()
void  LightsBlinkL ()
void  LightsOffL ()
void  LightsStatusL ()
void  PrintLightTargetsL ()
virtual void  VibraModeChanged (CHWRMVibra::TVibraModeState aStatus)
virtual void  VibraStatusChanged (CHWRMVibra::TVibraStatus aStatus)
virtual void  LightStatusChanged (TInt aTarget, CHWRMLight::TLightStatus aStatus)
TInt  GetLightsTargetL ()
virtual void  HandleForegroundEventL (TBool aForeground)

Private Attributes

CHWRMTestAppContainer *  iAppContainer
CHWRMLight *  iLight
CHWRMVibra *  iVibra
CHWRMTestAppPropertyObserver *  iBatteryStatusObserver
CHWRMTestAppPropertyObserver *  iBatteryLevelObserver
CHWRMTestAppPropertyObserver *  iChargingStatusObserver


Constructor & Destructor Documentation

CHWRMTestAppAppUi::~CHWRMTestAppAppUi (   ) 
 

Destructor.

Definition at line 79 of file HWRMTestAppAppUi.cpp.

References iAppContainer, iBatteryLevelObserver, iBatteryStatusObserver, iChargingStatusObserver, iLight, and iVibra.

00080     {
00081     // Delete the observers
00082     delete iBatteryStatusObserver;
00083     delete iBatteryLevelObserver;
00084     delete iChargingStatusObserver;
00085 
00086     delete iLight; // kill light
00087     delete iVibra; // kill vibra
00088 
00089     if(iAppContainer)
00090         {
00091         RemoveFromStack( iAppContainer );
00092         delete iAppContainer;
00093         }
00094     }


Member Function Documentation

void CHWRMTestAppAppUi::ConstructL (   ) 
 

EPOC default constructor.

Definition at line 37 of file HWRMTestAppAppUi.cpp.

References CHWRMTestAppContainer::AddMessageL(), CHWRMTestAppContainer::ConstructL(), iAppContainer, and iLight.

00038     {
00039     BaseConstructL(CAknAppUi::EAknEnableSkin);
00040     iAppContainer = new (ELeave) CHWRMTestAppContainer;
00041     iAppContainer->SetMopParent(this);
00042     iAppContainer->ConstructL( ClientRect() );
00043     AddToStackL( iAppContainer );
00044     
00045     // We can ignore this error, simply dim the menus if 
00046     // pointer is null with the DynInitMenuPaneL method
00047     TRAPD( err, iLight = CHWRMLight::NewL(this) );
00048     if( err == KErrNotSupported )
00049         {
00050         _LIT( KLightNotSupported, "Light API Not Supported!" );
00051         iAppContainer->AddMessageL( KLightNotSupported );
00052         }
00053     else
00054         {
00055         PrintLightTargetsL();    
00056         }
00057     TRAP( err, iVibra = CHWRMVibra::NewL(this) );
00058     if( err == KErrNotSupported )
00059         {
00060         _LIT( KVibraNotSupported, "Vibra API Not Supported!" );
00061         iAppContainer->AddMessageL( KVibraNotSupported );
00062         }
00063 
00064     // Create the observers
00065     iBatteryStatusObserver = CHWRMTestAppPropertyObserver::NewL(
00066                     KPSUidHWRMPowerState,KHWRMBatteryStatus, iAppContainer );
00067     iBatteryLevelObserver = CHWRMTestAppPropertyObserver::NewL(
00068                     KPSUidHWRMPowerState,KHWRMBatteryLevel, iAppContainer );
00069     iChargingStatusObserver = CHWRMTestAppPropertyObserver::NewL(
00070                     KPSUidHWRMPowerState,KHWRMChargingStatus, iAppContainer );
00071     }

void CHWRMTestAppAppUi::HandleCommandL (  TInt  aCommand  )  [private]
 

From CEikAppUi, takes care of command handling.

Parameters:
aCommand  command to be handled

Definition at line 149 of file HWRMTestAppAppUi.cpp.

References CHWRMTestAppContainer::AddMessageL(), iAppContainer, LightsBlinkL(), LightsOffL(), LightsOnL(), LightsReleaseL(), LightsReserveL(), LightsStatusL(), VibraReleaseL(), VibraReserveL(), VibraSettings(), VibraStartL(), VibraStatus(), and VibraStopL().

00150     {
00151     TInt err(KErrNone);
00152     
00153     switch ( aCommand )
00154         {
00155         case EAknSoftkeyBack:
00156         case EEikCmdExit:
00157             {
00158             Exit();
00159             break;
00160             }
00161         case EHWRMTestAppCmdVibraReserve:
00162             {
00163             _LIT(KReserveVibra, "Reserve vibra");
00164             iAppContainer->AddMessageL( KReserveVibra );
00165             TRAP( err, VibraReserveL() );
00166             break;
00167             }
00168         case EHWRMTestAppCmdVibraRelease:
00169             {
00170             _LIT(KReleaseVibra, "Release vibra");
00171             iAppContainer->AddMessageL( KReleaseVibra );
00172             TRAP( err, VibraReleaseL() );
00173             break;
00174             }
00175         case EHWRMTestAppCmdVibraStart:
00176             {
00177             _LIT(KStartVibra, "Start vibra");
00178             iAppContainer->AddMessageL( KStartVibra );
00179             TRAP( err, VibraStartL() );
00180             break;
00181             }
00182         case EHWRMTestAppCmdVibraStop:
00183             {
00184             _LIT(KStopVibra, "Stop vibra");
00185             iAppContainer->AddMessageL( KStopVibra );
00186             TRAP( err, VibraStopL() );
00187             break;
00188             }
00189         case EHWRMTestAppCmdVibraSettings:
00190                 {
00191                 _LIT(KVibraSettings, "Vibra settings");
00192                 iAppContainer->AddMessageL( KVibraSettings );
00193             VibraSettings();
00194             break;
00195                 }
00196         case EHWRMTestAppCmdVibraStatus:
00197                 {
00198                 _LIT(KVibraStatus, "Vibra status");
00199                 iAppContainer->AddMessageL( KVibraStatus );
00200             VibraStatus();
00201             break;
00202                 }
00203         case EHWRMTestAppCmdLightsReserve:
00204             {
00205             _LIT(KReserveLights, "Reserve lights");
00206             iAppContainer->AddMessageL( KReserveLights );
00207             TRAP( err, LightsReserveL() );
00208             break;
00209             }
00210         case EHWRMTestAppCmdLightsRelease:
00211             {
00212             _LIT(KReleaseLights, "Release lights");
00213             iAppContainer->AddMessageL( KReleaseLights );
00214             TRAP( err, LightsReleaseL() );
00215             break;
00216             }
00217         case EHWRMTestAppCmdLightsOn:
00218                 {
00219                 _LIT(KLightsOn, "Lights on");
00220                 iAppContainer->AddMessageL( KLightsOn );
00221             TRAP( err, LightsOnL() );
00222             break;
00223                 }
00224         case EHWRMTestAppCmdLightsBlink:
00225                 {
00226                 _LIT(KBlinkLights, "Blink lights");
00227                 iAppContainer->AddMessageL( KBlinkLights );
00228             TRAP( err, LightsBlinkL() );
00229             break;
00230                 }
00231         case EHWRMTestAppCmdLightsOff:
00232                 {
00233                 _LIT(KLightsOff, "Lights off");
00234                 iAppContainer->AddMessageL( KLightsOff );
00235             TRAP( err, LightsOffL() );
00236             break;
00237                 }
00238         case EHWRMTestAppCmdLightsStatus:
00239                 {
00240                 _LIT(KLightsStatus, "Lights status");
00241                 iAppContainer->AddMessageL( KLightsStatus );
00242             TRAP( err, LightsStatusL() );
00243             break;
00244                 }
00245         default:
00246             break;      
00247         }
00248     if( err != KErrNone )
00249         {
00250         TBuf<100> buf;
00251         _LIT(KErrorTrapped, "Error Trapped = %d!!!");
00252         buf.Format( KErrorTrapped, err );
00253         iAppContainer->AddMessageL( buf );
00254         }
00255     }

TKeyResponse CHWRMTestAppAppUi::HandleKeyEventL (  const TKeyEvent &  aKeyEvent,
TEventCode  aType
)  [private, virtual]
 

From CEikAppUi, handles key events.

Parameters:
aKeyEvent  Event to handled.
aType  Type of the key event.
Returns:
Response code (EKeyWasConsumed, EKeyWasNotConsumed).

Definition at line 138 of file HWRMTestAppAppUi.cpp.

References iAppContainer, and CHWRMTestAppContainer::OfferKeyEventL().

00140     {
00141     return iAppContainer->OfferKeyEventL( aKeyEvent, aType );
00142     }


The documentation for this class was generated from the following files:

© Nokia 2009

Back to top