Managing RGB Color of Light Targets

The Symbian platform provides device-independent interfaces for setting RGB color values for the various light targets on the device. This means extend classCHWRMLight to set the RGB color value of the specific light target.

Prerequisites

Before you start, you must know:

  • UI Application : A software component that requires access to the LEDs of the device.

  • Hardware Resource Manger (HWRM) : A component that provides device-independent interfaces for accessing and controlling various hardware resources on the device.

  • Light adaptation plug-in : An ECOM plug-in that implements the HWRM light plug-in interfaces described by the HWRM server component.

Follow the steps given below to manage the RGB color of light targets:

Steps

  1. Instantiate the light interface object.
    CHWRMLight * p = CHWRMLight::NewL();
  2. 2. Set the default RGB color for a selected target by using the following methods.
    Method Description

    SetLightColorL()

    Sets the specific RGB color for the target.

    SetLightDefaultColorL()

    Sets the default color of light target.

    LightOn(TargetX, 10sec, RGB(Y))

    Restores the default color after a specific duration.

    SetLightColorL(TargetX, RGB(X))

    Restores the specific RGB color to default state.

Results

The default RGB color is set for a light target.

The following code snippet illustartes the use of SetLightDefaultColorL() method.

EXPORT_C CHWRMLight * CHWRMLight::NewL ( )
{
    CHWRMLight * self = NewLC ( );
    CleanupStack::Pop ( self );
    return self ;
}

    //Used for setting default color of Light Target(s).
    // Target Defines which light should be controlled. Multiple lights can be specified with using bitwise-or.
    // KErrNotSupported One or more of specified targets are not supported.
    // KErrBadHandle Light session has been invalidated.
    // KErrTimedOut Timeout occurred in controlling light.
    // KErrInUse One or more of specified targets are not reserved for this client but are reserved for others.
    // KErrNoMemory There is a memory allocation failure. 

void CHWRLight::SETLightDefaultColorL()
{
    INFO_PRINTF1 ( _L ("Start test step: SETLightDefaultColorL" ) );
    AddLightPreparationStatesL();
    AddTargetStateL( this, &CHWRMLight::DisplayLightDefaultColorL, KTwoTimeUnits );
    AddTargetStateL( this, &CHWRMLight::DisplayAndKeyboardLightDefaultColorL, KTwoTimeUnits );
    ExecuteSETLightDefaultColorL();
}
....

Related concepts