|
1 /* |
|
2 * Copyright (c) 2010 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 the License "Symbian Foundation License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef HAPTICSCLIENTTESTMAIN_H |
|
21 #define HAPTICSCLIENTTESTMAIN_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <StifLogger.h> |
|
25 #include <TestScripterInternal.h> |
|
26 #include <StifTestModule.h> |
|
27 #include <hwrmhaptics.h> |
|
28 |
|
29 // CONSTANTS |
|
30 //const ?type ?constant_var = ?constant; |
|
31 |
|
32 // MACROS |
|
33 //#define ?macro ?macro_def |
|
34 // Logging path |
|
35 _LIT( KHapticsClientTestLogPath, "\\logs\\HapticsClientTest\\" ); |
|
36 // Log file |
|
37 _LIT( KHapticsClientTestLogFile, "HapticsClientTest.txt" ); |
|
38 |
|
39 // FUNCTION PROTOTYPES |
|
40 //?type ?function_name(?arg_list); |
|
41 |
|
42 // FORWARD DECLARATIONS |
|
43 //class ?FORWARD_CLASSNAME; |
|
44 class MT_HapticsTestAsyncPlaySender; |
|
45 |
|
46 // DATA TYPES |
|
47 //enum ?declaration |
|
48 //typedef ?declaration |
|
49 //extern ?data_type; |
|
50 |
|
51 // CLASS DECLARATION |
|
52 |
|
53 /** |
|
54 * HpaticsClient test class for STIF Test Framework TestScripter. |
|
55 * ?other_description_lines |
|
56 * |
|
57 * @lib ?library |
|
58 * @since ?Series60_version |
|
59 */ |
|
60 NONSHARABLE_CLASS(CHapticsClientTest) : public CScriptBase |
|
61 { |
|
62 public: // Constructors and destructor |
|
63 |
|
64 /** |
|
65 * Two-phased constructor. |
|
66 */ |
|
67 static CHapticsClientTest* NewL( CTestModuleIf& aTestModuleIf ); |
|
68 |
|
69 /** |
|
70 * Destructor. |
|
71 */ |
|
72 virtual ~CHapticsClientTest(); |
|
73 |
|
74 public: // New functions |
|
75 |
|
76 /** |
|
77 * ?member_description. |
|
78 * @since ?Series60_version |
|
79 * @param ?arg1 ?description |
|
80 * @return ?description |
|
81 */ |
|
82 //?type ?member_function( ?type ?arg1 ); |
|
83 |
|
84 public: // Functions from base classes |
|
85 |
|
86 /** |
|
87 * From CScriptBase Runs a script line. |
|
88 * @since ?Series60_version |
|
89 * @param aItem Script line containing method name and parameters |
|
90 * @return Symbian OS error code |
|
91 */ |
|
92 virtual TInt RunMethodL( CStifItemParser& aItem ); |
|
93 |
|
94 /** |
|
95 * Method, which is called by the status callback, when a status |
|
96 * has been received. Stops the wait loop waiting for a new status. |
|
97 */ |
|
98 void HapticsStatusReceived(); |
|
99 |
|
100 private: |
|
101 |
|
102 /** |
|
103 * C++ default constructor. |
|
104 */ |
|
105 CHapticsClientTest( CTestModuleIf& aTestModuleIf ); |
|
106 |
|
107 /** |
|
108 * By default Symbian 2nd phase constructor is private. |
|
109 */ |
|
110 void ConstructL(); |
|
111 |
|
112 // Prohibit copy constructor if not deriving from CBase. |
|
113 // ?classname( const ?classname& ); |
|
114 // Prohibit assigment operator if not deriving from CBase. |
|
115 // ?classname& operator=( const ?classname& ); |
|
116 |
|
117 /** |
|
118 * Frees all resources allocated from test methods. |
|
119 * @since ?Series60_version |
|
120 */ |
|
121 void Delete(); |
|
122 |
|
123 /** |
|
124 * Build resources needed for test methods. |
|
125 * @since ?Series60_version |
|
126 */ |
|
127 void BuildL (); |
|
128 |
|
129 /** |
|
130 * Test methods are listed below. |
|
131 */ |
|
132 /** |
|
133 * Test construction; Creates haptics client instance. |
|
134 */ |
|
135 TInt SetupL(); |
|
136 |
|
137 /** |
|
138 * Test teardown; Deletes haptics client instance. |
|
139 */ |
|
140 TInt Teardown(); |
|
141 |
|
142 /** |
|
143 * Helpers for creating effects |
|
144 */ |
|
145 void CreateMagSweepEffect( CHWRMHaptics::THWRMHapticsMagSweepEffect& aEffect ); |
|
146 void CreatePeriodicEffect( CHWRMHaptics::THWRMHapticsPeriodicEffect& aEffect ); |
|
147 void CreateIVTEffect( RBuf8& aBuffer, CHWRMHaptics::THWRMHapticsEffectTypes aType ); |
|
148 |
|
149 /** |
|
150 * Helper for such cases where it is first needed to load IVT data |
|
151 */ |
|
152 TInt LoadIVTDataInternal( TInt& aFileHandle, CHWRMHaptics::THWRMHapticsEffectTypes aType, |
|
153 TBool aOpenActuator = ETrue ); |
|
154 |
|
155 /** |
|
156 * Helper for such cases where it is first needed to load IVT data |
|
157 */ |
|
158 TInt LoadIVTDataInternal( TInt& aFileHandle, |
|
159 const TUint8 aIvtData[], |
|
160 TInt aIvtDataSize, |
|
161 TBool aOpenActuator = ETrue ); |
|
162 |
|
163 /** |
|
164 * Helper for such cases where contents of stream sample |
|
165 * is not relevant. |
|
166 */ |
|
167 void CreateDummyStreamSample( TInt aSize, RBuf8& aBuffer ); |
|
168 |
|
169 TInt T_CreateAndDeleteL(); |
|
170 TInt T_SeveralSessionsL(); |
|
171 TInt T_ConsecutiveSessionsL(); |
|
172 TInt T_SupportedActuators(); |
|
173 TInt T_OpenSupportedActuator(); |
|
174 TInt T_OpenNotSupportedActuator(); |
|
175 TInt T_OpenAllActuators(); |
|
176 TInt T_SeveralClientsWithOpenActuatorsL(); |
|
177 TInt T_PlayMagSweepEffectSynchronous(); |
|
178 TInt T_PlayMagSweepEffectAsynchronous(); |
|
179 TInt T_PlayPeriodicEffectSynchronous(); |
|
180 TInt T_PlayPeriodicEffectAsynchronous(); |
|
181 TInt T_PlayIVTEffectWithDirectDataSynchronous(); |
|
182 TInt T_PlayIVTEffectWithDirectDataAsynchronous(); |
|
183 TInt T_PlayIVTEffectRepeatWithDirectDataSynchronous(); |
|
184 TInt T_PlayIVTEffectRepeatWithDirectDataAsynchronous(); |
|
185 TInt T_GetEffectState(); |
|
186 TInt T_PlayNonTimelineIVTEffectRepeatWithDirectDataSynchronous(); |
|
187 TInt T_PlayNonTimelineIVTEffectRepeatWithDirectDataAsynchronous(); |
|
188 TInt T_PlayIVTEffectRepeatWithDirectDataWithZeroRepeatValueSynchronous(); |
|
189 TInt T_PlayIVTEffectRepeatWithDirectDataWithZeroRepeatValueAsynchronous(); |
|
190 TInt T_LoadMultipleIVTData(); |
|
191 TInt T_PlayIVTEffectsFromMultipleIVTDataSynchronous(); |
|
192 TInt T_PlayIVTEffectsFromMultipleIVTDataAsynchronous(); |
|
193 TInt T_PlayIVTEffectRepeatFromMultipleIVTDataSynchronous(); |
|
194 TInt T_PlayIVTEffectRepeatFromMultipleIVTDataAsynchronous(); |
|
195 TInt T_LoadIVTData(); |
|
196 TInt T_DeleteIVTData(); |
|
197 TInt T_DeleteAllIVTData(); |
|
198 TInt T_LoadAndDeleteIVTData(); |
|
199 TInt T_LoadAndDeleteIVTDataMixed(); |
|
200 TInt T_LoadDeletePlaySync(); |
|
201 TInt T_LoadDeletePlayAsync(); |
|
202 TInt T_LoadDeletePlayRepeatSync(); |
|
203 TInt T_LoadDeletePlayRepeatAsync(); |
|
204 TInt T_PlayIVTEffectWithLoadedDataSynchronous(); |
|
205 TInt T_PlayIVTEffectWithLoadedDataAsynchronous(); |
|
206 TInt T_PlayIVTEffectRepeatWithLoadedDataSynchronous(); |
|
207 TInt T_PlayIVTEffectRepeatWithLoadedDataAsynchronous(); |
|
208 TInt T_ReserveAndReleaseHaptics(); |
|
209 TInt T_ReserveHapticsSeveralTimes(); |
|
210 TInt T_ReserveHapticsNoReleaseL(); |
|
211 TInt T_ReleaseHapticsWithoutReservingFirst(); |
|
212 TInt T_ReserveNoAutomaticFocusNotTrusted(); |
|
213 TInt T_ReserveAlreadyReservedHigherL(); |
|
214 TInt T_ReserveAlreadyReservedLowerL(); |
|
215 TInt T_PlayWhenReservedL(); |
|
216 TInt T_GetIVTEffectCount(); |
|
217 TInt T_GetIVTEffectDuration(); |
|
218 TInt T_GetIVTEffectIndexFromName(); |
|
219 TInt T_GetIVTEffectType(); |
|
220 TInt T_GetIVTEffectName(); |
|
221 TInt T_GetIVTMagSweepEffectDefinition(); |
|
222 TInt T_GetIVTPeriodicEffectDefinition(); |
|
223 TInt T_CreateAndDeleteAsynchronousL(); |
|
224 TInt T_SeveralSessionsAsynchronousL(); |
|
225 TInt T_ConsecutiveSessionsAsynchronousL(); |
|
226 TInt T_PauseEffect(); |
|
227 TInt T_ResumeEffect(); |
|
228 TInt T_StopEffect(); |
|
229 TInt T_StopAllEffects(); |
|
230 TInt T_PlayPauseResumeStop(); |
|
231 TInt T_ConstantGetters(); |
|
232 TInt T_ModifyMagSweepEffectSynchronous(); |
|
233 TInt T_ModifyMagSweepEffectAsynchronous(); |
|
234 TInt T_ModifyPeriodicEffectSynchronous(); |
|
235 TInt T_ModifyPeriodicEffectAsynchronous(); |
|
236 TInt T_VibeStatusToS60StatusConversions(); |
|
237 TInt T_GetDeviceProperty_TInt_TInt(); |
|
238 TInt T_GetDeviceProperty_TInt_TDesC(); |
|
239 TInt T_SetDeviceProperty_TInt_TInt(); |
|
240 TInt T_SetDeviceProperty_TInt_TDesC(); |
|
241 TInt T_GetDeviceCapability_TInt_TInt(); |
|
242 TInt T_GetDeviceCapability_TInt_TDesC(); |
|
243 TInt T_GetHapticsStatus(); |
|
244 TInt T_ObserveHapticsStatus(); |
|
245 TInt T_GetHapticsStatusWithReservations(); |
|
246 TInt T_ObserveHapticsStatusWithReservations(); |
|
247 TInt T_GetHapticsStatusWithSeveralReservations(); |
|
248 TInt T_ObserveHapticsStatusWithSeveralReservations(); |
|
249 TInt T_GetHapticsStatusWithSeveralClientsOneReservation(); |
|
250 TInt T_ObserveHapticsStatusWithSeveralClientsOneReservations(); |
|
251 TInt T_CreateStreamingEffect(); |
|
252 TInt T_PlayStreamingSample(); |
|
253 TInt T_PlayStreamingSampleAsync(); |
|
254 TInt T_PlayStreamingSampleWithOffset(); |
|
255 TInt T_PlayStreamingSampleWithOffsetAsync(); |
|
256 TInt T_DestroyStreamingEffect(); |
|
257 TInt T_ObserveActuatorStatus(); |
|
258 TInt T_ObserveActuatorStatusAndHapticsStatus(); |
|
259 TInt T_PluginMgrTransTimerExpires(); |
|
260 |
|
261 private: // Data |
|
262 /** |
|
263 * Haptics client instance. Owned. |
|
264 */ |
|
265 CHWRMHaptics* iHaptics; |
|
266 |
|
267 /** |
|
268 * Used to control tests, which are observing haptics status using |
|
269 * status callback. |
|
270 */ |
|
271 CActiveSchedulerWait iWait; |
|
272 |
|
273 /** |
|
274 * Async play-with-handle methods sender. |
|
275 * Owned. |
|
276 */ |
|
277 MT_HapticsTestAsyncPlaySender* iSender; |
|
278 |
|
279 public: // Friend classes |
|
280 //?friend_class_declaration; |
|
281 protected: // Friend classes |
|
282 //?friend_class_declaration; |
|
283 private: // Friend classes |
|
284 //?friend_class_declaration; |
|
285 }; |
|
286 |
|
287 #endif // HAPTICSCLIENTTEST_H |
|
288 |
|
289 // End of File |