MHWRMLightObserver Class Reference

#include <hwrmlight.h>

class MHWRMLightObserver
Public Member Functions
pure virtual voidLightStatusChanged(TInt, CHWRMLight::TLightStatus)

Detailed Description

A callback interface for light status reporting.

If the client requires up-to-date status information, the client needs to derive a class from the MHWRMlightObserver interface and implement the LightStatusChanged() method.

A callback object header example:

 // INCLUDES
 #include <hwrmlight.h> // Link against HWRMLightClient.lib.

 class CTests : public CBase,
                public MHWRMLightObserver
     {
     public:
         CTests();
         ~CTests();
                           
         void ConstructL();
         static CTests* NewL();
                
         // from MHWRMLightObserver
         virtual void LightStatusChanged(TInt aTarget, 
                                         CHWRMLight::TLightStatus aStatus);

    private:
         CHWRMLight* iLight;
    };

A callback method implementation example:

 void CTests::LightStatusChanged(TInt aTarget, 
                          CHWRMLight::TLightStatus aStatus)
     {
     RDebug::Print(_L("### Light state changed for target: 0x%x"), aTarget);
     switch ( aStatus )
         {
         case CHWRMLight::ELightOn:
             RDebug::Print(_L("### Light state changed: ELightOn"));
             break;
         case CHWRMLight::ELightOff:
             RDebug::Print(_L("### Light state changed: ELightOff"));
             break;
         case CHWRMLight::ELightBlink:
             RDebug::Print(_L("### Light state changed: ELightBlink"));
             break;
         case CHWRMLight::ELightStatusUnknown:
             RDebug::Print(_L("### Light state changed: ELightStatusUnknown"));
             break;
         default:
             RDebug::Print(_L("### Light state changed: UNDEFINED !"));
             break;
         }
     }

Member Function Documentation

LightStatusChanged ( TInt, CHWRMLight::TLightStatus )

voidLightStatusChanged(TIntaTarget,
CHWRMLight::TLightStatusaStatus
)[pure virtual]

Called when the device light status changes. Note that if the light status for certain target changes very rapidly, some state transitions might be missed. It is however guaranteed that latest state is always obtained.

See also: CHWRMLight::TLightTarget CHWRMLight::TLightStatus

Parameters
aTargetIndicates target(s) the new status applies to.
aStatusIndicates light request status.