API published in: S60 3rd Ed
Link against: hwrmlightclient.lib
Required Capabilities
None
#include <hwrmlight.h>
The HW Resource Manager Light API is a library API providing the ability to control the various light targets of the device. The API provides also methods to retrieve the current light status and the supported light targets of the device. The API is meant for all applications which need to control lights of the device.
Type of the HW Resource Manager Light API is a synchronous method call meaning the method call will block the client application. Every new call of the light API method stops all ongoing light control orders. Light state after duration based orders expire is the state specified by the last non-duration based order.
The API consist of the classes CHWRMLight and MHWRMLightObserver. If the client requires up-to-date status information, it should also provide callback pointer of the MHWRMLightObserver implementing class for the NewL-method.
Usage:
#include <HWRMLight.h> // link against HWRMLightClient.lib // A CHWRMLight instance can be created by using NewL() or NewLC() methods. // Up-to-date status information not required, no callbacks. CHWRMLight* light = CHWRMLight::NewL(); // After this, lights can be directly controlled via the provided class methods. light-> LightOnL (EPrimaryDisplay, 5000); // Turn display lights on for five seconds. light->LightOffL(EPrimaryDisplay); // Turn display lights off indefinitely. // To clean up, delete the created object: delete light;
Public Types |
|
enum | TLightStatus { ELightStatusUnknown = 0, ELightOn, ELightOff, ELightBlink } |
Possible light states that can be get for the different light targets. More... |
|
enum | TLightTarget { ENoTarget = 0x0, EPrimaryDisplay = 0x1, EPrimaryKeyboard = 0x2, EPrimaryDisplayAndKeyboard = 0x3, ESecondaryDisplay = 0x4, ESecondaryKeyboard = 0x8, ESecondaryDisplayAndKeyboard = 0xC, ECustomTarget1 = 0x10, ECustomTarget2 = 0x20, ECustomTarget3 = 0x40, ECustomTarget4 = 0x80, ESystemTarget = 0x80000000 } |
Possible light targets. More... |
|
Public Member Functions |
|
virtual void | ReserveLightL (TInt aTarget)=0 |
Reserves light target exclusively for this client. |
|
virtual void | ReserveLightL (TInt aTarget, TBool aRestoreState, TBool aForceNoCCoeEnv)=0 |
Reserves light target exclusively for this client. |
|
virtual void | ReleaseLight (TInt aTarget)=0 |
Releases light target if it was previously reserved for this client. |
|
virtual void | LightOnL (TInt aTarget)=0 |
The LightOnL method switches the specified target light on for infinite duration using default intensity. |
|
virtual void | LightOnL (TInt aTarget, TInt aDuration)=0 |
The LightOnL method switches the specified target light on for the specified duration using default intensity. |
|
virtual void | LightOnL (TInt aTarget, TInt aDuration, TInt aIntensity, TBool aFadeIn)=0 |
The LightOnL method switches the specified target light on for the specified duration using specified intensity. |
|
virtual void | LightBlinkL (TInt aTarget)=0 |
The LightBlinkL method blinks the target light(s) of the device for infinite duration using default intensity. |
|
virtual void | LightBlinkL (TInt aTarget, TInt aDuration)=0 |
The LightBlinkL method blinks the target light(s) of the device for specified duration using default intensity. |
|
virtual void | LightBlinkL (TInt aTarget, TInt aDuration, TInt aOnDuration, TInt aOffDuration, TInt aIntensity)=0 |
The LightBlinkL method blinks the target light(s) of the device for specified duration using specified intensity. |
|
virtual void | LightOffL (TInt aTarget)=0 |
The LightOffL method switches the device light off for the specified target for infinite duration. |
|
virtual void | LightOffL (TInt aTarget, TInt aDuration)=0 |
The LightOffL method switches the device light off for the specified target for the specified duration time. |
|
virtual void | LightOffL (TInt aTarget, TInt aDuration, TBool aFadeOut)=0 |
The LightOffL method switches the device light off for the specified target for the specified duration time. |
|
virtual TLightStatus | LightStatus (TInt aTarget) const =0 |
This method retrieves the current light status. |
|
virtual TInt | SupportedTargets () const =0 |
This method retrieves the supported light targets of the device. |
|
Static Public Member Functions |
|
static IMPORT_C CHWRMLight * | NewL () |
Two-phased constructor. |
|
static IMPORT_C CHWRMLight * | NewLC () |
Two-phased constructor. |
|
static IMPORT_C CHWRMLight * | NewL (MHWRMLightObserver *aCallback) |
Two-phased constructor. |
|
static IMPORT_C CHWRMLight * | NewLC (MHWRMLightObserver *aCallback) |
Two-phased constructor. |
|
Possible light states that can be get for the different light targets. |
|
Possible light targets. Targets can be used as bitmask. Some common masks are provided as enum. Note that all targets are not supported by all devices. Attempting to use unsupported target will result in KErrNotSupported. At least one target must be defined.
|
|
The LightBlinkL method blinks the target light(s) of the device for specified duration using specified intensity. On- and Off-cycle times of the blinking can also be controlled.
|
|
The LightBlinkL method blinks the target light(s) of the device for specified duration using default intensity. Calling this method is equal to calling LightBlinkL(aTarget, aDuration, KHWRMDefaultCycleTime, KHWRMDefaultCycleTime, KHWRMDefaultIntensity).
|
|
The LightBlinkL method blinks the target light(s) of the device for infinite duration using default intensity. Calling this method is equal to call LightBlinkL(aTarget, KHWRMInfiniteDuration, KHWRMDefaultCycleTime, KHWRMDefaultCycleTime, KHWRMDefaultIntensity).
|
|
The LightOffL method switches the device light off for the specified target for the specified duration time. Lights fade-out can also be controlled.
|
|
The LightOffL method switches the device light off for the specified target for the specified duration time. Lights will be switched off with fade-out. Calling this method is equal to call LightOffL(aTarget, aDuration, ETrue).
|
|
The LightOffL method switches the device light off for the specified target for infinite duration. Lights will be switched off with fade-out. Calling this method is equal to call LightOffL(aTarget, KHWRMInfiniteDuration, ETrue).
|
|
The LightOnL method switches the specified target light on for the specified duration using specified intensity. Fade-in can also be controlled.
|
|
The LightOnL method switches the specified target light on for the specified duration using default intensity. Lights will use fade-in. Calling this method is equal to call LightOnL(aTarget, aDuration, KHWRMDefaultIntensity, ETrue).
|
|
The LightOnL method switches the specified target light on for infinite duration using default intensity. Lights will use fade-in. Calling this method is equal to calling LightOnL(aTarget, KHWRMInfiniteDuration, KHWRMDefaultIntensity, ETrue).
|
|
This method retrieves the current light status.
|
|
Two-phased constructor. Use this method for creating a Light client with callbacks.
|
|
Two-phased constructor.
|
|
Two-phased constructor. Use this method for creating a Light client with callbacks. Leaves instance to cleanup stack.
|
|
Two-phased constructor. Leaves instance to cleanup stack.
|
|
Releases light target if it was previously reserved for this client. If this client has not reserved any of the specified lights, this method does nothing. Any reserved light targets that are released and have no other suspended clients will be reset to default state, which is either lights on or lights off, depending on system inactivity time.
|
|
Reserves light target exclusively for this client. A higher priority client may cause lower priority client reservation to be temporarily suspended. Commands can still be issued in suspended state, but they will not be acted upon unless suspension is lifted within specified duration. The suspended client will not get any notification about suspension. If light target is already reserved by a higher or equal priority application, reserving will still succeeds, but reservation is immediately suspended.
|
|
Reserves light target exclusively for this client. A higher priority client may cause lower priority client reservation to be temporarily suspended. Commands can still be issued in suspended state, but they will not be acted upon unless suspension is lifted within specified duration. The suspended client will not get any notification about suspension. If light target is already reserved by a higher or equal priority application, reserving will still succeeds, but reservation is immediately suspended. Calling this method is equal to calling ReserveLightL( aTarget, EFalse, EFalse), i.e. any previously frozen state will not be restored and CCoeEnv background/foreground status is always used to control further reservations.
|
|
This method retrieves the supported light targets of the device. Any attempt to use or reserve unsupported targets will fail with KErrNotSupported.
|