williamr@2
|
1 |
/*
|
williamr@4
|
2 |
* Copyright (c) 2006-2009 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@4
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.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@4
|
14 |
* Description:
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
*/
|
williamr@2
|
17 |
|
williamr@2
|
18 |
|
williamr@4
|
19 |
|
williamr@2
|
20 |
#ifndef HWRMVIBRA_H
|
williamr@2
|
21 |
#define HWRMVIBRA_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 vibra. When intensity is negative,
|
williamr@2
|
30 |
* the vibra motor rotates in the negative direction.
|
williamr@4
|
31 |
|
williamr@4
|
32 |
*
|
williamr@4
|
33 |
* @publishedAll
|
williamr@4
|
34 |
* @released
|
williamr@2
|
35 |
*/
|
williamr@2
|
36 |
const TInt KHWRMVibraMinIntensity = -100;
|
williamr@2
|
37 |
|
williamr@2
|
38 |
/**
|
williamr@2
|
39 |
* Minimum allowed intensity setting for vibra pulse.
|
williamr@4
|
40 |
*
|
williamr@4
|
41 |
* @publishedAll
|
williamr@4
|
42 |
* @released
|
williamr@2
|
43 |
*/
|
williamr@2
|
44 |
const TInt KHWRMVibraMinPulseIntensity = 1;
|
williamr@2
|
45 |
|
williamr@4
|
46 |
|
williamr@2
|
47 |
/**
|
williamr@2
|
48 |
* Maximum allowed intensity setting for vibra. When intensity is positive,
|
williamr@2
|
49 |
* the vibra motor rotates in the positive direction. Value 0 effectively
|
williamr@2
|
50 |
* stops the vibra.
|
williamr@4
|
51 |
|
williamr@4
|
52 |
* @publishedAll
|
williamr@4
|
53 |
* @released
|
williamr@2
|
54 |
*/
|
williamr@2
|
55 |
const TInt KHWRMVibraMaxIntensity = 100;
|
williamr@2
|
56 |
|
williamr@2
|
57 |
/**
|
williamr@2
|
58 |
* Maximum allowed duration value in milliseconds. Maximum vibrating time
|
williamr@2
|
59 |
* supported by device is declared in KVibraCtrlMaxTime cenrep-key.
|
williamr@4
|
60 |
|
williamr@2
|
61 |
*
|
williamr@2
|
62 |
* Note that duration probably has device specific
|
williamr@2
|
63 |
* maximum duration that is much lower.
|
williamr@4
|
64 |
*
|
williamr@4
|
65 |
* @publishedAll
|
williamr@4
|
66 |
* @released
|
williamr@2
|
67 |
*/
|
williamr@2
|
68 |
const TInt KHWRMVibraMaxDuration = (KMaxTInt / 1000) - 1;
|
williamr@2
|
69 |
|
williamr@2
|
70 |
/**
|
williamr@2
|
71 |
* KHWRMVibraInfiniteDuration specifies, that vibrating should continue maximum
|
williamr@2
|
72 |
* vibrating time supported by device if vibrating is not explicitly stopped.
|
williamr@2
|
73 |
*
|
williamr@4
|
74 |
*
|
williamr@4
|
75 |
* @publishedAll
|
williamr@4
|
76 |
* @released
|
williamr@2
|
77 |
*/
|
williamr@2
|
78 |
const TInt KHWRMVibraInfiniteDuration = 0;
|
williamr@2
|
79 |
|
williamr@4
|
80 |
|
williamr@2
|
81 |
class MHWRMVibraObserver;
|
williamr@2
|
82 |
class MHWRMVibraFeedbackObserver;
|
williamr@2
|
83 |
|
williamr@2
|
84 |
/**
|
williamr@2
|
85 |
* The class used to control the device vibra.
|
williamr@2
|
86 |
*
|
williamr@2
|
87 |
* HW Resource Manager Vibra API is a library API providing ability to control
|
williamr@2
|
88 |
* the device vibra. The API provides also methods to retrieve the current settings
|
williamr@2
|
89 |
* of the vibration feature in the user profile and the current status of the vibra.
|
williamr@2
|
90 |
*
|
williamr@2
|
91 |
* The type of HW Resource Manager Vibra API is a synchronous method call meaning
|
williamr@4
|
92 |
* the method call will block the client application. The API is meant for all
|
williamr@2
|
93 |
* applications which need to control the device vibra.
|
williamr@2
|
94 |
*
|
williamr@4
|
95 |
* The API consist of the classes CHWRMVibra and MHWRMVibraObserver. If the client
|
williamr@4
|
96 |
* requires up-to-date status information, it should also provide callback pointer
|
williamr@4
|
97 |
* of the MHWRMVibraObserver implementing class for the NewL-method.
|
williamr@2
|
98 |
*
|
williamr@2
|
99 |
* Usage:
|
williamr@2
|
100 |
*
|
williamr@2
|
101 |
* @code
|
williamr@4
|
102 |
* #include <hwrmvibra.h>
|
williamr@2
|
103 |
*
|
williamr@2
|
104 |
* // A CHWRMVibra instance can be created by using NewL() or NewLC() methods.
|
williamr@2
|
105 |
* // Up-to-date status information not required, no callbacks.
|
williamr@2
|
106 |
* CHWRMVibra* vibra = CHWRMVibra::NewL();
|
williamr@2
|
107 |
*
|
williamr@2
|
108 |
* // After this, vibra can be directly controlled via the provided class methods.
|
williamr@2
|
109 |
* vibra->StartVibraL(5000); // Start vibra for five seconds
|
williamr@2
|
110 |
* vibra->StopVibraL(); // Immediately stop vibra
|
williamr@2
|
111 |
*
|
williamr@2
|
112 |
* // To clean up, delete the created object:
|
williamr@2
|
113 |
* delete vibra;
|
williamr@2
|
114 |
* @endcode
|
williamr@2
|
115 |
*
|
williamr@4
|
116 |
* @publishedAll
|
williamr@4
|
117 |
* @released
|
williamr@2
|
118 |
*/
|
williamr@2
|
119 |
class CHWRMVibra : public CBase
|
williamr@2
|
120 |
{
|
williamr@2
|
121 |
public: // enums
|
williamr@2
|
122 |
/**
|
williamr@2
|
123 |
* Vibration setting in the user profile.
|
williamr@2
|
124 |
*/
|
williamr@2
|
125 |
enum TVibraModeState
|
williamr@2
|
126 |
{
|
williamr@4
|
127 |
/**
|
williamr@4
|
128 |
Not initialized yet or there is an error condion.
|
williamr@4
|
129 |
*/
|
williamr@4
|
130 |
EVibraModeUnknown = 0,
|
williamr@4
|
131 |
/**
|
williamr@4
|
132 |
Vibration setting in the user profile is on.
|
williamr@4
|
133 |
*/
|
williamr@4
|
134 |
EVibraModeON,
|
williamr@4
|
135 |
/**
|
williamr@4
|
136 |
Vibration setting in the user profile is off.
|
williamr@4
|
137 |
*/
|
williamr@4
|
138 |
EVibraModeOFF
|
williamr@2
|
139 |
};
|
williamr@2
|
140 |
|
williamr@2
|
141 |
/**
|
williamr@2
|
142 |
* Status of the vibration feature
|
williamr@2
|
143 |
*/
|
williamr@2
|
144 |
enum TVibraStatus
|
williamr@2
|
145 |
{
|
williamr@4
|
146 |
/**
|
williamr@4
|
147 |
Vibra is not initialized yet or status is uncertain because of an error condition.
|
williamr@4
|
148 |
*/
|
williamr@4
|
149 |
EVibraStatusUnknown = 0,
|
williamr@4
|
150 |
/**
|
williamr@4
|
151 |
Vibra is set off in the user profile or some application is specifically blocking vibra.
|
williamr@4
|
152 |
*/
|
williamr@4
|
153 |
EVibraStatusNotAllowed,
|
williamr@4
|
154 |
/**
|
williamr@4
|
155 |
Vibra is stopped.
|
williamr@4
|
156 |
*/
|
williamr@4
|
157 |
EVibraStatusStopped,
|
williamr@4
|
158 |
/**
|
williamr@4
|
159 |
Vibra is on.
|
williamr@4
|
160 |
*/
|
williamr@4
|
161 |
EVibraStatusOn
|
williamr@2
|
162 |
};
|
williamr@2
|
163 |
/**
|
williamr@2
|
164 |
* Tactile feedback vibration setting in the user profile.
|
williamr@2
|
165 |
*/
|
williamr@2
|
166 |
enum TVibraFeedbackModeState
|
williamr@2
|
167 |
{
|
williamr@2
|
168 |
EVibraFeedbackModeUnknown = 0, ///< Not initialized yet or there is an error condion.
|
williamr@2
|
169 |
EVibraFeedbackModeON, ///< Feedback vibration setting in the user profile is on.
|
williamr@2
|
170 |
EVibraFeedbackModeOFF ///< Feedback vibration setting in the user profile is off.
|
williamr@4
|
171 |
};
|
williamr@4
|
172 |
public:
|
williamr@2
|
173 |
/**
|
williamr@2
|
174 |
* Two-phased constructor.
|
williamr@2
|
175 |
*
|
williamr@2
|
176 |
* @return A pointer to a new instance of the CHWRMVibra class.
|
williamr@2
|
177 |
*
|
williamr@2
|
178 |
* @leave KErrNotSupported Device doesn't support vibration feature.
|
williamr@2
|
179 |
* @leave KErrNoMemory There is a memory allocation failure.
|
williamr@2
|
180 |
*/
|
williamr@2
|
181 |
IMPORT_C static CHWRMVibra* NewL();
|
williamr@2
|
182 |
|
williamr@2
|
183 |
/**
|
williamr@2
|
184 |
* Two-phased constructor.
|
williamr@2
|
185 |
* Leaves instance to cleanup stack.
|
williamr@2
|
186 |
*
|
williamr@2
|
187 |
* @return A pointer to a new instance of the CHWRMVibra class.
|
williamr@2
|
188 |
*
|
williamr@2
|
189 |
* @leave KErrNotSupported Device doesn't support vibration feature.
|
williamr@2
|
190 |
* @leave KErrNoMemory There is a memory allocation failure.
|
williamr@2
|
191 |
*/
|
williamr@2
|
192 |
IMPORT_C static CHWRMVibra* NewLC();
|
williamr@2
|
193 |
|
williamr@2
|
194 |
/**
|
williamr@2
|
195 |
* Two-phased constructor.
|
williamr@2
|
196 |
* Use this method for creating a vibra client with callbacks.
|
williamr@2
|
197 |
*
|
williamr@2
|
198 |
* @param aCallback Pointer to callback instance
|
williamr@2
|
199 |
* @return A pointer to a new instance of the CHWRMVibra class.
|
williamr@2
|
200 |
*
|
williamr@2
|
201 |
* @leave KErrNotSupported Device doesn't support vibration feature.
|
williamr@2
|
202 |
* @leave KErrNoMemory There is a memory allocation failure.
|
williamr@2
|
203 |
*/
|
williamr@2
|
204 |
IMPORT_C static CHWRMVibra* NewL(MHWRMVibraObserver* aCallback);
|
williamr@2
|
205 |
|
williamr@2
|
206 |
/**
|
williamr@2
|
207 |
* Two-phased constructor.
|
williamr@2
|
208 |
* Use this method for creating a vibra client with callbacks.
|
williamr@2
|
209 |
* Leaves instance to cleanup stack.
|
williamr@2
|
210 |
*
|
williamr@2
|
211 |
* @param aCallback Pointer to callback instance
|
williamr@2
|
212 |
* @return A pointer to a new instance of the CHWRMVibra class.
|
williamr@2
|
213 |
*
|
williamr@2
|
214 |
* @leave KErrNotSupported Device doesn't support vibration feature.
|
williamr@2
|
215 |
* @leave KErrNoMemory There is a memory allocation failure.
|
williamr@2
|
216 |
*/
|
williamr@2
|
217 |
IMPORT_C static CHWRMVibra* NewLC(MHWRMVibraObserver* aCallback);
|
williamr@2
|
218 |
|
williamr@2
|
219 |
public: // New functions
|
williamr@2
|
220 |
|
williamr@2
|
221 |
/**
|
williamr@2
|
222 |
* Reserves vibration feature exclusively for this client.
|
williamr@4
|
223 |
* A higher priority client may cause lower priority client reservation
|
williamr@4
|
224 |
* to be temporarily suspended. Commands can still be issued in suspended
|
williamr@4
|
225 |
* state, but they will not be acted upon unless suspension is lifted
|
williamr@4
|
226 |
* within specified duration.
|
williamr@4
|
227 |
* The suspended client will not get any notification about suspension.
|
williamr@2
|
228 |
* If vibra is already reserved by a higher or equal priority application,
|
williamr@2
|
229 |
* reserving will still succeed, but reservation is immediately suspended.
|
williamr@2
|
230 |
*
|
williamr@2
|
231 |
* Calling this method is equal to call ReserveVibraL(EFalse, EFalse),
|
williamr@2
|
232 |
* i.e. any previously frozen state will not be restored and CCoeEnv
|
williamr@2
|
233 |
* background/foreground status is always used to control further reservations.
|
williamr@2
|
234 |
*
|
williamr@2
|
235 |
* @leave KErrAccessDenied No CCoeEnv present.
|
williamr@2
|
236 |
* @leave KErrNotReady Trying to reserve while on background.
|
williamr@2
|
237 |
* @leave KErrNoMemory There is a memory allocation failure.
|
williamr@2
|
238 |
*/
|
williamr@2
|
239 |
virtual void ReserveVibraL()=0;
|
williamr@2
|
240 |
|
williamr@2
|
241 |
/**
|
williamr@2
|
242 |
* Reserves vibration feature exclusively for this client.
|
williamr@4
|
243 |
* A higher priority client may cause lower priority client reservation
|
williamr@4
|
244 |
* to be temporarily suspended. Commands can still be issued in suspended
|
williamr@4
|
245 |
* state, but they will not be acted upon unless suspension is lifted
|
williamr@4
|
246 |
* within specified duration.
|
williamr@4
|
247 |
* The suspended client will not get any notification about suspension.
|
williamr@2
|
248 |
* If vibra is already reserved by a higher or equal priority application,
|
williamr@2
|
249 |
* reserving will still succeed, but reservation is immediately suspended.
|
williamr@2
|
250 |
*
|
williamr@2
|
251 |
*
|
williamr@2
|
252 |
* @param aRestoreState If ETrue, the state frozen on last release will be
|
williamr@2
|
253 |
* restored upon successful reservation.
|
williamr@2
|
254 |
* I.e. if vibra was on when it was released by this
|
williamr@2
|
255 |
* client the last time, it would continue the vibrating
|
williamr@2
|
256 |
* upon successful reservation.
|
williamr@2
|
257 |
* For the first reservation of each session this
|
williamr@2
|
258 |
* parameter is always considered EFalse regardless of
|
williamr@2
|
259 |
* what is supplied, as there is no previous frozen state
|
williamr@2
|
260 |
* to restore.
|
williamr@2
|
261 |
* @param aForceNoCCoeEnv If EFalse, then reservation requires that this client
|
williamr@2
|
262 |
* has the keyboard focus at the time of reservation and
|
williamr@2
|
263 |
* vibra will be automatically released and re-reserved
|
williamr@2
|
264 |
* based on the keyboard focus status of this client.
|
williamr@2
|
265 |
* This also implies that CCoeEnv::Static() != NULL is
|
williamr@2
|
266 |
* required.
|
williamr@2
|
267 |
* If ETrue, the client will not require CCoeEnv to be
|
williamr@2
|
268 |
* present nor does it automatically reserve/release vibra
|
williamr@2
|
269 |
* by depending on foreground/background status of the
|
williamr@2
|
270 |
* client.
|
williamr@2
|
271 |
* Only trusted clients are allowed to set this flag to
|
williamr@2
|
272 |
* ETrue. A client is considered trusted if it has nonstandard
|
williamr@2
|
273 |
* priority defined in the internal vibra policy of the
|
williamr@2
|
274 |
* HW Resource Manager. A client can be defined trusted
|
williamr@4
|
275 |
* only by a product.
|
williamr@2
|
276 |
*
|
williamr@2
|
277 |
* @leave KErrAccessDenied Parameter aForceNoCCoeEnv is ETrue and client is not
|
williamr@2
|
278 |
* trusted.
|
williamr@2
|
279 |
* @leave KErrBadHandle Parameter aForceNoCCoeEnv 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 |
virtual void ReserveVibraL(TBool aRestoreState, TBool aForceNoCCoeEnv)=0;
|
williamr@2
|
285 |
|
williamr@2
|
286 |
/**
|
williamr@2
|
287 |
* Releases vibration feature if it was previously reserved for this client.
|
williamr@2
|
288 |
* If this client has not reserved vibration feature, does nothing.
|
williamr@2
|
289 |
* If vibra is on when it is released and no other client has a suspended
|
williamr@2
|
290 |
* reservation, vibra is stopped.
|
williamr@2
|
291 |
*/
|
williamr@2
|
292 |
virtual void ReleaseVibra()=0;
|
williamr@2
|
293 |
|
williamr@2
|
294 |
|
williamr@2
|
295 |
/**
|
williamr@2
|
296 |
* Starts the device vibration feature with the product specific default
|
williamr@2
|
297 |
* intensity.
|
williamr@2
|
298 |
* If StartVibraL is called again before the first vibration completes
|
williamr@2
|
299 |
* then the first vibration is interrupted and the second vibrations
|
williamr@2
|
300 |
* starts immediately -- i.e. The periods of vibration are not cumulative.
|
williamr@2
|
301 |
*
|
williamr@2
|
302 |
* The vibration can be interrupted with the method StopVibraL before
|
williamr@2
|
303 |
* the specified interval has elapsed.
|
williamr@2
|
304 |
*
|
williamr@2
|
305 |
* Vibra settings of the vibration feature in the user profile
|
williamr@2
|
306 |
* must be active.
|
williamr@2
|
307 |
*
|
williamr@2
|
308 |
* Note: The device may have implementation defined or hardware imposed
|
williamr@2
|
309 |
* limits to the duration of the vibration feature. In such
|
williamr@2
|
310 |
* circumstances any vibration will cut off at that limit even if
|
williamr@2
|
311 |
* the duration parameter is greater than the limit.
|
williamr@2
|
312 |
*
|
williamr@2
|
313 |
* @param aDuration Duration of the vibration measured in milliseconds.
|
williamr@4
|
314 |
* A value of 0 specifies that the vibration should
|
williamr@4
|
315 |
* continue indefinetely and should be stopped with a
|
williamr@4
|
316 |
* call to StopVibraL. Duration can have maximum value
|
williamr@4
|
317 |
* of KHWRMVibraMaxDuration.
|
williamr@2
|
318 |
*
|
williamr@2
|
319 |
* @leave KErrArgument Duration is invalid.
|
williamr@2
|
320 |
* @leave KErrAccessDenied Vibration setting in the user profile is not set.
|
williamr@2
|
321 |
* @leave KErrBadHandle Vibra session has been invalidated.
|
williamr@2
|
322 |
* @leave KErrLocked Vibra is locked down because too much continuous use
|
williamr@2
|
323 |
* or explicitly blocked by for example some vibration
|
williamr@2
|
324 |
* sensitive accessory.
|
williamr@2
|
325 |
* @leave KErrTimedOut Timeout occurred in controlling vibra.
|
williamr@2
|
326 |
* @leave KErrInUse Vibra is not reserved to this client but it is
|
williamr@2
|
327 |
* reserved to some other client.
|
williamr@2
|
328 |
* @leave KErrNoMemory There is a memory allocation failure.
|
williamr@2
|
329 |
* @leave KErrGeneral There is a hardware error.
|
williamr@2
|
330 |
*
|
williamr@2
|
331 |
* @see MHWRMVibraObserver
|
williamr@2
|
332 |
*/
|
williamr@2
|
333 |
virtual void StartVibraL(TInt aDuration)=0;
|
williamr@2
|
334 |
|
williamr@2
|
335 |
/**
|
williamr@2
|
336 |
* Starts the device vibration feature. If StartVibraL is called again before
|
williamr@2
|
337 |
* the first vibration completes then the first vibration is interrupted
|
williamr@2
|
338 |
* and the second vibrations starts immediately -- i.e. The periods of
|
williamr@2
|
339 |
* vibration are not cumulative.
|
williamr@2
|
340 |
*
|
williamr@2
|
341 |
* The vibration can be interrupted with the method StopVibraL before
|
williamr@2
|
342 |
* the specified interval has elapsed.
|
williamr@2
|
343 |
*
|
williamr@2
|
344 |
* Vibra settings of the vibration feature in the user profile
|
williamr@2
|
345 |
* must be active.
|
williamr@2
|
346 |
*
|
williamr@2
|
347 |
* Note: The device may have implementation defined or hardware imposed
|
williamr@2
|
348 |
* limits to the duration of the vibration feature. In such
|
williamr@2
|
349 |
* circumstances any vibration will cut off at that limit even if
|
williamr@2
|
350 |
* the duration parameter is greater than the limit.
|
williamr@2
|
351 |
*
|
williamr@2
|
352 |
* @param aDuration Duration of the vibration measured in milliseconds.
|
williamr@4
|
353 |
* A value of 0 specifies that the vibration should
|
williamr@4
|
354 |
* continue indefinitly and should be stopped with a
|
williamr@4
|
355 |
* call to StopVibraL. Duration can have maximum value
|
williamr@4
|
356 |
* of KHWRMVibraMaxDuration.
|
williamr@4
|
357 |
* @param aIntensity Intensity of the vibra in decimal is -100 to 100,
|
williamr@2
|
358 |
* which shows the percentage of the vibra motor full
|
williamr@2
|
359 |
* rotation speed. When intensity is negative,
|
williamr@2
|
360 |
* the vibra motor rotates in the negative direction.
|
williamr@2
|
361 |
* When intensity is positive, the vibra motor rotates
|
williamr@2
|
362 |
* in the positive direction. Value 0 stops the vibra.
|
williamr@2
|
363 |
* NOTE: The device might have hardware-imposed limits
|
williamr@2
|
364 |
* on supported vibra intensity values, so actual
|
williamr@2
|
365 |
* effect might vary between different hardware.
|
williamr@2
|
366 |
*
|
williamr@2
|
367 |
* @leave KErrNotSupported The device doesn't support user-defined
|
williamr@2
|
368 |
* vibra intensity.
|
williamr@2
|
369 |
* @leave KErrArgument One of the parameters is out of range.
|
williamr@2
|
370 |
* @leave KErrAccessDenied Vibration setting in the user profile
|
williamr@2
|
371 |
* is not set.
|
williamr@2
|
372 |
* @leave KErrBadHandle Vibra session has been invalidated.
|
williamr@2
|
373 |
* @leave KErrLocked Vibra is locked down because too much continuous use
|
williamr@2
|
374 |
* or explicitly blocked by for example some vibration
|
williamr@2
|
375 |
* sensitive accessory.
|
williamr@2
|
376 |
* @leave KErrTimedOut Timeout occurred in controlling vibra.
|
williamr@2
|
377 |
* @leave KErrInUse Vibra is not reserved to this client but it is
|
williamr@2
|
378 |
* reserved to some other client.
|
williamr@2
|
379 |
* @leave KErrNoMemory There is a memory allocation failure.
|
williamr@2
|
380 |
* @leave KErrGeneral There is a hardware error.
|
williamr@2
|
381 |
*
|
williamr@2
|
382 |
* @see MHWRMVibraObserver
|
williamr@2
|
383 |
*/
|
williamr@2
|
384 |
virtual void StartVibraL(TInt aDuration, TInt aIntensity)=0;
|
williamr@2
|
385 |
|
williamr@2
|
386 |
/**
|
williamr@2
|
387 |
* Interrupts the device vibration that is started with the StartVibraL
|
williamr@2
|
388 |
* method immediately.
|
williamr@2
|
389 |
*
|
williamr@2
|
390 |
* @leave KErrBadHandle Vibra session has been invalidated.
|
williamr@2
|
391 |
* @leave KErrTimedOut Timeout occurred in controlling vibra.
|
williamr@2
|
392 |
* @leave KErrInUse Vibra is not reserved to this client but it is
|
williamr@2
|
393 |
* reserved to some other client.
|
williamr@2
|
394 |
* @leave KErrNoMemory There is a memory allocation failure.
|
williamr@2
|
395 |
* @leave KErrGeneral There is a hardware error.
|
williamr@2
|
396 |
*
|
williamr@2
|
397 |
* @see MHWRMVibraObserver
|
williamr@2
|
398 |
*/
|
williamr@2
|
399 |
virtual void StopVibraL()=0;
|
williamr@2
|
400 |
|
williamr@2
|
401 |
/**
|
williamr@2
|
402 |
* This method retrieves the current settings of the vibration feature
|
williamr@2
|
403 |
* in the user profile. The developer can check the Vibra settings
|
williamr@2
|
404 |
* in the profile and if there is no Vibra active but it is needed by
|
williamr@2
|
405 |
* the client application then the user can be informed.
|
williamr@2
|
406 |
*
|
williamr@2
|
407 |
* @return TVibraModeState indicating the current vibra mode setting.
|
williamr@2
|
408 |
*
|
williamr@2
|
409 |
* @see TVibraModeState
|
williamr@2
|
410 |
* @see MHWRMVibraObserver
|
williamr@2
|
411 |
*/
|
williamr@2
|
412 |
virtual TVibraModeState VibraSettings() const=0;
|
williamr@2
|
413 |
|
williamr@2
|
414 |
/**
|
williamr@2
|
415 |
* This method retrieves the current vibra status.
|
williamr@2
|
416 |
*
|
williamr@2
|
417 |
* @return TVibraStatus indicating the current vibra status
|
williamr@2
|
418 |
*
|
williamr@2
|
419 |
* @see TVibraStatus
|
williamr@2
|
420 |
* @see MHWRMVibraObserver
|
williamr@2
|
421 |
*/
|
williamr@2
|
422 |
virtual TVibraStatus VibraStatus() const=0;
|
williamr@2
|
423 |
|
williamr@2
|
424 |
/**
|
williamr@2
|
425 |
* This method is intended only for firmware build time configured
|
williamr@2
|
426 |
* privileged clients.
|
williamr@2
|
427 |
*
|
williamr@2
|
428 |
* Executes a tactile feedback vibration pulse with product
|
williamr@2
|
429 |
* specific default intensity and duration.
|
williamr@2
|
430 |
* If PulseVibraL is called before ongoing vibration completes and
|
williamr@2
|
431 |
* PulseVibraL calling client has higher priority than executing client,
|
williamr@2
|
432 |
* pulse request is accepted. Also possible vibra-reservations are bypassed.
|
williamr@2
|
433 |
* If client calling PulseVibraL has lower or equal priority
|
williamr@2
|
434 |
* than executing client, ongoing vibration is not affected.
|
williamr@2
|
435 |
*
|
williamr@2
|
436 |
* Tactile feedback vibration settings of the vibration feature in the
|
williamr@2
|
437 |
* user profile must be active.
|
williamr@2
|
438 |
*
|
williamr@2
|
439 |
* Note: The device may have implementation defined or hardware imposed
|
williamr@2
|
440 |
* limits to the duration of the vibration feature. In such
|
williamr@2
|
441 |
* circumstances any vibration will cut off at that limit even if
|
williamr@2
|
442 |
* the duration parameter is greater than the limit.
|
williamr@2
|
443 |
*
|
williamr@2
|
444 |
* @param aDuration Duration of the vibration measured in milliseconds.
|
williamr@2
|
445 |
* Duration can have maximum value
|
williamr@2
|
446 |
* of KHWRMVibraMaxDuration.
|
williamr@2
|
447 |
*
|
williamr@2
|
448 |
* @leave KErrAccessDenied Vibration setting in the user profile is not set
|
williamr@2
|
449 |
* or client is not privileged to use pulse feature.
|
williamr@2
|
450 |
* @leave KErrBadHandle Vibra session has been invalidated.
|
williamr@2
|
451 |
* @leave KErrLocked Vibra is locked down because too much continuous use
|
williamr@2
|
452 |
* or explicitly blocked by for example some vibration
|
williamr@2
|
453 |
* sensitive accessory.
|
williamr@2
|
454 |
* @leave KErrTimedOut Timeout occurred in controlling vibra.
|
williamr@2
|
455 |
* @leave KErrInUse Vibra is not reserved to this client but it is
|
williamr@2
|
456 |
* reserved to some other client or ongoing vibration
|
williamr@2
|
457 |
* has been requested by higher priority client.
|
williamr@2
|
458 |
* @leave KErrNoMemory There is a memory allocation failure.
|
williamr@2
|
459 |
* @leave KErrGeneral There is a hardware error.
|
williamr@2
|
460 |
*
|
williamr@2
|
461 |
* @see MHWRMVibraFeedbackObserver
|
williamr@2
|
462 |
*/
|
williamr@2
|
463 |
virtual void PulseVibraL()=0;
|
williamr@2
|
464 |
|
williamr@2
|
465 |
/**
|
williamr@2
|
466 |
* This method is intended only for firmware build time configured
|
williamr@2
|
467 |
* privileged clients.
|
williamr@2
|
468 |
*
|
williamr@2
|
469 |
* Executes a tactile feedback vibration pulse with product
|
williamr@2
|
470 |
* specific default intensity and specified duration.
|
williamr@2
|
471 |
* If PulseVibraL is called before ongoing vibration completes and
|
williamr@2
|
472 |
* PulseVibraL calling client has higher priority than executing client,
|
williamr@2
|
473 |
* pulse request is accepted. Also possible vibra-reservations are bypassed.
|
williamr@2
|
474 |
* If client calling PulseVibraL has lower or equal priority
|
williamr@2
|
475 |
* than executing client, ongoing vibration is not affected.
|
williamr@2
|
476 |
*
|
williamr@2
|
477 |
* Tactile feedback vibration settings of the vibration feature in the
|
williamr@2
|
478 |
* user profile must be active.
|
williamr@2
|
479 |
*
|
williamr@2
|
480 |
* Note: The device may have implementation defined or hardware imposed
|
williamr@2
|
481 |
* limits to the duration of the vibration feature. In such
|
williamr@2
|
482 |
* circumstances any vibration will cut off at that limit even if
|
williamr@2
|
483 |
* the duration parameter is greater than the limit.
|
williamr@2
|
484 |
*
|
williamr@2
|
485 |
* @param aDuration Duration of the vibration measured in milliseconds.
|
williamr@2
|
486 |
* Duration can have maximum value
|
williamr@2
|
487 |
* of KHWRMVibraMaxDuration.
|
williamr@2
|
488 |
*
|
williamr@2
|
489 |
* @leave KErrArgument One of the parameters is out of range.
|
williamr@2
|
490 |
* @leave KErrAccessDenied Vibration setting in the user profile is not set
|
williamr@2
|
491 |
* or client is not privileged to use pulse feature.
|
williamr@2
|
492 |
* @leave KErrBadHandle Vibra session has been invalidated.
|
williamr@2
|
493 |
* @leave KErrLocked Vibra is locked down because too much continuous use
|
williamr@2
|
494 |
* or explicitly blocked by for example some vibration
|
williamr@2
|
495 |
* sensitive accessory.
|
williamr@2
|
496 |
* @leave KErrTimedOut Timeout occurred in controlling vibra.
|
williamr@2
|
497 |
* @leave KErrInUse Vibra is not reserved to this client but it is
|
williamr@2
|
498 |
* reserved to some other client or ongoing vibration
|
williamr@2
|
499 |
* has been requested by higher priority client.
|
williamr@2
|
500 |
* @leave KErrNoMemory There is a memory allocation failure.
|
williamr@2
|
501 |
* @leave KErrGeneral There is a hardware error.
|
williamr@2
|
502 |
*
|
williamr@2
|
503 |
* @see MHWRMVibraFeedbackObserver
|
williamr@2
|
504 |
*/
|
williamr@2
|
505 |
virtual void PulseVibraL(TInt aDuration)=0;
|
williamr@2
|
506 |
|
williamr@2
|
507 |
/**
|
williamr@2
|
508 |
* This method is intended only for firmware build time configured
|
williamr@2
|
509 |
* privileged clients.
|
williamr@2
|
510 |
*
|
williamr@2
|
511 |
* Executes a tactile feedback vibration pulse.
|
williamr@2
|
512 |
* If PulseVibraL is called before ongoing vibration completes and
|
williamr@2
|
513 |
* PulseVibraL calling client has higher priority than executing client,
|
williamr@2
|
514 |
* pulse request is accepted. Also possible vibra-reservations are bypassed.
|
williamr@2
|
515 |
* If client calling PulseVibraL has lower or equal priority
|
williamr@2
|
516 |
* than executing client, ongoing vibration is not affected.
|
williamr@2
|
517 |
*
|
williamr@2
|
518 |
* Tactile feedback vibration settings of the vibration feature in the
|
williamr@2
|
519 |
* user profile must be active.
|
williamr@2
|
520 |
*
|
williamr@2
|
521 |
* Note: The device may have implementation defined or hardware imposed
|
williamr@2
|
522 |
* limits to the duration of the vibration feature. In such
|
williamr@2
|
523 |
* circumstances any vibration will cut off at that limit even if
|
williamr@2
|
524 |
* the duration parameter is greater than the limit.
|
williamr@2
|
525 |
*
|
williamr@2
|
526 |
* @param aDuration Duration of the vibration measured in milliseconds.
|
williamr@2
|
527 |
* Duration can have maximum value
|
williamr@2
|
528 |
* of KHWRMVibraMaxDuration.
|
williamr@2
|
529 |
* @param aIntensity Intensity of the pulse in decimal is KHWRMVibraMinPulseIntensity
|
williamr@2
|
530 |
* to KHWRMVibraMaxIntensity, which shows the percentage
|
williamr@2
|
531 |
* of the vibra motor full rotation speed.
|
williamr@2
|
532 |
* NOTE: The device might have hardware-imposed limits
|
williamr@2
|
533 |
* on supported vibra intensity values, so actual
|
williamr@2
|
534 |
* effect might vary between different hardware.
|
williamr@2
|
535 |
* @leave KErrNotSupported The device doesn't support user-defined
|
williamr@2
|
536 |
* vibra intensity.
|
williamr@4
|
537 |
*
|
williamr@2
|
538 |
* @leave KErrArgument One of the parameters is out of range.
|
williamr@2
|
539 |
* @leave KErrAccessDenied Vibration setting in the user profile is not set
|
williamr@2
|
540 |
* or client is not privileged to use pulse feature.
|
williamr@2
|
541 |
* @leave KErrBadHandle Vibra session has been invalidated.
|
williamr@2
|
542 |
* @leave KErrLocked Vibra is locked down because too much continuous use
|
williamr@2
|
543 |
* or explicitly blocked by for example some vibration
|
williamr@2
|
544 |
* sensitive accessory.
|
williamr@2
|
545 |
* @leave KErrTimedOut Timeout occurred in controlling vibra.
|
williamr@2
|
546 |
* @leave KErrInUse Vibra is not reserved to this client but it is
|
williamr@2
|
547 |
* reserved to some other client or ongoing vibration
|
williamr@2
|
548 |
* has been requested by higher priority client.
|
williamr@2
|
549 |
* @leave KErrNoMemory There is a memory allocation failure.
|
williamr@2
|
550 |
* @leave KErrGeneral There is a hardware error.
|
williamr@2
|
551 |
*
|
williamr@2
|
552 |
* @see MHWRMVibraFeedbackObserver
|
williamr@2
|
553 |
*/
|
williamr@2
|
554 |
virtual void PulseVibraL(TInt aDuration, TInt aIntensity)=0;
|
williamr@2
|
555 |
|
williamr@2
|
556 |
/**
|
williamr@2
|
557 |
* Use this method for setting feedback observer.
|
williamr@2
|
558 |
*
|
williamr@2
|
559 |
* @param aCallback Pointer to callback instance
|
williamr@2
|
560 |
*/
|
williamr@2
|
561 |
virtual void SetFeedbackObserver(MHWRMVibraFeedbackObserver* aCallback)=0;
|
williamr@2
|
562 |
|
williamr@2
|
563 |
/**
|
williamr@2
|
564 |
* This method retrieves the current settings of the feedback vibration feature
|
williamr@2
|
565 |
* in the user profile. The developer can check the feedback vibration settings
|
williamr@2
|
566 |
* in the profile and if there is no feedback vibration active but it is needed by
|
williamr@2
|
567 |
* the client application then the user can be informed. However, client needs to
|
williamr@2
|
568 |
* explicitly register to listen these changes via SetFeedbackObserver-method.
|
williamr@2
|
569 |
*
|
williamr@2
|
570 |
* @return TVibraFeedbackModeState indicating the current vibra feedback mode setting.
|
williamr@2
|
571 |
*
|
williamr@2
|
572 |
* @see TVibraFeedbackModeState
|
williamr@2
|
573 |
* @see MHWRMVibraFeedbackObserver
|
williamr@2
|
574 |
*/
|
williamr@2
|
575 |
virtual TVibraFeedbackModeState VibraFeedbackSettings() const=0;
|
williamr@2
|
576 |
};
|
williamr@2
|
577 |
|
williamr@2
|
578 |
/**
|
williamr@2
|
579 |
* A callback interface for vibra status reporting.
|
williamr@2
|
580 |
*
|
williamr@2
|
581 |
* If the client requires up-to-date status information, the client needs
|
williamr@2
|
582 |
* to derive a class from the MHWRMVibraObserver interface and implement
|
williamr@2
|
583 |
* the VibraModeChanged() and VibraStatusChanged() methods.
|
williamr@2
|
584 |
*
|
williamr@2
|
585 |
* A callback object header example:
|
williamr@2
|
586 |
*
|
williamr@2
|
587 |
* @code
|
williamr@2
|
588 |
* // INCLUDES
|
williamr@4
|
589 |
* #include <hwrmvibra.h> // Link against HWRMVibraClient.lib.
|
williamr@2
|
590 |
*
|
williamr@2
|
591 |
* class CTest : public CBase,
|
williamr@2
|
592 |
* public MHWRMVibraObserver
|
williamr@2
|
593 |
* {
|
williamr@2
|
594 |
* public:
|
williamr@2
|
595 |
* CTest();
|
williamr@2
|
596 |
* ~CTest();
|
williamr@2
|
597 |
*
|
williamr@2
|
598 |
* void ConstructL();
|
williamr@2
|
599 |
* static CTest* NewL();
|
williamr@2
|
600 |
*
|
williamr@2
|
601 |
* // from MHWRMVibraObserver
|
williamr@2
|
602 |
* virtual void VibraModeChanged(CHWRMVibra::TVibraModeState aStatus);
|
williamr@2
|
603 |
* virtual void VibraStatusChanged(CHWRMVibra::TVibraStatus aStatus);
|
williamr@2
|
604 |
*
|
williamr@2
|
605 |
* private:
|
williamr@2
|
606 |
* CHWRMVibra* iVibra;
|
williamr@2
|
607 |
* };
|
williamr@2
|
608 |
* @endcode
|
williamr@2
|
609 |
*
|
williamr@2
|
610 |
* A callback method implementation example:
|
williamr@2
|
611 |
*
|
williamr@2
|
612 |
* @code
|
williamr@2
|
613 |
* void CTest::VibraStatusChanged(CHWRMVibra::TVibraStatus aStatus)
|
williamr@2
|
614 |
* {
|
williamr@2
|
615 |
* switch ( aStatus )
|
williamr@2
|
616 |
* {
|
williamr@2
|
617 |
* case CHWRMVibra::EVibraStatusUnknown:
|
williamr@2
|
618 |
* RDebug::Print(_L("### Vibra state changed: EVibraStatusUnknown"));
|
williamr@2
|
619 |
* break;
|
williamr@2
|
620 |
* case CHWRMVibra::EVibraStatusNotAllowed:
|
williamr@2
|
621 |
* RDebug::Print(_L("### Vibra state changed: EVibraStatusNotAllowed"));
|
williamr@2
|
622 |
* break;
|
williamr@2
|
623 |
* case CHWRMVibra::EVibraStatusStopped:
|
williamr@2
|
624 |
* RDebug::Print(_L("### Vibra state changed: EVibraStatusStopped"));
|
williamr@2
|
625 |
* break;
|
williamr@2
|
626 |
* case CHWRMVibra::EVibraStatusOn:
|
williamr@2
|
627 |
* RDebug::Print(_L("### Vibra state changed: EVibraStatusOn"));
|
williamr@2
|
628 |
* break;
|
williamr@2
|
629 |
* default:
|
williamr@2
|
630 |
* RDebug::Print(_L("### Vibra state changed: UNDEFINED !"));
|
williamr@2
|
631 |
* break;
|
williamr@2
|
632 |
* }
|
williamr@2
|
633 |
* }
|
williamr@2
|
634 |
* @endcode
|
williamr@2
|
635 |
*
|
williamr@4
|
636 |
* @publishedAll
|
williamr@4
|
637 |
* @released
|
williamr@2
|
638 |
*/
|
williamr@2
|
639 |
class MHWRMVibraObserver
|
williamr@2
|
640 |
{
|
williamr@2
|
641 |
public:
|
williamr@2
|
642 |
|
williamr@2
|
643 |
/**
|
williamr@2
|
644 |
* Called when the vibration setting in the user profile is changed.
|
williamr@2
|
645 |
*
|
williamr@2
|
646 |
* @param aStatus Indicates the new setting.
|
williamr@2
|
647 |
*
|
williamr@2
|
648 |
* @see CHWRMVibra::TVibraModeState
|
williamr@2
|
649 |
*/
|
williamr@2
|
650 |
virtual void VibraModeChanged(CHWRMVibra::TVibraModeState aStatus) = 0;
|
williamr@2
|
651 |
|
williamr@2
|
652 |
/**
|
williamr@2
|
653 |
* Called when the device vibration feature state changes
|
williamr@2
|
654 |
*
|
williamr@2
|
655 |
* @param aStatus Indicates vibra status.
|
williamr@2
|
656 |
*
|
williamr@2
|
657 |
* @see CHWRMVibra::TVibraStatus
|
williamr@2
|
658 |
*/
|
williamr@2
|
659 |
virtual void VibraStatusChanged(CHWRMVibra::TVibraStatus aStatus) = 0;
|
williamr@2
|
660 |
};
|
williamr@2
|
661 |
|
williamr@2
|
662 |
/**
|
williamr@2
|
663 |
*
|
williamr@4
|
664 |
* @publishedAll
|
williamr@4
|
665 |
* @released
|
williamr@2
|
666 |
*/
|
williamr@2
|
667 |
class MHWRMVibraFeedbackObserver
|
williamr@2
|
668 |
{
|
williamr@2
|
669 |
public:
|
williamr@2
|
670 |
|
williamr@2
|
671 |
/**
|
williamr@2
|
672 |
* Called when the tactile feedback vibration setting in the user profile is changed.
|
williamr@2
|
673 |
*
|
williamr@2
|
674 |
* @param aMode Indicates the new setting.
|
williamr@2
|
675 |
*
|
williamr@2
|
676 |
* @see CHWRMVibra::TVibraFeedbackModeState
|
williamr@2
|
677 |
*/
|
williamr@2
|
678 |
virtual void VibraFeedbackModeChanged(CHWRMVibra::TVibraFeedbackModeState aMode) = 0;
|
williamr@2
|
679 |
};
|
williamr@2
|
680 |
|
williamr@2
|
681 |
|
williamr@2
|
682 |
#endif // HWRMVIBRA_H
|
williamr@2
|
683 |
|
williamr@2
|
684 |
// End of File
|