S60 3rd Edition SDK for Symbian OS
Example Applications Guide

CHWRMTestAppAppUi Class Reference

#include <HWRMTestAppAppUi.h>

List of all members.

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 ()
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


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.


Constructor & Destructor Documentation

CHWRMTestAppAppUi::~CHWRMTestAppAppUi (   ) 
 

Destructor.

Definition at line 75 of file HWRMTestAppAppUi.cpp.

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

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


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     TRAP( err, iVibra = CHWRMVibra::NewL(this) );
00054     if( err == KErrNotSupported )
00055         {
00056         _LIT( KVibraNotSupported, "Vibra API Not Supported!" );
00057         iAppContainer->AddMessageL( KVibraNotSupported );
00058         }
00059 
00060     // Create the observers
00061     iBatteryStatusObserver = CHWRMTestAppPropertyObserver::NewL(
00062                     KPSUidHWRMPowerState,KHWRMBatteryStatus, iAppContainer );
00063     iBatteryLevelObserver = CHWRMTestAppPropertyObserver::NewL(
00064                     KPSUidHWRMPowerState,KHWRMBatteryLevel, iAppContainer );
00065     iChargingStatusObserver = CHWRMTestAppPropertyObserver::NewL(
00066                     KPSUidHWRMPowerState,KHWRMChargingStatus, iAppContainer );
00067     }

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

From CEikAppUi, takes care of command handling.

Parameters:
aCommand command to be handled

Definition at line 145 of file HWRMTestAppAppUi.cpp.

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

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

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 134 of file HWRMTestAppAppUi.cpp.

References iAppContainer, and CHWRMTestAppContainer::OfferKeyEventL().

00136     {
00137     return iAppContainer->OfferKeyEventL( aKeyEvent, aType );
00138     }


© Nokia 2006

Back to top