|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
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". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Tactile feedback player plugin interface. |
|
15 * Part of: Tactile Feedback. |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef C_TACTILEPLAYER_H |
|
20 #define C_TACTILEPLAYER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <ecom/ecom.h> |
|
24 |
|
25 #include <touchlogicalfeedback.h> |
|
26 |
|
27 class CRepository; |
|
28 |
|
29 |
|
30 /** |
|
31 * Types of tactile players. This enumeration is used for listing the |
|
32 * implementations of players of certain type. |
|
33 * @since S60 5.2 |
|
34 */ |
|
35 enum TTactilePlayerType |
|
36 { |
|
37 ETactilePlayerAny, |
|
38 ETactilePlayerHaptics, |
|
39 ETactilePlayerAudio |
|
40 }; |
|
41 |
|
42 /** |
|
43 * Tactile feedback player ECom plugin interface. |
|
44 * |
|
45 * There are two basic types of tactile players, haptics and audio |
|
46 * players. Each player must follow the player type specific settings |
|
47 * from Central Repository to play feedback in the specified level. If |
|
48 * playing level for haptics or audio is set to zero, players of that type |
|
49 * must not produce any feedback. |
|
50 * |
|
51 * UID for tactile feedback settings is: |
|
52 * KCRUidTactileFeedback = 0x2000B494; |
|
53 * |
|
54 * Players are instantiated based on plugins' implementation UIDs, which |
|
55 * are read from Central Repository by feedback resolver. Player types |
|
56 * are differentiated by using word "Haptics" or "Audio" in default_data |
|
57 * field in plugin's implementation info resource file. |
|
58 * |
|
59 * Preview functions for playing immediate and starting continuous feedback |
|
60 * are ment to use for example in settings view to get feedback played with |
|
61 * different level without actually changing the level in settings. It is |
|
62 * feedback resolver's responsibility not to play regular feedbacks when |
|
63 * preview functions are used. |
|
64 * |
|
65 * @lib tactilefeedbackresolver.lib |
|
66 * @since S60 5.2 |
|
67 */ |
|
68 class CTactilePlayer : public CBase |
|
69 { |
|
70 public: |
|
71 /** |
|
72 * Instantiates an object of this type. |
|
73 * |
|
74 * @since S60 5.2 |
|
75 * @param aImplementationUid - Implementation uid of the plugin |
|
76 * to be created. |
|
77 * @param aRepository - Reference to Central Repository, which is |
|
78 * used for reading Tactile Feedback |
|
79 * settings. CR Keys for Tactile Feedback are |
|
80 * defined in tactilefeedbackdomaincrkeys.h |
|
81 * |
|
82 * @return Instance of feedback player plugin. |
|
83 */ |
|
84 static CTactilePlayer* NewL( TUid aImplementationUid, |
|
85 CRepository& aRepository ); |
|
86 |
|
87 /** |
|
88 * Destructor. |
|
89 */ |
|
90 IMPORT_C virtual ~CTactilePlayer(); |
|
91 |
|
92 /** |
|
93 * Returns a list of available implementations for this |
|
94 * interface. |
|
95 * |
|
96 * @since S60 5.2 |
|
97 * @param aType - Type of players to be listed. |
|
98 * @param aImplInfoArray - Implementation information array of all |
|
99 * available implementations. |
|
100 */ |
|
101 static void ListImplementationsL( TTactilePlayerType aType, |
|
102 RImplInfoPtrArray& aImplInfoArray ); |
|
103 |
|
104 public: |
|
105 /** |
|
106 * Produces immediate physical feedback according to given |
|
107 * logical feedback type. |
|
108 * |
|
109 * Haptics and audio players have onw level value, which is |
|
110 * specified in Tactile Feedback settings in Central Repository. |
|
111 * That value defines the strength of feedback produced by this function. |
|
112 * When settings are changed, plugin implementation must change the |
|
113 * playing level according to that value. If feedback level for this |
|
114 * type of player in settings is set to zero, this function must not |
|
115 * produce any feedback. |
|
116 * |
|
117 * @since S60 5.2 |
|
118 * @param aFeedback - The logical feedback type, which is used to |
|
119 * select the physical response to feedback method. |
|
120 * @return TInt KErrNone if successful, otherwise one of the other |
|
121 * system-wide error codes. |
|
122 */ |
|
123 virtual TInt PlayFeedback( TTouchLogicalFeedback aFeedback ) = 0; |
|
124 |
|
125 /** |
|
126 * Starts continuous feedback according to given logical |
|
127 * continuous feedback type. Continuous feedback is started with given |
|
128 * intensity, which is a percentage value of maximum strength on current |
|
129 * level. Ongoing continuous feedback can be modified using |
|
130 * ModifyFeedback() to change intensity of feedback. |
|
131 * |
|
132 * Continuous feedback is stopped using StopFeedback(). |
|
133 * |
|
134 * @since S60 5.2 |
|
135 * @param aFeedback - The logical feedback type of continuous feedback, |
|
136 * which is used to select the physical response to |
|
137 * continuous feedback method. |
|
138 * @param aIntensity - The percentage value of continuous feedback's |
|
139 * maximum strength. |
|
140 * @return TInt KErrNone if successful, otherwise one of the other |
|
141 * system-wide error codes. |
|
142 * @return TInt KErrNotSupported if player doesn't support continuous |
|
143 * feedback. |
|
144 */ |
|
145 IMPORT_C virtual TInt StartFeedback( TTouchContinuousFeedback aFeedback, |
|
146 TInt aIntensity ); |
|
147 |
|
148 /** |
|
149 * Modifies the intensity of continuous feedback. |
|
150 * |
|
151 * @since S60 5.2 |
|
152 * @param aIntensity - The percentage value of continuous feedback's |
|
153 * intensity. |
|
154 * @return TInt KErrNone if successful, otherwise one of the other |
|
155 * system-wide error codes. |
|
156 * @return TInt KErrNotSupported if player doesn't support continuous |
|
157 * feedback. |
|
158 */ |
|
159 IMPORT_C virtual TInt ModifyFeedback( TInt aIntensity ); |
|
160 |
|
161 /** |
|
162 * Stops continuous feedback. |
|
163 * |
|
164 * @since S60 5.2 |
|
165 */ |
|
166 IMPORT_C virtual void StopFeedback(); |
|
167 |
|
168 /** |
|
169 * Plugin's maximum feedback level, which defines the strength |
|
170 * of played feedback. The amount of feedback levels is dependent on |
|
171 * a plugin. |
|
172 * |
|
173 * Level values are used for playing preview of feedback. |
|
174 * |
|
175 * @since S60 5.2 |
|
176 * @return TInt KErrNone if successful, otherwise one of the other |
|
177 * system-wide error codes. |
|
178 */ |
|
179 IMPORT_C virtual TInt MaxLevel(); |
|
180 |
|
181 /** |
|
182 * Produces preview of feedback according to given locigal feedback |
|
183 * type and given level value of feedback strength. |
|
184 * |
|
185 * @since S60 5.2 |
|
186 * @param aLevel - A value, which defines the strength of preview |
|
187 * feedback. Preview level can be any positive |
|
188 * value up to value of MaxLevel(). |
|
189 * @param aFeedback - The logical feedback type, which is used to |
|
190 * select the physical response to feedback method. |
|
191 * @return TInt KErrNone if successful, otherwise one of the other |
|
192 * system-wide error codes. |
|
193 * @return TInt KErrNotSupported if player doesn't support feedback |
|
194 * preview. |
|
195 */ |
|
196 IMPORT_C virtual TInt PlayPreviewFeedback( TInt aLevel, |
|
197 TTouchLogicalFeedback aFeedback ); |
|
198 |
|
199 /** |
|
200 * Starts preview of continuous feedback according to given logical |
|
201 * continuous feedback type and given level value of feedback strength. |
|
202 * Preview of continuous feedback is started with given intensity, |
|
203 * which is a percentage value of maximum strength in given level. |
|
204 * Ongoing continuous feedback can be modified using ModifyFeedback() |
|
205 * to change intensity of feedback. |
|
206 * |
|
207 * Preview of continuous feedback is stopped using StopFeedback(). |
|
208 * |
|
209 * @since S60 5.2 |
|
210 * @param aLevel - A value, which defines the strength of preview |
|
211 * feedback. Preview level can be any positive |
|
212 * value between zero and MaxLevel(). |
|
213 * @param aFeedback - The logical feedback type of continuous feedback, |
|
214 * which is used to select the physical response to |
|
215 * continuous feedback method. |
|
216 * @param aIntensity - The percentage value of continuous feedback's |
|
217 * maximum strength. |
|
218 * @return TInt KErrNone if successful, otherwise one of the other |
|
219 * system-wide error codes. |
|
220 * @return TInt KErrNotSupported if player doesn't support preview |
|
221 * for continuous feedback. |
|
222 */ |
|
223 IMPORT_C virtual TInt StartPreviewFeedback( TInt aLevel, |
|
224 TTouchContinuousFeedback aFeedback, |
|
225 TInt aIntensity ); |
|
226 |
|
227 /** |
|
228 * Stops preview of continuous feedback. Player must set the original |
|
229 * level value back in this function. |
|
230 * |
|
231 * @since S60 5.2 |
|
232 */ |
|
233 IMPORT_C virtual void StopPreviewFeedback(); |
|
234 |
|
235 private: |
|
236 |
|
237 // Unique instance identifier key. |
|
238 TUid iDtor_ID_Key; |
|
239 |
|
240 }; |
|
241 |
|
242 #endif // C_TACTILEPLAYER_H |