CSysApLightControlPlugin Class Reference

class CSysApLightControlPlugin : public CBase

Base class for System Application Light Control plugin implementation.

A plugin that inherits this base class is able to implement customized system light control.

Plugin will receive light events and commands via interface methods.

Light event is signaled when such a system state change occurs that System Application is about to change state of lights.

A light event is followed by one or several light commands. Light command's purpose is to inform the plug-in about the light controlling measure System Application is about to take. Plugin can then either allow or deny the action with the return value of the notification method.

Below is an example how plugin can alter System Application's way of handling lights. In this scenario the plugin wishes to blink lights three times every time when an accessory is connected. In order to achieve this plugin monitors EAccessoryConnection light event for setting internal state variable. When the consequential light command is notified, plugin uses HWRM Light API for setting the lights to blink and gives a response to System Application that it must not execute light commands related to this event.

       void CSysApTestLightPluginAccDemo::LightEventL( TInt aEvent, const TDesC8& aData )
           {
           switch ( aEvent )
               {
               case SysApLightExtension::EAccessoryConnection:
                   {
                   TPckgBuf<TBool> connected;
                   connected.Copy( aData );
                   iConnected = connected(); // blink if accessory is just connected    
                   }
                   break;
                    
               default:
                   iConnected = EFalse;
                   break;
               }
           }

       TInt CSysApTestLightPluginAccDemo::HandleLightCommandL( TInt aCommand, const TDesC8& aData )
           {
           TInt retval( SysApLightExtension::ECommandNotHandled );
            
           // Blink lights only in case System Application would set lights on when an accessory is connected
           if ( aCommand == SysApLightExtension::ELightCommandOn && iConnected )
               {
               CHWRMLight* lightApi = CHWRMLight::NewLC();
                
               lightApi->LightOnL( CHWRMLight::ESystemTarget ); // ensure that lights are on after blinking

               lightApi->LightBlinkL( CHWRMLight::ESystemTarget, // blink lights for three times
                                      1200, // ms
                                      200, // ms
                                      200, // ms
                                      KHWRMDefaultIntensity );
                
               CleanupStack::PopAndDestroy( lightApi );

               retval = SysApLightExtension::ECommandHandled;
               }
            
           return retval;
           }
Since
S60 3.2 None.

Inherits from

  • CSysApLightControlPlugin

Constructor & Destructor Documentation

~CSysApLightControlPlugin()

~CSysApLightControlPlugin()[inline, virtual]

Destructor

Member Functions Documentation

HandleLightCommandL(TInt, const TDesC8 &)

TInt HandleLightCommandL(TIntaCommand,
const TDesC8 &aData
)[pure virtual]

A light command is about to be executed by System Application.

A light commad is the concrete light controlling action (on, off or blink) that System Application will take after a light event. This method is called with a special value (ELightCommandNoAction) also in case the light status should not be changed due to a light event.

Since
S60 3.2
TLightCommand TLightCommandResponse
leave
a Symbian error code. Leaves are not propagated. If a leave occurs, System Application will continue light processing as it had received return value ECommandHandled.

Parameters

TInt aCommandthe light command (defined in TLightCommand).
const TDesC8 & aDatadata related to the command.

LightEventL(TInt, const TDesC8 &)

voidLightEventL(TIntaEvent,
const TDesC8 &aData
)[pure virtual]

A light event has occurred.

A light event is a system state change relevant to System Application light control, for example user activity or accessory connection.

Plugin can use information received via this method for preparing its internal state before the actual light command is notified.

Since
S60 3.2
TLightEvent
leave
a Symbian error code. Leaves are not propagated.

Parameters

TInt aEventevent to be handled (defined in TLightEvent).
const TDesC8 & aDatadata related to the event.

NewL()

CSysApLightControlPlugin *NewL()[static, inline]

Symbian two-phased constructor.

This method uses ECom for finding and creating the instance of the plugin.

Since
S60 v3.2
leave
Standard Symbian leaves.

Member Data Documentation

TUid iDestructorIDKey

TUid iDestructorIDKey[protected]

Destructor identifier to be used with ECom framework.