williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@2
|
5 |
* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@2
|
7 |
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description: This file contains the header of the
|
williamr@2
|
15 |
* CHWRMLight class.
|
williamr@2
|
16 |
*
|
williamr@2
|
17 |
*/
|
williamr@2
|
18 |
|
williamr@2
|
19 |
|
williamr@2
|
20 |
#ifndef HWRMLIGHT_H
|
williamr@2
|
21 |
#define HWRMLIGHT_H
|
williamr@2
|
22 |
|
williamr@2
|
23 |
// INCLUDES
|
williamr@2
|
24 |
#include <e32base.h>
|
williamr@2
|
25 |
|
williamr@2
|
26 |
// CONSTANTS
|
williamr@2
|
27 |
|
williamr@2
|
28 |
/**
|
williamr@2
|
29 |
* Minimum allowed intensity setting for Light.
|
williamr@2
|
30 |
*/
|
williamr@2
|
31 |
const TInt KHWRMLightMinIntensity = 1;
|
williamr@2
|
32 |
|
williamr@2
|
33 |
/**
|
williamr@2
|
34 |
* Maximum allowed intensity setting for Light.
|
williamr@2
|
35 |
*/
|
williamr@2
|
36 |
const TInt KHWRMLightMaxIntensity = 100;
|
williamr@2
|
37 |
|
williamr@2
|
38 |
/**
|
williamr@2
|
39 |
* Indicates default intensity in various methods.
|
williamr@2
|
40 |
*/
|
williamr@2
|
41 |
const TInt KHWRMDefaultIntensity = 0;
|
williamr@2
|
42 |
|
williamr@2
|
43 |
/**
|
williamr@2
|
44 |
* Maximum allowed duration value.
|
williamr@2
|
45 |
*/
|
williamr@2
|
46 |
const TInt KHWRMLightMaxDuration = (KMaxTInt / 1000) - 1;
|
williamr@2
|
47 |
|
williamr@2
|
48 |
/**
|
williamr@2
|
49 |
* Infinite duration value.
|
williamr@2
|
50 |
*/
|
williamr@2
|
51 |
const TInt KHWRMInfiniteDuration = 0;
|
williamr@2
|
52 |
|
williamr@2
|
53 |
/**
|
williamr@2
|
54 |
* Indicates device default Blink cycle time.
|
williamr@2
|
55 |
*/
|
williamr@2
|
56 |
const TInt KHWRMDefaultCycleTime = 0;
|
williamr@2
|
57 |
|
williamr@2
|
58 |
|
williamr@2
|
59 |
// FORWARD DECLARATIONS
|
williamr@2
|
60 |
class MHWRMLightObserver;
|
williamr@2
|
61 |
|
williamr@2
|
62 |
// CLASS DECLARATIONS
|
williamr@2
|
63 |
|
williamr@2
|
64 |
/**
|
williamr@2
|
65 |
* The class used to control the device lights.
|
williamr@2
|
66 |
*
|
williamr@2
|
67 |
* The HW Resource Manager Light API is a library API providing the ability
|
williamr@2
|
68 |
* to control the various light targets of the device. The API provides also
|
williamr@2
|
69 |
* methods to retrieve the current light status and the supported light targets
|
williamr@2
|
70 |
* of the device. The API is meant for all applications which need to control
|
williamr@2
|
71 |
* lights of the device.
|
williamr@2
|
72 |
*
|
williamr@2
|
73 |
* Type of the HW Resource Manager Light API is a synchronous method call meaning
|
williamr@2
|
74 |
* the method call will block the client application. Every new call of the light
|
williamr@2
|
75 |
* API method stops all ongoing light control orders. Light state after duration
|
williamr@2
|
76 |
* based orders expire is the state specified by the last non-duration based order.
|
williamr@2
|
77 |
*
|
williamr@2
|
78 |
* The API consist of the classes CHWRMLight and MHWRMLightObserver. If the client
|
williamr@2
|
79 |
* requires up-to-date status information, it should also provide callback pointer
|
williamr@2
|
80 |
* of the MHWRMLightObserver implementing class for the NewL-method.
|
williamr@2
|
81 |
*
|
williamr@2
|
82 |
* Usage:
|
williamr@2
|
83 |
*
|
williamr@2
|
84 |
* @code
|
williamr@2
|
85 |
* #include <HWRMLight.h> // link against HWRMLightClient.lib
|
williamr@2
|
86 |
*
|
williamr@2
|
87 |
* // A CHWRMLight instance can be created by using NewL() or NewLC() methods.
|
williamr@2
|
88 |
* // Up-to-date status information not required, no callbacks.
|
williamr@2
|
89 |
* CHWRMLight* light = CHWRMLight::NewL();
|
williamr@2
|
90 |
*
|
williamr@2
|
91 |
* // After this, lights can be directly controlled via the provided class methods.
|
williamr@2
|
92 |
* light-> LightOnL (EPrimaryDisplay, 5000); // Turn display lights on for five seconds.
|
williamr@2
|
93 |
* light->LightOffL(EPrimaryDisplay); // Turn display lights off indefinitely.
|
williamr@2
|
94 |
*
|
williamr@2
|
95 |
* // To clean up, delete the created object:
|
williamr@2
|
96 |
* delete light;
|
williamr@2
|
97 |
* @endcode
|
williamr@2
|
98 |
*
|
williamr@2
|
99 |
* @lib HWRMLIGHTCLIENT.DLL
|
williamr@2
|
100 |
* @since S60 3.0
|
williamr@2
|
101 |
*/
|
williamr@2
|
102 |
class CHWRMLight : public CBase
|
williamr@2
|
103 |
{
|
williamr@2
|
104 |
public:
|
williamr@2
|
105 |
|
williamr@2
|
106 |
/**
|
williamr@2
|
107 |
* Possible light states that can be get for the different light targets
|
williamr@2
|
108 |
*/
|
williamr@2
|
109 |
enum TLightStatus
|
williamr@2
|
110 |
{
|
williamr@2
|
111 |
ELightStatusUnknown = 0, ///< For debugging/development and signaling an error conditions.
|
williamr@2
|
112 |
ELightOn, ///< Light state switch to light on.
|
williamr@2
|
113 |
ELightOff, ///< Light state switch to light off.
|
williamr@2
|
114 |
ELightBlink ///< Light state switch to light blinking.
|
williamr@2
|
115 |
};
|
williamr@2
|
116 |
|
williamr@2
|
117 |
/**
|
williamr@2
|
118 |
* Possible light targets.
|
williamr@2
|
119 |
* Targets can be used as bitmask. Some common masks are provided as enum.
|
williamr@2
|
120 |
*
|
williamr@2
|
121 |
* Note that all targets are not supported by all devices.
|
williamr@2
|
122 |
* Attempting to use unsupported target will result in
|
williamr@2
|
123 |
* KErrNotSupported.
|
williamr@2
|
124 |
*
|
williamr@2
|
125 |
* At least one target must be defined.
|
williamr@2
|
126 |
*/
|
williamr@2
|
127 |
enum TLightTarget
|
williamr@2
|
128 |
{
|
williamr@2
|
129 |
ENoTarget = 0x0, ///< No target. Not a valid target value, used only
|
williamr@2
|
130 |
///< for error checking.
|
williamr@2
|
131 |
|
williamr@2
|
132 |
EPrimaryDisplay = 0x1, ///< Primary display of the device.
|
williamr@2
|
133 |
EPrimaryKeyboard = 0x2, ///< Primary keyboard of the device.
|
williamr@2
|
134 |
EPrimaryDisplayAndKeyboard = 0x3, ///< Both primary display and the
|
williamr@2
|
135 |
///< primary keyboard of the device.
|
williamr@2
|
136 |
|
williamr@2
|
137 |
ESecondaryDisplay = 0x4, ///< Secondary display of the device.
|
williamr@2
|
138 |
ESecondaryKeyboard = 0x8, ///< Secondary keyboard of the device.
|
williamr@2
|
139 |
ESecondaryDisplayAndKeyboard = 0xC, ///< Both secondary display and the
|
williamr@2
|
140 |
///< secondary keyboard of the device.
|
williamr@2
|
141 |
|
williamr@2
|
142 |
ECustomTarget1 = 0x10, ///< Device specific custom target 1.
|
williamr@2
|
143 |
ECustomTarget2 = 0x20, ///< Device specific custom target 2.
|
williamr@2
|
144 |
ECustomTarget3 = 0x40, ///< Device specific custom target 3.
|
williamr@2
|
145 |
ECustomTarget4 = 0x80, ///< Device specific custom target 4.
|
williamr@2
|
146 |
|
williamr@2
|
147 |
/**
|
williamr@2
|
148 |
* Special target used to control all currently available system lights.
|
williamr@2
|
149 |
*
|
williamr@2
|
150 |
* System lights normally include all displays and keyboards,
|
williamr@2
|
151 |
* but not custom lights. This is however device dependent.
|
williamr@2
|
152 |
*
|
williamr@2
|
153 |
* A target mask including this target is
|
williamr@2
|
154 |
* always changed to a device state specific target mask.
|
williamr@2
|
155 |
* Note that the system target with any other target is not supported.
|
williamr@2
|
156 |
*
|
williamr@2
|
157 |
* This target is always supported but it is never
|
williamr@2
|
158 |
* included in supported targets mask.
|
williamr@2
|
159 |
*
|
williamr@2
|
160 |
* @see CHWRMLight::SupportedTargets()
|
williamr@2
|
161 |
*/
|
williamr@2
|
162 |
ESystemTarget = 0x80000000
|
williamr@2
|
163 |
};
|
williamr@2
|
164 |
|
williamr@2
|
165 |
public: // Constructors
|
williamr@2
|
166 |
|
williamr@2
|
167 |
/**
|
williamr@2
|
168 |
* Two-phased constructor.
|
williamr@2
|
169 |
*
|
williamr@2
|
170 |
* @return A pointer to a new instance of the CHWRMLight class.
|
williamr@2
|
171 |
*
|
williamr@2
|
172 |
* @leave KErrNotSupported Device doesn't support Light feature.
|
williamr@2
|
173 |
* @leave KErrNoMemory There is a memory allocation failure.
|
williamr@2
|
174 |
*/
|
williamr@2
|
175 |
IMPORT_C static CHWRMLight* NewL();
|
williamr@2
|
176 |
|
williamr@2
|
177 |
/**
|
williamr@2
|
178 |
* Two-phased constructor.
|
williamr@2
|
179 |
* Leaves instance to cleanup stack.
|
williamr@2
|
180 |
*
|
williamr@2
|
181 |
* @return A pointer to a new instance of the CHWRMLight class.
|
williamr@2
|
182 |
*
|
williamr@2
|
183 |
* @leave KErrNotSupported Device doesn't support Light feature.
|
williamr@2
|
184 |
* @leave KErrNoMemory There is a memory allocation failure.
|
williamr@2
|
185 |
*/
|
williamr@2
|
186 |
IMPORT_C static CHWRMLight* NewLC();
|
williamr@2
|
187 |
|
williamr@2
|
188 |
/**
|
williamr@2
|
189 |
* Two-phased constructor.
|
williamr@2
|
190 |
* Use this method for creating a Light client with callbacks.
|
williamr@2
|
191 |
*
|
williamr@2
|
192 |
* @param aCallback Pointer to the callback instance.
|
williamr@2
|
193 |
* @return A pointer to a new instance of the CHWRMLight class.
|
williamr@2
|
194 |
*
|
williamr@2
|
195 |
* @leave KErrNotSupported Device doesn't support Light feature.
|
williamr@2
|
196 |
* @leave KErrNoMemory There is a memory allocation failure.
|
williamr@2
|
197 |
*/
|
williamr@2
|
198 |
IMPORT_C static CHWRMLight* NewL(MHWRMLightObserver* aCallback);
|
williamr@2
|
199 |
|
williamr@2
|
200 |
/**
|
williamr@2
|
201 |
* Two-phased constructor.
|
williamr@2
|
202 |
* Use this method for creating a Light client with callbacks.
|
williamr@2
|
203 |
* Leaves instance to cleanup stack.
|
williamr@2
|
204 |
*
|
williamr@2
|
205 |
* @param aCallback Pointer to the callback instance
|
williamr@2
|
206 |
* @return A pointer to a new instance of the CHWRMLight class.
|
williamr@2
|
207 |
*
|
williamr@2
|
208 |
* @leave KErrNotSupported Device doesn't support Light feature.
|
williamr@2
|
209 |
* @leave KErrNoMemory There is a memory allocation failure.
|
williamr@2
|
210 |
*/
|
williamr@2
|
211 |
IMPORT_C static CHWRMLight* NewLC(MHWRMLightObserver* aCallback);
|
williamr@2
|
212 |
|
williamr@2
|
213 |
public: // New functions
|
williamr@2
|
214 |
|
williamr@2
|
215 |
|
williamr@2
|
216 |
/**
|
williamr@2
|
217 |
* Reserves light target exclusively for this client.
|
williamr@2
|
218 |
* A higher priority client may cause lower priority client reservation
|
williamr@2
|
219 |
* to be temporarily suspended. Commands can still be issued in suspended
|
williamr@2
|
220 |
* state, but they will not be acted upon unless suspension is lifted
|
williamr@2
|
221 |
* within specified duration.
|
williamr@2
|
222 |
* The suspended client will not get any notification about suspension.
|
williamr@2
|
223 |
* If light target is already reserved by a higher or equal priority application,
|
williamr@2
|
224 |
* reserving will still succeeds, but reservation is immediately suspended.
|
williamr@2
|
225 |
*
|
williamr@2
|
226 |
* Calling this method is equal to calling ReserveLightL( aTarget, EFalse, EFalse),
|
williamr@2
|
227 |
* i.e. any previously frozen state will not be restored and CCoeEnv
|
williamr@2
|
228 |
* background/foreground status is always used to control further reservations.
|
williamr@2
|
229 |
*
|
williamr@2
|
230 |
* @param aTarget Defines which light should be reserved. Multiple lights can
|
williamr@2
|
231 |
* be specified with using bitwise-or.
|
williamr@2
|
232 |
*
|
williamr@2
|
233 |
* @leave KErrNotSupported One or more of specified targets are not supported.
|
williamr@2
|
234 |
* @leave KErrAccessDenied No CCoeEnv present.
|
williamr@2
|
235 |
* @leave KErrNotReady Trying to reserve while on background.
|
williamr@2
|
236 |
* @leave KErrNoMemory There is a memory allocation failure.
|
williamr@2
|
237 |
*
|
williamr@2
|
238 |
* @see TLightTarget
|
williamr@2
|
239 |
*/
|
williamr@2
|
240 |
virtual void ReserveLightL(TInt aTarget)=0;
|
williamr@2
|
241 |
|
williamr@2
|
242 |
/**
|
williamr@2
|
243 |
* Reserves light target exclusively for this client.
|
williamr@2
|
244 |
* A higher priority client may cause lower priority client reservation
|
williamr@2
|
245 |
* to be temporarily suspended. Commands can still be issued in suspended
|
williamr@2
|
246 |
* state, but they will not be acted upon unless suspension is lifted
|
williamr@2
|
247 |
* within specified duration.
|
williamr@2
|
248 |
* The suspended client will not get any notification about suspension.
|
williamr@2
|
249 |
* If light target is already reserved by a higher or equal priority application,
|
williamr@2
|
250 |
* reserving will still succeeds, but reservation is immediately suspended.
|
williamr@2
|
251 |
*
|
williamr@2
|
252 |
*
|
williamr@2
|
253 |
* @param aTarget Defines which light should be reserved. Multiple lights can
|
williamr@2
|
254 |
* be specified with using bitwise-or.
|
williamr@2
|
255 |
* @param aRestoreState If ETrue, the state frozen on last release will be
|
williamr@2
|
256 |
* restored upon successful reservation.
|
williamr@2
|
257 |
* I.e. if light was blinking when it was released by this
|
williamr@2
|
258 |
* client the last time, it would start blinking again upon
|
williamr@2
|
259 |
* successful reservation.
|
williamr@2
|
260 |
* For the first reservation of each session this parameter
|
williamr@2
|
261 |
* is always considered EFalse regardless of what is supplied,
|
williamr@2
|
262 |
* as there is no previous frozen state to restore.
|
williamr@2
|
263 |
* @param aForceNoCCoeEnv If EFalse, then reservation requires that this client is
|
williamr@2
|
264 |
* on the foreground at the time of reservation and light
|
williamr@2
|
265 |
* target will be automatically released and re-reserved based
|
williamr@2
|
266 |
* on background/foreground status of the this client. This
|
williamr@2
|
267 |
* also implies that CCoeEnv::Static() != NULL is required.
|
williamr@2
|
268 |
* If ETrue, the client will not require CCoeEnv to be present
|
williamr@2
|
269 |
* nor does it automatically reserve/release light by depending
|
williamr@2
|
270 |
* on foreground/background status of the client.
|
williamr@2
|
271 |
* Only trusted clients are allowed to set this flag to ETrue.
|
williamr@2
|
272 |
* A client is considered trusted if it has nonstandard
|
williamr@2
|
273 |
* priority defined in the internal lights policy of the
|
williamr@2
|
274 |
* HW Resource Manager. A client can be defined trusted
|
williamr@2
|
275 |
* only by S60 or a product.
|
williamr@2
|
276 |
*
|
williamr@2
|
277 |
* @leave KErrNotSupported One or more of specified targets are not supported.
|
williamr@2
|
278 |
* @leave KErrAccessDenied Paramenter aForceNoCCoeEnv is ETrue and client is not trusted.
|
williamr@2
|
279 |
* @leave KErrBadHandle Parameter ForceNoCCoeEnv is EFalse and no CCoeEnv present.
|
williamr@2
|
280 |
* @leave KErrNotReady Trying to reserve while on background and parameter
|
williamr@2
|
281 |
* aForceNoCCoeEnv is EFalse.
|
williamr@2
|
282 |
* @leave KErrNoMemory There is a memory allocation failure.
|
williamr@2
|
283 |
*
|
williamr@2
|
284 |
* @see TLightTarget
|
williamr@2
|
285 |
*/
|
williamr@2
|
286 |
virtual void ReserveLightL(TInt aTarget, TBool aRestoreState, TBool aForceNoCCoeEnv)=0;
|
williamr@2
|
287 |
|
williamr@2
|
288 |
/**
|
williamr@2
|
289 |
* Releases light target if it was previously reserved for this client.
|
williamr@2
|
290 |
* If this client has not reserved any of the specified lights,
|
williamr@2
|
291 |
* this method does nothing.
|
williamr@2
|
292 |
* Any reserved light targets that are released and have no other suspended
|
williamr@2
|
293 |
* clients will be reset to default state, which is either lights on or lights off,
|
williamr@2
|
294 |
* depending on system inactivity time.
|
williamr@2
|
295 |
*
|
williamr@2
|
296 |
* @param aTarget Defines which light should be released. Multiple lights can
|
williamr@2
|
297 |
* be specified with using bitwise-or.
|
williamr@2
|
298 |
*
|
williamr@2
|
299 |
* @see TLightTarget
|
williamr@2
|
300 |
*/
|
williamr@2
|
301 |
virtual void ReleaseLight(TInt aTarget)=0;
|
williamr@2
|
302 |
|
williamr@2
|
303 |
|
williamr@2
|
304 |
/**
|
williamr@2
|
305 |
* The LightOnL method switches the specified target light on
|
williamr@2
|
306 |
* for infinite duration using default intensity. Lights will use fade-in.
|
williamr@2
|
307 |
*
|
williamr@2
|
308 |
* Calling this method is equal to calling
|
williamr@2
|
309 |
* LightOnL(aTarget, KHWRMInfiniteDuration, KHWRMDefaultIntensity, ETrue).
|
williamr@2
|
310 |
*
|
williamr@2
|
311 |
* @param aTarget Defines which light should be controlled. Multiple lights can
|
williamr@2
|
312 |
* be specified with using bitwise-or.
|
williamr@2
|
313 |
*
|
williamr@2
|
314 |
* @leave KErrNotSupported One or more of specified targets are not supported.
|
williamr@2
|
315 |
* @leave KErrBadHandle Light session has been invalidated.
|
williamr@2
|
316 |
* @leave KErrTimedOut Timeout occurred in controlling light.
|
williamr@2
|
317 |
* @leave KErrInUse One or more of specified targets are not reserved for
|
williamr@2
|
318 |
* this client but are reserved for others.
|
williamr@2
|
319 |
* @leave KErrNoMemory There is a memory allocation failure.
|
williamr@2
|
320 |
* @leave KErrGeneral There is a hardware error.
|
williamr@2
|
321 |
*
|
williamr@2
|
322 |
* @see TLightTarget
|
williamr@2
|
323 |
*/
|
williamr@2
|
324 |
virtual void LightOnL(TInt aTarget) = 0;
|
williamr@2
|
325 |
|
williamr@2
|
326 |
/**
|
williamr@2
|
327 |
* The LightOnL method switches the specified target light on
|
williamr@2
|
328 |
* for the specified duration using default intensity. Lights will use fade-in.
|
williamr@2
|
329 |
*
|
williamr@2
|
330 |
* Calling this method is equal to call
|
williamr@2
|
331 |
* LightOnL(aTarget, aDuration, KHWRMDefaultIntensity, ETrue).
|
williamr@2
|
332 |
*
|
williamr@2
|
333 |
* @param aTarget Defines which light should be controlled. Multiple lights can
|
williamr@2
|
334 |
* be specified with using bitwise-or.
|
williamr@2
|
335 |
* @param aDuration Duration of the time the light is switched on measured in milliseconds.
|
williamr@2
|
336 |
* After the duration expires, the light state for target will be changed
|
williamr@2
|
337 |
* to whatever state was caused by the last infinite time duration call, or
|
williamr@2
|
338 |
* default state determined by inactivity timer, in case there has not
|
williamr@2
|
339 |
* been a previous infinite time duration call in this session.
|
williamr@2
|
340 |
* If the aDuration time is KHWRMInfiniteDuration then it means an
|
williamr@2
|
341 |
* infinite value that has to be stopped by calling of any of the other
|
williamr@2
|
342 |
' light control methods.
|
williamr@2
|
343 |
* Duration can have maximum value of KHWRMLightMaxDuration.
|
williamr@2
|
344 |
*
|
williamr@2
|
345 |
* @leave KErrArgument Parameter aDuration is out of range.
|
williamr@2
|
346 |
* @leave KErrNotSupported One or more of specified targets are not supported.
|
williamr@2
|
347 |
* @leave KErrBadHandle Light session has been invalidated.
|
williamr@2
|
348 |
* @leave KErrTimedOut Timeout occurred in controlling light.
|
williamr@2
|
349 |
* @leave KErrInUse One or more of specified targets are not reserved for
|
williamr@2
|
350 |
* this client but are reserved for others.
|
williamr@2
|
351 |
* @leave KErrNoMemory There is a memory allocation failure.
|
williamr@2
|
352 |
* @leave KErrGeneral There is a hardware error.
|
williamr@2
|
353 |
*
|
williamr@2
|
354 |
* @see TLightTarget
|
williamr@2
|
355 |
*/
|
williamr@2
|
356 |
virtual void LightOnL(TInt aTarget,
|
williamr@2
|
357 |
TInt aDuration) = 0;
|
williamr@2
|
358 |
|
williamr@2
|
359 |
/**
|
williamr@2
|
360 |
* The LightOnL method switches the specified target light on
|
williamr@2
|
361 |
* for the specified duration using specified intensity. Fade-in can also be controlled.
|
williamr@2
|
362 |
*
|
williamr@2
|
363 |
* @param aTarget Defines which light should be controlled. Multiple lights can
|
williamr@2
|
364 |
* be specified with using bitwise-or.
|
williamr@2
|
365 |
* @param aDuration Duration of the time the light is switched on measured in milliseconds.
|
williamr@2
|
366 |
* After the duration expires, the light state for target will be changed
|
williamr@2
|
367 |
* to whatever state was caused by the last infinite time duration call, or
|
williamr@2
|
368 |
* default state determined by inactivity timer, in case there has not
|
williamr@2
|
369 |
* been a previous infinite time duration call in this session.
|
williamr@2
|
370 |
* If the aDuration time is KHWRMInfiniteDuration then it means
|
williamr@2
|
371 |
* an infinite value that has to be stopped by calling of any of
|
williamr@2
|
372 |
* the other light control methods.
|
williamr@2
|
373 |
* Duration can have maximum value of KHWRMLightMaxDuration.
|
williamr@2
|
374 |
* @param aIntensity Intensity of the light. If aIntensity is KHWRMDefaultIntensity, device default
|
williamr@2
|
375 |
* intensity will be used.
|
williamr@2
|
376 |
* Note: All devices might not support user defined intensity, in which case
|
williamr@2
|
377 |
* device will behave in its default fashion.
|
williamr@2
|
378 |
* @param aFadeIn If ETrue, lights will not turn on instantly but instead smoothly fade-in.
|
williamr@2
|
379 |
* Note: All devices will not support fade-in, in which case device will
|
williamr@2
|
380 |
* behave in its default fashion.
|
williamr@2
|
381 |
*
|
williamr@2
|
382 |
* @leave KErrArgument One of the parameters is out of range.
|
williamr@2
|
383 |
* @leave KErrNotSupported One or more of specified targets are not supported.
|
williamr@2
|
384 |
* @leave KErrBadHandle Light session has been invalidated.
|
williamr@2
|
385 |
* @leave KErrTimedOut Timeout occurred in controlling light.
|
williamr@2
|
386 |
* @leave KErrInUse One or more of specified targets are not reserved for
|
williamr@2
|
387 |
* this client but are reserved for others.
|
williamr@2
|
388 |
* @leave KErrNoMemory There is a memory allocation failure.
|
williamr@2
|
389 |
* @leave KErrGeneral There is a hardware error.
|
williamr@2
|
390 |
*
|
williamr@2
|
391 |
* @see TLightTarget
|
williamr@2
|
392 |
*/
|
williamr@2
|
393 |
virtual void LightOnL(TInt aTarget,
|
williamr@2
|
394 |
TInt aDuration,
|
williamr@2
|
395 |
TInt aIntensity,
|
williamr@2
|
396 |
TBool aFadeIn) = 0;
|
williamr@2
|
397 |
|
williamr@2
|
398 |
/**
|
williamr@2
|
399 |
* The LightBlinkL method blinks the target light(s) of the device for infinite duration
|
williamr@2
|
400 |
* using default intensity.
|
williamr@2
|
401 |
*
|
williamr@2
|
402 |
* Calling this method is equal to call
|
williamr@2
|
403 |
* LightBlinkL(aTarget, KHWRMInfiniteDuration, KHWRMDefaultCycleTime,
|
williamr@2
|
404 |
* KHWRMDefaultCycleTime, KHWRMDefaultIntensity).
|
williamr@2
|
405 |
*
|
williamr@2
|
406 |
* @param aTarget Defines which light should be controlled. Multiple lights can
|
williamr@2
|
407 |
* be specified with using bitwise-or.
|
williamr@2
|
408 |
*
|
williamr@2
|
409 |
* @leave KErrNotSupported One or more of specified targets are not supported.
|
williamr@2
|
410 |
* @leave KErrBadHandle Light session has been invalidated.
|
williamr@2
|
411 |
* @leave KErrTimedOut Timeout occurred in controlling light.
|
williamr@2
|
412 |
* @leave KErrInUse One or more of specified targets are not reserved for
|
williamr@2
|
413 |
* this client but are reserved for others.
|
williamr@2
|
414 |
* @leave KErrNoMemory There is a memory allocation failure.
|
williamr@2
|
415 |
* @leave KErrGeneral There is a hardware error.
|
williamr@2
|
416 |
*
|
williamr@2
|
417 |
* @see TLightTarget
|
williamr@2
|
418 |
*/
|
williamr@2
|
419 |
virtual void LightBlinkL(TInt aTarget) = 0;
|
williamr@2
|
420 |
|
williamr@2
|
421 |
/**
|
williamr@2
|
422 |
* The LightBlinkL method blinks the target light(s) of the device for specified duration
|
williamr@2
|
423 |
* using default intensity.
|
williamr@2
|
424 |
*
|
williamr@2
|
425 |
* Calling this method is equal to calling
|
williamr@2
|
426 |
* LightBlinkL(aTarget, aDuration, KHWRMDefaultCycleTime,
|
williamr@2
|
427 |
* KHWRMDefaultCycleTime, KHWRMDefaultIntensity).
|
williamr@2
|
428 |
*
|
williamr@2
|
429 |
* @param aTarget Defines which light should be controlled. Multiple lights can
|
williamr@2
|
430 |
* be specified with using bitwise-or.
|
williamr@2
|
431 |
* @param aDuration Duration of the time the light is set to blink measured in milliseconds.
|
williamr@2
|
432 |
* After the duration expires, the light state for target will be changed
|
williamr@2
|
433 |
* to whatever state was caused by the last infinite time duration call, or
|
williamr@2
|
434 |
* default state determined by inactivity timer, in case there has not
|
williamr@2
|
435 |
* been a previous infinite time duration call in this session.
|
williamr@2
|
436 |
* If the aTotalDuration time is KHWRMInfiniteDuration then it
|
williamr@2
|
437 |
* means an infinite value that has to be
|
williamr@2
|
438 |
* stopped by calling of any of the other light control methods.
|
williamr@2
|
439 |
* Duration can have maximum value of KHWRMLightMaxDuration.
|
williamr@2
|
440 |
*
|
williamr@2
|
441 |
* @leave KErrArgument Parameter aDuration is out of range.
|
williamr@2
|
442 |
* @leave KErrNotSupported One or more of specified targets are not supported.
|
williamr@2
|
443 |
* @leave KErrBadHandle Light session has been invalidated.
|
williamr@2
|
444 |
* @leave KErrTimedOut Timeout occurred in controlling light.
|
williamr@2
|
445 |
* @leave KErrInUse One or more of specified targets are not reserved for
|
williamr@2
|
446 |
* this client but are reserved for others.
|
williamr@2
|
447 |
* @leave KErrNoMemory There is a memory allocation failure.
|
williamr@2
|
448 |
* @leave KErrGeneral There is a hardware error.
|
williamr@2
|
449 |
*
|
williamr@2
|
450 |
* @see TLightTarget
|
williamr@2
|
451 |
*/
|
williamr@2
|
452 |
virtual void LightBlinkL(TInt aTarget,
|
williamr@2
|
453 |
TInt aDuration) = 0;
|
williamr@2
|
454 |
|
williamr@2
|
455 |
/**
|
williamr@2
|
456 |
* The LightBlinkL method blinks the target light(s) of the device for specified duration
|
williamr@2
|
457 |
* using specified intensity. On- and Off-cycle times of the blinking can also be controlled.
|
williamr@2
|
458 |
*
|
williamr@2
|
459 |
* @param aTarget Defines which light should be controlled. Multiple lights can
|
williamr@2
|
460 |
* be specified with using bitwise-or.
|
williamr@2
|
461 |
* @param aDuration Duration of the time the light is set to blink measured in milliseconds.
|
williamr@2
|
462 |
* After the duration expires, the light state for target will be changed
|
williamr@2
|
463 |
* to whatever state was caused by the last infinite time duration call, or
|
williamr@2
|
464 |
* default state determined by inactivity timer, in case there has not
|
williamr@2
|
465 |
* been a previous infinite time duration call in this session.
|
williamr@2
|
466 |
* If the aTotalDuration time is KHWRMInfiniteDuration then it
|
williamr@2
|
467 |
* means an infinite value that has to be
|
williamr@2
|
468 |
* stopped by calling of any of the other light control methods.
|
williamr@2
|
469 |
* Duration can have maximum value of KHWRMLightMaxDuration.
|
williamr@2
|
470 |
* @param aOnDuration Duration time, measured in milliseconds, of how long the Light is
|
williamr@2
|
471 |
* switched on in every Blink cycle.
|
williamr@2
|
472 |
* Duration can have maximum value of KHWRMLightMaxDuration.
|
williamr@2
|
473 |
* For device default cycle duration, use value KHWRMDefaultCycleTime.
|
williamr@2
|
474 |
* If either of aOnDuration or aOffDuration is KHWRMDefaultCycleTime,
|
williamr@2
|
475 |
* both must be KHWRMDefaultCycleTime.
|
williamr@2
|
476 |
* Some devices might not support variable blink cycle times, in which
|
williamr@2
|
477 |
* case default value will be substituted.
|
williamr@2
|
478 |
* @param aOffDuration Duration time, measured in milliseconds, of how long the Light
|
williamr@2
|
479 |
* is switched off in every Blink cycle.
|
williamr@2
|
480 |
* Duration can have maximum value of KHWRMLightMaxDuration.
|
williamr@2
|
481 |
* For device default cycle duration, use value KHWRMDefaultCycleTime.
|
williamr@2
|
482 |
* If either of aOnDuration or aOffDuration is KHWRMDefaultCycleTime,
|
williamr@2
|
483 |
* both must be KHWRMDefaultCycleTime.
|
williamr@2
|
484 |
* Some devices might not support variable blink cycle times, in which
|
williamr@2
|
485 |
* case default value will be substituted.
|
williamr@2
|
486 |
* @param aIntensity Intensity of the light. If aIntensity is KHWRMDefaultIntensity, device default
|
williamr@2
|
487 |
* intensity will be used.
|
williamr@2
|
488 |
* Note: All devices might not support user defined intensity, in which case
|
williamr@2
|
489 |
* device will behave in its default fashion.
|
williamr@2
|
490 |
*
|
williamr@2
|
491 |
* @leave KErrArgument One of the parameters is out of range or otherwise invalid.
|
williamr@2
|
492 |
* @leave KErrNotSupported One or more of specified targets are not supported.
|
williamr@2
|
493 |
* @leave KErrBadHandle Light session has been invalidated.
|
williamr@2
|
494 |
* @leave KErrTimedOut Timeout occurred in controlling light.
|
williamr@2
|
495 |
* @leave KErrInUse One or more of specified targets are not reserved for
|
williamr@2
|
496 |
* this client but are reserved for others.
|
williamr@2
|
497 |
* @leave KErrNoMemory There is a memory allocation failure.
|
williamr@2
|
498 |
* @leave KErrGeneral There is a hardware error.
|
williamr@2
|
499 |
*
|
williamr@2
|
500 |
* @see TLightTarget
|
williamr@2
|
501 |
*/
|
williamr@2
|
502 |
virtual void LightBlinkL(TInt aTarget,
|
williamr@2
|
503 |
TInt aDuration,
|
williamr@2
|
504 |
TInt aOnDuration,
|
williamr@2
|
505 |
TInt aOffDuration,
|
williamr@2
|
506 |
TInt aIntensity) = 0;
|
williamr@2
|
507 |
|
williamr@2
|
508 |
/**
|
williamr@2
|
509 |
* The LightOffL method switches the device light off for the specified target for
|
williamr@2
|
510 |
* infinite duration. Lights will be switched off with fade-out.
|
williamr@2
|
511 |
*
|
williamr@2
|
512 |
* Calling this method is equal to call
|
williamr@2
|
513 |
* LightOffL(aTarget, KHWRMInfiniteDuration, ETrue).
|
williamr@2
|
514 |
*
|
williamr@2
|
515 |
* @param aTarget Defines which light should be controlled. Multiple lights can
|
williamr@2
|
516 |
* be specified with using bitwise-or.
|
williamr@2
|
517 |
*
|
williamr@2
|
518 |
* @leave KErrNotSupported One or more of specified targets are not supported.
|
williamr@2
|
519 |
* @leave KErrBadHandle Light session has been invalidated.
|
williamr@2
|
520 |
* @leave KErrTimedOut Timeout occurred in controlling light.
|
williamr@2
|
521 |
* @leave KErrInUse One or more of specified targets are not reserved for
|
williamr@2
|
522 |
* this client but are reserved for others.
|
williamr@2
|
523 |
* @leave KErrNoMemory There is a memory allocation failure.
|
williamr@2
|
524 |
* @leave KErrGeneral There is a hardware error.
|
williamr@2
|
525 |
*
|
williamr@2
|
526 |
* @see TLightTarget
|
williamr@2
|
527 |
*/
|
williamr@2
|
528 |
virtual void LightOffL(TInt aTarget) = 0;
|
williamr@2
|
529 |
|
williamr@2
|
530 |
/**
|
williamr@2
|
531 |
* The LightOffL method switches the device light off for the specified target for
|
williamr@2
|
532 |
* the specified duration time. Lights will be switched off with fade-out.
|
williamr@2
|
533 |
*
|
williamr@2
|
534 |
* Calling this method is equal to call LightOffL(aTarget, aDuration, ETrue).
|
williamr@2
|
535 |
*
|
williamr@2
|
536 |
* @param aTarget Defines which light should be controlled. Multiple lights can
|
williamr@2
|
537 |
* be specified with using bitwise-or.
|
williamr@2
|
538 |
* @param aDuration Duration of the time the light is switched off measured in milliseconds.
|
williamr@2
|
539 |
* After the duration expires, the light state for target will be changed
|
williamr@2
|
540 |
* to whatever state was caused by the last infinite time duration call, or
|
williamr@2
|
541 |
* default state determined by inactivity timer, in case there has not
|
williamr@2
|
542 |
* been a previous infinite time duration call in this session.
|
williamr@2
|
543 |
* If the aDuration time is KHWRMInfiniteDuration then it
|
williamr@2
|
544 |
* means an infinite value that has to be
|
williamr@2
|
545 |
* stopped by calling of any of the other light control methods.
|
williamr@2
|
546 |
* Duration can have maximum value of KHWRMLightMaxDuration.
|
williamr@2
|
547 |
*
|
williamr@2
|
548 |
* @leave KErrArgument Parameter aDuration is out of range.
|
williamr@2
|
549 |
* @leave KErrNotSupported One or more of specified targets are not supported.
|
williamr@2
|
550 |
* @leave KErrBadHandle Light session has been invalidated.
|
williamr@2
|
551 |
* @leave KErrTimedOut Timeout occurred in controlling light.
|
williamr@2
|
552 |
* @leave KErrInUse One or more of specified targets are not reserved for
|
williamr@2
|
553 |
* this client but are reserved for others.
|
williamr@2
|
554 |
* @leave KErrNoMemory There is a memory allocation failure.
|
williamr@2
|
555 |
* @leave KErrGeneral There is a hardware error.
|
williamr@2
|
556 |
*
|
williamr@2
|
557 |
* @see TLightTarget
|
williamr@2
|
558 |
*/
|
williamr@2
|
559 |
virtual void LightOffL(TInt aTarget,
|
williamr@2
|
560 |
TInt aDuration) = 0;
|
williamr@2
|
561 |
|
williamr@2
|
562 |
/**
|
williamr@2
|
563 |
* The LightOffL method switches the device light off for the specified target for
|
williamr@2
|
564 |
* the specified duration time. Lights fade-out can also be controlled.
|
williamr@2
|
565 |
*
|
williamr@2
|
566 |
* @param aTarget Defines which light should be controlled. Multiple lights can
|
williamr@2
|
567 |
* be specified with using bitwise-or.
|
williamr@2
|
568 |
* @param aDuration Duration of the time the light is switched off measured in milliseconds.
|
williamr@2
|
569 |
* After the duration expires, the light state for target will be changed
|
williamr@2
|
570 |
* to whatever state was caused by the last infinite time duration call, or
|
williamr@2
|
571 |
* default state determined by inactivity timer, in case there has not
|
williamr@2
|
572 |
* been a previous infinite time duration call in this session.
|
williamr@2
|
573 |
* If the aDuration time is KHWRMInfiniteDuration then it
|
williamr@2
|
574 |
* means an infinite value that has to be
|
williamr@2
|
575 |
* stopped by calling of any of the other light control methods.
|
williamr@2
|
576 |
* Duration can have maximum value of KHWRMLightMaxDuration.
|
williamr@2
|
577 |
* @param aFadeOut If ETrue, lights will not turn off instantly but instead smoothly fade-out
|
williamr@2
|
578 |
* Note: All devices will not support fade-out, in which case device will
|
williamr@2
|
579 |
* behave in its default fashion.
|
williamr@2
|
580 |
*
|
williamr@2
|
581 |
* @leave KErrArgument aDuration is out of range.
|
williamr@2
|
582 |
* @leave KErrNotSupported One or more of specified targets are not supported.
|
williamr@2
|
583 |
* @leave KErrBadHandle Light session has been invalidated.
|
williamr@2
|
584 |
* @leave KErrTimedOut Timeout occurred in controlling light.
|
williamr@2
|
585 |
* @leave KErrInUse One or more of specified targets are not reserved for
|
williamr@2
|
586 |
* this client but are reserved for others.
|
williamr@2
|
587 |
* @leave KErrNoMemory There is a memory allocation failure.
|
williamr@2
|
588 |
* @leave KErrGeneral There is a hardware error.
|
williamr@2
|
589 |
*
|
williamr@2
|
590 |
* @see TLightTarget
|
williamr@2
|
591 |
*/
|
williamr@2
|
592 |
virtual void LightOffL(TInt aTarget,
|
williamr@2
|
593 |
TInt aDuration,
|
williamr@2
|
594 |
TBool aFadeOut) = 0;
|
williamr@2
|
595 |
|
williamr@2
|
596 |
/**
|
williamr@2
|
597 |
* This method retrieves the current light status.
|
williamr@2
|
598 |
*
|
williamr@2
|
599 |
* @param aTarget Defines which light status is returned.
|
williamr@2
|
600 |
* This method only supports single target, as different
|
williamr@2
|
601 |
* targets might have different statuses.
|
williamr@2
|
602 |
* @return TLightStatus indicating the current light status. If there is a problem or
|
williamr@2
|
603 |
* multiple targets were specified, CHWRMLight::ELightStatusUnknown is returned.
|
williamr@2
|
604 |
*
|
williamr@2
|
605 |
* @see MHWRMLightObserver
|
williamr@2
|
606 |
* @see TLightTarget
|
williamr@2
|
607 |
*/
|
williamr@2
|
608 |
virtual TLightStatus LightStatus(TInt aTarget) const = 0;
|
williamr@2
|
609 |
|
williamr@2
|
610 |
/**
|
williamr@2
|
611 |
* This method retrieves the supported light targets of the device.
|
williamr@2
|
612 |
* Any attempt to use or reserve unsupported targets will fail with
|
williamr@2
|
613 |
* KErrNotSupported.
|
williamr@2
|
614 |
*
|
williamr@2
|
615 |
* @return Bitmask containing supported light targets.
|
williamr@2
|
616 |
*
|
williamr@2
|
617 |
* @see TLightTarget
|
williamr@2
|
618 |
*/
|
williamr@2
|
619 |
virtual TInt SupportedTargets() const = 0;
|
williamr@2
|
620 |
};
|
williamr@2
|
621 |
|
williamr@2
|
622 |
/**
|
williamr@2
|
623 |
* A callback interface for light status reporting.
|
williamr@2
|
624 |
*
|
williamr@2
|
625 |
* If the client requires up-to-date status information, the client needs
|
williamr@2
|
626 |
* to derive a class from the MHWRMlightObserver interface and implement
|
williamr@2
|
627 |
* the LightStatusChanged() method.
|
williamr@2
|
628 |
*
|
williamr@2
|
629 |
* A callback object header example:
|
williamr@2
|
630 |
*
|
williamr@2
|
631 |
* @code
|
williamr@2
|
632 |
* // INCLUDES
|
williamr@2
|
633 |
* #include <HWRMLight.h> // Link against HWRMLightClient.lib.
|
williamr@2
|
634 |
*
|
williamr@2
|
635 |
* class CTests : public CBase,
|
williamr@2
|
636 |
* public MHWRMLightObserver
|
williamr@2
|
637 |
* {
|
williamr@2
|
638 |
* public:
|
williamr@2
|
639 |
* CTests();
|
williamr@2
|
640 |
* ~CTests();
|
williamr@2
|
641 |
*
|
williamr@2
|
642 |
* void ConstructL();
|
williamr@2
|
643 |
* static CTests* NewL();
|
williamr@2
|
644 |
*
|
williamr@2
|
645 |
* // from MHWRMLightObserver
|
williamr@2
|
646 |
* virtual void LightStatusChanged(TInt aTarget,
|
williamr@2
|
647 |
* CHWRMLight::TLightStatus aStatus);
|
williamr@2
|
648 |
*
|
williamr@2
|
649 |
* private:
|
williamr@2
|
650 |
* CHWRMLight* iLight;
|
williamr@2
|
651 |
* };
|
williamr@2
|
652 |
*
|
williamr@2
|
653 |
* @endcode
|
williamr@2
|
654 |
*
|
williamr@2
|
655 |
* A callback method implementation example:
|
williamr@2
|
656 |
*
|
williamr@2
|
657 |
* @code
|
williamr@2
|
658 |
* void CTests::LightStatusChanged(TInt aTarget,
|
williamr@2
|
659 |
* CHWRMLight::TLightStatus aStatus)
|
williamr@2
|
660 |
* {
|
williamr@2
|
661 |
* RDebug::Print(_L("### Light state changed for target: 0x%x"), aTarget);
|
williamr@2
|
662 |
* switch ( aStatus )
|
williamr@2
|
663 |
* {
|
williamr@2
|
664 |
* case CHWRMLight::ELightOn:
|
williamr@2
|
665 |
* RDebug::Print(_L("### Light state changed: ELightOn"));
|
williamr@2
|
666 |
* break;
|
williamr@2
|
667 |
* case CHWRMLight::ELightOff:
|
williamr@2
|
668 |
* RDebug::Print(_L("### Light state changed: ELightOff"));
|
williamr@2
|
669 |
* break;
|
williamr@2
|
670 |
* case CHWRMLight::ELightBlink:
|
williamr@2
|
671 |
* RDebug::Print(_L("### Light state changed: ELightBlink"));
|
williamr@2
|
672 |
* break;
|
williamr@2
|
673 |
* case CHWRMLight::ELightStatusUnknown:
|
williamr@2
|
674 |
* RDebug::Print(_L("### Light state changed: ELightStatusUnknown"));
|
williamr@2
|
675 |
* break;
|
williamr@2
|
676 |
* default:
|
williamr@2
|
677 |
* RDebug::Print(_L("### Light state changed: UNDEFINED !"));
|
williamr@2
|
678 |
* break;
|
williamr@2
|
679 |
* }
|
williamr@2
|
680 |
* }
|
williamr@2
|
681 |
*
|
williamr@2
|
682 |
* @endcode
|
williamr@2
|
683 |
*
|
williamr@2
|
684 |
* @since S60 3.0
|
williamr@2
|
685 |
*/
|
williamr@2
|
686 |
class MHWRMLightObserver
|
williamr@2
|
687 |
{
|
williamr@2
|
688 |
public:
|
williamr@2
|
689 |
|
williamr@2
|
690 |
/**
|
williamr@2
|
691 |
* Called when the device light status changes.
|
williamr@2
|
692 |
* Note that if the light status for certain target changes
|
williamr@2
|
693 |
* very rapidly, some state transitions might be missed.
|
williamr@2
|
694 |
* It is however guaranteed that latest state is always obtained.
|
williamr@2
|
695 |
*
|
williamr@2
|
696 |
* @param aTarget Indicates target(s) the new status applies to.
|
williamr@2
|
697 |
* @param aStatus Indicates light request status.
|
williamr@2
|
698 |
*
|
williamr@2
|
699 |
* @see CHWRMLight::TLightTarget
|
williamr@2
|
700 |
* @see CHWRMLight::TLightStatus
|
williamr@2
|
701 |
*/
|
williamr@2
|
702 |
virtual void LightStatusChanged(TInt aTarget,
|
williamr@2
|
703 |
CHWRMLight::TLightStatus aStatus) = 0;
|
williamr@2
|
704 |
};
|
williamr@2
|
705 |
|
williamr@2
|
706 |
|
williamr@2
|
707 |
#endif // HWRMLIGHT_H
|
williamr@2
|
708 |
|
williamr@2
|
709 |
// End of File
|