2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
30 * Minimum allowed intensity setting for Light.
35 const TInt KHWRMLightMinIntensity = 1;
38 * Maximum allowed intensity setting for Light.
43 const TInt KHWRMLightMaxIntensity = 100;
46 * Indicates default intensity in various methods.
51 const TInt KHWRMDefaultIntensity = 0;
54 * Maximum allowed duration value.
59 const TInt KHWRMLightMaxDuration = (KMaxTInt / 1000) - 1;
62 * Infinite duration value.
67 const TInt KHWRMInfiniteDuration = 0;
70 * Indicates device default Blink cycle time.
75 const TInt KHWRMDefaultCycleTime = 0;
78 class MHWRMLightObserver;
79 class CHWRMEnhancedLight;
87 struct THWRMLightColor
96 * The class used to control the device lights.
98 * The HW Resource Manager Light API is a library API providing the ability
99 * to control the various light targets of the device. The API provides also
100 * methods to retrieve the current light status and the supported light targets
101 * of the device. The API is meant for all applications which need to control
102 * lights of the device.
104 * Type of the HW Resource Manager Light API is a synchronous method call meaning
105 * the method call will block the client application. Every new call of the light
106 * API method stops all ongoing light control orders. Light state after duration
107 * based orders expire is the state specified by the last non-duration based order.
109 * The API consist of the classes CHWRMLight and MHWRMLightObserver. If the client
110 * requires up-to-date status information, it should also provide callback pointer
111 * of the MHWRMLightObserver implementing class for the NewL-method.
116 * #include <hwrmlight.h>
118 * // A CHWRMLight instance can be created by using NewL() or NewLC() methods.
119 * // Up-to-date status information not required, no callbacks.
120 * CHWRMLight* light = CHWRMLight::NewL();
122 * // After this, lights can be directly controlled via the provided class methods.
123 * light-> LightOnL (EPrimaryDisplay, 5000); // Turn display lights on for five seconds.
124 * light->LightOffL(EPrimaryDisplay); // Turn display lights off indefinitely.
126 * // To clean up, delete the created object:
133 class CHWRMLight : public CBase
138 * Possible light states that can be get for the different light targets
143 For debugging/development and signaling an error conditions.
145 ELightStatusUnknown = 0,
147 Light state switch to light on.
151 Light state switch to light off.
155 Light state switch to light blinking.
161 * Possible light targets.
162 * Targets can be used as bitmask. Some common masks are provided as enum.
164 * Note that all targets are not supported by all devices.
165 * Attempting to use unsupported target will result in
168 * At least one target must be defined.
173 No target. Not a valid target value, used only for error checking.
177 Primary display of the device.
179 EPrimaryDisplay = 0x1,
181 Primary keyboard of the device.
183 EPrimaryKeyboard = 0x2,
185 Both primary display and the primary keyboard of the device.
187 EPrimaryDisplayAndKeyboard = 0x3,
189 Secondary display of the device.
191 ESecondaryDisplay = 0x4,
193 Secondary keyboard of the device.
195 ESecondaryKeyboard = 0x8,
197 Both secondary display and the secondary keyboard of the device.
199 ESecondaryDisplayAndKeyboard = 0xC,
201 Device specific custom target 1.
203 ECustomTarget1 = 0x10,
205 Device specific custom target 2.
207 ECustomTarget2 = 0x20,
209 Device specific custom target 3.
211 ECustomTarget3 = 0x40,
213 Device specific custom target 4.
215 ECustomTarget4 = 0x80,
217 * Special target used to control all currently available system lights.
219 * System lights normally include all displays and keyboards,
220 * but not custom lights. This is however device dependent.
222 * A target mask including this target is
223 * always changed to a device state specific target mask.
224 * Note that the system target with any other target is not supported.
226 * This target is always supported but it is never
227 * included in supported targets mask.
229 * @see CHWRMLight::SupportedTargets()
231 ESystemTarget = 0x80000000
234 public: // Constructors
237 * Two-phased constructor.
239 * @return A pointer to a new instance of the CHWRMLight class.
241 * @leave KErrNotSupported Device doesn't support Light feature.
242 * @leave KErrNoMemory There is a memory allocation failure.
244 IMPORT_C static CHWRMLight* NewL();
247 * Two-phased constructor.
248 * Leaves instance to cleanup stack.
250 * @return A pointer to a new instance of the CHWRMLight class.
252 * @leave KErrNotSupported Device doesn't support Light feature.
253 * @leave KErrNoMemory There is a memory allocation failure.
255 IMPORT_C static CHWRMLight* NewLC();
258 * Two-phased constructor.
259 * Use this method for creating a Light client with callbacks.
261 * @param aCallback Pointer to the callback instance.
262 * @return A pointer to a new instance of the CHWRMLight class.
264 * @leave KErrNotSupported Device doesn't support Light feature.
265 * @leave KErrNoMemory There is a memory allocation failure.
267 IMPORT_C static CHWRMLight* NewL(MHWRMLightObserver* aCallback);
270 * Two-phased constructor.
271 * Use this method for creating a Light client with callbacks.
272 * Leaves instance to cleanup stack.
274 * @param aCallback Pointer to the callback instance
275 * @return A pointer to a new instance of the CHWRMLight class.
277 * @leave KErrNotSupported Device doesn't support Light feature.
278 * @leave KErrNoMemory There is a memory allocation failure.
280 IMPORT_C static CHWRMLight* NewLC(MHWRMLightObserver* aCallback);
286 IMPORT_C ~CHWRMLight();
288 public: // New functions
292 * Reserves light target exclusively for this client.
293 * A higher priority client may cause lower priority client reservation
294 * to be temporarily suspended. Commands can still be issued in suspended
295 * state, but they will not be acted upon unless suspension is lifted
296 * within specified duration.
297 * The suspended client will not get any notification about suspension.
298 * If light target is already reserved by a higher or equal priority application,
299 * reserving will still succeeds, but reservation is immediately suspended.
301 * Calling this method is equal to calling ReserveLightL( aTarget, EFalse, EFalse),
302 * i.e. any previously frozen state will not be restored and CCoeEnv
303 * background/foreground status is always used to control further reservations.
305 * @param aTarget Defines which light should be reserved. Multiple lights can
306 * be specified with using bitwise-or.
308 * @leave KErrNotSupported One or more of specified targets are not supported.
309 * @leave KErrAccessDenied No CCoeEnv present.
310 * @leave KErrNotReady Trying to reserve while on background.
311 * @leave KErrNoMemory There is a memory allocation failure.
315 virtual void ReserveLightL(TInt aTarget);
318 * Reserves light target exclusively for this client.
319 * A higher priority client may cause lower priority client reservation
320 * to be temporarily suspended. Commands can still be issued in suspended
321 * state, but they will not be acted upon unless suspension is lifted
322 * within specified duration.
323 * The suspended client will not get any notification about suspension.
324 * If light target is already reserved by a higher or equal priority application,
325 * reserving will still succeeds, but reservation is immediately suspended.
328 * @param aTarget Defines which light should be reserved. Multiple lights can
329 * be specified with using bitwise-or.
330 * @param aRestoreState If ETrue, the state frozen on last release will be
331 * restored upon successful reservation.
332 * I.e. if light was blinking when it was released by this
333 * client the last time, it would start blinking again upon
334 * successful reservation.
335 * For the first reservation of each session this parameter
336 * is always considered EFalse regardless of what is supplied,
337 * as there is no previous frozen state to restore.
338 * @param aForceNoCCoeEnv If EFalse, then reservation requires that this client is
339 * on the foreground at the time of reservation and light
340 * target will be automatically released and re-reserved based
341 * on background/foreground status of the this client. This
342 * also implies that CCoeEnv::Static() != NULL is required.
343 * If ETrue, the client will not require CCoeEnv to be present
344 * nor does it automatically reserve/release light by depending
345 * on foreground/background status of the client.
346 * Only trusted clients are allowed to set this flag to ETrue.
347 * A client is considered trusted if it has nonstandard
348 * priority defined in the internal lights policy of the
349 * HW Resource Manager. A client can be defined trusted
352 * @leave KErrNotSupported One or more of specified targets are not supported.
353 * @leave KErrAccessDenied Paramenter aForceNoCCoeEnv is ETrue and client is not trusted.
354 * @leave KErrBadHandle Parameter ForceNoCCoeEnv is EFalse and no CCoeEnv present.
355 * @leave KErrNotReady Trying to reserve while on background and parameter
356 * aForceNoCCoeEnv is EFalse.
357 * @leave KErrNoMemory There is a memory allocation failure.
361 virtual void ReserveLightL(TInt aTarget, TBool aRestoreState, TBool aForceNoCCoeEnv);
364 * Releases light target if it was previously reserved for this client.
365 * If this client has not reserved any of the specified lights,
366 * this method does nothing.
367 * Any reserved light targets that are released and have no other suspended
368 * clients will be reset to default state, which is either lights on or lights off,
369 * depending on system inactivity time.
371 * @param aTarget Defines which light should be released. Multiple lights can
372 * be specified with using bitwise-or.
376 virtual void ReleaseLight(TInt aTarget);
380 * The LightOnL method switches the specified target light on
381 * for infinite duration using default intensity. Lights will use fade-in.
383 * Calling this method is equal to calling
384 * LightOnL(aTarget, KHWRMInfiniteDuration, KHWRMDefaultIntensity, ETrue).
386 * @param aTarget Defines which light should be controlled. Multiple lights can
387 * be specified with using bitwise-or.
389 * @leave KErrNotSupported One or more of specified targets are not supported.
390 * @leave KErrBadHandle Light session has been invalidated.
391 * @leave KErrTimedOut Timeout occurred in controlling light.
392 * @leave KErrInUse One or more of specified targets are not reserved for
393 * this client but are reserved for others.
394 * @leave KErrNoMemory There is a memory allocation failure.
395 * @leave KErrGeneral There is a hardware error.
399 virtual void LightOnL(TInt aTarget);
402 * The LightOnL method switches the specified target light on
403 * for the specified duration using default intensity. Lights will use fade-in.
405 * Calling this method is equal to call
406 * LightOnL(aTarget, aDuration, KHWRMDefaultIntensity, ETrue).
408 * @param aTarget Defines which light should be controlled. Multiple lights can
409 * be specified with using bitwise-or.
410 * @param aDuration Duration of the time the light is switched on measured in milliseconds.
411 * After the duration expires, the light state for target will be changed
412 * to whatever state was caused by the last infinite time duration call, or
413 * default state determined by inactivity timer, in case there has not
414 * been a previous infinite time duration call in this session.
415 * If the aDuration time is KHWRMInfiniteDuration then it means an
416 * infinite value that has to be stopped by calling of any of the other
417 ' light control methods.
418 * Duration can have maximum value of KHWRMLightMaxDuration.
420 * @leave KErrArgument Parameter aDuration is out of range.
421 * @leave KErrNotSupported One or more of specified targets are not supported.
422 * @leave KErrBadHandle Light session has been invalidated.
423 * @leave KErrTimedOut Timeout occurred in controlling light.
424 * @leave KErrInUse One or more of specified targets are not reserved for
425 * this client but are reserved for others.
426 * @leave KErrNoMemory There is a memory allocation failure.
427 * @leave KErrGeneral There is a hardware error.
431 virtual void LightOnL(TInt aTarget,
435 * The LightOnL method switches the specified target light on
436 * for the specified duration using specified intensity. Fade-in can also be controlled.
438 * @param aTarget Defines which light should be controlled. Multiple lights can
439 * be specified with using bitwise-or.
440 * @param aDuration Duration of the time the light is switched on measured in milliseconds.
441 * After the duration expires, the light state for target will be changed
442 * to whatever state was caused by the last infinite time duration call, or
443 * default state determined by inactivity timer, in case there has not
444 * been a previous infinite time duration call in this session.
445 * If the aDuration time is KHWRMInfiniteDuration then it means
446 * an infinite value that has to be stopped by calling of any of
447 * the other light control methods.
448 * Duration can have maximum value of KHWRMLightMaxDuration.
449 * @param aIntensity Intensity of the light. If aIntensity is KHWRMDefaultIntensity, device default
450 * intensity will be used.
451 * Note: All devices might not support user defined intensity, in which case
452 * device will behave in its default fashion.
453 * @param aFadeIn If ETrue, lights will not turn on instantly but instead smoothly fade-in.
454 * Note: All devices will not support fade-in, in which case device will
455 * behave in its default fashion.
457 * @leave KErrArgument One of the parameters is out of range.
458 * @leave KErrNotSupported One or more of specified targets are not supported.
459 * @leave KErrBadHandle Light session has been invalidated.
460 * @leave KErrTimedOut Timeout occurred in controlling light.
461 * @leave KErrInUse One or more of specified targets are not reserved for
462 * this client but are reserved for others.
463 * @leave KErrNoMemory There is a memory allocation failure.
464 * @leave KErrGeneral There is a hardware error.
468 virtual void LightOnL(TInt aTarget,
474 * The LightBlinkL method blinks the target light(s) of the device for infinite duration
475 * using default intensity.
477 * Calling this method is equal to call
479 * LightBlinkL(aTarget, KHWRMInfiniteDuration, KHWRMDefaultCycleTime,
480 * KHWRMDefaultCycleTime, KHWRMDefaultIntensity).
483 * @param aTarget Defines which light should be controlled. Multiple lights can
484 * be specified with using bitwise-or.
486 * @leave KErrNotSupported One or more of specified targets are not supported.
487 * @leave KErrBadHandle Light session has been invalidated.
488 * @leave KErrTimedOut Timeout occurred in controlling light.
489 * @leave KErrInUse One or more of specified targets are not reserved for
490 * this client but are reserved for others.
491 * @leave KErrNoMemory There is a memory allocation failure.
492 * @leave KErrGeneral There is a hardware error.
496 virtual void LightBlinkL(TInt aTarget);
499 * The LightBlinkL method blinks the target light(s) of the device for specified duration
500 * using default intensity.
502 * Calling this method is equal to calling
503 * LightBlinkL(aTarget, aDuration, KHWRMDefaultCycleTime,
504 * KHWRMDefaultCycleTime, KHWRMDefaultIntensity).
506 * @param aTarget Defines which light should be controlled. Multiple lights can
507 * be specified with using bitwise-or.
508 * @param aDuration Duration of the time the light is set to blink measured in milliseconds.
509 * After the duration expires, the light state for target will be changed
510 * to whatever state was caused by the last infinite time duration call, or
511 * default state determined by inactivity timer, in case there has not
512 * been a previous infinite time duration call in this session.
513 * If the aTotalDuration time is KHWRMInfiniteDuration then it
514 * means an infinite value that has to be
515 * stopped by calling of any of the other light control methods.
516 * Duration can have maximum value of KHWRMLightMaxDuration.
518 * @leave KErrArgument Parameter aDuration is out of range.
519 * @leave KErrNotSupported One or more of specified targets are not supported.
520 * @leave KErrBadHandle Light session has been invalidated.
521 * @leave KErrTimedOut Timeout occurred in controlling light.
522 * @leave KErrInUse One or more of specified targets are not reserved for
523 * this client but are reserved for others.
524 * @leave KErrNoMemory There is a memory allocation failure.
525 * @leave KErrGeneral There is a hardware error.
529 virtual void LightBlinkL(TInt aTarget,
533 * The LightBlinkL method blinks the target light(s) of the device for specified duration
534 * using specified intensity. On- and Off-cycle times of the blinking can also be controlled.
536 * @param aTarget Defines which light should be controlled. Multiple lights can
537 * be specified with using bitwise-or.
538 * @param aDuration Duration of the time the light is set to blink measured in milliseconds.
539 * After the duration expires, the light state for target will be changed
540 * to whatever state was caused by the last infinite time duration call, or
541 * default state determined by inactivity timer, in case there has not
542 * been a previous infinite time duration call in this session.
543 * If the aTotalDuration time is KHWRMInfiniteDuration then it
544 * means an infinite value that has to be
545 * stopped by calling of any of the other light control methods.
546 * Duration can have maximum value of KHWRMLightMaxDuration.
547 * @param aOnDuration Duration time, measured in milliseconds, of how long the Light is
548 * switched on in every Blink cycle.
549 * Duration can have maximum value of KHWRMLightMaxDuration.
550 * For device default cycle duration, use value KHWRMDefaultCycleTime.
551 * If either of aOnDuration or aOffDuration is KHWRMDefaultCycleTime,
552 * both must be KHWRMDefaultCycleTime.
553 * Some devices might not support variable blink cycle times, in which
554 * case default value will be substituted.
555 * @param aOffDuration Duration time, measured in milliseconds, of how long the Light
556 * is switched off in every Blink cycle.
557 * Duration can have maximum value of KHWRMLightMaxDuration.
558 * For device default cycle duration, use value KHWRMDefaultCycleTime.
559 * If either of aOnDuration or aOffDuration is KHWRMDefaultCycleTime,
560 * both must be KHWRMDefaultCycleTime.
561 * Some devices might not support variable blink cycle times, in which
562 * case default value will be substituted.
563 * @param aIntensity Intensity of the light. If aIntensity is KHWRMDefaultIntensity, device default
564 * intensity will be used.
565 * Note: All devices might not support user defined intensity, in which case
566 * device will behave in its default fashion.
568 * @leave KErrArgument One of the parameters is out of range or otherwise invalid.
569 * @leave KErrNotSupported One or more of specified targets are not supported.
570 * @leave KErrBadHandle Light session has been invalidated.
571 * @leave KErrTimedOut Timeout occurred in controlling light.
572 * @leave KErrInUse One or more of specified targets are not reserved for
573 * this client but are reserved for others.
574 * @leave KErrNoMemory There is a memory allocation failure.
575 * @leave KErrGeneral There is a hardware error.
579 virtual void LightBlinkL(TInt aTarget,
586 * The LightOffL method switches the device light off for the specified target for
587 * infinite duration. Lights will be switched off with fade-out.
589 * Calling this method is equal to call
590 * LightOffL(aTarget, KHWRMInfiniteDuration, ETrue).
592 * @param aTarget Defines which light should be controlled. Multiple lights can
593 * be specified with using bitwise-or.
595 * @leave KErrNotSupported One or more of specified targets are not supported.
596 * @leave KErrBadHandle Light session has been invalidated.
597 * @leave KErrTimedOut Timeout occurred in controlling light.
598 * @leave KErrInUse One or more of specified targets are not reserved for
599 * this client but are reserved for others.
600 * @leave KErrNoMemory There is a memory allocation failure.
601 * @leave KErrGeneral There is a hardware error.
605 virtual void LightOffL(TInt aTarget);
608 * The LightOffL method switches the device light off for the specified target for
609 * the specified duration time. Lights will be switched off with fade-out.
611 * Calling this method is equal to call LightOffL(aTarget, aDuration, ETrue).
613 * @param aTarget Defines which light should be controlled. Multiple lights can
614 * be specified with using bitwise-or.
615 * @param aDuration Duration of the time the light is switched off measured in milliseconds.
616 * After the duration expires, the light state for target will be changed
617 * to whatever state was caused by the last infinite time duration call, or
618 * default state determined by inactivity timer, in case there has not
619 * been a previous infinite time duration call in this session.
620 * If the aDuration time is KHWRMInfiniteDuration then it
621 * means an infinite value that has to be
622 * stopped by calling of any of the other light control methods.
623 * Duration can have maximum value of KHWRMLightMaxDuration.
625 * @leave KErrArgument Parameter aDuration is out of range.
626 * @leave KErrNotSupported One or more of specified targets are not supported.
627 * @leave KErrBadHandle Light session has been invalidated.
628 * @leave KErrTimedOut Timeout occurred in controlling light.
629 * @leave KErrInUse One or more of specified targets are not reserved for
630 * this client but are reserved for others.
631 * @leave KErrNoMemory There is a memory allocation failure.
632 * @leave KErrGeneral There is a hardware error.
636 virtual void LightOffL(TInt aTarget,
640 * The LightOffL method switches the device light off for the specified target for
641 * the specified duration time. Lights fade-out can also be controlled.
643 * @param aTarget Defines which light should be controlled. Multiple lights can
644 * be specified with using bitwise-or.
645 * @param aDuration Duration of the time the light is switched off measured in milliseconds.
646 * After the duration expires, the light state for target will be changed
647 * to whatever state was caused by the last infinite time duration call, or
648 * default state determined by inactivity timer, in case there has not
649 * been a previous infinite time duration call in this session.
650 * If the aDuration time is KHWRMInfiniteDuration then it
651 * means an infinite value that has to be
652 * stopped by calling of any of the other light control methods.
653 * Duration can have maximum value of KHWRMLightMaxDuration.
654 * @param aFadeOut If ETrue, lights will not turn off instantly but instead smoothly fade-out
655 * Note: All devices will not support fade-out, in which case device will
656 * behave in its default fashion.
658 * @leave KErrArgument aDuration is out of range.
659 * @leave KErrNotSupported One or more of specified targets are not supported.
660 * @leave KErrBadHandle Light session has been invalidated.
661 * @leave KErrTimedOut Timeout occurred in controlling light.
662 * @leave KErrInUse One or more of specified targets are not reserved for
663 * this client but are reserved for others.
664 * @leave KErrNoMemory There is a memory allocation failure.
665 * @leave KErrGeneral There is a hardware error.
669 virtual void LightOffL(TInt aTarget,
674 * This method retrieves the current light status.
676 * @param aTarget Defines which light status is returned.
677 * This method only supports single target, as different
678 * targets might have different statuses.
679 * @return TLightStatus indicating the current light status. If there is a problem or
680 * multiple targets were specified, CHWRMLight::ELightStatusUnknown is returned.
682 * @see MHWRMLightObserver
685 virtual TLightStatus LightStatus(TInt aTarget) const;
688 * This method retrieves the supported light targets of the device.
689 * Any attempt to use or reserve unsupported targets will fail with
692 * @return Bitmask containing supported light targets.
696 virtual TInt SupportedTargets() const;
700 * Used for setting color of Light Target(s).
702 * @param aTarget Defines which light should be controlled. Multiple lights can
703 * be specified with using bitwise-or.
705 * @param aRGB RGB Values to be set for the target(s).
707 * @leave KErrNotSupported One or more of specified targets are not supported.
708 * @leave KErrBadHandle Light session has been invalidated.
709 * @leave KErrTimedOut Timeout occurred in controlling light.
710 * @leave KErrInUse One or more of specified targets are not reserved for
711 * this client but are reserved for others.
712 * @leave KErrNoMemory There is a memory allocation failure.
714 * @see THWRMLightColor
716 IMPORT_C void SetLightColorL(TInt aTarget, THWRMLightColor& aRGB);
719 * Used for setting default color of Light Target(s).
721 * @param aTarget Defines which light should be controlled. Multiple lights can
722 * be specified with using bitwise-or.
723 * @leave KErrNotSupported One or more of specified targets are not supported.
724 * @leave KErrBadHandle Light session has been invalidated.
725 * @leave KErrTimedOut Timeout occurred in controlling light.
726 * @leave KErrInUse One or more of specified targets are not reserved for
727 * this client but are reserved for others.
728 * @leave KErrNoMemory There is a memory allocation failure.
732 IMPORT_C void SetLightDefaultColorL(TInt aTarget);
735 * The LightOnL method switches the specified target light on
736 * for the specified duration and specified color.
738 * @param aTarget Defines which light should be controlled. Multiple lights can
739 * be specified with using bitwise-or.
740 * @param aDuration Duration of the time the light is switched on measured in milliseconds.
741 * After the duration expires, the light state for target will be changed
742 * to whatever state was caused by the last infinite time duration call, or
743 * default state determined by inactivity timer, in case there has not
744 * been a previous infinite time duration call in this session.
745 * If the aDuration time is KHWRMInfiniteDuration then it means
746 * an infinite value that has to be stopped by calling of any of
747 * the other light control methods.
748 * Duration can have maximum value of KHWRMLightMaxDuration.
749 * @param aRGBParam RGB Values to be set for the target(s).
751 * @leave KErrArgument One of the parameters is out of range.
752 * @leave KErrNotSupported One or more of specified targets are not supported.
753 * @leave KErrBadHandle Light session has been invalidated.
754 * @leave KErrTimedOut Timeout occurred in controlling light.
755 * @leave KErrInUse One or more of specified targets are not reserved for
756 * this client but are reserved for others.
757 * @leave KErrNoMemory There is a memory allocation failure.
758 * @leave KErrGeneral There is a hardware error.
761 * @see THWRMLightColor
763 IMPORT_C void LightOnL(TInt aTarget, TInt aDuration, const THWRMLightColor& aRGBParam);
766 * The LightOnL method switches the specified target light on
767 * for the specified duration using specified intensity and color. Fade-in can also be controlled.
769 * @param aTarget Defines which light should be controlled. Multiple lights can
770 * be specified with using bitwise-or.
771 * @param aDuration Duration of the time the light is switched on measured in milliseconds.
772 * After the duration expires, the light state for target will be changed
773 * to whatever state was caused by the last infinite time duration call, or
774 * default state determined by inactivity timer, in case there has not
775 * been a previous infinite time duration call in this session.
776 * If the aDuration time is KHWRMInfiniteDuration then it means
777 * an infinite value that has to be stopped by calling of any of
778 * the other light control methods.
779 * Duration can have maximum value of KHWRMLightMaxDuration.
780 * @param aIntensity Intensity of the light. If aIntensity is KHWRMDefaultIntensity, device default
781 * intensity will be used.
782 * Note: All devices might not support user defined intensity, in which case
783 * device will behave in its default fashion.
784 * @param aFadeIn If ETrue, lights will not turn on instantly but instead smoothly fade-in.
785 * Note: All devices will not support fade-in, in which case device will
786 * behave in its default fashion.
787 * @param aRGBParam RGB Values to be set for the target(s).
789 * @leave KErrArgument One of the parameters is out of range.
790 * @leave KErrNotSupported One or more of specified targets are not supported.
791 * @leave KErrBadHandle Light session has been invalidated.
792 * @leave KErrTimedOut Timeout occurred in controlling light.
793 * @leave KErrInUse One or more of specified targets are not reserved for
794 * this client but are reserved for others.
795 * @leave KErrNoMemory There is a memory allocation failure.
796 * @leave KErrGeneral There is a hardware error.
799 * @see THWRMLightColor
802 IMPORT_C void LightOnL(TInt aTarget, TInt aDuration, TInt aIntensity, TBool aFadeIn,
803 const THWRMLightColor& aRGBParam);
806 * The LightBlinkL method blinks the target light(s) of the device for specified duration and color
807 * using default intensity.
810 * @param aTarget Defines which light should be controlled. Multiple lights can
811 * be specified with using bitwise-or.
812 * @param aDuration Duration of the time the light is set to blink measured in milliseconds.
813 * After the duration expires, the light state for target will be changed
814 * to whatever state was caused by the last infinite time duration call, or
815 * default state determined by inactivity timer, in case there has not
816 * been a previous infinite time duration call in this session.
817 * If the aTotalDuration time is KHWRMInfiniteDuration then it
818 * means an infinite value that has to be
819 * stopped by calling of any of the other light control methods.
820 * Duration can have maximum value of KHWRMLightMaxDuration.
822 * @param aRGBParam RGB Values to be set for the target(s).
824 * @leave KErrArgument Parameter aDuration is out of range.
825 * @leave KErrNotSupported One or more of specified targets are not supported.
826 * @leave KErrBadHandle Light session has been invalidated.
827 * @leave KErrTimedOut Timeout occurred in controlling light.
828 * @leave KErrInUse One or more of specified targets are not reserved for
829 * this client but are reserved for others.
830 * @leave KErrNoMemory There is a memory allocation failure.
831 * @leave KErrGeneral There is a hardware error.
834 * @see THWRMLightColor
837 IMPORT_C void LightBlinkL(TInt aTarget, TInt aDuration, const THWRMLightColor& aRGBParam);
840 * The LightBlinkL method blinks the target light(s) of the device for specified duration
841 * using specified intensity and color. On- and Off-cycle times of the blinking can also be controlled.
843 * @param aTarget Defines which light should be controlled. Multiple lights can
844 * be specified with using bitwise-or.
845 * @param aDuration Duration of the time the light is set to blink measured in milliseconds.
846 * After the duration expires, the light state for target will be changed
847 * to whatever state was caused by the last infinite time duration call, or
848 * default state determined by inactivity timer, in case there has not
849 * been a previous infinite time duration call in this session.
850 * If the aTotalDuration time is KHWRMInfiniteDuration then it
851 * means an infinite value that has to be
852 * stopped by calling of any of the other light control methods.
853 * Duration can have maximum value of KHWRMLightMaxDuration.
854 * @param aOnDuration Duration time, measured in milliseconds, of how long the Light is
855 * switched on in every Blink cycle.
856 * Duration can have maximum value of KHWRMLightMaxDuration.
857 * For device default cycle duration, use value KHWRMDefaultCycleTime.
858 * If either of aOnDuration or aOffDuration is KHWRMDefaultCycleTime,
859 * both must be KHWRMDefaultCycleTime.
860 * Some devices might not support variable blink cycle times, in which
861 * case default value will be substituted.
862 * @param aOffDuration Duration time, measured in milliseconds, of how long the Light
863 * is switched off in every Blink cycle.
864 * Duration can have maximum value of KHWRMLightMaxDuration.
865 * For device default cycle duration, use value KHWRMDefaultCycleTime.
866 * If either of aOnDuration or aOffDuration is KHWRMDefaultCycleTime,
867 * both must be KHWRMDefaultCycleTime.
868 * Some devices might not support variable blink cycle times, in which
869 * case default value will be substituted.
870 * @param aIntensity Intensity of the light. If aIntensity is KHWRMDefaultIntensity, device default
871 * intensity will be used.
872 * Note: All devices might not support user defined intensity, in which case
873 * device will behave in its default fashion.
875 * @param aRGBParam RGB Values to be set for the target(s).
877 * @leave KErrArgument One of the parameters is out of range or otherwise invalid.
878 * @leave KErrNotSupported One or more of specified targets are not supported.
879 * @leave KErrBadHandle Light session has been invalidated.
880 * @leave KErrTimedOut Timeout occurred in controlling light.
881 * @leave KErrInUse One or more of specified targets are not reserved for
882 * this client but are reserved for others.
883 * @leave KErrNoMemory There is a memory allocation failure.
884 * @leave KErrGeneral There is a hardware error.
887 * @see THWRMLightColor
890 IMPORT_C void LightBlinkL(TInt aTarget, TInt aDuration, TInt aOnDuration, TInt aOffDuration,
891 TInt aIntensity, const THWRMLightColor& aRGBParam);
898 void ConstructL(MHWRMLightObserver* aCallback);
901 CHWRMEnhancedLight* iEnhanced;
906 * A callback interface for light status reporting.
908 * If the client requires up-to-date status information, the client needs
909 * to derive a class from the MHWRMlightObserver interface and implement
910 * the LightStatusChanged() method.
912 * A callback object header example:
916 * #include <hwrmlight.h> // Link against HWRMLightClient.lib.
918 * class CTests : public CBase,
919 * public MHWRMLightObserver
926 * static CTests* NewL();
928 * // from MHWRMLightObserver
929 * virtual void LightStatusChanged(TInt aTarget,
930 * CHWRMLight::TLightStatus aStatus);
933 * CHWRMLight* iLight;
938 * A callback method implementation example:
941 * void CTests::LightStatusChanged(TInt aTarget,
942 * CHWRMLight::TLightStatus aStatus)
944 * RDebug::Print(_L("### Light state changed for target: 0x%x"), aTarget);
947 * case CHWRMLight::ELightOn:
948 * RDebug::Print(_L("### Light state changed: ELightOn"));
950 * case CHWRMLight::ELightOff:
951 * RDebug::Print(_L("### Light state changed: ELightOff"));
953 * case CHWRMLight::ELightBlink:
954 * RDebug::Print(_L("### Light state changed: ELightBlink"));
956 * case CHWRMLight::ELightStatusUnknown:
957 * RDebug::Print(_L("### Light state changed: ELightStatusUnknown"));
960 * RDebug::Print(_L("### Light state changed: UNDEFINED !"));
970 class MHWRMLightObserver
975 * Called when the device light status changes.
976 * Note that if the light status for certain target changes
977 * very rapidly, some state transitions might be missed.
978 * It is however guaranteed that latest state is always obtained.
980 * @param aTarget Indicates target(s) the new status applies to.
981 * @param aStatus Indicates light request status.
983 * @see CHWRMLight::TLightTarget
984 * @see CHWRMLight::TLightStatus
986 virtual void LightStatusChanged(TInt aTarget,
987 CHWRMLight::TLightStatus aStatus) = 0;
991 #endif // HWRMLIGHT_H