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; }
Public Member Functions | |
---|---|
~CSysApLightControlPlugin() | |
TInt | HandleLightCommandL(TInt, const TDesC8 &) |
void | LightEventL(TInt, const TDesC8 &) |
CSysApLightControlPlugin * | NewL() |
Protected Attributes | |
---|---|
TUid | iDestructorIDKey |
TInt | HandleLightCommandL | ( | TInt | aCommand, |
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.
void | LightEventL | ( | TInt | aEvent, |
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.
CSysApLightControlPlugin * | NewL | ( | ) | [static, inline] |
Symbian two-phased constructor.
This method uses ECom for finding and creating the instance of the plugin.
TUid | iDestructorIDKey | [protected] |
Destructor identifier to be used with ECom framework.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.