|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "testcasecontroller.h" |
|
17 #include <centralrepository.h> |
|
18 #include <e32debug.h> |
|
19 #include <e32math.h> |
|
20 #include <hwrmvibrasdkcrkeys.h> |
|
21 #include "TestScheduler.h" |
|
22 |
|
23 |
|
24 const TInt KSDKAPIAllowedTargets( |
|
25 CHWRMExtendedLight::EPrimaryDisplay | |
|
26 CHWRMExtendedLight::EPrimaryKeyboard | |
|
27 CHWRMExtendedLight::ESecondaryDisplay | |
|
28 CHWRMExtendedLight::ESecondaryKeyboard | |
|
29 CHWRMExtendedLight::ECustomTarget1 | |
|
30 CHWRMExtendedLight::ECustomTarget2 | |
|
31 CHWRMExtendedLight::ECustomTarget3 | |
|
32 CHWRMExtendedLight::ECustomTarget4 |
|
33 ); |
|
34 |
|
35 const TInt KExtendedAPIAllowedTargets( |
|
36 CHWRMExtendedLight::EPrimaryDisplay | |
|
37 CHWRMExtendedLight::EPrimaryKeyboard | |
|
38 CHWRMExtendedLight::ESecondaryDisplay | |
|
39 CHWRMExtendedLight::ESecondaryKeyboard | |
|
40 CHWRMExtendedLight::ECustomTarget1 | |
|
41 CHWRMExtendedLight::ECustomTarget2 | |
|
42 CHWRMExtendedLight::ECustomTarget3 | |
|
43 CHWRMExtendedLight::ECustomTarget4 | |
|
44 CHWRMExtendedLight::ECustomTarget5 | |
|
45 CHWRMExtendedLight::ECustomTarget6 | |
|
46 CHWRMExtendedLight::ECustomTarget7 | |
|
47 CHWRMExtendedLight::ECustomTarget8 | |
|
48 CHWRMExtendedLight::ECustomTarget9 | |
|
49 CHWRMExtendedLight::ECustomTarget10 | |
|
50 CHWRMExtendedLight::ECustomTarget11 | |
|
51 CHWRMExtendedLight::ECustomTarget12 | |
|
52 CHWRMExtendedLight::ECustomTarget13 | |
|
53 CHWRMExtendedLight::ECustomTarget14 | |
|
54 CHWRMExtendedLight::ECustomTarget15 | |
|
55 CHWRMExtendedLight::ECustomTarget16 | |
|
56 CHWRMExtendedLight::ECustomTarget17 | |
|
57 CHWRMExtendedLight::ECustomTarget18 | |
|
58 CHWRMExtendedLight::ECustomTarget19 | |
|
59 CHWRMExtendedLight::ECustomTarget20 | |
|
60 CHWRMExtendedLight::ECustomTarget21 | |
|
61 CHWRMExtendedLight::ECustomTarget22 | |
|
62 CHWRMExtendedLight::ECustomTarget23 | |
|
63 CHWRMExtendedLight::ECustomTarget24 | |
|
64 CHWRMExtendedLight::ECustomTarget25 | |
|
65 CHWRMExtendedLight::ECustomTarget26 | |
|
66 CHWRMExtendedLight::ECustomTarget27 |
|
67 ); |
|
68 |
|
69 const TInt KEnhancedAPIAllowedTargets = KExtendedAPIAllowedTargets; |
|
70 |
|
71 //Delay in milliseconds. |
|
72 const TUint KHwrmtestsLightMoreDelay = 2000; |
|
73 const TUint KHwrmtestsVibraMoreDelay = 2000; |
|
74 const TInt KTestCategory = 0x101FB3E7; |
|
75 const TUint32 KHWRMColorStatus = 0x00001000; |
|
76 const TUint8 KHWRMRedShift = 16; |
|
77 const TUint8 KHWRMGreenShift = 8; |
|
78 |
|
79 |
|
80 CHwrmTestCaseController* CHwrmTestCaseController::NewL(MHwrmTestCaseObserver& aObserver) |
|
81 { |
|
82 CHwrmTestCaseController* self = new (ELeave) CHwrmTestCaseController(aObserver); |
|
83 CleanupStack::PushL(self); |
|
84 self->ConstructL(); |
|
85 CleanupStack::Pop(self); |
|
86 return self; |
|
87 } |
|
88 |
|
89 CHwrmTestCaseController::CHwrmTestCaseController(MHwrmTestCaseObserver& aObserver) : |
|
90 iObserver(aObserver) |
|
91 ,iApiType(EHWRMApiTypeNoAPI) |
|
92 { |
|
93 } |
|
94 |
|
95 void CHwrmTestCaseController::ConstructL() |
|
96 { |
|
97 iSession = CRepository::NewL(KCRUidVibraCtrl); |
|
98 } |
|
99 |
|
100 CHwrmTestCaseController::~CHwrmTestCaseController() |
|
101 { |
|
102 delete iSession; |
|
103 delete iMyLight; |
|
104 delete iVibra; |
|
105 delete iMcFramework; |
|
106 } |
|
107 |
|
108 void CHwrmTestCaseController::SetApiType(THWRMLightTestFAPIType aApiType) |
|
109 { |
|
110 iApiType = aApiType; |
|
111 } |
|
112 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // CHwrmTestCaseController::RunTestCases |
|
115 // Run test cases |
|
116 // ----------------------------------------------------------------------------- |
|
117 // |
|
118 void CHwrmTestCaseController::RunBasicTestCases(THWRMLightTestFAPIType aApiType) |
|
119 { |
|
120 SetApiType(aApiType); |
|
121 UpdateSupportedTargets(); |
|
122 |
|
123 RunTestCases( EBasicTestIdFirst, EBasicTestIdLast ); |
|
124 } |
|
125 |
|
126 void CHwrmTestCaseController::RunMulticlientTestCases() |
|
127 { |
|
128 if (iMcFramework == NULL) |
|
129 { |
|
130 TRAPD(err,iMcFramework = CMcFramework::NewL()); |
|
131 if (err) |
|
132 { |
|
133 _LIT(KErrorMsg,"Failed to instantiate CMcFramework. Aborting multiclient cases"); |
|
134 iObserver.LogMessage(KErrorMsg); |
|
135 return; |
|
136 } |
|
137 } |
|
138 |
|
139 RunTestCases( EMulticlientTestIdFirst, EMulticlientTestIdLast ); |
|
140 } |
|
141 |
|
142 void CHwrmTestCaseController::UpdateSupportedTargets() |
|
143 { |
|
144 if( iApiType == EHWRMApiTypeXAPI ) |
|
145 { |
|
146 CHWRMExtendedLight* tmpLight = CHWRMExtendedLight::NewL(); |
|
147 iSupportedTargets = tmpLight->SupportedTargets(); |
|
148 delete tmpLight; |
|
149 } |
|
150 else if( iApiType == EHWRMApiTypeSAPI ) |
|
151 { |
|
152 CHWRMLight* tmpLight = CHWRMLight::NewL(); |
|
153 iSupportedTargets = tmpLight->SupportedTargets(); |
|
154 delete tmpLight; |
|
155 } |
|
156 else if( iApiType == EHWRMApiTypeEAPI ) |
|
157 { |
|
158 CHWRMEnhancedLight* tmpLight = CHWRMEnhancedLight::NewL(); |
|
159 iSupportedTargets = tmpLight->SupportedTargets(); |
|
160 delete tmpLight; |
|
161 } |
|
162 } |
|
163 |
|
164 void CHwrmTestCaseController::RunTestCases(TInt aCase) |
|
165 { |
|
166 RunTestCases( aCase, aCase ); |
|
167 } |
|
168 |
|
169 void CHwrmTestCaseController::RunTestCases(TInt aFirst, TInt aLast) |
|
170 { |
|
171 _LIT(KLogMessage1,"Running test cases from %d to %d.."); |
|
172 _LIT(KLogMessage2,"Using API: %d."); |
|
173 |
|
174 TBuf<256> logMessage; |
|
175 logMessage.Format(KLogMessage1,aFirst,aLast); |
|
176 iObserver.LogMessage(logMessage); |
|
177 |
|
178 logMessage.Format(KLogMessage2,iApiType); |
|
179 iObserver.LogMessage(logMessage); |
|
180 |
|
181 TInt i; |
|
182 |
|
183 for( i = aFirst; i <= aLast; i++ ) |
|
184 { |
|
185 iErrCode = 1; |
|
186 |
|
187 iObserver.InfoMessage(_L("Executing test case...")); |
|
188 switch(i) |
|
189 { |
|
190 // Basic test cases start |
|
191 case EBasicTestIdFirst: |
|
192 FormatMessageL(EHwrmMessageOpDebug, _L( "Start test case number %d" ), i ); |
|
193 iObserver.InfoMessage( _L("Basic tests start...") ); |
|
194 break; |
|
195 |
|
196 /** |
|
197 * This case runs LightTest for all targets supported by the device defined in CenRep (10200C8C.txt) |
|
198 * Targets can be removed for this test by defining a mask to targetsToBeSkipped |
|
199 * * Nokia Core OS * |
|
200 */ |
|
201 case EAllSupportedTargetsLightTest: |
|
202 { |
|
203 //define here targets not to be tested in this case |
|
204 TInt targetsToBeSkipped(0); |
|
205 |
|
206 if( iApiType == EHWRMApiTypeSAPI ) // SDK Light API |
|
207 { |
|
208 FormatMessageL(EHwrmMessageOpDebug,_L( "All Supported Targets Test, API Type: SDK Light API" ) ); |
|
209 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-SDKAPI-L-0002 . \nAll Supported Targets Light Test::SDK Light API used." ) ); |
|
210 LightTestAllSupportedSDKTargets( targetsToBeSkipped ); |
|
211 |
|
212 } |
|
213 else if( (iApiType == EHWRMApiTypeXAPI) || (iApiType == EHWRMApiTypeEAPI) ) // Extended Light API |
|
214 { |
|
215 FormatMessageL(EHwrmMessageOpDebug, _L( "All Supported Targets Test, API Type: Extended Light API" ) ); |
|
216 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-0002 . \nAll Supported Targets Test::Extended Light API used." ) ); |
|
217 LightTestAllSupportedExtendedTargets( targetsToBeSkipped ); |
|
218 } |
|
219 else // No API selected, skip the test |
|
220 { |
|
221 FormatMessageL(EHwrmMessageOpDebug, _L( "All Targets Test, API Type not determined. Skipping test..." ) ); |
|
222 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-NOAPI-L-0002 .\nAll Targets Test, API Type not determined. Skipping test..." ) ); |
|
223 } |
|
224 |
|
225 break; |
|
226 } |
|
227 |
|
228 /** |
|
229 * This case runs LightTest for all possible targets |
|
230 */ |
|
231 case EAllTargetsLightTest: |
|
232 { |
|
233 |
|
234 if( iApiType == EHWRMApiTypeSAPI ) // SDK Light API |
|
235 { |
|
236 FormatMessageL(EHwrmMessageOpDebug, _L( " All Targets Light Test, API Type: SDK Light API" ) ); |
|
237 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-SDKAPI-L-0003 . \nAll Targets Light Test::SDK Light API used." ) ); |
|
238 LightTargetTest( KSDKAPIAllowedTargets ); |
|
239 } |
|
240 else if( (iApiType == EHWRMApiTypeXAPI) || (iApiType == EHWRMApiTypeEAPI) ) // Extended Light API |
|
241 { |
|
242 FormatMessageL(EHwrmMessageOpDebug, _L( " All Targets Light Test, API Type: Extended Light API" ) ); |
|
243 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-0003 .\nAll Targets Light Test::Extended Light API used." ) ); |
|
244 LightTargetTest( KExtendedAPIAllowedTargets ); |
|
245 } |
|
246 else // No API selected, skip the test |
|
247 { |
|
248 FormatMessageL(EHwrmMessageOpDebug, _L( " All Targets Light Test, API Type not determined. Skipping test..." ) ); |
|
249 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-NOAPI-L-0003 . \nAll Targets Light Test, API Type not determined. Skipping test..." ) ); |
|
250 } |
|
251 |
|
252 break; |
|
253 } |
|
254 |
|
255 // Possibility to test just one target. Main use could be System Target testing |
|
256 // Expected result is passed to LogResult function as 3rd parameter |
|
257 case ESingleTargetLightTest1: |
|
258 { |
|
259 |
|
260 if( iApiType == EHWRMApiTypeSAPI ) // SDK Light API |
|
261 { |
|
262 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
263 iErrCode = LightTargetTestSDK( CHWRMLight::ESystemTarget ); |
|
264 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-SDKAPI-L-0004 . HWRM [LightOnWithSingleTarget] System target" ), iErrCode, KErrNone ); |
|
265 } |
|
266 else if( (iApiType == EHWRMApiTypeXAPI) || (iApiType == EHWRMApiTypeEAPI) ) // Extended Light API |
|
267 { |
|
268 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
269 iErrCode = LightTargetTestExtended( CHWRMExtendedLight::ESystemTarget ); |
|
270 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-0004 . HWRM [LightOnWithSingleTarget] System target " ), iErrCode, KErrNone ); |
|
271 } |
|
272 else // No API selected, skip the test |
|
273 { |
|
274 FormatMessageL(EHwrmMessageOpDebug, _L( "HWRM [LightOnWithSingleTarget], API Type not determined. Skipping test..." ) ); |
|
275 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-NOAPI-L-0004 . HWRM [LightOnWithSingleTarget]t, API Type not determined. Skipping test..." ) ); |
|
276 } |
|
277 break; |
|
278 } |
|
279 |
|
280 // In order to pass, this case needs EPrimaryDisplay to be supported |
|
281 // Expected result is passed to LogResult function as 3rd parameter |
|
282 case ECombinedTargetsLightTest1: |
|
283 { |
|
284 iErrCode = KErrNone; |
|
285 |
|
286 if( iApiType == EHWRMApiTypeSAPI ) // SDK Light API |
|
287 { |
|
288 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
289 CHWRMLight* myLight = CHWRMLight::NewLC(); |
|
290 TRAP( iErrCode, myLight->LightOnL( CHWRMLight::EPrimaryDisplay | CHWRMLight::ESystemTarget ) ); |
|
291 if( iErrCode == KErrNone ) |
|
292 { |
|
293 iErrCode = GetLightStatusForSystemTarget( myLight, CHWRMLight::ELightOn ); |
|
294 } |
|
295 LogResult( _L( "\n @SYMTestCaseID:DEVSRVS-HWRMMC-SDKAPI-L-0005 . HWRM [LightOnWithCombinedTargets] PrimaryDisplay | SystemTarget " ), iErrCode ); |
|
296 LogResult( _L( "\nHWRM [LightOnWithCombinedTargets] PrimaryDisplay | SystemTarget " ), iErrCode, KErrNone ); |
|
297 CleanupStack::PopAndDestroy( myLight ); |
|
298 } |
|
299 else if( iApiType == EHWRMApiTypeXAPI ) // Extended Light API |
|
300 { |
|
301 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
302 CHWRMExtendedLight* myLight = CHWRMExtendedLight::NewLC(); |
|
303 TRAP( iErrCode, myLight->LightOnL( CHWRMExtendedLight::EPrimaryDisplay | CHWRMExtendedLight::ESystemTarget ) ); |
|
304 if( iErrCode == KErrNone ) |
|
305 { |
|
306 iErrCode = GetLightStatusForSystemTarget( myLight, CHWRMExtendedLight::ELightOn ); |
|
307 } |
|
308 LogResult( _L( "\n @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-0005 . HWRM [LightOnWithCombinedTargets] PrimaryDisplay | SystemTarget " ), iErrCode, KErrNone ); |
|
309 CleanupStack::PopAndDestroy( myLight ); |
|
310 } |
|
311 else if( iApiType == EHWRMApiTypeEAPI ) // Extended Light API |
|
312 { |
|
313 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
314 CHWRMEnhancedLight* myLight = CHWRMEnhancedLight::NewLC(); |
|
315 TRAP( iErrCode, myLight->LightOnL( CHWRMExtendedLight::EPrimaryDisplay | CHWRMExtendedLight::ESystemTarget ) ); |
|
316 if( iErrCode == KErrNone ) |
|
317 { |
|
318 iErrCode = GetLightStatusForSystemTarget( myLight, CHWRMExtendedLight::ELightOn ); |
|
319 } |
|
320 LogResult( _L( "\n @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-0005 . HWRM [LightOnWithCombinedTargets] PrimaryDisplay | SystemTarget " ), iErrCode, KErrNone ); |
|
321 CleanupStack::PopAndDestroy( myLight ); |
|
322 } |
|
323 else // No API selected, skip the test |
|
324 { |
|
325 FormatMessageL(EHwrmMessageOpDebug, _L( " Combined Targets Test, API Type not determined. Skipping test..." ) ); |
|
326 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-NOAPI-L-0005 . Combined Targets Test, API Type not determined. Skipping test..." ) ); |
|
327 } |
|
328 break; |
|
329 } |
|
330 |
|
331 //In order to pass, this case needs EPrimaryDisplayAndKeyboard and ECustomTarget1 to be supported |
|
332 // Expected result is passed to LogResult function as 3rd parameter |
|
333 case ECombinedTargetsLightTest2: |
|
334 { |
|
335 iErrCode = KErrNone; |
|
336 |
|
337 if( iApiType == EHWRMApiTypeSAPI ) // SDK Light API |
|
338 { |
|
339 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
340 CHWRMLight* myLight = CHWRMLight::NewLC(); |
|
341 TRAP( iErrCode, myLight->LightOnL( CHWRMLight::EPrimaryDisplayAndKeyboard | CHWRMLight::ECustomTarget1 ) ); |
|
342 LogResult( _L( "\n @SYMTestCaseID:DEVSRVS-HWRMMC-SDKAPI-L-0006 . HWRM [LightOnWithCombinedTargets] PrimaryDisplayAndKeyboard | ECustomTarget1 " ), iErrCode, KErrNotSupported ); |
|
343 CleanupStack::PopAndDestroy( myLight ); |
|
344 } |
|
345 else if( iApiType == EHWRMApiTypeXAPI ) // Extended Light API |
|
346 { |
|
347 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
348 CHWRMExtendedLight* myLight = CHWRMExtendedLight::NewLC(); |
|
349 TRAP( iErrCode, myLight->LightOnL( CHWRMExtendedLight::EPrimaryDisplayAndKeyboard | CHWRMExtendedLight::ECustomTarget1 ) ); |
|
350 LogResult( _L( "\n @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-0006 . HWRM [LightOnWithCombinedTargets] PrimaryDisplayAndKeyboard | ECustomTarget1 " ), iErrCode, KErrNotSupported ); |
|
351 CleanupStack::PopAndDestroy( myLight ); |
|
352 } |
|
353 else if( iApiType == EHWRMApiTypeEAPI ) // Extended Light API |
|
354 { |
|
355 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
356 CHWRMEnhancedLight* myLight = CHWRMEnhancedLight::NewLC(); |
|
357 TRAP( iErrCode, myLight->LightOnL( CHWRMExtendedLight::EPrimaryDisplayAndKeyboard | CHWRMExtendedLight::ECustomTarget1 ) ); |
|
358 LogResult( _L( "\n @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-0006 . HWRM [LightOnWithCombinedTargets] PrimaryDisplayAndKeyboard | ECustomTarget1 " ), iErrCode, KErrNotSupported ); |
|
359 CleanupStack::PopAndDestroy( myLight ); |
|
360 } |
|
361 else // No API selected, skip the test |
|
362 { |
|
363 FormatMessageL(EHwrmMessageOpDebug, _L( " Combined Targets Test, API Type not determined. Skipping test..." ) ); |
|
364 LogResult(_L( " @SYMTestCaseID:DEVSRVS-HWRMMC-NOAPI-L-0006 .Combined Targets Test, API Type not determined. Skipping test..." ) ); |
|
365 } |
|
366 break; |
|
367 } |
|
368 |
|
369 /** |
|
370 * This case runs LightOnDurationTest for all possible targets |
|
371 */ |
|
372 case EAllTargetsLightOnDurationTest: |
|
373 { |
|
374 if( iApiType == EHWRMApiTypeSAPI ) // SDK Light API |
|
375 { |
|
376 FormatMessageL(EHwrmMessageOpDebug, _L( " All Targets Light on Duration Test, API Type: SDK Light API" ) ); |
|
377 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-SDKAPI-L-0007 . All Targets Light on Duration Test::SDK Light API used." ) ); |
|
378 LightOnDurationTest( KSDKAPIAllowedTargets ); |
|
379 } |
|
380 else if( (iApiType == EHWRMApiTypeXAPI) || (iApiType == EHWRMApiTypeEAPI) ) // Extended Light API |
|
381 { |
|
382 FormatMessageL(EHwrmMessageOpDebug, _L( " All Targets Light on Duration Test, API Type: Extended Light API" ) ); |
|
383 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-0007 .All Targets Light on Duration Test::Extended Light API used." ) ); |
|
384 LightOnDurationTest( KExtendedAPIAllowedTargets ); |
|
385 } |
|
386 else // No API selected, skip the test |
|
387 { |
|
388 FormatMessageL(EHwrmMessageOpDebug, _L( " All Targets Light on Duration Test, API Type not determined. Skipping test..." ) ); |
|
389 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-NOAPI-L-0007 . All Targets Light on Duration Test, API Type not determined. Skipping test..." ) ); |
|
390 } |
|
391 |
|
392 break; |
|
393 } |
|
394 |
|
395 //possibility to test just one target. Main use could be System Target testing |
|
396 case ESingleTargetLightOnDurationTest1: |
|
397 { |
|
398 if( iApiType == EHWRMApiTypeSAPI ) // SDK Light API |
|
399 { |
|
400 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
401 iErrCode = LightOnDurationTestSDK( CHWRMLight::ESystemTarget ); |
|
402 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-SDKAPI-L-0008 . HWRM [LightOnDurationWithSingleTarget] System target" ), iErrCode ); |
|
403 } |
|
404 else if( iApiType == EHWRMApiTypeXAPI ) // Extended Light API |
|
405 { |
|
406 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
407 iErrCode = LightOnDurationTestExtended( CHWRMExtendedLight::ESystemTarget ); |
|
408 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-0008 . HWRM [LightOnDurationWithSingleTarget] System target " ), iErrCode ); |
|
409 } |
|
410 else if( iApiType == EHWRMApiTypeEAPI ) // Extended Light API |
|
411 { |
|
412 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
413 iErrCode = LightOnDurationTestEnhanced( CHWRMExtendedLight::ESystemTarget ); |
|
414 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-0008 . HWRM [LightOnDurationWithSingleTarget] System target " ), iErrCode ); |
|
415 } |
|
416 else // No API selected, skip the test |
|
417 { |
|
418 FormatMessageL(EHwrmMessageOpDebug, _L( " LightOnDurationWithSingleTarget, API Type not determined. Skipping test..." ) ); |
|
419 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-NOAPI-L-0008 . LightOnDurationWithSingleTarget, API Type not determined. Skipping test..." ) ); |
|
420 } |
|
421 break; |
|
422 } |
|
423 |
|
424 /** |
|
425 * This case runs LightOffDurationTest for all possible targets |
|
426 */ |
|
427 case EAllTargetsLightOffDurationTest: |
|
428 { |
|
429 if( iApiType == EHWRMApiTypeSAPI ) // SDK Light API |
|
430 { |
|
431 FormatMessageL(EHwrmMessageOpDebug, _L( " All Targets Light Off Duration Test, API Type: SDK Light API" ) ); |
|
432 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-SDKAPI-L-0009 . All Targets Light Off Duration Test::SDK Light API used." ) ); |
|
433 LightOffDurationTest( KSDKAPIAllowedTargets ); |
|
434 } |
|
435 else if( (iApiType == EHWRMApiTypeXAPI) || (iApiType == EHWRMApiTypeXAPI) ) // Extended Light API |
|
436 { |
|
437 FormatMessageL(EHwrmMessageOpDebug, _L( " All Targets Light Off Duration Test, API Type: Extended Light API" ) ); |
|
438 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-0009 . All Targets Light Off Duration Test::Extended Light API used." ) ); |
|
439 LightOffDurationTest( KExtendedAPIAllowedTargets ); |
|
440 } |
|
441 else // No API selected, skip the test |
|
442 { |
|
443 FormatMessageL(EHwrmMessageOpDebug, _L( " All Targets Light Off Duration Test, API Type not determined. Skipping test..." ) ); |
|
444 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-NOAPI-L-0009 . All Targets Light Off Duration Test, API Type not determined. Skipping test..." ) ); |
|
445 } |
|
446 |
|
447 break; |
|
448 } |
|
449 |
|
450 //possibility to test just one target. Main use could be System Target testing |
|
451 case ESingleTargetLightOffDurationTest1: |
|
452 { |
|
453 if( iApiType == EHWRMApiTypeSAPI ) // SDK Light API |
|
454 { |
|
455 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
456 iErrCode = LightOffDurationTestSDK( CHWRMLight::ESystemTarget ); |
|
457 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-SDKAPI-L-0010 . HWRM [LightOffDurationWithSingleTarget] System target" ), iErrCode ); |
|
458 } |
|
459 else if( (iApiType == EHWRMApiTypeXAPI) || (iApiType == EHWRMApiTypeEAPI) ) // Extended Light API |
|
460 { |
|
461 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
462 iErrCode = LightOffDurationTestExtended( CHWRMExtendedLight::ESystemTarget ); |
|
463 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-0010 . HWRM [LightOffDurationWithSingleTarget] System target " ), iErrCode ); |
|
464 } |
|
465 else // No API selected, skip the test |
|
466 { |
|
467 FormatMessageL(EHwrmMessageOpDebug, _L( " LightOffDurationWithSingleTarget, API Type not determined. Skipping test..." ) ); |
|
468 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-NOAPI-L-0010 . LightOffDurationWithSingleTarget, API Type not determined. Skipping test..." ) ); |
|
469 } |
|
470 break; |
|
471 } |
|
472 |
|
473 |
|
474 /** |
|
475 * This case runs LightIntensityTest for all possible targets |
|
476 */ |
|
477 case EAllTargetsLightIntensityTest: |
|
478 { |
|
479 if( iApiType == EHWRMApiTypeSAPI ) // SDK Light API |
|
480 { |
|
481 FormatMessageL(EHwrmMessageOpDebug, _L( " All Targets Light Intensity Test, API Type: SDK Light API" ) ); |
|
482 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-SDKAPI-L-0011 . All Targets Light Intensity Test::SDK Light API used." ) ); |
|
483 LightIntensityTest( KSDKAPIAllowedTargets ); |
|
484 } |
|
485 else if( (iApiType == EHWRMApiTypeXAPI) || (iApiType == EHWRMApiTypeEAPI) ) // Extended Light API |
|
486 { |
|
487 FormatMessageL(EHwrmMessageOpDebug, _L( " All Targets Light Intensity Test, API Type: Extended Light API" ) ); |
|
488 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-0011 . All Targets Light Intensity Test::Extended Light API used." ) ); |
|
489 LightIntensityTest( KExtendedAPIAllowedTargets ); |
|
490 } |
|
491 else // No API selected, skip the test |
|
492 { |
|
493 FormatMessageL(EHwrmMessageOpDebug, _L( " All Targets Light Intensity Test, API Type not determined. Skipping test..." ) ); |
|
494 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-NOAPI-L-0011 . All Targets Light Intensity Test, API Type not determined. Skipping test..." ) ); |
|
495 } |
|
496 |
|
497 break; |
|
498 } |
|
499 |
|
500 |
|
501 //possibility to test just one target. Main use could be System Target testing |
|
502 case ESingleTargetLightIntensityTest1: |
|
503 { |
|
504 if( iApiType == EHWRMApiTypeSAPI ) // SDK Light API |
|
505 { |
|
506 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
507 iErrCode = LightIntensityTestSDK( CHWRMLight::ESystemTarget ); |
|
508 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-SDKAPI-L-0012 . HWRM [LightIntensityWithSingleTarget] System target" ), iErrCode ); |
|
509 } |
|
510 else if( (iApiType == EHWRMApiTypeXAPI) || (iApiType == EHWRMApiTypeEAPI) ) // Extended Light API |
|
511 { |
|
512 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
513 iErrCode = LightIntensityTestExtended( CHWRMExtendedLight::ESystemTarget ); |
|
514 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-0012 . HWRM [LightIntensityWithSingleTarget] System target " ), iErrCode ); |
|
515 } |
|
516 else // No API selected, skip the test |
|
517 { |
|
518 FormatMessageL(EHwrmMessageOpDebug, _L( " LightIntensityWithSingleTarget, API Type not determined. Skipping test..." ) ); |
|
519 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-NOAPI-L-0012 .LightIntensityWithSingleTarget, API Type not determined. Skipping test..." ) ); |
|
520 } |
|
521 break; |
|
522 } |
|
523 |
|
524 /** |
|
525 * This case runs LightBlinkTest for all possible targets |
|
526 */ |
|
527 case EAllTargetsLightBlinkTest: |
|
528 { |
|
529 if( iApiType == EHWRMApiTypeSAPI ) // SDK Light API |
|
530 { |
|
531 FormatMessageL(EHwrmMessageOpDebug, _L( " All Targets Light Blink Test, API Type: SDK Light API" ) ); |
|
532 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-SDKAPI-L-0013 .All Targets Light Blink Test::SDK Light API used." ) ); |
|
533 LightBlinkTest( KSDKAPIAllowedTargets ); |
|
534 } |
|
535 else if( (iApiType == EHWRMApiTypeXAPI) || (iApiType == EHWRMApiTypeEAPI) ) // Extended Light API |
|
536 { |
|
537 FormatMessageL(EHwrmMessageOpDebug, _L( " All Targets Light Blink Test, API Type: Extended Light API" ) ); |
|
538 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-0013 .All Targets Light Blink Test::Extended Light API used." ) ); |
|
539 LightBlinkTest( KExtendedAPIAllowedTargets ); |
|
540 } |
|
541 else // No API selected, skip the test |
|
542 { |
|
543 FormatMessageL(EHwrmMessageOpDebug, _L( " All Targets Light Blink Test, API Type not determined. Skipping test..." ) ); |
|
544 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-NOAPI-L-0013 .All Targets Light Blink Test, API Type not determined. Skipping test..." ) ); |
|
545 } |
|
546 |
|
547 break; |
|
548 } |
|
549 |
|
550 //possibility to test just one target. Main use could be System Target testing |
|
551 case ESingleTargetLightBlinkTest1: |
|
552 { |
|
553 if( iApiType == EHWRMApiTypeSAPI ) // SDK Light API |
|
554 { |
|
555 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
556 iErrCode = LightBlinkTestSDK( CHWRMLight::ESystemTarget ); |
|
557 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-SDKAPI-L-0014 .HWRM [LightBlinkWithSingleTarget] System target" ), iErrCode ); |
|
558 } |
|
559 else if( (iApiType == EHWRMApiTypeXAPI) || (iApiType == EHWRMApiTypeEAPI) ) // Extended Light API |
|
560 { |
|
561 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
562 iErrCode = LightBlinkTestExtended( CHWRMExtendedLight::ESystemTarget ); |
|
563 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-0014 .HWRM [LightBlinkWithSingleTarget] System target " ), iErrCode ); |
|
564 } |
|
565 else // No API selected, skip the test |
|
566 { |
|
567 FormatMessageL(EHwrmMessageOpDebug, _L( " LightBlinkWithSingleTarget, API Type not determined. Skipping test..." ) ); |
|
568 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-NOAPI-L-0014 .LightBlinkWithSingleTarget, API Type not determined. Skipping test..." ) ); |
|
569 } |
|
570 break; |
|
571 } |
|
572 |
|
573 /** |
|
574 * This case runs LightBlinkDurationTest for all possible targets |
|
575 */ |
|
576 case EAllTargetsLightBlinkDurationTest: |
|
577 { |
|
578 if( iApiType == EHWRMApiTypeSAPI ) // SDK Light API |
|
579 { |
|
580 FormatMessageL(EHwrmMessageOpDebug, _L( " All Targets Light Blink Duration Test, API Type: SDK Light API" ) ); |
|
581 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-SDKAPI-L-0015 .All Targets Light Blink Duration Test::SDK Light API used." ) ); |
|
582 LightBlinkDurationTest( KSDKAPIAllowedTargets ); |
|
583 } |
|
584 else if( (iApiType == EHWRMApiTypeXAPI) || (iApiType == EHWRMApiTypeEAPI) ) // Extended Light API |
|
585 { |
|
586 FormatMessageL(EHwrmMessageOpDebug, _L( " All Targets Light Blink Duration Test, API Type: Extended Light API" ) ); |
|
587 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-0015 .All Targets Light Blink Duration Test::Extended Light API used." ) ); |
|
588 LightBlinkDurationTest( KExtendedAPIAllowedTargets ); |
|
589 } |
|
590 else // No API selected, skip the test |
|
591 { |
|
592 FormatMessageL(EHwrmMessageOpDebug, _L( " All Targets Light Blink Duration Test, API Type not determined. Skipping test..." ) ); |
|
593 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-NOAPI-L-0015 .All Targets Light Blink Duration Test, API Type not determined. Skipping test..." ) ); |
|
594 } |
|
595 |
|
596 break; |
|
597 } |
|
598 |
|
599 //possibility to test just one target. Main use could be System Target testing |
|
600 case ESingleTargetLightBlinkDurationTest1: |
|
601 { |
|
602 if( iApiType == EHWRMApiTypeSAPI ) // SDK Light API |
|
603 { |
|
604 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
605 iErrCode = LightBlinkDurationTestSDK( CHWRMLight::ESystemTarget ); |
|
606 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-SDKAPI-L-0016 .HWRM [LightBlinkDurationWithSingleTarget] System target" ), iErrCode ); |
|
607 } |
|
608 else if( iApiType == EHWRMApiTypeXAPI ) // Extended Light API |
|
609 { |
|
610 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
611 iErrCode = LightBlinkDurationTestExtended( CHWRMExtendedLight::ESystemTarget ); |
|
612 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-0016 .HWRM [LightBlinkDurationWithSingleTarget] System target " ), iErrCode ); |
|
613 } |
|
614 else if( iApiType == EHWRMApiTypeEAPI ) // Extended Light API |
|
615 { |
|
616 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
617 iErrCode = LightBlinkDurationTestEnhanced( CHWRMExtendedLight::ESystemTarget ); |
|
618 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-0016 .HWRM [LightBlinkDurationWithSingleTarget] System target " ), iErrCode ); |
|
619 } |
|
620 else // No API selected, skip the test |
|
621 { |
|
622 FormatMessageL(EHwrmMessageOpDebug, _L( " LightBlinkDurationWithSingleTarget, API Type not determined. Skipping test..." ) ); |
|
623 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-NOAPI-L-0016 .LightBlinkDurationWithSingleTarget, API Type not determined. Skipping test..." ) ); |
|
624 } |
|
625 break; |
|
626 } |
|
627 |
|
628 /** |
|
629 * This case runs LightBlinkOnOffTest for all possible targets |
|
630 */ |
|
631 case EAllTargetsLightBlinkOnOffTest: |
|
632 { |
|
633 if( iApiType == EHWRMApiTypeSAPI ) // SDK Light API |
|
634 { |
|
635 FormatMessageL(EHwrmMessageOpDebug, _L( " All Targets Light Blink On/Off Test, API Type: SDK Light API" ) ); |
|
636 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-SDKAPI-L-0017 .All Targets Light Blink On/Off Test::SDK Light API used." ) ); |
|
637 LightBlinkOnOffTest( KSDKAPIAllowedTargets ); |
|
638 } |
|
639 else if( (iApiType == EHWRMApiTypeXAPI) || (iApiType == EHWRMApiTypeEAPI) ) // Extended Light API |
|
640 { |
|
641 FormatMessageL(EHwrmMessageOpDebug, _L( " All Targets Light Blink On/Off Testt, API Type: Extended Light API" ) ); |
|
642 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-0017 .All Targets Light Blink On/Off Test::Extended Light API used." ) ); |
|
643 LightBlinkOnOffTest( KExtendedAPIAllowedTargets ); |
|
644 } |
|
645 else // No API selected, skip the test |
|
646 { |
|
647 FormatMessageL(EHwrmMessageOpDebug, _L( " All Targets Light Blink On/Off Test, API Type not determined. Skipping test..." ) ); |
|
648 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-NOAPI-L-0017 .All Targets Light Blink On/Off Test, API Type not determined. Skipping test..." ) ); |
|
649 } |
|
650 |
|
651 break; |
|
652 } |
|
653 |
|
654 //possibility to test just one target. Main use could be System Target testing |
|
655 case ESingleTargetLightBlinkOnOffTest1: |
|
656 { |
|
657 if( iApiType == EHWRMApiTypeSAPI ) // SDK Light API |
|
658 { |
|
659 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
660 iErrCode = LightBlinkOnOffTestSDK( CHWRMLight::ESystemTarget ); |
|
661 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-SDKAPI-L-0018 .HWRM [LightBlinkOnOffWithSingleTarget] System target" ), iErrCode ); |
|
662 } |
|
663 else if( (iApiType == EHWRMApiTypeXAPI) || (iApiType == EHWRMApiTypeEAPI) ) // Extended Light API |
|
664 { |
|
665 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
666 iErrCode = LightBlinkOnOffTestExtended( CHWRMExtendedLight::ESystemTarget ); |
|
667 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-0018 .HWRM [LightBlinkOnOffWithSingleTarget] System target " ), iErrCode ); |
|
668 } |
|
669 else // No API selected, skip the test |
|
670 { |
|
671 FormatMessageL(EHwrmMessageOpDebug, _L( " LightBlinkOnOffWithSingleTarget, API Type not determined. Skipping test..." ) ); |
|
672 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-NOAPI-L-0018 .LightBlinkOnOffWithSingleTarget, API Type not determined. Skipping test..." ) ); |
|
673 } |
|
674 break; |
|
675 } |
|
676 |
|
677 /** |
|
678 * This case runs LightOnDurationRGBTest for all possible targets |
|
679 */ |
|
680 case EAllTargetsLightOnDurationRGBTest: |
|
681 { |
|
682 if( iApiType == EHWRMApiTypeSAPI ) // SDK Light API |
|
683 { |
|
684 FormatMessageL(EHwrmMessageOpDebug, _L( " All Targets Light on Duration RGB Test, API Type: SDK Light API" ) ); |
|
685 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-SDKAPI-L-0018A . All Targets Light on Duration RGB Test::SDK Light API used." ) ); |
|
686 LightOnDurationTest( KSDKAPIAllowedTargets, ETrue, 0xFF, 0, 0 ); |
|
687 } |
|
688 else if( iApiType == EHWRMApiTypeEAPI ) // Enhanced Light API |
|
689 { |
|
690 FormatMessageL(EHwrmMessageOpDebug, _L( " All Targets Light on Duration RGB Test, API Type: Enhanced Light API" ) ); |
|
691 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-0018A .All Targets Light on Duration RGB Test::Enhanced Light API used." ) ); |
|
692 LightOnDurationTest( KEnhancedAPIAllowedTargets, ETrue, 0, 0xff, 0 ); |
|
693 } |
|
694 break; |
|
695 } |
|
696 |
|
697 //possibility to test just one target. Main use could be System Target testing |
|
698 case EAllTargetsLightOnDurationRGBTest1: |
|
699 { |
|
700 if( iApiType == EHWRMApiTypeSAPI ) // SDK Light API |
|
701 { |
|
702 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
703 iErrCode = LightOnDurationTestSDK( CHWRMLight::ESystemTarget, ETrue, 0, 0, 0xff ); |
|
704 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-SDKAPI-L-00018B . HWRM [LightOnDurationWithSingleTarget] System target" ), iErrCode ); |
|
705 } |
|
706 else if( iApiType == EHWRMApiTypeEAPI ) // Enhanced Light API |
|
707 { |
|
708 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
709 iErrCode = LightOnDurationTestEnhanced( CHWRMExtendedLight::ESystemTarget, ETrue, 0xff, 0, 0 ); |
|
710 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-00018B . HWRM [LightOnDurationWithSingleTarget] System target " ), iErrCode ); |
|
711 } |
|
712 break; |
|
713 } |
|
714 |
|
715 /** |
|
716 * This case runs LightBlinkDurationRGBTest for all possible targets |
|
717 */ |
|
718 case EAllTargetsLightBlinkDurationRGBTest: |
|
719 { |
|
720 if( iApiType == EHWRMApiTypeSAPI ) // SDK Light API |
|
721 { |
|
722 FormatMessageL(EHwrmMessageOpDebug, _L( " All Targets Light Blink Duration RGB Test, API Type: SDK Light API" ) ); |
|
723 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-SDKAPI-L-0018C . All Targets Light Blink Duration RGB Test::SDK Light API used." ) ); |
|
724 LightBlinkDurationTest( KSDKAPIAllowedTargets, ETrue, 0, 0xff, 0 ); |
|
725 } |
|
726 else if( iApiType == EHWRMApiTypeEAPI ) // Enhanced Light API |
|
727 { |
|
728 FormatMessageL(EHwrmMessageOpDebug, _L( " All Targets Light Blink Duration RGB Test, API Type: Enhanced Light API" ) ); |
|
729 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-0018C .All Targets Light Blink Duration RGB Test::Enhanced Light API used." ) ); |
|
730 LightBlinkDurationTest( KEnhancedAPIAllowedTargets, ETrue, 0, 0, 0xff); |
|
731 } |
|
732 break; |
|
733 } |
|
734 |
|
735 //possibility to test just one target. Main use could be System Target testing |
|
736 case EAllTargetsLightBlinkDurationRGBTest1: |
|
737 { |
|
738 if( iApiType == EHWRMApiTypeSAPI ) // SDK Light API |
|
739 { |
|
740 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
741 iErrCode = LightBlinkDurationTestSDK( CHWRMLight::ESystemTarget, ETrue, 0xff, 0, 0); |
|
742 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-SDKAPI-L-00018D . HWRM [LightOnDurationWithSingleTarget] System target" ), iErrCode ); |
|
743 } |
|
744 else if( iApiType == EHWRMApiTypeEAPI ) // Enhanced Light API |
|
745 { |
|
746 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
747 iErrCode = LightBlinkDurationTestEnhanced( CHWRMExtendedLight::ESystemTarget, ETrue, 0, 0xff, 0 ); |
|
748 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-00018D . HWRM [LightOnDurationWithSingleTarget] System target " ), iErrCode ); |
|
749 } |
|
750 break; |
|
751 } |
|
752 |
|
753 |
|
754 /** |
|
755 * This case runs LightTests(On/Off/Blink) for multiple hardcoded targets |
|
756 */ |
|
757 case ELightDifferentTargetsTest: |
|
758 { |
|
759 if( iApiType == EHWRMApiTypeSAPI ) // SDK Light API |
|
760 { |
|
761 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
762 iErrCode = LightWithDifferentTargetsSDK( ); |
|
763 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-SDKAPI-L-0019 .HWRM [LightWithDifferentTargets]" ), iErrCode, KErrNone ); |
|
764 } |
|
765 else if( (iApiType == EHWRMApiTypeXAPI) || (iApiType == EHWRMApiTypeEAPI) ) // Extended Light API |
|
766 { |
|
767 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
768 iErrCode = LightWithDifferentTargetsExtended(); |
|
769 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-0019 .HWRM [LightWithDifferentTargets]" ), iErrCode, KErrNone ); |
|
770 } |
|
771 else // No API selected, skip the test |
|
772 { |
|
773 FormatMessageL(EHwrmMessageOpDebug, _L( " LightWithDifferentTargets, API Type not determined. Skipping test..." ) ); |
|
774 LogResult( _L(" @SYMTestCaseID:DEVSRVS-HWRMMC-NOAPI-L-0019 .LightWithDifferentTargets, API Type not determined. Skipping test..." ) ); |
|
775 } |
|
776 break; |
|
777 } |
|
778 |
|
779 /** |
|
780 * This case runs LightTests(On/Off/Blink) for multiple hardcoded targets with |
|
781 * invalid duration |
|
782 */ |
|
783 case ELightInvalidDurationTest: |
|
784 { |
|
785 if( iApiType == EHWRMApiTypeSAPI ) // SDK Light API |
|
786 { |
|
787 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
788 iErrCode = LightWithInvalidDurationSDK( ); |
|
789 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-SDKAPI-L-0020 .HWRM [LightWithInvalidDuration]" ), iErrCode, KErrNone ); |
|
790 } |
|
791 else if( (iApiType == EHWRMApiTypeXAPI) || (iApiType == EHWRMApiTypeEAPI) ) // Extended Light API |
|
792 { |
|
793 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
794 iErrCode = LightWithInvalidDurationExtended(); |
|
795 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-0020 .HWRM [LightWithInvalidDuration]" ), iErrCode, KErrNone ); |
|
796 } |
|
797 else // No API selected, skip the test |
|
798 { |
|
799 FormatMessageL(EHwrmMessageOpDebug, _L( " LightWithInvalidDuration, API Type not determined. Skipping test %d..." ) ,i ); |
|
800 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-NOAPI-L-0020 .LightWithInvalidDuration, API Type not determined. Skipping test..." ) ); |
|
801 } |
|
802 break; |
|
803 } |
|
804 |
|
805 |
|
806 case ELightIntensityTest2: |
|
807 { |
|
808 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
809 if( iApiType == EHWRMApiTypeSAPI ) // SDK Light API |
|
810 { |
|
811 iErrCode = LightIntensitySDK( ); |
|
812 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-SDKAPI-L-0021 .HWRM [LightWithIntensity]" ), iErrCode, KErrNone ); |
|
813 } |
|
814 else if( (iApiType == EHWRMApiTypeXAPI) || (iApiType == EHWRMApiTypeEAPI) ) // Extended Light API |
|
815 { |
|
816 iErrCode = LightIntensityExtended(); |
|
817 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-EXTAPI-L-0021 .HWRM [LightWithIntensity]" ), iErrCode, KErrNone ); |
|
818 } |
|
819 else // No API selected, skip the test |
|
820 { |
|
821 FormatMessageL(EHwrmMessageOpDebug, _L( " LightWithIntensity, API Type not determined. Skipping test %d..." ), i ); |
|
822 LogResult( _L( " @SYMTestCaseID:DEVSRVS-HWRMMC-NOAPI-L-0021 .LightWithIntensity, API Type not determined. Skipping test..." ) ); |
|
823 } |
|
824 break; |
|
825 } |
|
826 |
|
827 |
|
828 case EBasicTestIdLast: |
|
829 iObserver.InfoMessage( _L("Basic tests end...") ); |
|
830 break; |
|
831 |
|
832 // End of Basic test cases |
|
833 |
|
834 |
|
835 |
|
836 // Multiclient cases start |
|
837 |
|
838 case EMulticlientTestIdFirst: |
|
839 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
840 iObserver.InfoMessage( _L("Multiclient tests start...") ); |
|
841 iErrCode = Verify_MCFramework_M(); |
|
842 if (iErrCode != KErrNone) |
|
843 { |
|
844 iMcFramework->StepExecuted(KErrGeneral); |
|
845 } |
|
846 |
|
847 LogResult(_L(" @SYMTestCaseID:DEVSRVS-HWRMMC-L-0023 .HWRM [Verify_MCFramework_M] "), iErrCode); |
|
848 break; |
|
849 |
|
850 case EMCPrimaryDisplayLight: |
|
851 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
852 iErrCode = MC_Primary_display_light_M(); |
|
853 if (iErrCode != KErrNone) |
|
854 { |
|
855 iMcFramework->StepExecuted(KErrGeneral); |
|
856 } |
|
857 LogResult(_L(" @SYMTestCaseID:DEVSRVS-HWRMMC-L-0024 .HWRM [MC_Primary_display_light_M] "), iErrCode); |
|
858 break; |
|
859 |
|
860 case EMCDisplayOnKbBlink: |
|
861 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
862 iErrCode = MC_Display_on_and_keyboard_blink_M(); |
|
863 if (iErrCode != KErrNone) |
|
864 { |
|
865 iMcFramework->StepExecuted(KErrGeneral); |
|
866 } |
|
867 LogResult(_L(" @SYMTestCaseID:DEVSRVS-HWRMMC-L-0025 .HWRM [MC_Display_on_and_keyboard_blink_M] "), iErrCode); |
|
868 break; |
|
869 |
|
870 case EMCDisplayOnKbReserved: |
|
871 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
872 iErrCode = MC_Display_on_and_keyboard_reserved_M(); |
|
873 if (iErrCode != KErrNone) |
|
874 { |
|
875 iMcFramework->StepExecuted(KErrGeneral); |
|
876 } |
|
877 LogResult(_L(" @SYMTestCaseID:DEVSRVS-HWRMMC-L-0026 .HWRM [MC_Display_on_and_keyboard_reserved_M] "), iErrCode); |
|
878 break; |
|
879 |
|
880 case EMCDisplayAndKbBlink: |
|
881 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
882 iErrCode = MC_Display_and_keyboard_blink_M(); |
|
883 if (iErrCode != KErrNone) |
|
884 { |
|
885 iMcFramework->StepExecuted(KErrGeneral); |
|
886 } |
|
887 LogResult(_L(" @SYMTestCaseID:DEVSRVS-HWRMMC-L-0027 .HWRM [MC_Display_and_keyboard_blink_M] "), iErrCode); |
|
888 break; |
|
889 |
|
890 case EMCDisplayRGBColor: |
|
891 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
892 iErrCode = MC_Display_RGB_M(); |
|
893 if (iErrCode != KErrNone) |
|
894 { |
|
895 iMcFramework->StepExecuted(KErrGeneral); |
|
896 } |
|
897 LogResult(_L(" @SYMTestCaseID:DEVSRVS-HWRMMC-L-0027A .HWRM [MC_Display_RGB_M1] "), iErrCode); |
|
898 break; |
|
899 |
|
900 case EMCVibraBasicUsage: |
|
901 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
902 iErrCode = MC_Vibra_Basic_Usage_M(); |
|
903 if (iErrCode != KErrNone) |
|
904 { |
|
905 iMcFramework->StepExecuted(KErrGeneral); |
|
906 } |
|
907 LogResult(_L(" @SYMTestCaseID:DEVSRVS-HWRMMC-V-0028 .HWRM [MC_Vibra_Basic_Usage_M] "), iErrCode); |
|
908 break; |
|
909 |
|
910 case EMCCombinedLightAndVibra1: |
|
911 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
912 iErrCode = MC_Combined_light_and_vibra_usage_M(); |
|
913 if (iErrCode != KErrNone) |
|
914 { |
|
915 iMcFramework->StepExecuted(KErrGeneral); |
|
916 } |
|
917 LogResult(_L(" @SYMTestCaseID:DEVSRVS-HWRMMC-LV-0029 .HWRM [MC_Combined_light_and_vibra_usage_M] "), iErrCode); |
|
918 break; |
|
919 |
|
920 case EMCCombinedLightAndVibra2: |
|
921 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
922 iErrCode = MC_Combined_light_and_vibra_usage_2_M(); |
|
923 if (iErrCode != KErrNone) |
|
924 { |
|
925 iMcFramework->StepExecuted(KErrGeneral); |
|
926 } |
|
927 LogResult(_L(" @SYMTestCaseID:DEVSRVS-HWRMMC-LV-0030 .HWRM [MC_Combined_light_and_vibra_usage_2_M] "), iErrCode); |
|
928 break; |
|
929 |
|
930 case EMCFmTxBasicUsage: |
|
931 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
932 iErrCode = MC_FmTx_Basic_Usage_M(); |
|
933 if (iErrCode != KErrNone) |
|
934 { |
|
935 iMcFramework->StepExecuted(KErrGeneral); |
|
936 } |
|
937 LogResult(_L(" @SYMTestCaseID:DEVSRVS-HWRMMC-F-0031 .HWRM [MC_FmTx_Basic_Usage_M] "), iErrCode); |
|
938 break; |
|
939 |
|
940 case EMulticlientTestIdLast: |
|
941 FormatMessageL(EHwrmMessageOpDebug, _L( " Start test case number %d" ), i ); |
|
942 iMcFramework->StopMultiClientTestInSlave( ); |
|
943 break; |
|
944 |
|
945 // End of Multiclient cases |
|
946 |
|
947 |
|
948 // Repeat invalid parameters |
|
949 // Expected to return KErrArgument |
|
950 case ERepeatInvalidParamsTest: |
|
951 FormatMessageL(EHwrmMessageOpDebug,_L(" Start test case %d [%d]"), i, iErrCode); |
|
952 iErrCode = RunRepeatedlyInvalidValues(); |
|
953 FormatMessageL(EHwrmMessageOpDebug,_L(" End test case %d [%d]"), i, iErrCode ); |
|
954 LogResult(_L(" @SYMTestCaseID:DEVSRVS-HWRMMC-LV-0034 .HWRM [Repeated Invalid Values] "), iErrCode, KErrArgument); |
|
955 break; |
|
956 |
|
957 // Vibra test (30 min) |
|
958 case EMaliciousVibraTest: |
|
959 FormatMessageL(EHwrmMessageOpDebug,_L(" Start test case %d [%d]"), i, iErrCode); |
|
960 iErrCode = MaliciousVibra(); |
|
961 FormatMessageL(EHwrmMessageOpDebug,_L(" End test case %d [%d]"), i, iErrCode); |
|
962 LogResult(_L(" @SYMTestCaseID:DEVSRVS-HWRMMC-V-0035 .HWRM [Malicious Vibra Usage] "), iErrCode); |
|
963 break; |
|
964 |
|
965 // Wait charging notify (5 min) |
|
966 case EWaitForChargingNotify: |
|
967 FormatMessageL(EHwrmMessageOpDebug,_L(" Start test case %d [%d]"), i, iErrCode); |
|
968 iErrCode = ChargingNotify(); |
|
969 FormatMessageL(EHwrmMessageOpDebug,_L(" End test case %d [%d]"), i, iErrCode); |
|
970 LogResult(_L(" @SYMTestCaseID:DEVSRVS-HWRMMC-V-0036 .HWRM [Wait Charging Notify] "), iErrCode); |
|
971 |
|
972 break; |
|
973 |
|
974 default: |
|
975 break; |
|
976 |
|
977 |
|
978 } |
|
979 |
|
980 |
|
981 CTestScheduler::StartAndStopL(2000); // Short delay after each test case |
|
982 |
|
983 //iErrCode set to 1 in the beginning. If not changed, no case has been executed |
|
984 if( !iErrCode ) |
|
985 { |
|
986 FormatMessageL(EHwrmMessageOpDebug,_L(" End test case %d, error code [%d]"), i, iErrCode); |
|
987 FormatMessageL(EHwrmMessageOpDebug,_L("")); |
|
988 FormatMessageL(EHwrmMessageOpDebug,_L("#############################################################")); |
|
989 FormatMessageL(EHwrmMessageOpDebug,_L("")); |
|
990 |
|
991 if(iErrCode == KErrNone) |
|
992 { |
|
993 iObserver.InfoMessage(_L("Test case PASSED")); |
|
994 } |
|
995 else |
|
996 { |
|
997 iObserver.InfoMessage(_L("Test case FAILED")); |
|
998 } |
|
999 } |
|
1000 |
|
1001 } |
|
1002 |
|
1003 } |
|
1004 |
|
1005 |
|
1006 |
|
1007 // ----------------------------------------------------------------------------- |
|
1008 // CHwrmTestCaseController::TargetSupported |
|
1009 // ----------------------------------------------------------------------------- |
|
1010 // |
|
1011 TBool CHwrmTestCaseController::TargetSupported( TInt aTarget ) |
|
1012 { |
|
1013 return( iSupportedTargets & aTarget); |
|
1014 } |
|
1015 |
|
1016 |
|
1017 // ----------------------------------------------------------------------------- |
|
1018 // CHwrmTestCaseController::LightTestAllSupportedTargets |
|
1019 // This method |
|
1020 // -runs LightTest for all targets supported by the device defined in CenRep (10200C8C.txt) |
|
1021 // Targets can be removed for this test by defining a mask to targetsToBeSkipped |
|
1022 // -logs results |
|
1023 // ----------------------------------------------------------------------------- |
|
1024 // |
|
1025 void CHwrmTestCaseController::LightTestAllSupportedSDKTargets( TInt aTargetsToBeSkipped ) |
|
1026 { |
|
1027 |
|
1028 TBuf<100> msg( KNullDesC ); |
|
1029 |
|
1030 _LIT( KMessageText, "HWRM [All supported targets test]: target 0x%x" ); |
|
1031 |
|
1032 TInt counter(0); |
|
1033 |
|
1034 TInt testTargets(0); |
|
1035 |
|
1036 testTargets = iSupportedTargets & ( ~aTargetsToBeSkipped ); |
|
1037 |
|
1038 //loop through supported targets mask and execute LightTargetTest if current target is supported |
|
1039 while( testTargets ) |
|
1040 { |
|
1041 |
|
1042 TInt currentTarget = ( 1 << counter ); |
|
1043 |
|
1044 if( testTargets & 1 ) |
|
1045 { |
|
1046 FormatMessageL(EHwrmMessageOpDebug, _L( " All Supported Targets Test, target 0x%x" ), currentTarget ); |
|
1047 iErrCode = LightTargetTestSDK( currentTarget ); |
|
1048 msg.Format( KMessageText, currentTarget ); |
|
1049 LogResult( msg, iErrCode ); |
|
1050 } |
|
1051 else |
|
1052 { |
|
1053 FormatMessageL(EHwrmMessageOpDebug, _L( " All Supported Targets Test, target 0x%x SKIPPED. Target not supported" ), (TInt)currentTarget ); |
|
1054 msg.Format( KMessageText, currentTarget ); |
|
1055 msg.Append(_L(" - SKIPPED. Target not supported" ) ); |
|
1056 LogResult( msg ); |
|
1057 } |
|
1058 |
|
1059 |
|
1060 counter++; |
|
1061 |
|
1062 //remove tested target from the mask |
|
1063 testTargets >>= 1; |
|
1064 |
|
1065 } |
|
1066 } |
|
1067 |
|
1068 void CHwrmTestCaseController::LightTestAllSupportedExtendedTargets( TInt aTargetsToBeSkipped ) |
|
1069 { |
|
1070 |
|
1071 TBuf<100> msg( KNullDesC ); |
|
1072 |
|
1073 _LIT( KMessageText, "HWRM [All supported targets test]: target 0x%x" ); |
|
1074 |
|
1075 TInt counter(0); |
|
1076 |
|
1077 TInt testTargets(0); |
|
1078 |
|
1079 testTargets = iSupportedTargets & ( ~aTargetsToBeSkipped ); |
|
1080 |
|
1081 //loop through supported targets mask and execute LightTargetTest if current target is supported |
|
1082 while( testTargets ) |
|
1083 { |
|
1084 |
|
1085 TInt currentTarget = ( 1 << counter ); |
|
1086 |
|
1087 if( testTargets & 1 ) |
|
1088 { |
|
1089 FormatMessageL(EHwrmMessageOpDebug, _L( " All Supported Targets Test, target 0x%x" ), currentTarget ); |
|
1090 iErrCode = LightTargetTestExtended( currentTarget ); |
|
1091 msg.Format( KMessageText, currentTarget ); |
|
1092 LogResult( msg, iErrCode ); |
|
1093 } |
|
1094 else |
|
1095 { |
|
1096 FormatMessageL(EHwrmMessageOpDebug, _L( " All Supported Targets Test, target 0x%x SKIPPED. Target not supported" ), (TInt)currentTarget ); |
|
1097 msg.Format( KMessageText, currentTarget ); |
|
1098 msg.Append(_L(" - SKIPPED. Target not supported" ) ); |
|
1099 LogResult( msg ); |
|
1100 } |
|
1101 |
|
1102 |
|
1103 counter++; |
|
1104 |
|
1105 //remove tested target from the mask |
|
1106 testTargets >>= 1; |
|
1107 |
|
1108 } |
|
1109 } |
|
1110 |
|
1111 |
|
1112 // ----------------------------------------------------------------------------- |
|
1113 // CHwrmTestCaseController::TestLightOn |
|
1114 // This method |
|
1115 // - call LightOnL method with given parameters |
|
1116 // - Run 100ms delay |
|
1117 // - Print parameters to log |
|
1118 // ----------------------------------------------------------------------------- |
|
1119 // |
|
1120 TInt CHwrmTestCaseController::TestLightOn(TInt aTarget, TInt aDur, TInt aIntens, TBool aFadeIn) |
|
1121 { |
|
1122 TInt errorStatus(KErrNone); |
|
1123 TRAP(errorStatus, iMyLight->LightOnL(aTarget, aDur, aIntens, aFadeIn)); |
|
1124 CTestScheduler::StartAndStopL(100); |
|
1125 FormatMessageL(EHwrmMessageOpDebug,_L(" LightONL ->error:%d"), errorStatus); |
|
1126 return errorStatus; |
|
1127 } |
|
1128 |
|
1129 TInt CHwrmTestCaseController::TestLightOn(TInt aTarget) |
|
1130 { |
|
1131 TInt errorStatus(KErrNone); |
|
1132 TRAP(errorStatus, iMyLight->LightOnL(aTarget)); |
|
1133 CTestScheduler::StartAndStopL(100); |
|
1134 FormatMessageL(EHwrmMessageOpDebug,_L(" LightONL ->error:%d"), errorStatus); |
|
1135 return errorStatus; |
|
1136 } |
|
1137 |
|
1138 TInt CHwrmTestCaseController::TestLightOnColor(TInt aTarget, TInt aDur, THWRMLightColor& aColor) |
|
1139 { |
|
1140 TInt errorStatus(KErrNone); |
|
1141 TRAP(errorStatus, iMyLight->LightOnL(aTarget, aDur, aColor)); |
|
1142 CTestScheduler::StartAndStopL(100); |
|
1143 FormatMessageL(EHwrmMessageOpDebug,_L(" LightONL ->error:%d"), errorStatus); |
|
1144 return errorStatus; |
|
1145 } |
|
1146 |
|
1147 // ----------------------------------------------------------------------------- |
|
1148 // CHwrmTestCaseController::TestLightOff |
|
1149 // This method |
|
1150 // - call LightOffL method with given parameters |
|
1151 // - Run 100ms delay |
|
1152 // - Print parameters to log |
|
1153 // ----------------------------------------------------------------------------- |
|
1154 // |
|
1155 TInt CHwrmTestCaseController::TestLightOff(TInt aTarget, TInt aDuration, TBool aFadeOut) |
|
1156 { |
|
1157 TInt errorStatus(KErrNone); |
|
1158 TRAP(errorStatus, iMyLight->LightOffL(aTarget, aDuration, aFadeOut)); |
|
1159 CTestScheduler::StartAndStopL(100); |
|
1160 FormatMessageL(EHwrmMessageOpDebug,_L(" LightOffL ->error:%d"), errorStatus); |
|
1161 return errorStatus; |
|
1162 } |
|
1163 |
|
1164 TInt CHwrmTestCaseController::TestLightOff(TInt aTarget) |
|
1165 { |
|
1166 TInt errorStatus(KErrNone); |
|
1167 TRAP(errorStatus, iMyLight->LightOffL(aTarget)); |
|
1168 CTestScheduler::StartAndStopL(100); |
|
1169 FormatMessageL(EHwrmMessageOpDebug,_L(" LightOffL ->error:%d"), errorStatus); |
|
1170 return errorStatus; |
|
1171 } |
|
1172 |
|
1173 // ----------------------------------------------------------------------------- |
|
1174 // CHwrmTestCaseController::TestLightBlink |
|
1175 // This method |
|
1176 // - call LightBlinkL method with given parameters |
|
1177 // - Run 100ms delay |
|
1178 // - Print parameters to log |
|
1179 // ----------------------------------------------------------------------------- |
|
1180 // |
|
1181 TInt CHwrmTestCaseController::TestLightBlink(TInt aTarget, |
|
1182 TInt aDuration, |
|
1183 TInt aOnDuration, |
|
1184 TInt aOffDuration, |
|
1185 TInt aIntensity) |
|
1186 { |
|
1187 TInt errorStatus(KErrNone); |
|
1188 TRAP(errorStatus, iMyLight->LightBlinkL(aTarget, aDuration, aOnDuration, aOffDuration, aIntensity)); |
|
1189 CTestScheduler::StartAndStopL(100); |
|
1190 FormatMessageL(EHwrmMessageOpDebug,_L(" LightBlinkL ->error:%d"), errorStatus); |
|
1191 return errorStatus; |
|
1192 } |
|
1193 |
|
1194 TInt CHwrmTestCaseController::TestLightBlink(TInt aTarget, |
|
1195 TInt aDuration) |
|
1196 { |
|
1197 TInt errorStatus(KErrNone); |
|
1198 TRAP(errorStatus, iMyLight->LightBlinkL(aTarget, aDuration)); |
|
1199 CTestScheduler::StartAndStopL(100); |
|
1200 FormatMessageL(EHwrmMessageOpDebug,_L(" LightBlinkL ->error:%d"), errorStatus); |
|
1201 return errorStatus; |
|
1202 } |
|
1203 |
|
1204 TInt CHwrmTestCaseController::TestLightBlink(TInt aTarget) |
|
1205 { |
|
1206 TInt errorStatus(KErrNone); |
|
1207 TRAP(errorStatus, iMyLight->LightBlinkL(aTarget)); |
|
1208 CTestScheduler::StartAndStopL(100); |
|
1209 FormatMessageL(EHwrmMessageOpDebug,_L(" LightBlinkL ->error:%d"), errorStatus); |
|
1210 return errorStatus; |
|
1211 } |
|
1212 |
|
1213 // ----------------------------------------------------------------------------- |
|
1214 // CHwrmTestCaseController::RunTestVibra |
|
1215 // This method |
|
1216 // - call LightBlinkL method with given parameters |
|
1217 // - Run 100ms delay |
|
1218 // - Print parameters to log |
|
1219 // ----------------------------------------------------------------------------- |
|
1220 // |
|
1221 |
|
1222 TInt CHwrmTestCaseController::RunTestVibra( TInt howLong, TInt whatIntensity) |
|
1223 { |
|
1224 TInt errorStatus(KErrNone); |
|
1225 TRAP(errorStatus, iVibra->StartVibraL(howLong, whatIntensity)); |
|
1226 CTestScheduler::StartAndStopL(100); |
|
1227 return errorStatus; |
|
1228 } |
|
1229 |
|
1230 TInt CHwrmTestCaseController::RunTestVibra( TInt howLong ) |
|
1231 { |
|
1232 TInt errorStatus(KErrNone); |
|
1233 TRAP(errorStatus, iVibra->StartVibraL(howLong)); |
|
1234 CTestScheduler::StartAndStopL(100); |
|
1235 return errorStatus; |
|
1236 } |
|
1237 |
|
1238 |
|
1239 TInt CHwrmTestCaseController::StopTestVibra() |
|
1240 { |
|
1241 TInt errorStatus(KErrNone); |
|
1242 TRAP(errorStatus, iVibra->StopVibraL()); |
|
1243 CTestScheduler::StartAndStopL(100); |
|
1244 return errorStatus; |
|
1245 } |
|
1246 |
|
1247 |
|
1248 // ----------------------------------------------------------------------------- |
|
1249 // CHwrmTestCaseController::RunTestFmTx |
|
1250 // This method |
|
1251 // - call EnableL method with given parameters |
|
1252 // - Run 100ms delay |
|
1253 // - Print parameters to log |
|
1254 // ----------------------------------------------------------------------------- |
|
1255 // |
|
1256 |
|
1257 TInt CHwrmTestCaseController::RunTestFmTx( TInt aFrequency ) |
|
1258 { |
|
1259 TInt errorStatus(KErrNone); |
|
1260 TRAP(errorStatus, iFmTx->EnableL(aFrequency)); |
|
1261 CTestScheduler::StartAndStopL(100); |
|
1262 FormatMessageL(EHwrmMessageOpDebug,_L(" EnableL ->error:%d"), errorStatus); |
|
1263 return errorStatus; |
|
1264 } |
|
1265 |
|
1266 |
|
1267 TInt CHwrmTestCaseController::StopTestFmTx() |
|
1268 { |
|
1269 TInt errorStatus(KErrNone); |
|
1270 TRAP(errorStatus, iFmTx->DisableL()); |
|
1271 CTestScheduler::StartAndStopL(100); |
|
1272 FormatMessageL(EHwrmMessageOpDebug,_L(" DisableL ->error:%d"), errorStatus); |
|
1273 return errorStatus; |
|
1274 } |
|
1275 |
|
1276 TInt CHwrmTestCaseController::Verify_RGBColorValue(THWRMLightColor& aColor) |
|
1277 { |
|
1278 TInt colorval; |
|
1279 |
|
1280 RProperty::Get( TUid::Uid( KTestCategory ), KHWRMColorStatus, colorval ); |
|
1281 |
|
1282 if(((colorval>>KHWRMRedShift) & 0xFF) != aColor.iRed) |
|
1283 { |
|
1284 FormatMessageL(EHwrmMessageOpDebug,_L("Red value not correct. Expected=0x%x, Received=0x%x"), ((colorval>>KHWRMRedShift) & 0xFF), aColor.iRed); |
|
1285 return KErrArgument; |
|
1286 } |
|
1287 if(((colorval>>KHWRMGreenShift) & 0xFF) != aColor.iGreen) |
|
1288 { |
|
1289 FormatMessageL(EHwrmMessageOpDebug,_L("Green value not correct. Expected=0x%x, Received=0x%x"), ((colorval>>KHWRMGreenShift) & 0xFF), aColor.iGreen); |
|
1290 return KErrArgument; |
|
1291 } |
|
1292 if((colorval & 0xFF) != aColor.iBlue) |
|
1293 { |
|
1294 FormatMessageL(EHwrmMessageOpDebug,_L("Blue value not correct. Expected=0x%x, Received=0x%x"), (colorval & 0xFF), aColor.iBlue); |
|
1295 return KErrArgument; |
|
1296 } |
|
1297 return KErrNone; |
|
1298 } |
|
1299 |
|
1300 /*******************************************************************************/ |
|
1301 /* M U L T I C L I E N T C A S E S */ |
|
1302 // |
|
1303 // |
|
1304 TInt CHwrmTestCaseController::MC_Display_RGB_S() |
|
1305 { |
|
1306 TInt mcResult; |
|
1307 mcResult = KErrNone; |
|
1308 FormatMessageL(EHwrmMessageOpDebug,_L("MC_Display_RGB_S()")); |
|
1309 iObserver.InfoMessage(_L("MC_Display_RGB_S")); |
|
1310 CHWRMLight::TLightStatus currStatus; |
|
1311 |
|
1312 TRAP( mcResult, iMyLight = CHWRMLight::NewL(this) ); |
|
1313 |
|
1314 if( mcResult == KErrNone ) |
|
1315 { |
|
1316 //Reserve Primary display, Restore current state after reservation, Don't force CoeEnv "on" */ |
|
1317 TRAP(mcResult, iMyLight->ReserveLightL(CHWRMLight::EPrimaryDisplay, ETrue, ETrue)); |
|
1318 |
|
1319 if( mcResult == KErrNone ) |
|
1320 { |
|
1321 THWRMLightColor red; |
|
1322 red.iRed = 0xff; |
|
1323 red.iGreen = 0; |
|
1324 red.iBlue = 0; |
|
1325 |
|
1326 TRAP( mcResult, iMyLight->SetLightColorL(CHWRMLight::EPrimaryDisplay, red)); |
|
1327 |
|
1328 if( mcResult == KErrNone ) |
|
1329 { |
|
1330 mcResult = Verify_RGBColorValue(red); |
|
1331 |
|
1332 if( mcResult == KErrNone ) |
|
1333 { |
|
1334 THWRMLightColor green; |
|
1335 green.iRed = 0; |
|
1336 green.iGreen = 0xff; |
|
1337 green.iBlue = 0; |
|
1338 mcResult = TestLightOnColor(CHWRMLight::EPrimaryDisplay, 10000, green); |
|
1339 |
|
1340 if( mcResult == KErrNone) |
|
1341 { |
|
1342 currStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
1343 |
|
1344 if( currStatus == CHWRMLight::ELightOn ) |
|
1345 { |
|
1346 CTestScheduler::StartAndStopL(5000); |
|
1347 |
|
1348 mcResult = Verify_RGBColorValue(green); |
|
1349 |
|
1350 if( mcResult == KErrNone ) |
|
1351 { |
|
1352 CTestScheduler::StartAndStopL(8000); |
|
1353 |
|
1354 mcResult = Verify_RGBColorValue(red); // base state color |
|
1355 |
|
1356 if( mcResult == KErrNone ) |
|
1357 { |
|
1358 iMyLight->ReleaseLight(CHWRMLight::EPrimaryDisplay); |
|
1359 iMcFramework->StepExecuted(KErrNone); |
|
1360 mcResult = KErrNone; |
|
1361 } |
|
1362 } |
|
1363 } |
|
1364 else |
|
1365 { |
|
1366 FormatMessageL(EHwrmMessageOpDebug,_L(" Expected light status failed. error [%d]"), mcResult); |
|
1367 FormatMessageL(EHwrmMessageOpLog, _L("Expected light status failed. error [%d]"), mcResult); |
|
1368 } |
|
1369 } |
|
1370 } |
|
1371 else |
|
1372 { |
|
1373 FormatMessageL(EHwrmMessageOpDebug,_L(" Verify_RGBColorValue returned error [%d]"), mcResult); |
|
1374 FormatMessageL(EHwrmMessageOpLog, _L("Verify_RGBColorValue returned error [%d]"), mcResult); |
|
1375 } |
|
1376 |
|
1377 } |
|
1378 else |
|
1379 { |
|
1380 FormatMessageL(EHwrmMessageOpDebug,_L(" SetLightColorL returned error [%d]"), mcResult); |
|
1381 FormatMessageL(EHwrmMessageOpLog, _L("SetLightColorL returned error [%d]"), mcResult); |
|
1382 } |
|
1383 } |
|
1384 else |
|
1385 { |
|
1386 FormatMessageL(EHwrmMessageOpDebug,_L(" ReserveLightL returned error [%d]"), mcResult); |
|
1387 FormatMessageL(EHwrmMessageOpLog, _L("ReserveLightL returned error [%d]"), mcResult); |
|
1388 } |
|
1389 } |
|
1390 |
|
1391 delete iMyLight; |
|
1392 return mcResult; |
|
1393 |
|
1394 } |
|
1395 |
|
1396 TInt CHwrmTestCaseController::MC_Display_RGB_M() |
|
1397 { |
|
1398 TInt mcResult; |
|
1399 mcResult = KErrNone; |
|
1400 FormatMessageL(EHwrmMessageOpDebug,_L("MC_Display_RGB_M()")); |
|
1401 iObserver.InfoMessage(_L("MC_Display_RGB_M")); |
|
1402 CHWRMLight::TLightStatus currStatus; |
|
1403 |
|
1404 TRAP( mcResult, iMyLight = CHWRMLight::NewL(this) ); |
|
1405 |
|
1406 if( mcResult == KErrNone ) |
|
1407 { |
|
1408 //Reserve Primary display, Restore current state after reservation, Don't force CoeEnv "on" */ |
|
1409 TRAP(mcResult, iMyLight->ReserveLightL(CHWRMLight::EPrimaryDisplay, ETrue, EFalse)); |
|
1410 |
|
1411 if( mcResult == KErrNone ) |
|
1412 { |
|
1413 THWRMLightColor blue; |
|
1414 blue.iRed = 0; |
|
1415 blue.iGreen = 0; |
|
1416 blue.iBlue = 0xff; |
|
1417 |
|
1418 TRAP( mcResult, iMyLight->SetLightColorL(CHWRMLight::EPrimaryDisplay, blue)); |
|
1419 |
|
1420 if( mcResult == KErrNone ) |
|
1421 { |
|
1422 mcResult = Verify_RGBColorValue(blue); |
|
1423 |
|
1424 if( mcResult == KErrNone ) |
|
1425 { |
|
1426 mcResult = TestLightOff(CHWRMLight::EPrimaryDisplay); |
|
1427 |
|
1428 if( mcResult == KErrNone) |
|
1429 { |
|
1430 currStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
1431 |
|
1432 if( currStatus == CHWRMLight::ELightOff ) |
|
1433 { |
|
1434 mcResult = iMcFramework->StartTestCaseInSlave(EMultiClientCase14); |
|
1435 |
|
1436 if( mcResult == KErrNone ) |
|
1437 { |
|
1438 |
|
1439 mcResult = Verify_RGBColorValue(blue); |
|
1440 |
|
1441 if( mcResult == KErrNone ) |
|
1442 { |
|
1443 |
|
1444 iMyLight->ReleaseLight(CHWRMLight::EPrimaryDisplay); |
|
1445 |
|
1446 iMcFramework->StepExecuted(KErrNone); |
|
1447 mcResult = KErrNone; |
|
1448 } |
|
1449 |
|
1450 } |
|
1451 } |
|
1452 else |
|
1453 { |
|
1454 FormatMessageL(EHwrmMessageOpDebug,_L(" Expected light status failed. error [%d]"), mcResult); |
|
1455 FormatMessageL(EHwrmMessageOpLog, _L("Expected light status failed. error [%d]"), mcResult); |
|
1456 } |
|
1457 } |
|
1458 } |
|
1459 else |
|
1460 { |
|
1461 FormatMessageL(EHwrmMessageOpDebug,_L(" Verify_RGBColorValue returned error [%d]"), mcResult); |
|
1462 FormatMessageL(EHwrmMessageOpLog, _L("Verify_RGBColorValue returned error [%d]"), mcResult); |
|
1463 } |
|
1464 |
|
1465 } |
|
1466 else |
|
1467 { |
|
1468 FormatMessageL(EHwrmMessageOpDebug,_L(" SetLightColorL returned error [%d]"), mcResult); |
|
1469 FormatMessageL(EHwrmMessageOpLog, _L("SetLightColorL returned error [%d]"), mcResult); |
|
1470 } |
|
1471 } |
|
1472 else |
|
1473 { |
|
1474 FormatMessageL(EHwrmMessageOpDebug,_L(" ReserveLightL returned error [%d]"), mcResult); |
|
1475 FormatMessageL(EHwrmMessageOpLog, _L("ReserveLightL returned error [%d]"), mcResult); |
|
1476 } |
|
1477 } |
|
1478 |
|
1479 delete iMyLight; |
|
1480 return mcResult; |
|
1481 |
|
1482 } |
|
1483 |
|
1484 // ----------------------------------------------------------------------------- |
|
1485 // CHwrmTestCaseController::MC_Primary_display_light_M |
|
1486 // Light usage with two applications / This application is on front |
|
1487 // ----------------------------------------------------------------------------- |
|
1488 // |
|
1489 TInt CHwrmTestCaseController::MC_Primary_display_light_M() |
|
1490 { |
|
1491 TInt mcResult; |
|
1492 mcResult = KErrNone; |
|
1493 FormatMessageL(EHwrmMessageOpDebug,_L("MC_Primary_display_light_M()")); |
|
1494 iObserver.InfoMessage(_L("MC_Primary_display_light_M")); |
|
1495 CHWRMLight::TLightStatus currStatus; |
|
1496 //CHWRMLight::TLightStatus origStatus; |
|
1497 |
|
1498 TRAP(mcResult, iMyLight = CHWRMLight::NewL(this)); |
|
1499 |
|
1500 if(mcResult == KErrNone) |
|
1501 { |
|
1502 |
|
1503 //Reserve Primary display, Restore current state after reservation, Don't force CoeEnv "on" */ |
|
1504 TRAP(mcResult, iMyLight->ReserveLightL(CHWRMLight::EPrimaryDisplay, ETrue, EFalse)); |
|
1505 |
|
1506 if (mcResult == KErrNone) |
|
1507 { |
|
1508 //CTestScheduler::StartAndStopL(1000); |
|
1509 |
|
1510 //origStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
1511 |
|
1512 //FormatMessageL(EHwrmMessageOpDebug,_L(" Light reserved while Status:%d"),origStatus); |
|
1513 /********************/ |
|
1514 /* L I G H T O F F */ |
|
1515 /********************/ |
|
1516 |
|
1517 mcResult = TestLightOff(CHWRMLight::EPrimaryDisplay); |
|
1518 |
|
1519 if(mcResult == KErrNone) |
|
1520 { |
|
1521 /* Setting light off succeeded */ |
|
1522 |
|
1523 currStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
1524 if (currStatus == CHWRMLight::ELightOff) |
|
1525 { |
|
1526 /*****************/ |
|
1527 /* Step executed */ |
|
1528 /*****************/ |
|
1529 |
|
1530 mcResult = iMcFramework->StartTestCaseInSlave(EMultiClientCase1); |
|
1531 |
|
1532 /* Peer (background application) does following: |
|
1533 * -------------------------------------------------- |
|
1534 * - Reserve Primary display with higher priority |
|
1535 * - Set Primary Display light blinking for 10 seconds |
|
1536 */ |
|
1537 |
|
1538 if (mcResult == KErrNone) |
|
1539 { |
|
1540 // check light status |
|
1541 currStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
1542 |
|
1543 if(currStatus == CHWRMLight::ELightBlink) |
|
1544 { |
|
1545 /******************/ |
|
1546 /* L I G H T O N */ |
|
1547 /******************/ |
|
1548 mcResult = TestLightOn(CHWRMLight::EPrimaryDisplay, 5000, 75, ETrue); |
|
1549 |
|
1550 if(mcResult == KErrNone) /* Reserved for Slave!!! */ |
|
1551 { |
|
1552 // check light status |
|
1553 currStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
1554 |
|
1555 if(currStatus == CHWRMLight::ELightBlink) |
|
1556 { |
|
1557 /*****************/ |
|
1558 /* Step executed */ |
|
1559 /*****************/ |
|
1560 iMcFramework->StepExecuted(KErrNone); |
|
1561 mcResult = iMcFramework->WaitNextTestStep(); |
|
1562 |
|
1563 /* SLAVE (background application) does following: |
|
1564 * -------------------------------------------------- |
|
1565 * - Idle 10 seconds |
|
1566 * - Release primary display light reservation |
|
1567 * - End test case execution |
|
1568 */ |
|
1569 |
|
1570 if (mcResult == KErrNone) |
|
1571 { |
|
1572 /* Light reservation has returned back to this application */ |
|
1573 |
|
1574 currStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
1575 |
|
1576 if(currStatus == CHWRMLight::ELightOff) |
|
1577 { |
|
1578 /* Light status should now be OFF because it was the original setting before peer application reserved it */ |
|
1579 |
|
1580 /******************/ |
|
1581 /* L I G H T O N */ |
|
1582 /******************/ |
|
1583 mcResult = TestLightOn(CHWRMLight::EPrimaryDisplay, 5000, 100, ETrue); |
|
1584 |
|
1585 if (mcResult == KErrNone) |
|
1586 { |
|
1587 /* Light on succeeded */ |
|
1588 currStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
1589 if (currStatus == CHWRMLight::ELightOn) |
|
1590 { |
|
1591 CTestScheduler::StartAndStopL(5000); |
|
1592 |
|
1593 currStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
1594 if(currStatus == CHWRMLight::ELightOff) |
|
1595 { |
|
1596 /*****************/ |
|
1597 /* Release light */ |
|
1598 /*****************/ |
|
1599 iMyLight->ReleaseLight(CHWRMLight::EPrimaryDisplay); |
|
1600 |
|
1601 mcResult = KErrNone; |
|
1602 |
|
1603 } |
|
1604 else |
|
1605 { |
|
1606 FormatMessageL(EHwrmMessageOpDebug,_L(" wrong light status %d expected ELightOff"), currStatus); |
|
1607 //iObserver.LogMessage(_L(" Wrong light status [%d]. Expected [ELightOff]"), currStatus); |
|
1608 FormatMessageL(EHwrmMessageOpLog, _L("Wrong light status [%d]. Expected [ELightOff]"), currStatus); |
|
1609 mcResult = KErrGeneral; |
|
1610 } |
|
1611 } |
|
1612 else |
|
1613 { |
|
1614 // Wrong status |
|
1615 FormatMessageL(EHwrmMessageOpDebug,_L(" wrong light status %d expected ELightOn"), currStatus); |
|
1616 FormatMessageL(EHwrmMessageOpLog, _L("Wrong light status [%d]. Expected [ELightOn]"), currStatus); |
|
1617 mcResult = KErrGeneral; |
|
1618 } |
|
1619 } |
|
1620 else |
|
1621 { |
|
1622 FormatMessageL(EHwrmMessageOpDebug,_L(" error:%d"), mcResult); |
|
1623 FormatMessageL(EHwrmMessageOpLog, _L("TestLightOn returned error [%d]"), mcResult); |
|
1624 mcResult = KErrGeneral; |
|
1625 } |
|
1626 } |
|
1627 else |
|
1628 { |
|
1629 FormatMessageL(EHwrmMessageOpDebug,_L(" Wrong light status [%d]. Expected [ELightOff]"), currStatus); |
|
1630 FormatMessageL(EHwrmMessageOpLog, _L("Wrong light status [%d]. Expected [ELightOff]"), currStatus); |
|
1631 mcResult = KErrGeneral; |
|
1632 } |
|
1633 |
|
1634 } |
|
1635 else |
|
1636 { |
|
1637 // Error happened peer. End test, report result and clean situation |
|
1638 // Peer should clean itself and be ready for next test case |
|
1639 FormatMessageL(EHwrmMessageOpDebug,_L(" peer error:%d"), mcResult); |
|
1640 FormatMessageL(EHwrmMessageOpLog, _L("error from peer [%d]"), mcResult); |
|
1641 } |
|
1642 |
|
1643 } |
|
1644 else |
|
1645 { |
|
1646 FormatMessageL(EHwrmMessageOpDebug,_L(" wrong light status [%d]. Expected [ELightBlink]"), currStatus); |
|
1647 FormatMessageL(EHwrmMessageOpLog, _L("wrong light status [%d]. Expected [ELightBlink]"), currStatus); |
|
1648 mcResult = KErrGeneral; |
|
1649 } |
|
1650 } |
|
1651 else |
|
1652 { |
|
1653 FormatMessageL(EHwrmMessageOpDebug,_L(" TestLightOn returned wrong error:%d"), mcResult); |
|
1654 FormatMessageL(EHwrmMessageOpLog, _L("TestLightOn returned wrong error [%d]"), mcResult); |
|
1655 mcResult = KErrGeneral; |
|
1656 } |
|
1657 } |
|
1658 else |
|
1659 { |
|
1660 FormatMessageL(EHwrmMessageOpDebug,_L(" wrong light status [%d]. Expected [ELightBlink]"), currStatus); |
|
1661 FormatMessageL(EHwrmMessageOpLog, _L("wrong light status [%d]. Expected [ELightBlink]"), currStatus); |
|
1662 mcResult = KErrGeneral; |
|
1663 } |
|
1664 } |
|
1665 else |
|
1666 { |
|
1667 // Error happened peer. End test, report result and clean situation |
|
1668 // Peer should clean itself and be ready for next test case |
|
1669 FormatMessageL(EHwrmMessageOpDebug,_L(" peer returned error: [%d]"), mcResult); |
|
1670 FormatMessageL(EHwrmMessageOpLog, _L("peer returned error: [%d]"), mcResult); |
|
1671 } |
|
1672 } |
|
1673 else |
|
1674 { |
|
1675 FormatMessageL(EHwrmMessageOpDebug,_L(" wrong light status [%d]. Expected [ELightOff]"), currStatus); |
|
1676 FormatMessageL(EHwrmMessageOpLog, _L("wrong light status [%d], Expected [ELightOff]"), currStatus); |
|
1677 mcResult = KErrGeneral; |
|
1678 } |
|
1679 } |
|
1680 else |
|
1681 { |
|
1682 FormatMessageL(EHwrmMessageOpDebug,_L(" TestLightOff returned error [%d]"), mcResult); |
|
1683 FormatMessageL(EHwrmMessageOpLog, _L("TestLightOff returned error [%d]"), mcResult); |
|
1684 mcResult = KErrGeneral; |
|
1685 } |
|
1686 } |
|
1687 else |
|
1688 { |
|
1689 FormatMessageL(EHwrmMessageOpDebug,_L(" ReserveLightL returned error [%d]"), mcResult); |
|
1690 FormatMessageL(EHwrmMessageOpLog, _L("ReserveLightL returned error [%d]"), mcResult); |
|
1691 } |
|
1692 |
|
1693 // Q: Mitä tapahtuu jos light-instanssi tuhotaan vapauttamatta targettia? |
|
1694 } |
|
1695 |
|
1696 delete iMyLight; |
|
1697 return mcResult; |
|
1698 |
|
1699 } |
|
1700 |
|
1701 // ----------------------------------------------------------------------------- |
|
1702 // CHwrmTestCaseController::MC_Display_on_and_keyboard_blink_M() |
|
1703 // |
|
1704 // ----------------------------------------------------------------------------- |
|
1705 // |
|
1706 TInt CHwrmTestCaseController::MC_Display_on_and_keyboard_blink_M() |
|
1707 { |
|
1708 TInt mcResult; |
|
1709 mcResult = KErrNone; |
|
1710 |
|
1711 iObserver.InfoMessage(_L("MC_Display_on_and_keyboard_blink_M")); |
|
1712 FormatMessageL(EHwrmMessageOpDebug,_L("MC_Display_on_and_keyboard_blink_M()")); |
|
1713 |
|
1714 CHWRMLight::TLightStatus keybStatus; |
|
1715 CHWRMLight::TLightStatus dispStatus; |
|
1716 //CHWRMLight::TLightStatus origDispStatus; |
|
1717 |
|
1718 TRAP(mcResult, iMyLight = CHWRMLight::NewL(this)); |
|
1719 |
|
1720 if(mcResult == KErrNone) |
|
1721 { |
|
1722 |
|
1723 /*****************/ |
|
1724 /* Step executed */ |
|
1725 /*****************/ |
|
1726 |
|
1727 TInt mcResult = iMcFramework->StartTestCaseInSlave(EMultiClientCase2); |
|
1728 |
|
1729 if (mcResult == KErrNone) |
|
1730 { |
|
1731 /* Step executed succesfully by peer */ |
|
1732 |
|
1733 /* Query keyboard status */ |
|
1734 keybStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
1735 dispStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
1736 |
|
1737 if (keybStatus == CHWRMLight::ELightBlink) |
|
1738 { |
|
1739 /* OK Keyboard status is Blink (set in peer application) */ |
|
1740 |
|
1741 /* Reserve Primary Display light */ |
|
1742 TRAP(mcResult, iMyLight->ReserveLightL(CHWRMLight::EPrimaryDisplay, ETrue, ETrue)); |
|
1743 |
|
1744 if ( mcResult == KErrNone) |
|
1745 { |
|
1746 /*******************/ |
|
1747 /* L I G H T ON */ |
|
1748 /*******************/ |
|
1749 mcResult = TestLightOn(CHWRMLight::EPrimaryDisplay, 5000, 1, ETrue); |
|
1750 |
|
1751 /* Check light status */ |
|
1752 dispStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
1753 keybStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
1754 |
|
1755 if (mcResult == KErrNone && dispStatus == CHWRMLight::ELightOn && keybStatus == CHWRMLight::ELightBlink) |
|
1756 { |
|
1757 /* Pause 5s */ |
|
1758 CTestScheduler::StartAndStopL(5000); |
|
1759 |
|
1760 /* Release primary display light reservation */ |
|
1761 iMyLight->ReleaseLight(CHWRMLight::EPrimaryDisplay); |
|
1762 |
|
1763 /*****************/ |
|
1764 /* Step executed */ |
|
1765 /*****************/ |
|
1766 iMcFramework->StepExecuted(KErrNone); |
|
1767 |
|
1768 mcResult = iMcFramework->WaitNextTestStep(); |
|
1769 |
|
1770 if (mcResult != KErrNone) |
|
1771 { |
|
1772 FormatMessageL(EHwrmMessageOpDebug,_L("peer returned error [%d]"), mcResult); |
|
1773 FormatMessageL(EHwrmMessageOpLog, _L("Slave returned error: [%d]"), mcResult); |
|
1774 } |
|
1775 //************************* |
|
1776 // else -> Case passed OK |
|
1777 //************************* |
|
1778 } |
|
1779 else |
|
1780 { |
|
1781 /* Light status was wrong or setting of light failed */ |
|
1782 FormatMessageL(EHwrmMessageOpDebug,_L(" display status:%d Keyboard status:%d, Error:%d"), dispStatus, keybStatus, mcResult); |
|
1783 FormatMessageL(EHwrmMessageOpLog, _L("display status:%d Keyboard status:%d, Error:%d"),dispStatus, keybStatus, mcResult); |
|
1784 mcResult = KErrGeneral; |
|
1785 } |
|
1786 } |
|
1787 else |
|
1788 { |
|
1789 FormatMessageL(EHwrmMessageOpDebug,_L(" reservation failed. Error:%d"), mcResult); |
|
1790 FormatMessageL(EHwrmMessageOpLog, _L("reservation failed. Error:%d"), mcResult); |
|
1791 } |
|
1792 } |
|
1793 else |
|
1794 { |
|
1795 // Wrong keyboard status |
|
1796 FormatMessageL(EHwrmMessageOpDebug,_L(" wrong keyboard status:%d"),keybStatus); |
|
1797 FormatMessageL(EHwrmMessageOpLog, _L("wrong keyboard status:%d"),keybStatus); |
|
1798 mcResult = KErrGeneral; |
|
1799 } |
|
1800 } |
|
1801 } |
|
1802 delete iMyLight; |
|
1803 return mcResult; |
|
1804 |
|
1805 } |
|
1806 |
|
1807 // ----------------------------------------------------------------------------- |
|
1808 // CHwrmTestCaseController:: |
|
1809 // |
|
1810 // ----------------------------------------------------------------------------- |
|
1811 // |
|
1812 |
|
1813 TInt CHwrmTestCaseController::MC_Display_on_and_keyboard_reserved_M() |
|
1814 { |
|
1815 TInt mcResult; |
|
1816 mcResult = KErrNone; |
|
1817 iObserver.InfoMessage(_L("MC_Display_on_and_keyboard_reserved_M")); |
|
1818 FormatMessageL(EHwrmMessageOpDebug,_L("MC_Display_on_and_keyboard_reserved_M()")); |
|
1819 //CHWRMLight::TLightStatus currStatus; |
|
1820 CHWRMLight::TLightStatus displayStatus; |
|
1821 CHWRMLight::TLightStatus keybStatus; |
|
1822 CHWRMLight::TLightStatus originalKStatus; |
|
1823 CHWRMLight::TLightStatus originalDStatus; |
|
1824 |
|
1825 TRAP(mcResult, iMyLight = CHWRMLight::NewL(this)); |
|
1826 |
|
1827 if(mcResult == KErrNone) |
|
1828 { |
|
1829 |
|
1830 //Reserve Primary display and keyboard |
|
1831 TRAP(mcResult, iMyLight->ReserveLightL(CHWRMLight::EPrimaryDisplayAndKeyboard, ETrue, EFalse)); |
|
1832 |
|
1833 if (mcResult == KErrNone) |
|
1834 { |
|
1835 |
|
1836 CTestScheduler::StartAndStopL(1000); |
|
1837 |
|
1838 // Valojen statusten kysely testin alussa: |
|
1839 originalDStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
1840 originalKStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
1841 |
|
1842 mcResult = iMcFramework->StartTestCaseInSlave(EMultiClientCase3); |
|
1843 |
|
1844 if (mcResult == KErrNone) |
|
1845 { |
|
1846 // Tarkista että valojen statukset ei ole muuttuneet alkutilanteesta |
|
1847 displayStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
1848 keybStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
1849 |
|
1850 if(displayStatus == originalDStatus && keybStatus == originalKStatus) |
|
1851 { |
|
1852 |
|
1853 mcResult = TestLightOn(CHWRMLight::EPrimaryDisplayAndKeyboard); |
|
1854 |
|
1855 displayStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
1856 keybStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
1857 |
|
1858 if(mcResult == KErrNone && displayStatus == CHWRMLight::ELightOn && keybStatus == CHWRMLight::ELightOn) |
|
1859 { |
|
1860 CTestScheduler::StartAndStopL(5000); |
|
1861 |
|
1862 mcResult = TestLightOff(CHWRMLight::EPrimaryDisplay); |
|
1863 |
|
1864 displayStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
1865 keybStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
1866 |
|
1867 if (mcResult == KErrNone && displayStatus == CHWRMLight::ELightOff && keybStatus == CHWRMLight::ELightOn) |
|
1868 { |
|
1869 /*****************************/ |
|
1870 /* Test executed succesfully */ |
|
1871 /*****************************/ |
|
1872 mcResult = KErrNone; |
|
1873 } |
|
1874 else |
|
1875 { |
|
1876 // Wrong status or error |
|
1877 FormatMessageL(EHwrmMessageOpDebug,_L(" light off failed. Error:%d, Display status:[%d] Keyboard status:[%d]"),mcResult, displayStatus, keybStatus); |
|
1878 FormatMessageL(EHwrmMessageOpLog, _L("light off failed. Error:%d, Display status:[%d] Keyboard status:[%d]"), mcResult, displayStatus, keybStatus); |
|
1879 mcResult = KErrGeneral; |
|
1880 } |
|
1881 } |
|
1882 else |
|
1883 { |
|
1884 FormatMessageL(EHwrmMessageOpDebug,_L(" light on failed. Error:%d, Display status:[%d] Keyboard status:[%d]"), mcResult, displayStatus, keybStatus); |
|
1885 FormatMessageL(EHwrmMessageOpLog, _L("light on failed. Error:%d, Display status:[%d] Keyboard status:[%d]"), mcResult, displayStatus, keybStatus); |
|
1886 mcResult = KErrGeneral; |
|
1887 } |
|
1888 } |
|
1889 else |
|
1890 { |
|
1891 FormatMessageL(EHwrmMessageOpDebug,_L(" original light status did not remain. Display:%d,%d, Keyboard:%d,%d"),displayStatus,originalDStatus, keybStatus, originalKStatus); |
|
1892 FormatMessageL(EHwrmMessageOpLog, _L("original light status did not remain. Display:%d,%d, Keyboard:%d,%d"),displayStatus,originalDStatus, keybStatus, originalKStatus); |
|
1893 mcResult = KErrGeneral; |
|
1894 } |
|
1895 } |
|
1896 else |
|
1897 { |
|
1898 // Testi feilasi tausta-aplikaatiossa |
|
1899 FormatMessageL(EHwrmMessageOpDebug,_L(" execution failed peer. Error:%d"), mcResult); |
|
1900 FormatMessageL(EHwrmMessageOpLog, _L("execution failed peer. Error:%d"), mcResult); |
|
1901 mcResult = KErrGeneral; |
|
1902 } |
|
1903 |
|
1904 iMyLight->ReleaseLight(CHWRMLight::EPrimaryDisplayAndKeyboard); |
|
1905 } |
|
1906 else |
|
1907 { |
|
1908 FormatMessageL(EHwrmMessageOpDebug,_L(" reservation failed. Error:%d"), mcResult); |
|
1909 FormatMessageL(EHwrmMessageOpLog, _L("reservation failed. Error:%d"), mcResult); |
|
1910 mcResult = KErrGeneral; |
|
1911 } |
|
1912 |
|
1913 } |
|
1914 delete iMyLight; |
|
1915 return mcResult; |
|
1916 |
|
1917 } |
|
1918 |
|
1919 // ----------------------------------------------------------------------------- |
|
1920 // CHwrmTestCaseController::MC_Display_and_keyboard_blink_M() |
|
1921 // |
|
1922 // ----------------------------------------------------------------------------- |
|
1923 // |
|
1924 |
|
1925 TInt CHwrmTestCaseController::MC_Display_and_keyboard_blink_M() |
|
1926 { |
|
1927 TInt mcResult; |
|
1928 mcResult = KErrNone; |
|
1929 |
|
1930 iObserver.InfoMessage(_L("MC_Display_and_keyboard_blink_M")); |
|
1931 FormatMessageL(EHwrmMessageOpDebug,_L("MC_Display_and_keyboard_blink_M()")); |
|
1932 CHWRMLight::TLightStatus displayStatus; |
|
1933 CHWRMLight::TLightStatus keybStatus; |
|
1934 //CHWRMLight::TLightStatus origDispStatus; |
|
1935 //CHWRMLight::TLightStatus origKeybStatus; |
|
1936 |
|
1937 TRAP(mcResult, iMyLight = CHWRMLight::NewL(this)); |
|
1938 |
|
1939 if(mcResult == KErrNone) |
|
1940 { |
|
1941 |
|
1942 //Reserve Primary display and keyboard |
|
1943 TRAP(mcResult, iMyLight->ReserveLightL(CHWRMLight::EPrimaryDisplayAndKeyboard, ETrue, EFalse)); |
|
1944 |
|
1945 //origDispStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
1946 //origKeybStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
1947 |
|
1948 if (mcResult == KErrNone) |
|
1949 { |
|
1950 /*****************/ |
|
1951 /* Step executed */ |
|
1952 /*****************/ |
|
1953 |
|
1954 mcResult = iMcFramework->StartTestCaseInSlave(EMultiClientCase4); |
|
1955 |
|
1956 if (mcResult == KErrNone) |
|
1957 { |
|
1958 /************************/ |
|
1959 /* L I G H T B L I N K */ |
|
1960 /************************/ |
|
1961 |
|
1962 mcResult = TestLightBlink(CHWRMLight::EPrimaryDisplayAndKeyboard, 5000, 1000, 1000, 66); |
|
1963 |
|
1964 displayStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
1965 keybStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
1966 |
|
1967 if (mcResult == KErrNone && displayStatus == CHWRMLight::ELightBlink && keybStatus == CHWRMLight::ELightBlink) |
|
1968 { |
|
1969 |
|
1970 CTestScheduler::StartAndStopL(5000); |
|
1971 |
|
1972 mcResult = TestLightOn(CHWRMLight::EPrimaryDisplayAndKeyboard); |
|
1973 |
|
1974 displayStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
1975 keybStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
1976 |
|
1977 if( displayStatus == CHWRMLight::ELightOn && keybStatus == CHWRMLight::ELightOn ) |
|
1978 { |
|
1979 /*****************/ |
|
1980 /* Step executed */ |
|
1981 /*****************/ |
|
1982 iMcFramework->StepExecuted(KErrNone); |
|
1983 |
|
1984 mcResult = iMcFramework->WaitNextTestStep(); |
|
1985 |
|
1986 if (mcResult != KErrNone) |
|
1987 { |
|
1988 // Tapaus feilasi toisessa aplikaatiossa |
|
1989 FormatMessageL(EHwrmMessageOpDebug,_L(" test execution failed in peer application. Error:%d"), mcResult); |
|
1990 FormatMessageL(EHwrmMessageOpLog, _L("test execution failed in peer application. Error:%d"), mcResult); |
|
1991 } |
|
1992 } |
|
1993 else |
|
1994 { |
|
1995 FormatMessageL(EHwrmMessageOpDebug,_L(" wrong light status. Display:%d Keyboard:%d"), displayStatus, keybStatus); |
|
1996 FormatMessageL(EHwrmMessageOpLog, _L("wrong light status. Display:%d Keyboard:%d"), displayStatus, keybStatus); |
|
1997 mcResult = KErrGeneral; |
|
1998 } |
|
1999 } |
|
2000 else |
|
2001 { |
|
2002 FormatMessageL(EHwrmMessageOpDebug,_L(" light blink failed Display:%d Keyboard:%d Error:%d"), displayStatus, keybStatus, mcResult); |
|
2003 FormatMessageL(EHwrmMessageOpLog, _L("light blink failed Display:%d Keyboard:%d Error:%d"), displayStatus, keybStatus, mcResult); |
|
2004 mcResult = KErrGeneral; |
|
2005 } |
|
2006 } |
|
2007 else |
|
2008 { |
|
2009 FormatMessageL(EHwrmMessageOpDebug,_L(" test failed in peer application. Error:%d"), mcResult); |
|
2010 FormatMessageL(EHwrmMessageOpLog, _L("test failed in peer application. Error:%d"), mcResult); |
|
2011 } |
|
2012 |
|
2013 iMyLight->ReleaseLight(CHWRMLight::EPrimaryDisplayAndKeyboard); |
|
2014 |
|
2015 } |
|
2016 } |
|
2017 delete iMyLight; |
|
2018 return mcResult; |
|
2019 } |
|
2020 |
|
2021 // ----------------------------------------------------------------------------- |
|
2022 // CHwrmTestCaseController::Verify_MCFramework_M |
|
2023 // Master side test case to verify McFramework functionality |
|
2024 // ----------------------------------------------------------------------------- |
|
2025 // |
|
2026 TInt CHwrmTestCaseController::Verify_MCFramework_M() |
|
2027 { |
|
2028 |
|
2029 TInt mcResult; |
|
2030 mcResult = KErrNone; |
|
2031 iObserver.InfoMessage(_L("Verify_MCFramework_M")); |
|
2032 FormatMessageL(EHwrmMessageOpDebug,_L("Verify_MCFramework_M() starting")); |
|
2033 iObserver.InfoMessage(_L("Verify_MCFramework_M")); |
|
2034 |
|
2035 CTestScheduler::StartAndStopL(1000); |
|
2036 |
|
2037 mcResult = iMcFramework->StartTestCaseInSlave(EMultiClientCase6); |
|
2038 /* <- Käynnistää testin uosritukset taustalla ja jää odottamaan vastausta (stepin tulosta) */ |
|
2039 |
|
2040 CTestScheduler::StartAndStopL(1000); // ootellaan sekunti |
|
2041 |
|
2042 iMcFramework->StepExecuted(KErrNone); // käynnistää suorituksen taustalla |
|
2043 mcResult = iMcFramework->WaitNextTestStep(); // menee odottamaan stepin tulosta |
|
2044 |
|
2045 FormatMessageL(EHwrmMessageOpDebug,_L("Verify_MCFramework_M() done")); |
|
2046 |
|
2047 return mcResult; |
|
2048 |
|
2049 } |
|
2050 |
|
2051 // ----------------------------------------------------------------------------- |
|
2052 // CHwrmTestCaseController::MC_Vibra_Basic_Usage_M |
|
2053 // |
|
2054 // ----------------------------------------------------------------------------- |
|
2055 // |
|
2056 TInt CHwrmTestCaseController::MC_Vibra_Basic_Usage_M() |
|
2057 { |
|
2058 TInt mcResult; |
|
2059 mcResult = KErrNone; |
|
2060 |
|
2061 iObserver.InfoMessage(_L("MC_Vibra_Basic_Usage_M")); |
|
2062 FormatMessageL(EHwrmMessageOpDebug,_L("MC_Vibra_Basic_Usage_M()")); |
|
2063 // CRepository* iSession; |
|
2064 CHWRMVibra::TVibraStatus vibraStatus; |
|
2065 |
|
2066 // iSession = CRepository::NewL(KCRUidVibraCtrl); |
|
2067 |
|
2068 TRAP(mcResult, iVibra = CHWRMVibra::NewL()); |
|
2069 if(mcResult == KErrNone) |
|
2070 { |
|
2071 |
|
2072 iSession->Set(KVibraCtrlProfileVibraEnabled, 1); |
|
2073 |
|
2074 /* Reserve Vibra */ |
|
2075 TRAP(mcResult, iVibra->ReserveVibraL(ETrue, EFalse)); |
|
2076 |
|
2077 if (mcResult == KErrNone) |
|
2078 { |
|
2079 /*****************/ |
|
2080 /* Step executed */ |
|
2081 /*****************/ |
|
2082 |
|
2083 mcResult = iMcFramework->StartTestCaseInSlave(EMultiClientCase5); |
|
2084 |
|
2085 if (mcResult == KErrNone) |
|
2086 { |
|
2087 /******************/ |
|
2088 /* V I B R A O N */ |
|
2089 /******************/ |
|
2090 |
|
2091 mcResult = RunTestVibra(5000); // Run vibra 5s |
|
2092 if (mcResult == KErrNone) |
|
2093 { |
|
2094 // Vibra start OK |
|
2095 CTestScheduler::StartAndStopL(100); |
|
2096 // Check status |
|
2097 vibraStatus = iVibra->VibraStatus(); |
|
2098 /* Should be stopped because vibra is reserved to another application */ |
|
2099 if(vibraStatus == CHWRMVibra::EVibraStatusStopped) |
|
2100 { |
|
2101 CTestScheduler::StartAndStopL(5000); |
|
2102 |
|
2103 // Check status |
|
2104 vibraStatus = iVibra->VibraStatus(); |
|
2105 if(vibraStatus == CHWRMVibra::EVibraStatusStopped) |
|
2106 { |
|
2107 /*****************/ |
|
2108 /* Step executed */ |
|
2109 /*****************/ |
|
2110 iMcFramework->StepExecuted(KErrNone); |
|
2111 mcResult = iMcFramework->WaitNextTestStep(); |
|
2112 |
|
2113 if( mcResult == KErrNone) |
|
2114 { |
|
2115 |
|
2116 CTestScheduler::StartAndStopL(500); |
|
2117 |
|
2118 vibraStatus = iVibra->VibraStatus(); |
|
2119 if(vibraStatus == CHWRMVibra::EVibraStatusOn) |
|
2120 { |
|
2121 /*****************/ |
|
2122 /* Step executed */ |
|
2123 /*****************/ |
|
2124 iMcFramework->StepExecuted(KErrNone); |
|
2125 mcResult = iMcFramework->WaitNextTestStep(); |
|
2126 |
|
2127 if( mcResult == KErrNone) |
|
2128 { |
|
2129 // Test succeeded peer |
|
2130 // Vibra is no longer suspended |
|
2131 |
|
2132 /******************/ |
|
2133 /* V I B R A O N */ |
|
2134 /******************/ |
|
2135 mcResult = RunTestVibra(5000); // Run vibra 5s |
|
2136 if (mcResult == KErrNone) |
|
2137 { |
|
2138 CTestScheduler::StartAndStopL(100); |
|
2139 |
|
2140 vibraStatus = iVibra->VibraStatus(); |
|
2141 |
|
2142 if(vibraStatus != CHWRMVibra::EVibraStatusOn) |
|
2143 { |
|
2144 // wrong status |
|
2145 FormatMessageL(EHwrmMessageOpDebug,_L(" Wrong vibra status (%d), expected ON"),vibraStatus); |
|
2146 mcResult = KErrGeneral; |
|
2147 } |
|
2148 } |
|
2149 else |
|
2150 { |
|
2151 // Vibra start failed |
|
2152 FormatMessageL(EHwrmMessageOpDebug,_L(" Vibra start failed. Error(%d)"),mcResult); |
|
2153 } |
|
2154 } |
|
2155 else |
|
2156 { |
|
2157 // Test failed peer |
|
2158 FormatMessageL(EHwrmMessageOpDebug,_L(" Test failed peer. Reason(%d)"),mcResult); |
|
2159 } |
|
2160 |
|
2161 } |
|
2162 else |
|
2163 { |
|
2164 // wrong status |
|
2165 FormatMessageL(EHwrmMessageOpDebug,_L(" Wrong vibra status (%d), expected ON "), vibraStatus); |
|
2166 mcResult = KErrGeneral; |
|
2167 } |
|
2168 } |
|
2169 else |
|
2170 { |
|
2171 // step failed peer |
|
2172 FormatMessageL(EHwrmMessageOpDebug,_L(" Test failed @ peer. Reason(%d)"),mcResult); |
|
2173 } |
|
2174 |
|
2175 } |
|
2176 else |
|
2177 { |
|
2178 // wrong vibra status |
|
2179 FormatMessageL(EHwrmMessageOpDebug,_L(" Wrong vibra status (%d), expected STOPPED"),vibraStatus); |
|
2180 mcResult = KErrGeneral; |
|
2181 } |
|
2182 } |
|
2183 else |
|
2184 { |
|
2185 // wrong status |
|
2186 FormatMessageL(EHwrmMessageOpDebug,_L(" Wrong vibra status (%d), expected ON"),vibraStatus); |
|
2187 mcResult = KErrGeneral; |
|
2188 } |
|
2189 } |
|
2190 else |
|
2191 { |
|
2192 // Start vibra failed |
|
2193 FormatMessageL(EHwrmMessageOpDebug,_L(" Vibra start failed. Reason(%d)"),mcResult); |
|
2194 } |
|
2195 } |
|
2196 else |
|
2197 { |
|
2198 FormatMessageL(EHwrmMessageOpDebug,_L(" Test failed @ peer. Reason(%d)"),mcResult); |
|
2199 } |
|
2200 |
|
2201 iVibra->ReleaseVibra(); |
|
2202 |
|
2203 } |
|
2204 else |
|
2205 { |
|
2206 // Varaus epäonnistui |
|
2207 FormatMessageL(EHwrmMessageOpDebug,_L(" Reservation failed"), mcResult); |
|
2208 } |
|
2209 |
|
2210 } |
|
2211 |
|
2212 delete iVibra; iVibra = NULL; |
|
2213 return mcResult; |
|
2214 |
|
2215 } |
|
2216 |
|
2217 // ----------------------------------------------------------------------------- |
|
2218 // CHwrmTestCaseController::MC_Combined_light_and_vibra_usage_M |
|
2219 // |
|
2220 // ----------------------------------------------------------------------------- |
|
2221 // |
|
2222 TInt CHwrmTestCaseController::MC_Combined_light_and_vibra_usage_M() |
|
2223 { |
|
2224 TInt mcResult; |
|
2225 mcResult = KErrNone; |
|
2226 iObserver.InfoMessage(_L("MC_Combined_light_and_vibra_usage_M")); |
|
2227 // CRepository* iSession; |
|
2228 CHWRMVibra::TVibraStatus vibraStatus; |
|
2229 CHWRMLight::TLightStatus displayStatus; |
|
2230 CHWRMLight::TLightStatus keybStatus; |
|
2231 |
|
2232 // iSession = CRepository::NewL(KCRUidVibraCtrl); |
|
2233 iSession->Set(KVibraCtrlProfileVibraEnabled, 1); |
|
2234 |
|
2235 TRAP(mcResult, iVibra = CHWRMVibra::NewL()); |
|
2236 { |
|
2237 // |
|
2238 // OG 13/03/07 |
|
2239 if (mcResult != KErrNone) |
|
2240 { |
|
2241 return mcResult; |
|
2242 } |
|
2243 // |
|
2244 |
|
2245 TRAP(mcResult, iMyLight = CHWRMLight::NewL(this)); |
|
2246 if(mcResult == KErrNone) |
|
2247 { |
|
2248 |
|
2249 //Reserve Primary display and keyboard |
|
2250 TRAP(mcResult, iMyLight->ReserveLightL(CHWRMLight::EPrimaryDisplayAndKeyboard, ETrue, EFalse)); |
|
2251 //origDispStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
2252 //origKeybStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
2253 |
|
2254 /* Reserve Vibra */ |
|
2255 TRAP(mcResult, iVibra->ReserveVibraL(ETrue, EFalse)); |
|
2256 if (mcResult == KErrNone) |
|
2257 { |
|
2258 TRAP(mcResult, iMyLight->ReserveLightL(CHWRMLight::EPrimaryDisplayAndKeyboard, ETrue, ETrue)); |
|
2259 |
|
2260 if (mcResult == KErrNone) |
|
2261 { |
|
2262 /******************/ |
|
2263 /* V I B R A O N */ |
|
2264 /******************/ |
|
2265 |
|
2266 mcResult = RunTestVibra(0,75); |
|
2267 |
|
2268 if (mcResult == KErrNone) |
|
2269 { |
|
2270 vibraStatus = iVibra->VibraStatus(); |
|
2271 |
|
2272 if (vibraStatus == CHWRMVibra::EVibraStatusOn ) |
|
2273 { |
|
2274 /************************/ |
|
2275 /* L I G H T B L I N K */ |
|
2276 /************************/ |
|
2277 mcResult = TestLightBlink(CHWRMLight::EPrimaryDisplayAndKeyboard); |
|
2278 |
|
2279 if(mcResult == KErrNone) |
|
2280 { |
|
2281 |
|
2282 displayStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
2283 keybStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
2284 |
|
2285 if( displayStatus == CHWRMLight::ELightBlink && keybStatus == CHWRMLight::ELightBlink) |
|
2286 { |
|
2287 |
|
2288 CTestScheduler::StartAndStopL(2000); |
|
2289 /*****************/ |
|
2290 /* Step executed */ |
|
2291 /*****************/ |
|
2292 mcResult = iMcFramework->StartTestCaseInSlave(EMultiClientCase7); |
|
2293 |
|
2294 if (mcResult == KErrNone) |
|
2295 { |
|
2296 |
|
2297 if(vibraStatus == CHWRMVibra::EVibraStatusOn) |
|
2298 { |
|
2299 /**********************/ |
|
2300 /* S T O P V I B R A */ |
|
2301 /**********************/ |
|
2302 mcResult = StopTestVibra(); |
|
2303 |
|
2304 vibraStatus = iVibra->VibraStatus(); |
|
2305 displayStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
2306 keybStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
2307 |
|
2308 if(vibraStatus == CHWRMVibra::EVibraStatusStopped && |
|
2309 displayStatus == CHWRMLight::ELightBlink && |
|
2310 keybStatus == CHWRMLight::ELightBlink) |
|
2311 { |
|
2312 if(mcResult == KErrNone) |
|
2313 { |
|
2314 /********************/ |
|
2315 /* L I G H T O F F */ |
|
2316 /********************/ |
|
2317 mcResult = TestLightOff(CHWRMLight::EPrimaryDisplayAndKeyboard); |
|
2318 |
|
2319 if(mcResult == KErrNone) |
|
2320 { |
|
2321 displayStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
2322 keybStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
2323 |
|
2324 if(displayStatus==CHWRMLight::ELightOff && keybStatus==CHWRMLight::ELightOff) |
|
2325 { |
|
2326 |
|
2327 } |
|
2328 else |
|
2329 { |
|
2330 // wrong light status |
|
2331 FormatMessageL(EHwrmMessageOpDebug,_L(" Wrong light status(%d)(%d) Expected(OFF)(OFF)"),displayStatus, keybStatus); |
|
2332 mcResult = KErrGeneral; |
|
2333 } |
|
2334 } |
|
2335 else |
|
2336 { |
|
2337 //light off epäonnistui |
|
2338 FormatMessageL(EHwrmMessageOpDebug,_L(" Set light off failed. Error(%d)"),mcResult); |
|
2339 } |
|
2340 |
|
2341 } |
|
2342 else |
|
2343 { |
|
2344 //vibra stop epäonnistui |
|
2345 FormatMessageL(EHwrmMessageOpDebug,_L(" Vibra stop failed. Error(%d)"),mcResult); |
|
2346 } |
|
2347 } |
|
2348 else |
|
2349 { |
|
2350 // wrong vibra or light status |
|
2351 FormatMessageL(EHwrmMessageOpDebug,_L(" Wrong status(%d)(%d)(%d) Expected(Stopped)(Blink)(Blink)"),vibraStatus, displayStatus, keybStatus); |
|
2352 mcResult = KErrGeneral; |
|
2353 } |
|
2354 } |
|
2355 else |
|
2356 { |
|
2357 // wrong vibra status |
|
2358 FormatMessageL(EHwrmMessageOpDebug,_L(" Wrong vibra status(%d) Expected(ON)"),vibraStatus); |
|
2359 mcResult = KErrGeneral; |
|
2360 } |
|
2361 } |
|
2362 else |
|
2363 { |
|
2364 //suoritus epäonnistui |
|
2365 FormatMessageL(EHwrmMessageOpDebug,_L(" Test case failed peer. Error(%d)"),mcResult); |
|
2366 } |
|
2367 } |
|
2368 else |
|
2369 { |
|
2370 // wrong light status |
|
2371 FormatMessageL(EHwrmMessageOpDebug,_L(" Wrong light status(%d)(%d) Expected(BLINK)(BLINK)"),displayStatus, keybStatus); |
|
2372 mcResult = KErrGeneral; |
|
2373 } |
|
2374 } |
|
2375 else |
|
2376 { |
|
2377 //blink epäonnistui |
|
2378 FormatMessageL(EHwrmMessageOpDebug,_L(" TestLightBlink failed. Error(%d)"),mcResult); |
|
2379 } |
|
2380 } |
|
2381 else |
|
2382 { |
|
2383 // Väärä vibra status |
|
2384 FormatMessageL(EHwrmMessageOpDebug,_L(" Wrong vibra status(%d) Expected ON"),vibraStatus); |
|
2385 mcResult = KErrGeneral; |
|
2386 } |
|
2387 } |
|
2388 else |
|
2389 { |
|
2390 //vibra start epäonnistui |
|
2391 FormatMessageL(EHwrmMessageOpDebug,_L(" Vibra start failed. Error(%d)"),mcResult); |
|
2392 } |
|
2393 |
|
2394 iMyLight->ReleaseLight(CHWRMLight::EPrimaryDisplayAndKeyboard); |
|
2395 } |
|
2396 else |
|
2397 { |
|
2398 //valon varaus epäonnistui |
|
2399 FormatMessageL(EHwrmMessageOpDebug,_L(" Light reservation failed. Error(%d)"),mcResult); |
|
2400 } |
|
2401 |
|
2402 iVibra->ReleaseVibra(); |
|
2403 } |
|
2404 else |
|
2405 { |
|
2406 //vibran varaus epäonnistui |
|
2407 FormatMessageL(EHwrmMessageOpDebug,_L(" Vibra reservation failed. Error(%d)"),mcResult); |
|
2408 } |
|
2409 } |
|
2410 |
|
2411 } |
|
2412 |
|
2413 delete iVibra; iVibra = NULL; |
|
2414 delete iMyLight; iMyLight = NULL; |
|
2415 return mcResult; |
|
2416 |
|
2417 } |
|
2418 |
|
2419 // ----------------------------------------------------------------------------- |
|
2420 // CHwrmTestCaseController::MC_Combined_light_and_vibra_usage_2_M |
|
2421 // |
|
2422 // ----------------------------------------------------------------------------- |
|
2423 // |
|
2424 TInt CHwrmTestCaseController::MC_Combined_light_and_vibra_usage_2_M() |
|
2425 { |
|
2426 TInt mcResult; |
|
2427 mcResult = KErrNone; |
|
2428 iObserver.InfoMessage(_L("MC_Combined_light_and_vibra_usage_2_M")); |
|
2429 // CRepository* iSession; |
|
2430 CHWRMVibra::TVibraStatus vibraStatus; |
|
2431 CHWRMLight::TLightStatus displayStatus; |
|
2432 CHWRMLight::TLightStatus keybStatus; |
|
2433 |
|
2434 // iSession = CRepository::NewL(KCRUidVibraCtrl); |
|
2435 iSession->Set(KVibraCtrlProfileVibraEnabled, 1); |
|
2436 |
|
2437 TRAP(mcResult, iVibra = CHWRMVibra::NewL()); |
|
2438 // |
|
2439 // OG 13/03/07 |
|
2440 if (mcResult != KErrNone) |
|
2441 { |
|
2442 return mcResult; |
|
2443 } |
|
2444 // |
|
2445 |
|
2446 |
|
2447 |
|
2448 TRAP(mcResult, iMyLight = CHWRMLight::NewL(this)); |
|
2449 if (mcResult == KErrNone) |
|
2450 { |
|
2451 |
|
2452 /******************/ |
|
2453 /* V I B R A O N */ |
|
2454 /******************/ |
|
2455 mcResult = RunTestVibra(5000,-75); |
|
2456 |
|
2457 if (mcResult == KErrNone) |
|
2458 { |
|
2459 /************************/ |
|
2460 /* L I G H T B L I N K */ |
|
2461 /************************/ |
|
2462 mcResult = TestLightBlink(CHWRMLight::EPrimaryDisplayAndKeyboard); |
|
2463 |
|
2464 if (mcResult == KErrNone) |
|
2465 { |
|
2466 vibraStatus = iVibra->VibraStatus(); |
|
2467 displayStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
2468 keybStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
2469 |
|
2470 if (displayStatus == CHWRMLight::ELightBlink && keybStatus == CHWRMLight::ELightBlink && vibraStatus == CHWRMVibra::EVibraStatusOn) |
|
2471 { |
|
2472 /*****************/ |
|
2473 /* Step executed */ |
|
2474 /*****************/ |
|
2475 mcResult = iMcFramework->StartTestCaseInSlave(EMultiClientCase8); |
|
2476 |
|
2477 if (mcResult == KErrNone) |
|
2478 { |
|
2479 // Check light |
|
2480 displayStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
2481 keybStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
2482 |
|
2483 if (displayStatus != CHWRMLight::ELightOff || keybStatus != CHWRMLight::ELightOff ) |
|
2484 { |
|
2485 // Wrong status |
|
2486 FormatMessageL(EHwrmMessageOpDebug,_L(" Wrong status (%d)(%d) Expected(OFF)(OFF)"),displayStatus, keybStatus); |
|
2487 mcResult = KErrGeneral; |
|
2488 } |
|
2489 } |
|
2490 else |
|
2491 { |
|
2492 // failed peer |
|
2493 FormatMessageL(EHwrmMessageOpDebug,_L(" Failed in peer application. Error(%d)"),mcResult); |
|
2494 } |
|
2495 } |
|
2496 else |
|
2497 { |
|
2498 // wrong status |
|
2499 FormatMessageL(EHwrmMessageOpDebug,_L(" Wrong status(%d)(%d)(%d) Expected(ON)(BLINK)(BLINK)"),vibraStatus, displayStatus, keybStatus); |
|
2500 mcResult = KErrGeneral; |
|
2501 } |
|
2502 } |
|
2503 else |
|
2504 { |
|
2505 // light blink failed |
|
2506 FormatMessageL(EHwrmMessageOpDebug,_L(" Blink light failed. Error(%d)"),mcResult); |
|
2507 } |
|
2508 } |
|
2509 else |
|
2510 { |
|
2511 // Start vibra failed |
|
2512 FormatMessageL(EHwrmMessageOpDebug,_L(" Start vibra failed. Error(%d)"),mcResult); |
|
2513 } |
|
2514 } |
|
2515 |
|
2516 |
|
2517 delete iVibra; iVibra = NULL; |
|
2518 delete iMyLight; iMyLight = NULL; |
|
2519 return mcResult; |
|
2520 |
|
2521 } |
|
2522 |
|
2523 |
|
2524 // ----------------------------------------------------------------------------- |
|
2525 // CHwrmTestCaseController::MC_FmTx_Basic_Usage_M |
|
2526 // |
|
2527 // ----------------------------------------------------------------------------- |
|
2528 // |
|
2529 TInt CHwrmTestCaseController::MC_FmTx_Basic_Usage_M() |
|
2530 { |
|
2531 TInt mcResult; |
|
2532 mcResult = KErrNone; |
|
2533 |
|
2534 iObserver.InfoMessage(_L("MC_FmTx_Basic_Usage_M")); |
|
2535 FormatMessageL(EHwrmMessageOpDebug,_L("MC_FmTx_Basic_Usage_M()")); |
|
2536 TFmTxState fmTxState; |
|
2537 TInt fmTxFrequency; |
|
2538 |
|
2539 TRAP(mcResult, iFmTx = CHWRMFmTx::NewL(this)); |
|
2540 if(mcResult == KErrNone) |
|
2541 { |
|
2542 //Reserve FmTx, Don't force CoeEnv "on" |
|
2543 TRAP(mcResult, iFmTx->ReserveL(EFalse)); |
|
2544 |
|
2545 if (mcResult == KErrNone) |
|
2546 { |
|
2547 mcResult = StopTestFmTx(); |
|
2548 /********************/ |
|
2549 /* F M T X O F F */ |
|
2550 /********************/ |
|
2551 |
|
2552 if (mcResult == KErrNone) |
|
2553 { |
|
2554 /* Disabling FmTx succeeded */ |
|
2555 fmTxState = iFmTx->Status(); |
|
2556 |
|
2557 if( fmTxState == EFmTxStateOff) |
|
2558 { |
|
2559 /*****************/ |
|
2560 /* Step executed */ |
|
2561 /*****************/ |
|
2562 |
|
2563 mcResult = iMcFramework->StartTestCaseInSlave(EMultiClientCase9); |
|
2564 |
|
2565 /* Peer (background application) does following: |
|
2566 * -------------------------------------------------- |
|
2567 * - Reserve FmTx with higher priority |
|
2568 * - Enable FmTx with Frequency 89900 KHz |
|
2569 */ |
|
2570 |
|
2571 if (mcResult == KErrNone) |
|
2572 { |
|
2573 fmTxState = iFmTx->Status(); |
|
2574 fmTxFrequency = iFmTx->Frequency(); |
|
2575 |
|
2576 if( (fmTxState == EFmTxStateInactive |
|
2577 || fmTxState == EFmTxStateActive) |
|
2578 && fmTxFrequency == 89900) |
|
2579 { |
|
2580 /******************/ |
|
2581 /* F M T X O N */ |
|
2582 /******************/ |
|
2583 |
|
2584 // try to set in another frequency (88100 KHZ) |
|
2585 mcResult = RunTestFmTx(88100); |
|
2586 |
|
2587 if (mcResult == KErrInUse ) /* Reserved for Slave!!! */ |
|
2588 { |
|
2589 // check FmTx status |
|
2590 fmTxState = iFmTx->Status(); |
|
2591 |
|
2592 fmTxFrequency = iFmTx->Frequency(); |
|
2593 |
|
2594 /* Should be Active or Inactive with frequency 89900 because fmtx is reserved to another application */ |
|
2595 if (fmTxState == EFmTxStateInactive |
|
2596 || fmTxState == EFmTxStateActive) |
|
2597 { |
|
2598 if (fmTxFrequency == 89900) |
|
2599 { |
|
2600 // Attemt to disable the FmTx |
|
2601 mcResult = StopTestFmTx(); |
|
2602 |
|
2603 if ( mcResult == KErrInUse ) /* Reserved for Slave!!! */ |
|
2604 { |
|
2605 // check FmTx status |
|
2606 fmTxState = iFmTx->Status(); |
|
2607 |
|
2608 fmTxFrequency = iFmTx->Frequency(); |
|
2609 |
|
2610 if( (fmTxState == EFmTxStateInactive |
|
2611 || fmTxState == EFmTxStateActive) |
|
2612 && fmTxFrequency == 89900) |
|
2613 { |
|
2614 /*****************/ |
|
2615 /* Step executed */ |
|
2616 /*****************/ |
|
2617 |
|
2618 iMcFramework->StepExecuted(KErrNone); |
|
2619 mcResult = iMcFramework->WaitNextTestStep(); |
|
2620 |
|
2621 /* SLAVE (background application) does following: |
|
2622 * -------------------------------------------------- |
|
2623 * - Release primary display light reservation |
|
2624 * - End test case execution |
|
2625 */ |
|
2626 |
|
2627 if( mcResult == KErrNone) |
|
2628 { |
|
2629 /* FmTx reservation has returned back to this application */ |
|
2630 |
|
2631 fmTxState = iFmTx->Status(); |
|
2632 fmTxFrequency = iFmTx->Frequency(); |
|
2633 |
|
2634 if( ( fmTxState == EFmTxStateInactive |
|
2635 || fmTxState == EFmTxStateActive) |
|
2636 && fmTxFrequency == 89900) |
|
2637 { |
|
2638 |
|
2639 mcResult = RunTestFmTx(88100); |
|
2640 |
|
2641 /***********************/ |
|
2642 /* F M T X (88100 KHz) */ |
|
2643 /***********************/ |
|
2644 |
|
2645 if( mcResult == KErrNone) |
|
2646 { |
|
2647 mcResult = StopTestFmTx(); |
|
2648 |
|
2649 /********************/ |
|
2650 /* F M T X O F F */ |
|
2651 /********************/ |
|
2652 |
|
2653 if( mcResult == KErrNone) |
|
2654 { |
|
2655 fmTxState = iFmTx->Status(); |
|
2656 fmTxFrequency = iFmTx->Frequency(); |
|
2657 |
|
2658 if( fmTxState != EFmTxStateOff |
|
2659 || fmTxFrequency != 88100) |
|
2660 { |
|
2661 // wrong status |
|
2662 FormatMessageL(EHwrmMessageOpDebug,_L(" Wrong FmTx status (%d), expected EFmTxStateInactive OR EFmTxStateActive"), fmTxState); |
|
2663 mcResult = KErrGeneral; |
|
2664 } |
|
2665 } |
|
2666 else |
|
2667 { |
|
2668 // FmTx disable failed |
|
2669 FormatMessageL(EHwrmMessageOpDebug,_L(" FmTx disable failed. Reason(%d)"),mcResult); |
|
2670 } |
|
2671 } |
|
2672 else |
|
2673 { |
|
2674 // Test failed peer |
|
2675 FormatMessageL(EHwrmMessageOpDebug,_L(" FmTx enable(88100 KHz) failed. Reason(%d)"),mcResult); |
|
2676 } |
|
2677 } |
|
2678 else |
|
2679 { |
|
2680 // wrong status |
|
2681 FormatMessageL(EHwrmMessageOpDebug,_L(" Wrong FmTx status (%d) Or frequency(%d), expected EFmTxStateInactive OR EFmTxStateActive and 89900"),fmTxState, fmTxFrequency); |
|
2682 mcResult = KErrGeneral; |
|
2683 } |
|
2684 } |
|
2685 else |
|
2686 { |
|
2687 // step failed peer |
|
2688 FormatMessageL(EHwrmMessageOpDebug,_L(" Test failed @ peer. Reason(%d)"),mcResult); |
|
2689 } |
|
2690 } |
|
2691 else |
|
2692 { |
|
2693 // wrong status |
|
2694 FormatMessageL(EHwrmMessageOpDebug,_L(" Wrong FmTx status (%d) Or frequency(%d), expected EFmTxStateInactive OR EFmTxStateActive and 89900"),fmTxState, fmTxFrequency); |
|
2695 mcResult = KErrGeneral; |
|
2696 } |
|
2697 } |
|
2698 else |
|
2699 { |
|
2700 // wrong status |
|
2701 FormatMessageL(EHwrmMessageOpDebug,_L(" FmTx disable did not leave with KErrInUse. Reason(%d)"),mcResult); |
|
2702 mcResult = KErrGeneral; |
|
2703 } |
|
2704 } |
|
2705 else |
|
2706 { |
|
2707 FormatMessageL(EHwrmMessageOpDebug,_L(" FmTx disable failed. Reason(%d)"),mcResult); |
|
2708 } |
|
2709 } |
|
2710 else |
|
2711 { |
|
2712 // wrong status |
|
2713 FormatMessageL(EHwrmMessageOpDebug,_L(" Wrong FmTx status (%d), expected ON"),fmTxState); |
|
2714 mcResult = KErrGeneral; |
|
2715 } |
|
2716 } |
|
2717 else |
|
2718 { |
|
2719 // Start FmTx failed |
|
2720 FormatMessageL(EHwrmMessageOpDebug,_L(" FmTx enable did not leave with KErrInUse. Reason(%d)"),mcResult); |
|
2721 } |
|
2722 } |
|
2723 else |
|
2724 { |
|
2725 // wrong status ot frequency |
|
2726 FormatMessageL(EHwrmMessageOpDebug,_L(" Wrong FmTx status (%d) OR frequency (%d), expected ON and 89900"),fmTxState, fmTxFrequency); |
|
2727 mcResult = KErrGeneral; |
|
2728 } |
|
2729 } |
|
2730 else |
|
2731 { |
|
2732 FormatMessageL(EHwrmMessageOpDebug,_L(" Test failed @ peer. Reason(%d)"),mcResult); |
|
2733 } |
|
2734 } |
|
2735 else |
|
2736 { |
|
2737 FormatMessageL(EHwrmMessageOpDebug,_L(" FmTx disable failed. Reason(%d)"),mcResult); |
|
2738 } |
|
2739 } |
|
2740 else |
|
2741 { |
|
2742 FormatMessageL(EHwrmMessageOpDebug,_L(" FmTx enable failed. Reason(%d)"),mcResult); |
|
2743 } |
|
2744 |
|
2745 iFmTx->Release(); |
|
2746 |
|
2747 } |
|
2748 else |
|
2749 { |
|
2750 // Varaus epäonnistui |
|
2751 FormatMessageL(EHwrmMessageOpDebug,_L(" Reservation failed"), mcResult); |
|
2752 } |
|
2753 |
|
2754 } |
|
2755 |
|
2756 delete iFmTx; |
|
2757 iFmTx = NULL; |
|
2758 return mcResult; |
|
2759 |
|
2760 } |
|
2761 |
|
2762 /*******************************************************************************/ |
|
2763 /* S E C U R I T Y / S P E C I A L C A S E S */ |
|
2764 // |
|
2765 // These cases might require some special arrangements, manual testing etc... |
|
2766 // |
|
2767 // ----------------------------------------------------------------------------- |
|
2768 // CHwrmTestCaseController::MaliciousVibra |
|
2769 // |
|
2770 // Run vibra 5 seconds in 6 seconds periods VERY LONG time |
|
2771 // WARNING! This is MALICIOS vibra usage. It might not be good for phones |
|
2772 // health to run vibra this long. |
|
2773 // |
|
2774 // Powerstate notifications are printed to trace. Also dislay light blinks every |
|
2775 // time when notifications is received |
|
2776 // |
|
2777 // ----------------------------------------------------------------------------- |
|
2778 // |
|
2779 TInt CHwrmTestCaseController::MaliciousVibra() |
|
2780 { |
|
2781 TInt mcResult; |
|
2782 mcResult = KErrNone; |
|
2783 |
|
2784 iObserver.InfoMessage(_L("MaliciousVibra")); |
|
2785 // CRepository* iSession; |
|
2786 TInt i; |
|
2787 CTestCasePropertyWatch* iBatteryLevelWatch; |
|
2788 CTestCasePropertyWatch* iBatteryStatusWatch; |
|
2789 CTestCasePropertyWatch* iChargingStatusWatch; |
|
2790 |
|
2791 iBatteryLevelWatch = CTestCasePropertyWatch::NewL(EPSBatteryLevel); |
|
2792 CleanupStack::PushL( iBatteryLevelWatch ); |
|
2793 iBatteryStatusWatch = CTestCasePropertyWatch::NewL(EPSBatteryStatus); |
|
2794 CleanupStack::PushL( iBatteryStatusWatch ); |
|
2795 iChargingStatusWatch = CTestCasePropertyWatch::NewL(EPSChargingStatus); |
|
2796 CleanupStack::PushL( iChargingStatusWatch ); |
|
2797 |
|
2798 // iSession = CRepository::NewL(KCRUidVibraCtrl); |
|
2799 iSession->Set(KVibraCtrlProfileVibraEnabled, 1); |
|
2800 |
|
2801 TRAP(mcResult, iVibra = CHWRMVibra::NewL()); |
|
2802 if(mcResult == KErrNone) |
|
2803 { |
|
2804 |
|
2805 TRAP(mcResult, iMyLight = CHWRMLight::NewL(this)); |
|
2806 if (mcResult == KErrNone) |
|
2807 { |
|
2808 for(i=0;i<300;i++) |
|
2809 { |
|
2810 TRAP(mcResult, iVibra->StartVibraL(5000, 99)); |
|
2811 |
|
2812 if (mcResult == KErrLocked) |
|
2813 { |
|
2814 //Wait for vibra to cool off. |
|
2815 FormatMessageL(EHwrmMessageOpDebug,_L(" Vibra Locked. Wait for more time ")); |
|
2816 CTestScheduler::StartAndStopL(KHwrmtestsVibraMoreDelay); |
|
2817 TRAP(mcResult, iVibra->StartVibraL(5000, 99)); |
|
2818 } |
|
2819 |
|
2820 if (mcResult == KErrNone) |
|
2821 { |
|
2822 iObserver.InfoMessage(_L("* ")); |
|
2823 CTestScheduler::StartAndStopL(2000); |
|
2824 iObserver.InfoMessage(_L(" * ")); |
|
2825 CTestScheduler::StartAndStopL(2000); |
|
2826 iObserver.InfoMessage(_L(" *")); |
|
2827 CTestScheduler::StartAndStopL(2000); |
|
2828 } |
|
2829 else |
|
2830 { |
|
2831 // Start vibra failed |
|
2832 FormatMessageL(EHwrmMessageOpDebug,_L(" Start vibra failed. Error(%d) Loop(%d)"),mcResult, i); |
|
2833 break; |
|
2834 } |
|
2835 |
|
2836 if(iBatteryLevelWatch->iStatusReceived) |
|
2837 { |
|
2838 FormatMessageL(EHwrmMessageOpDebug,_L(" BatteryLevel changed ->%d"),iBatteryLevelWatch->iKeyResult); |
|
2839 iBatteryLevelWatch->Start(); |
|
2840 mcResult = TestLightBlink(CHWRMLight::EPrimaryDisplayAndKeyboard); |
|
2841 } |
|
2842 |
|
2843 if(iBatteryStatusWatch->iStatusReceived) |
|
2844 { |
|
2845 FormatMessageL(EHwrmMessageOpDebug,_L(" BatteryStatus changed ->%d"),iBatteryStatusWatch->iKeyResult); |
|
2846 iBatteryStatusWatch->Start(); |
|
2847 mcResult = TestLightBlink(CHWRMLight::EPrimaryDisplayAndKeyboard); |
|
2848 } |
|
2849 |
|
2850 if(iChargingStatusWatch->iStatusReceived) |
|
2851 { |
|
2852 FormatMessageL(EHwrmMessageOpDebug,_L(" ChargingStatus changed ->%d"),iChargingStatusWatch->iKeyResult); |
|
2853 iChargingStatusWatch->Start(); |
|
2854 mcResult = TestLightBlink(CHWRMLight::EPrimaryDisplayAndKeyboard); |
|
2855 } |
|
2856 } |
|
2857 } |
|
2858 } |
|
2859 else |
|
2860 { |
|
2861 FormatMessageL(EHwrmMessageOpDebug,_L(" CHWRMVibra::NewL() Returned:%d"),mcResult); |
|
2862 } |
|
2863 CleanupStack::PopAndDestroy(3); |
|
2864 delete iVibra; iVibra = NULL; |
|
2865 return mcResult; |
|
2866 |
|
2867 } |
|
2868 |
|
2869 // ----------------------------------------------------------------------------- |
|
2870 // CHwrmTestCaseController::ChargingNotify |
|
2871 // |
|
2872 // Test case will wait 5 minutes for chargingStatus notification(s) |
|
2873 // Test is passed if at least one notification is received |
|
2874 // Notification should be received when charger is connected to phone |
|
2875 // Number of notifications is stored in counter that is printed to trace |
|
2876 // |
|
2877 // ----------------------------------------------------------------------------- |
|
2878 // |
|
2879 TInt CHwrmTestCaseController::ChargingNotify() |
|
2880 { |
|
2881 TInt mcResult; |
|
2882 mcResult = KErrNone; |
|
2883 |
|
2884 iObserver.InfoMessage(_L("ChargingNotify")); |
|
2885 TInt i,j = 0; |
|
2886 CTestCasePropertyWatch* iChargingStatusWatch; |
|
2887 |
|
2888 iChargingStatusWatch = CTestCasePropertyWatch::NewL(EPSChargingStatus); |
|
2889 CleanupStack::PushL( iChargingStatusWatch ); |
|
2890 |
|
2891 for(i=0;i<100;i++) |
|
2892 { |
|
2893 iObserver.InfoMessage(_L("* ")); |
|
2894 CTestScheduler::StartAndStopL(500); |
|
2895 iObserver.InfoMessage(_L(" * ")); |
|
2896 CTestScheduler::StartAndStopL(500); |
|
2897 iObserver.InfoMessage(_L(" *")); |
|
2898 CTestScheduler::StartAndStopL(500); |
|
2899 |
|
2900 if(iChargingStatusWatch->iStatusReceived) |
|
2901 { |
|
2902 j++; |
|
2903 FormatMessageL(EHwrmMessageOpDebug,_L(" ChargingStatus changed ->%d"),iChargingStatusWatch->iKeyResult); |
|
2904 iChargingStatusWatch->Start(); |
|
2905 mcResult = KErrNone; |
|
2906 break; |
|
2907 } |
|
2908 } |
|
2909 |
|
2910 FormatMessageL(EHwrmMessageOpDebug,_L(" ChargingStatus changed %d times"),j); |
|
2911 |
|
2912 delete iVibra; |
|
2913 iVibra = NULL; |
|
2914 CleanupStack::PopAndDestroy( iChargingStatusWatch ); |
|
2915 |
|
2916 return mcResult; |
|
2917 |
|
2918 } |
|
2919 |
|
2920 // ----------------------------------------------------------------------------- |
|
2921 // CHwrmTestCaseController::RunRepeatedlyInvalidValues |
|
2922 // |
|
2923 // Tests unsupported values in quite fast loop. Returned test result is always PASS, |
|
2924 // Test purpose is to crash client/server/phone. |
|
2925 // |
|
2926 // ----------------------------------------------------------------------------- |
|
2927 |
|
2928 TInt CHwrmTestCaseController::RunRepeatedlyInvalidValues() |
|
2929 { |
|
2930 |
|
2931 TInt mcResult; |
|
2932 mcResult = KErrNone; |
|
2933 |
|
2934 iObserver.InfoMessage(_L("RunRepeatedlyInvalidValues")); |
|
2935 // CRepository* iSession; |
|
2936 TInt i,iRandIntensity, iTargets; |
|
2937 TInt64 iSeed; |
|
2938 |
|
2939 // iSession = CRepository::NewL(KCRUidVibraCtrl); |
|
2940 iSession->Set(KVibraCtrlProfileVibraEnabled, 1); |
|
2941 iSeed = 100; |
|
2942 |
|
2943 TRAP(mcResult, iVibra = CHWRMVibra::NewL()); |
|
2944 if(mcResult == KErrNone) |
|
2945 { |
|
2946 |
|
2947 TRAP(mcResult, iMyLight = CHWRMLight::NewL(this)); |
|
2948 if (mcResult == KErrNone) |
|
2949 { |
|
2950 |
|
2951 for(i=0;i<300;i++) |
|
2952 { |
|
2953 TRAP(mcResult, iVibra->StartVibraL(5000, KMaxTInt)); |
|
2954 |
|
2955 iTargets = iMyLight->SupportedTargets(); |
|
2956 |
|
2957 mcResult = TestLightBlink(iTargets, KMaxTInt); |
|
2958 |
|
2959 mcResult = TestLightOn(10, KMaxTInt, KMaxTInt, ETrue); |
|
2960 |
|
2961 mcResult = TestLightBlink(9, KMaxTInt, KMaxTInt, KMaxTInt, KMaxTInt); |
|
2962 |
|
2963 mcResult = TestLightOn(0, -400, KMaxTInt, ETrue); |
|
2964 |
|
2965 iRandIntensity = Math::Rand(iSeed); |
|
2966 |
|
2967 TRAP(mcResult, iVibra->StartVibraL(5000, iRandIntensity)); |
|
2968 iObserver.InfoMessage(_L("* ")); |
|
2969 CTestScheduler::StartAndStopL(200); |
|
2970 iObserver.InfoMessage(_L(" * ")); |
|
2971 CTestScheduler::StartAndStopL(200); |
|
2972 iObserver.InfoMessage(_L(" *")); |
|
2973 CTestScheduler::StartAndStopL(200); |
|
2974 } |
|
2975 } |
|
2976 } |
|
2977 |
|
2978 delete iVibra; |
|
2979 iVibra = NULL; |
|
2980 |
|
2981 return mcResult; |
|
2982 |
|
2983 } |
|
2984 |
|
2985 |
|
2986 |
|
2987 // ----------------------------------------------------------------------------- |
|
2988 // CHwrmTestCaseController::LogResult |
|
2989 // Write test case result to log file |
|
2990 // ----------------------------------------------------------------------------- |
|
2991 // |
|
2992 |
|
2993 void CHwrmTestCaseController::LogResult( const TDesC& aText ) |
|
2994 { |
|
2995 iObserver.LogMessage(aText); |
|
2996 } |
|
2997 |
|
2998 void CHwrmTestCaseController::LogResult(const TDesC& aTestCase, TInt aErrorCode) |
|
2999 { |
|
3000 TBuf16<256> caseName; |
|
3001 caseName.Append(aTestCase); |
|
3002 |
|
3003 if(aErrorCode == KErrNone) |
|
3004 { |
|
3005 FormatMessageL(EHwrmMessageOpDebug,_L(" SUCCESS : %S "), &caseName); |
|
3006 FormatMessageL(EHwrmMessageOpLog, _L(" SUCCESS : %S "), &caseName); |
|
3007 } |
|
3008 else |
|
3009 { |
|
3010 FormatMessageL(EHwrmMessageOpDebug,_L(" FAIL : %S \nRTEST: Checkpoint-fail \n"), &caseName); |
|
3011 FormatMessageL(EHwrmMessageOpLog, _L(" FAIL : %S \nRTEST: Checkpoint-fail \n"), &caseName); |
|
3012 FormatMessageL(EHwrmMessageOpDebug,_L(" Test case returned with error [%d]"), aErrorCode); |
|
3013 FormatMessageL(EHwrmMessageOpLog, _L("Test case returned with error [%d]"), aErrorCode); |
|
3014 } |
|
3015 |
|
3016 // iErrCode = KErrNone; |
|
3017 } |
|
3018 |
|
3019 // TODO: PASS RESULT (PASS OR FAIL) AS PARAMETER TO THE OBSERVER FOR MORE FLEXIBLE FORMATTING |
|
3020 void CHwrmTestCaseController::LogResult(const TDesC& aTestCase, TInt aErrorCode, TInt aExpected) |
|
3021 { |
|
3022 TBuf16<256> caseName; |
|
3023 caseName.Append(aTestCase); |
|
3024 |
|
3025 if( aErrorCode == aExpected ) |
|
3026 { |
|
3027 FormatMessageL(EHwrmMessageOpDebug, _L( " SUCCESS : %S " ), &caseName ); |
|
3028 FormatMessageL(EHwrmMessageOpLog, _L( " SUCCESS : %S : (Returned: %d, expected: %d)"), &caseName, aErrorCode, aExpected ); |
|
3029 } |
|
3030 else |
|
3031 { |
|
3032 FormatMessageL(EHwrmMessageOpDebug, _L( " FAIL : %S \nRTEST: Checkpoint-fail \n" ), &caseName ); |
|
3033 FormatMessageL(EHwrmMessageOpLog, _L( " FAIL : %S : (Returned: %d, expected: %d) \nRTEST: Checkpoint-fail \n" ), &caseName, aErrorCode, aExpected ); |
|
3034 FormatMessageL(EHwrmMessageOpDebug, _L( " Test case returned with error [%d]" ), aErrorCode ); |
|
3035 FormatMessageL(EHwrmMessageOpLog, _L( "Test case returned unexpected error code [%d] (expected %d)" ), aErrorCode, aExpected ); |
|
3036 } |
|
3037 |
|
3038 // iErrCode = KErrNone; |
|
3039 } |
|
3040 |
|
3041 |
|
3042 |
|
3043 // ----------------------------------------------------------------------------- |
|
3044 // CHwrmTestCaseController::LightStatusChanged |
|
3045 // |
|
3046 // ----------------------------------------------------------------------------- |
|
3047 // |
|
3048 void CHwrmTestCaseController::LightStatusChanged( TInt aTarget, CHWRMLight::TLightStatus aStatus) |
|
3049 { |
|
3050 |
|
3051 //iObserver.LogMessage(_L("")); |
|
3052 //iMyTarget = aTarget; |
|
3053 iMyStatus = aStatus; |
|
3054 |
|
3055 FormatMessageL(EHwrmMessageOpDebug,_L(" Light state changed for target: 0x%x"), aTarget); |
|
3056 |
|
3057 switch ( aStatus ) |
|
3058 { |
|
3059 case CHWRMLight::ELightOn: |
|
3060 TEST_TRACE(_L(" Light state changed: ELightOn")); |
|
3061 |
|
3062 break; |
|
3063 case CHWRMLight::ELightOff: |
|
3064 TEST_TRACE(_L(" Light state changed: ELightOff")); |
|
3065 |
|
3066 break; |
|
3067 case CHWRMLight::ELightBlink: |
|
3068 TEST_TRACE(_L(" Light state changed: ELightBlink")); |
|
3069 |
|
3070 break; |
|
3071 case CHWRMLight::ELightStatusUnknown: |
|
3072 TEST_TRACE(_L(" Light state changed: ELightStatusUnknown")); |
|
3073 |
|
3074 break; |
|
3075 default: |
|
3076 TEST_TRACE(_L(" Light state changed: UNDEFINED !!!")); |
|
3077 |
|
3078 break; |
|
3079 } |
|
3080 } |
|
3081 |
|
3082 // ----------------------------------------------------------------------------- |
|
3083 // CHwrmTestCaseController::VibraStatusChanged |
|
3084 // |
|
3085 // ----------------------------------------------------------------------------- |
|
3086 // |
|
3087 void CHwrmTestCaseController::VibraStatusChanged( CHWRMVibra::TVibraStatus aStatus) |
|
3088 { |
|
3089 iVibraStatus = aStatus; |
|
3090 |
|
3091 FormatMessageL(EHwrmMessageOpDebug,_L(" Vibra status changed to %d"), aStatus); |
|
3092 |
|
3093 switch ( aStatus ) |
|
3094 { |
|
3095 case CHWRMVibra::EVibraStatusNotAllowed: |
|
3096 TEST_TRACE(_L(" Vibra status changed: EVibraStatusNotAllowed")); |
|
3097 |
|
3098 break; |
|
3099 case CHWRMVibra::EVibraStatusStopped: |
|
3100 TEST_TRACE(_L(" Vibra status changed: EVibraStatusStopped")); |
|
3101 |
|
3102 break; |
|
3103 case CHWRMVibra::EVibraStatusOn: |
|
3104 TEST_TRACE(_L(" Vibra status changed: EVibraStatusOn")); |
|
3105 |
|
3106 break; |
|
3107 case CHWRMVibra::EVibraStatusUnknown: |
|
3108 TEST_TRACE(_L(" Vibra status changed: EVibraStatusUnknown")); |
|
3109 |
|
3110 break; |
|
3111 default: |
|
3112 TEST_TRACE(_L(" Vibra status changed: UNDEFINED !!!")); |
|
3113 |
|
3114 break; |
|
3115 } |
|
3116 } |
|
3117 |
|
3118 // ----------------------------------------------------------------------------- |
|
3119 // CHwrmTestCaseController::VibraModeChanged |
|
3120 // |
|
3121 // ----------------------------------------------------------------------------- |
|
3122 // |
|
3123 void CHwrmTestCaseController::VibraModeChanged( CHWRMVibra::TVibraModeState aStatus) |
|
3124 { |
|
3125 iVibraMode = aStatus; |
|
3126 |
|
3127 FormatMessageL(EHwrmMessageOpDebug,_L(" Vibra mode changed to %d"), aStatus); |
|
3128 |
|
3129 switch ( aStatus ) |
|
3130 { |
|
3131 case CHWRMVibra::EVibraModeUnknown: |
|
3132 TEST_TRACE(_L(" Vibra mode changed: EVibraModeUnknown")); |
|
3133 |
|
3134 break; |
|
3135 case CHWRMVibra::EVibraModeON: |
|
3136 TEST_TRACE(_L(" Vibra mode changed: EVibraModeON")); |
|
3137 |
|
3138 break; |
|
3139 case CHWRMVibra::EVibraModeOFF: |
|
3140 TEST_TRACE(_L(" Vibra mode changed: EVibraModeOFF")); |
|
3141 |
|
3142 break; |
|
3143 default: |
|
3144 TEST_TRACE(_L(" Vibra mode changed: UNDEFINED !!!")); |
|
3145 |
|
3146 break; |
|
3147 } |
|
3148 } |
|
3149 |
|
3150 // ----------------------------------------------------------------------------- |
|
3151 // CHwrmTestCaseController::FmTxStatusChanged |
|
3152 // |
|
3153 // ----------------------------------------------------------------------------- |
|
3154 // |
|
3155 void CHwrmTestCaseController::FmTxStatusChanged(TFmTxState aStatus) |
|
3156 { |
|
3157 FormatMessageL(EHwrmMessageOpDebug,_L("FmTx State Changed to %d "), aStatus); |
|
3158 iFmTxState = aStatus; |
|
3159 |
|
3160 switch (aStatus) |
|
3161 { |
|
3162 case EFmTxStateUnknown: |
|
3163 TEST_TRACE(_L("FmTx state changed: EFmTxStateUnknown")); |
|
3164 break; |
|
3165 case EFmTxStateOff: |
|
3166 TEST_TRACE(_L("FmTx state changed: EFmTxStateOff")); |
|
3167 break; |
|
3168 case EFmTxStateActive: |
|
3169 TEST_TRACE(_L("FmTx state changed: EFmTxStateActive")); |
|
3170 break; |
|
3171 case EFmTxStateInactive: |
|
3172 TEST_TRACE(_L("FmTx state changed: EFmTxStateInactive")); |
|
3173 break; |
|
3174 case EFmTxStatePowerSaveInactivity: |
|
3175 TEST_TRACE(_L("FmTx state changed: EFmTxStatePowerSaveInactivity")); |
|
3176 break; |
|
3177 case EFmTxStatePowerSaveAccessory: |
|
3178 TEST_TRACE(_L("FmTx state changed: EFmTxStatePowerSaveAccessory")); |
|
3179 break; |
|
3180 case EFmTxStateScanning: |
|
3181 TEST_TRACE(_L("FmTx state changed: EFmTxStateScanning")); |
|
3182 break; |
|
3183 default: |
|
3184 TEST_TRACE(_L("FmTx state changed: UNDEFINED !")); |
|
3185 break; |
|
3186 } |
|
3187 } |
|
3188 |
|
3189 // ----------------------------------------------------------------------------- |
|
3190 // CHwrmTestCaseController::FmTxFrequencyChanged |
|
3191 // |
|
3192 // ----------------------------------------------------------------------------- |
|
3193 // |
|
3194 void CHwrmTestCaseController::FmTxFrequencyChanged(TInt aFrequency) |
|
3195 { |
|
3196 FormatMessageL(EHwrmMessageOpDebug,_L("FmTx Frequency Changed. New Frequency = %d "), aFrequency); |
|
3197 } |
|
3198 |
|
3199 // ----------------------------------------------------------------------------- |
|
3200 // CHwrmTestCaseController::GetStatusForSystemTarget |
|
3201 // Check light status for SystemTarget |
|
3202 // ----------------------------------------------------------------------------- |
|
3203 // |
|
3204 TInt CHwrmTestCaseController::GetLightStatusForSystemTarget( CHWRMLight* aLight, CHWRMLight::TLightStatus aStatus ) |
|
3205 { |
|
3206 |
|
3207 TInt mask(0); |
|
3208 |
|
3209 mask = aLight->SupportedTargets(); |
|
3210 |
|
3211 |
|
3212 if( ( mask & CHWRMLight::EPrimaryDisplay ) && |
|
3213 ( aLight->LightStatus( CHWRMLight::EPrimaryDisplay ) != aStatus ) ) |
|
3214 { |
|
3215 FormatMessageL(EHwrmMessageOpDebug,_L(" GetLightStatusForSystemTarget::EPrimaryDisplay. Status doesn't match")); |
|
3216 return KErrGeneral; |
|
3217 } |
|
3218 |
|
3219 if( ( mask & CHWRMLight::EPrimaryKeyboard ) && |
|
3220 ( aLight->LightStatus( CHWRMLight::EPrimaryKeyboard ) != aStatus ) ) |
|
3221 { |
|
3222 FormatMessageL(EHwrmMessageOpDebug,_L(" GetLightStatusForSystemTarget::EPrimaryKeyboard. Status doesn't match")); |
|
3223 return KErrGeneral; |
|
3224 } |
|
3225 |
|
3226 if( ( mask & CHWRMLight::ESecondaryDisplay ) && |
|
3227 ( aLight->LightStatus( CHWRMLight::ESecondaryDisplay ) != aStatus ) ) |
|
3228 { |
|
3229 FormatMessageL(EHwrmMessageOpDebug,_L(" GetLightStatusForSystemTarget::ESecondaryDisplay. Status doesn't match")); |
|
3230 return KErrGeneral; |
|
3231 } |
|
3232 |
|
3233 if( ( mask & CHWRMLight::ESecondaryKeyboard ) && |
|
3234 ( aLight->LightStatus( CHWRMLight::ESecondaryKeyboard ) != aStatus ) ) |
|
3235 { |
|
3236 FormatMessageL(EHwrmMessageOpDebug,_L(" GetLightStatusForSystemTarget::ESecondaryKeyboard. Status doesn't match")); |
|
3237 return KErrGeneral; |
|
3238 } |
|
3239 |
|
3240 return KErrNone; |
|
3241 |
|
3242 } |
|
3243 |
|
3244 TInt CHwrmTestCaseController::GetLightStatusForSystemTarget( CHWRMExtendedLight* aLight, CHWRMExtendedLight::TLightStatus aStatus ) |
|
3245 { |
|
3246 |
|
3247 TInt mask(0); |
|
3248 |
|
3249 mask = aLight->SupportedTargets(); |
|
3250 |
|
3251 |
|
3252 if( ( mask & CHWRMExtendedLight::EPrimaryDisplay ) && |
|
3253 ( aLight->LightStatus( CHWRMExtendedLight::EPrimaryDisplay ) != aStatus ) ) |
|
3254 { |
|
3255 FormatMessageL(EHwrmMessageOpDebug,_L(" GetLightStatusForSystemTarget::EPrimaryDisplay. Status doesn't match")); |
|
3256 return KErrGeneral; |
|
3257 } |
|
3258 |
|
3259 if( ( mask & CHWRMExtendedLight::EPrimaryKeyboard ) && |
|
3260 ( aLight->LightStatus( CHWRMExtendedLight::EPrimaryKeyboard ) != aStatus ) ) |
|
3261 { |
|
3262 FormatMessageL(EHwrmMessageOpDebug,_L(" GetLightStatusForSystemTarget::EPrimaryKeyboard. Status doesn't match")); |
|
3263 return KErrGeneral; |
|
3264 } |
|
3265 |
|
3266 if( ( mask & CHWRMExtendedLight::ESecondaryDisplay ) && |
|
3267 ( aLight->LightStatus( CHWRMExtendedLight::ESecondaryDisplay ) != aStatus ) ) |
|
3268 { |
|
3269 FormatMessageL(EHwrmMessageOpDebug,_L(" GetLightStatusForSystemTarget::ESecondaryDisplay. Status doesn't match")); |
|
3270 return KErrGeneral; |
|
3271 } |
|
3272 |
|
3273 if( ( mask & CHWRMExtendedLight::ESecondaryKeyboard ) && |
|
3274 ( aLight->LightStatus( CHWRMExtendedLight::ESecondaryKeyboard ) != aStatus ) ) |
|
3275 { |
|
3276 FormatMessageL(EHwrmMessageOpDebug,_L(" GetLightStatusForSystemTarget::ESecondaryKeyboard. Status doesn't match")); |
|
3277 return KErrGeneral; |
|
3278 } |
|
3279 |
|
3280 return KErrNone; |
|
3281 |
|
3282 } |
|
3283 |
|
3284 |
|
3285 |
|
3286 //------------------------------ TEST CASES------------------------------------- |
|
3287 |
|
3288 // ----------------------------------------------------------------------------- |
|
3289 // CHwrmTestCaseController::SDKLightTargetTest |
|
3290 // Call Light Target Test for multiple targets depending on selected API |
|
3291 // ----------------------------------------------------------------------------- |
|
3292 // |
|
3293 void CHwrmTestCaseController::LightTargetTest( TInt aTargetMask ) |
|
3294 { |
|
3295 TInt currentTarget(1); |
|
3296 TInt err( KErrNone ); |
|
3297 TInt expectedResult( KErrNone ); |
|
3298 |
|
3299 TBuf<100> msg( KNullDesC ); |
|
3300 |
|
3301 _LIT( KSupportedMessageText, "HWRM [Light target test]: Target 0x%x supported" ); |
|
3302 _LIT( KNotSupportedMessageText, "HWRM [Light target test]: Target 0x%x not supported" ); |
|
3303 |
|
3304 //loop through all possible targets |
|
3305 for( TInt i = 0; i < 31; i++ ) |
|
3306 { |
|
3307 //if current target is not included in the given mask, or not defined in CenRep, KErrNot Supported is expected |
|
3308 if( ( aTargetMask & currentTarget ) & iSupportedTargets ) |
|
3309 { |
|
3310 expectedResult = KErrNone; |
|
3311 msg.Format( KSupportedMessageText, currentTarget ); |
|
3312 } |
|
3313 else |
|
3314 { |
|
3315 expectedResult = KErrNotSupported; |
|
3316 msg.Format( KNotSupportedMessageText, currentTarget ); |
|
3317 } |
|
3318 |
|
3319 if( iApiType == EHWRMApiTypeSAPI ) |
|
3320 { |
|
3321 err = LightTargetTestSDK( currentTarget ); |
|
3322 } |
|
3323 else if( (iApiType == EHWRMApiTypeXAPI) || (iApiType == EHWRMApiTypeEAPI) ) |
|
3324 { |
|
3325 err = LightTargetTestExtended( currentTarget ); |
|
3326 } |
|
3327 |
|
3328 LogResult( msg, err, expectedResult ); |
|
3329 |
|
3330 // shift the target ready for next loop |
|
3331 currentTarget <<= 1; |
|
3332 } |
|
3333 } |
|
3334 |
|
3335 |
|
3336 // ----------------------------------------------------------------------------- |
|
3337 // CHwrmTestCaseController::LightTargetTest |
|
3338 // Set primary display on and off |
|
3339 // ----------------------------------------------------------------------------- |
|
3340 // |
|
3341 TInt CHwrmTestCaseController::LightTargetTestSDK( TInt aTarget) |
|
3342 { |
|
3343 iObserver.InfoMessage(_L("LightTargetTest")); |
|
3344 FormatMessageL(EHwrmMessageOpDebug, _L( " Test case: HWRM SDK [LightOnWithTarget] 0x%x" ), aTarget ); |
|
3345 TInt errVal = KErrNone; |
|
3346 |
|
3347 //create light instance |
|
3348 CHWRMLight* myLight = CHWRMLight::NewLC(); |
|
3349 |
|
3350 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights off")); |
|
3351 TRAP(errVal, myLight->LightOffL( aTarget ) ); |
|
3352 CTestScheduler::StartAndStopL(100); |
|
3353 if(errVal != KErrNone) |
|
3354 { |
|
3355 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOffL() failed [%d]"), errVal); |
|
3356 CleanupStack::PopAndDestroy( myLight ); |
|
3357 return errVal; |
|
3358 } |
|
3359 |
|
3360 //set light on for default intensity and infinite duration |
|
3361 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights on")); |
|
3362 |
|
3363 TRAP(errVal, myLight->LightOnL( aTarget ) ); |
|
3364 CTestScheduler::StartAndStopL(100); |
|
3365 if(errVal != KErrNone) |
|
3366 { |
|
3367 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOnL() failed [%d]"), errVal); |
|
3368 CleanupStack::PopAndDestroy( myLight ); |
|
3369 return errVal; |
|
3370 } |
|
3371 |
|
3372 /*Light status can be checked for one target only. If System Target is included in current target, |
|
3373 GetLightStatusForSystemTarget is called to check light status */ |
|
3374 if( aTarget & CHWRMLight::ESystemTarget ) |
|
3375 { |
|
3376 errVal = GetLightStatusForSystemTarget( myLight, CHWRMLight::ELightOn ); |
|
3377 if( errVal == KErrNone ) |
|
3378 { |
|
3379 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights off for default intensity and infinite duration")); |
|
3380 TRAP(errVal, myLight->LightOffL( aTarget )); |
|
3381 CTestScheduler::StartAndStopL(100); |
|
3382 if ( errVal != KErrNone ) |
|
3383 { |
|
3384 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOffL() failed [%d]"), errVal); |
|
3385 } |
|
3386 } |
|
3387 else |
|
3388 { |
|
3389 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not ok")); |
|
3390 FormatMessageL(EHwrmMessageOpDebug,_L(" Target light status: 0x%x"), iMyStatus); |
|
3391 errVal = KErrGeneral; |
|
3392 } |
|
3393 } |
|
3394 else |
|
3395 { |
|
3396 if((myLight->LightStatus( aTarget ) == CHWRMLight::ELightOn)) |
|
3397 { |
|
3398 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights off for default intensity and infinite duration")); |
|
3399 TRAP(errVal, myLight->LightOffL( aTarget )); |
|
3400 CTestScheduler::StartAndStopL(100); |
|
3401 |
|
3402 if (errVal != KErrNone) |
|
3403 { |
|
3404 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOffL() failed [%d]"), errVal); |
|
3405 } |
|
3406 |
|
3407 } |
|
3408 else |
|
3409 { |
|
3410 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not ok")); |
|
3411 FormatMessageL(EHwrmMessageOpDebug,_L(" Target light status: 0x%x"), iMyStatus); |
|
3412 errVal = KErrGeneral; |
|
3413 } |
|
3414 |
|
3415 } |
|
3416 |
|
3417 //delete light instance |
|
3418 CleanupStack::PopAndDestroy( myLight ); |
|
3419 |
|
3420 return errVal; |
|
3421 |
|
3422 } |
|
3423 |
|
3424 |
|
3425 TInt CHwrmTestCaseController::LightTargetTestExtended( TInt aTarget) |
|
3426 { |
|
3427 iObserver.InfoMessage(_L("LightTargetTest")); |
|
3428 FormatMessageL(EHwrmMessageOpDebug, _L( " Test case: HWRM Extended [LightOnWithTarget] 0x%x" ), aTarget ); |
|
3429 TInt errVal = KErrNone; |
|
3430 |
|
3431 //create light instance |
|
3432 CHWRMExtendedLight* myLight = NULL; |
|
3433 |
|
3434 if ( iApiType == EHWRMApiTypeEAPI ) |
|
3435 { |
|
3436 myLight = CHWRMEnhancedLight::NewLC(); |
|
3437 } |
|
3438 else |
|
3439 { |
|
3440 myLight = CHWRMExtendedLight::NewLC(); |
|
3441 } |
|
3442 |
|
3443 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights off")); |
|
3444 TRAP(errVal, myLight->LightOffL( aTarget ) ); |
|
3445 CTestScheduler::StartAndStopL(100); |
|
3446 if(errVal != KErrNone) |
|
3447 { |
|
3448 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOffL() failed [%d]"), errVal); |
|
3449 CleanupStack::PopAndDestroy( myLight ); |
|
3450 return errVal; |
|
3451 } |
|
3452 |
|
3453 //set light on for default intensity and infinite duration |
|
3454 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights on")); |
|
3455 |
|
3456 TRAP(errVal, myLight->LightOnL( aTarget ) ); |
|
3457 CTestScheduler::StartAndStopL(100); |
|
3458 if(errVal != KErrNone) |
|
3459 { |
|
3460 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOnL() failed [%d]"), errVal); |
|
3461 CleanupStack::PopAndDestroy( myLight ); |
|
3462 return errVal; |
|
3463 } |
|
3464 |
|
3465 /*Light status can be checked for one target only. If System Target is included in current target, |
|
3466 GetLightStatusForSystemTarget is called to check light status */ |
|
3467 if( aTarget & CHWRMExtendedLight::ESystemTarget ) |
|
3468 { |
|
3469 |
|
3470 errVal = GetLightStatusForSystemTarget( myLight, CHWRMExtendedLight::ELightOn ); |
|
3471 |
|
3472 if( errVal == KErrNone ) |
|
3473 { |
|
3474 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights off for default intensity and infinite duration")); |
|
3475 TRAP(errVal, myLight->LightOffL( aTarget )); |
|
3476 CTestScheduler::StartAndStopL(100); |
|
3477 if ( errVal != KErrNone ) |
|
3478 { |
|
3479 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOffL() failed [%d]"), errVal); |
|
3480 } |
|
3481 } |
|
3482 else |
|
3483 { |
|
3484 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not ok")); |
|
3485 FormatMessageL(EHwrmMessageOpDebug,_L(" Target light status: 0x%x"), iMyStatus); |
|
3486 errVal = KErrGeneral; |
|
3487 } |
|
3488 } |
|
3489 else |
|
3490 { |
|
3491 if((myLight->LightStatus( aTarget ) == CHWRMExtendedLight::ELightOn)) |
|
3492 { |
|
3493 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights off for default intensity and infinite duration")); |
|
3494 TRAP(errVal, myLight->LightOffL( aTarget )); |
|
3495 CTestScheduler::StartAndStopL(100); |
|
3496 |
|
3497 if (errVal != KErrNone) |
|
3498 { |
|
3499 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOffL() failed [%d]"), errVal); |
|
3500 } |
|
3501 |
|
3502 } |
|
3503 else |
|
3504 { |
|
3505 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not ok")); |
|
3506 FormatMessageL(EHwrmMessageOpDebug,_L(" Target light status: 0x%x"), iMyStatus); |
|
3507 errVal = KErrGeneral; |
|
3508 } |
|
3509 |
|
3510 } |
|
3511 |
|
3512 //delete light instance |
|
3513 CleanupStack::PopAndDestroy( myLight ); |
|
3514 |
|
3515 return errVal; |
|
3516 |
|
3517 } |
|
3518 |
|
3519 |
|
3520 // ----------------------------------------------------------------------------- |
|
3521 // CHwrmTestCaseController::LightOnDurationTest |
|
3522 // Call Light Target Test for multiple targets depending on selected API |
|
3523 // ----------------------------------------------------------------------------- |
|
3524 // |
|
3525 void CHwrmTestCaseController::LightOnDurationTest( TInt aTargetMask, TBool aIsRGBTest, TInt aRed, TInt aGreen, TInt aBlue ) |
|
3526 { |
|
3527 TInt currentTarget(1); |
|
3528 TInt err( KErrNone ); |
|
3529 TInt expectedResult( KErrNone ); |
|
3530 |
|
3531 TBuf<100> msg( KNullDesC ); |
|
3532 |
|
3533 _LIT( KSupportedMessageText, "HWRM [Light duration test]: Target 0x%x supported" ); |
|
3534 _LIT( KNotSupportedMessageText, "HWRM [Light duration test]: Target 0x%x not supported" ); |
|
3535 |
|
3536 //loop through all possible targets |
|
3537 for( TInt i = 0; i < 31; i++ ) |
|
3538 { |
|
3539 //if current target is not included in the given mask, or not defined in CenRep, KErrNot Supported is expected |
|
3540 if( ( aTargetMask & currentTarget ) & iSupportedTargets ) |
|
3541 { |
|
3542 expectedResult = KErrNone; |
|
3543 msg.Format( KSupportedMessageText, currentTarget ); |
|
3544 } |
|
3545 else |
|
3546 { |
|
3547 expectedResult = KErrNotSupported; |
|
3548 msg.Format( KNotSupportedMessageText, currentTarget ); |
|
3549 } |
|
3550 |
|
3551 |
|
3552 if( iApiType == EHWRMApiTypeSAPI ) |
|
3553 { |
|
3554 err = LightOnDurationTestSDK( currentTarget, aIsRGBTest, aRed, aGreen, aBlue ); |
|
3555 } |
|
3556 else if( iApiType == EHWRMApiTypeXAPI ) |
|
3557 { |
|
3558 err = LightOnDurationTestExtended( currentTarget ); |
|
3559 } |
|
3560 else if( iApiType == EHWRMApiTypeEAPI ) |
|
3561 { |
|
3562 err = LightOnDurationTestEnhanced( currentTarget, aIsRGBTest, aRed, aGreen, aBlue ); |
|
3563 } |
|
3564 |
|
3565 |
|
3566 LogResult( msg, err, expectedResult ); |
|
3567 |
|
3568 // shift the target ready for next loop |
|
3569 currentTarget <<= 1; |
|
3570 } |
|
3571 } |
|
3572 |
|
3573 // ----------------------------------------------------------------------------- |
|
3574 // CHwrmTestCaseController::LightOnDurationTestSDK |
|
3575 // Set target lights on for specified duration. |
|
3576 // ----------------------------------------------------------------------------- |
|
3577 // |
|
3578 |
|
3579 TInt CHwrmTestCaseController::LightOnDurationTestSDK( TInt aTarget, TBool aIsRGBTest, TInt aRed, TInt aGreen, TInt aBlue ) |
|
3580 { |
|
3581 iObserver.InfoMessage(_L("LightOnDurationTest")); |
|
3582 FormatMessageL(EHwrmMessageOpDebug,_L(" Test case: HWRM SDK [LightOnWithDuration], 0x%x"), aTarget); |
|
3583 TInt errVal = KErrNone; |
|
3584 |
|
3585 //create light instance |
|
3586 CHWRMLight* myLight = CHWRMLight::NewLC(); |
|
3587 |
|
3588 FormatMessageL(EHwrmMessageOpDebug,_L(" Set target lights off")); |
|
3589 //if light are on, set off for infinite duration |
|
3590 TRAP(errVal, myLight->LightOffL( aTarget )); |
|
3591 CTestScheduler::StartAndStopL(100); |
|
3592 if(errVal != KErrNone) |
|
3593 { |
|
3594 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOffL() failed [%d]"), errVal); |
|
3595 CleanupStack::PopAndDestroy( myLight ); |
|
3596 return errVal; |
|
3597 } |
|
3598 |
|
3599 if( aIsRGBTest ) |
|
3600 { |
|
3601 TRAP(errVal, myLight->SetLightDefaultColorL( aTarget )); |
|
3602 if(errVal != KErrNone) |
|
3603 { |
|
3604 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->SetLightColorL() failed [%d]"), errVal); |
|
3605 CleanupStack::PopAndDestroy( myLight ); |
|
3606 return errVal; |
|
3607 } |
|
3608 } |
|
3609 |
|
3610 FormatMessageL(EHwrmMessageOpDebug,_L(" Set target lights on")); |
|
3611 |
|
3612 //set light on for default intensity and 3 seconds |
|
3613 if ( aIsRGBTest ) |
|
3614 { |
|
3615 THWRMLightColor aRGBValue; |
|
3616 aRGBValue.iRed = aRed; |
|
3617 aRGBValue.iGreen = aGreen; |
|
3618 aRGBValue.iBlue = aBlue; |
|
3619 TRAP(errVal, myLight->LightOnL( aTarget, 3000, aRGBValue)); |
|
3620 } |
|
3621 else |
|
3622 { |
|
3623 TRAP(errVal, myLight->LightOnL( aTarget, 3000)); |
|
3624 } |
|
3625 CTestScheduler::StartAndStopL(100); |
|
3626 |
|
3627 if(errVal != KErrNone) |
|
3628 { |
|
3629 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOnL() failed [%d]"), errVal); |
|
3630 CleanupStack::PopAndDestroy( myLight ); |
|
3631 return errVal; |
|
3632 } |
|
3633 |
|
3634 |
|
3635 |
|
3636 FormatMessageL(EHwrmMessageOpDebug,_L(" Check target light status")); |
|
3637 /*Light status can be checked for one target only. If System Target is included in current target, |
|
3638 GetLightStatusForSystemTarget is called to check light status */ |
|
3639 if( aTarget & CHWRMLight::ESystemTarget ) |
|
3640 { |
|
3641 //check that display lights are on |
|
3642 errVal = GetLightStatusForSystemTarget( myLight, CHWRMLight::ELightOn ); |
|
3643 if( errVal == KErrNone ) |
|
3644 { |
|
3645 FormatMessageL(EHwrmMessageOpDebug,_L(" ELightOn")); |
|
3646 //wait for light on duration to expire |
|
3647 CTestScheduler::StartAndStopL(3100); |
|
3648 FormatMessageL(EHwrmMessageOpDebug,_L(" Check display light status")); |
|
3649 //lights should be off |
|
3650 errVal = GetLightStatusForSystemTarget( myLight, CHWRMLight::ELightOff ); |
|
3651 if(errVal != KErrNone) |
|
3652 { |
|
3653 //All targets might not be reset, so wait for some more time. |
|
3654 FormatMessageL(EHwrmMessageOpDebug,_L(" Wait for more time")); |
|
3655 CTestScheduler::StartAndStopL(KHwrmtestsLightMoreDelay); |
|
3656 errVal = GetLightStatusForSystemTarget( myLight, CHWRMLight::ELightOff ); |
|
3657 } |
|
3658 if( errVal != KErrNone ) |
|
3659 { |
|
3660 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK, target:(0x%x"), aTarget ); |
|
3661 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
3662 errVal = KErrGeneral; |
|
3663 } |
|
3664 } |
|
3665 else |
|
3666 { |
|
3667 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK, target:(0x%x"), aTarget ); |
|
3668 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
3669 errVal = KErrGeneral; |
|
3670 } |
|
3671 } |
|
3672 else |
|
3673 { |
|
3674 //check that display lights are on |
|
3675 if (myLight->LightStatus( aTarget ) == CHWRMLight::ELightOn) |
|
3676 { |
|
3677 FormatMessageL(EHwrmMessageOpDebug,_L(" ELightOn")); |
|
3678 //wait for light on duration to expire |
|
3679 CTestScheduler::StartAndStopL(3100); |
|
3680 |
|
3681 FormatMessageL(EHwrmMessageOpDebug,_L(" Check display light status")); |
|
3682 //lights should be off |
|
3683 if (myLight->LightStatus( aTarget ) != CHWRMLight::ELightOff) |
|
3684 { |
|
3685 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK, target:(0x%x"), aTarget ); |
|
3686 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
3687 errVal = KErrGeneral; |
|
3688 } |
|
3689 } |
|
3690 else |
|
3691 { |
|
3692 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK, target:(0x%x"), aTarget ); |
|
3693 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
3694 errVal = KErrGeneral; |
|
3695 } |
|
3696 } |
|
3697 //delete light instance |
|
3698 CleanupStack::PopAndDestroy( myLight ); |
|
3699 |
|
3700 return errVal; |
|
3701 |
|
3702 } |
|
3703 |
|
3704 // ----------------------------------------------------------------------------- |
|
3705 // CHwrmTestCaseController::LightOnDurationTestExtended |
|
3706 // Set target lights on for specified duration. |
|
3707 // ----------------------------------------------------------------------------- |
|
3708 // |
|
3709 TInt CHwrmTestCaseController::LightOnDurationTestExtended( TInt aTarget ) |
|
3710 { |
|
3711 iObserver.InfoMessage(_L("LightOnDurationTest")); |
|
3712 FormatMessageL(EHwrmMessageOpDebug,_L(" Test case: HWRM Extended [LightOnWithDuration], 0x%x"), aTarget); |
|
3713 TInt errVal = KErrNone; |
|
3714 |
|
3715 //create light instance |
|
3716 CHWRMExtendedLight* myLight = CHWRMExtendedLight::NewLC(); |
|
3717 |
|
3718 FormatMessageL(EHwrmMessageOpDebug,_L(" Set target lights off")); |
|
3719 //if light are on, set off for infinite duration |
|
3720 TRAP(errVal, myLight->LightOffL( aTarget )); |
|
3721 CTestScheduler::StartAndStopL(100); |
|
3722 if(errVal != KErrNone) |
|
3723 { |
|
3724 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOffL() failed [%d]"), errVal); |
|
3725 CleanupStack::PopAndDestroy( myLight ); |
|
3726 return errVal; |
|
3727 } |
|
3728 |
|
3729 FormatMessageL(EHwrmMessageOpDebug,_L(" Set target lights on")); |
|
3730 |
|
3731 //set light on for default intensity and 3 seconds |
|
3732 TRAP(errVal, myLight->LightOnL( aTarget, 3000)); |
|
3733 CTestScheduler::StartAndStopL(100); |
|
3734 |
|
3735 if(errVal != KErrNone) |
|
3736 { |
|
3737 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOnL() failed [%d]"), errVal); |
|
3738 CleanupStack::PopAndDestroy( myLight ); |
|
3739 return errVal; |
|
3740 } |
|
3741 |
|
3742 |
|
3743 |
|
3744 FormatMessageL(EHwrmMessageOpDebug,_L(" Check target light status")); |
|
3745 /*Light status can be checked for one target only. If System Target is included in current target, |
|
3746 GetLightStatusForSystemTarget is called to check light status */ |
|
3747 if( aTarget & CHWRMExtendedLight::ESystemTarget ) |
|
3748 { |
|
3749 //check that display lights are on |
|
3750 errVal = GetLightStatusForSystemTarget( myLight, CHWRMExtendedLight::ELightOn ); |
|
3751 if( errVal == KErrNone ) |
|
3752 { |
|
3753 FormatMessageL(EHwrmMessageOpDebug,_L(" ELightOn")); |
|
3754 //wait for light on duration to expire |
|
3755 CTestScheduler::StartAndStopL(3100); |
|
3756 FormatMessageL(EHwrmMessageOpDebug,_L(" Check display light status")); |
|
3757 //lights should be off |
|
3758 errVal = GetLightStatusForSystemTarget( myLight, CHWRMExtendedLight::ELightOff ); |
|
3759 |
|
3760 if(errVal != KErrNone) |
|
3761 { |
|
3762 //All targets might not be reset, so wait for some more time. |
|
3763 FormatMessageL(EHwrmMessageOpDebug,_L(" Wait for more time")); |
|
3764 CTestScheduler::StartAndStopL(KHwrmtestsLightMoreDelay); |
|
3765 errVal = GetLightStatusForSystemTarget( myLight, CHWRMExtendedLight::ELightOff ); |
|
3766 } |
|
3767 |
|
3768 if( errVal != KErrNone ) |
|
3769 { |
|
3770 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK, target:(0x%x"), aTarget ); |
|
3771 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
3772 errVal = KErrGeneral; |
|
3773 } |
|
3774 } |
|
3775 else |
|
3776 { |
|
3777 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK, target:(0x%x"), aTarget ); |
|
3778 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
3779 errVal = KErrGeneral; |
|
3780 } |
|
3781 } |
|
3782 else |
|
3783 { |
|
3784 //check that display lights are on |
|
3785 if (myLight->LightStatus( aTarget ) == CHWRMExtendedLight::ELightOn) |
|
3786 { |
|
3787 FormatMessageL(EHwrmMessageOpDebug,_L(" ELightOn")); |
|
3788 //wait for light on duration to expire |
|
3789 CTestScheduler::StartAndStopL(3100); |
|
3790 |
|
3791 FormatMessageL(EHwrmMessageOpDebug,_L(" Check display light status")); |
|
3792 //lights should be off |
|
3793 if (myLight->LightStatus( aTarget ) != CHWRMExtendedLight::ELightOff) |
|
3794 { |
|
3795 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK, target:(0x%x"), aTarget ); |
|
3796 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
3797 errVal = KErrGeneral; |
|
3798 } |
|
3799 } |
|
3800 else |
|
3801 { |
|
3802 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK, target:(0x%x"), aTarget ); |
|
3803 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
3804 errVal = KErrGeneral; |
|
3805 } |
|
3806 } |
|
3807 //delete light instance |
|
3808 CleanupStack::PopAndDestroy( myLight ); |
|
3809 |
|
3810 return errVal; |
|
3811 } |
|
3812 |
|
3813 // ----------------------------------------------------------------------------- |
|
3814 // CHwrmTestCaseController::LightOnDurationTestEnhanced |
|
3815 // Set target lights on for specified duration. |
|
3816 // ----------------------------------------------------------------------------- |
|
3817 // |
|
3818 TInt CHwrmTestCaseController::LightOnDurationTestEnhanced( TInt aTarget, TBool aIsRGBTest, TInt aRed, TInt aGreen, TInt aBlue ) |
|
3819 { |
|
3820 iObserver.InfoMessage(_L("LightOnDurationTest")); |
|
3821 FormatMessageL(EHwrmMessageOpDebug,_L(" Test case: HWRM Enhanced [LightOnWithDuration], 0x%x"), aTarget); |
|
3822 TInt errVal = KErrNone; |
|
3823 |
|
3824 //create light instance |
|
3825 CHWRMEnhancedLight* myLight = CHWRMEnhancedLight::NewLC(); |
|
3826 |
|
3827 FormatMessageL(EHwrmMessageOpDebug,_L(" Set target lights off")); |
|
3828 //if light are on, set off for infinite duration |
|
3829 TRAP(errVal, myLight->LightOffL( aTarget )); |
|
3830 CTestScheduler::StartAndStopL(100); |
|
3831 if(errVal != KErrNone) |
|
3832 { |
|
3833 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOffL() failed [%d]"), errVal); |
|
3834 CleanupStack::PopAndDestroy( myLight ); |
|
3835 return errVal; |
|
3836 } |
|
3837 |
|
3838 if ( aIsRGBTest ) |
|
3839 { |
|
3840 TRAP(errVal, myLight->SetLightDefaultColorL( aTarget )); |
|
3841 CTestScheduler::StartAndStopL(100); |
|
3842 if(errVal != KErrNone) |
|
3843 { |
|
3844 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->SetLightColorL() failed [%d]"), errVal); |
|
3845 CleanupStack::PopAndDestroy( myLight ); |
|
3846 return errVal; |
|
3847 } |
|
3848 } |
|
3849 |
|
3850 FormatMessageL(EHwrmMessageOpDebug,_L(" Set target lights on")); |
|
3851 |
|
3852 //set light on for default intensity and 3 seconds |
|
3853 if ( aIsRGBTest ) |
|
3854 { |
|
3855 THWRMLightColor aRGBValue; |
|
3856 aRGBValue.iRed = aRed; |
|
3857 aRGBValue.iGreen = aGreen; |
|
3858 aRGBValue.iBlue = aBlue; |
|
3859 TRAP(errVal, myLight->LightOnL( aTarget, 3000, aRGBValue)); |
|
3860 } |
|
3861 else |
|
3862 { |
|
3863 TRAP(errVal, myLight->LightOnL( aTarget, 3000)); |
|
3864 } |
|
3865 CTestScheduler::StartAndStopL(100); |
|
3866 |
|
3867 if(errVal != KErrNone) |
|
3868 { |
|
3869 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOnL() failed [%d]"), errVal); |
|
3870 CleanupStack::PopAndDestroy( myLight ); |
|
3871 return errVal; |
|
3872 } |
|
3873 |
|
3874 |
|
3875 |
|
3876 FormatMessageL(EHwrmMessageOpDebug,_L(" Check target light status")); |
|
3877 /*Light status can be checked for one target only. If System Target is included in current target, |
|
3878 GetLightStatusForSystemTarget is called to check light status */ |
|
3879 if( aTarget & CHWRMExtendedLight::ESystemTarget ) |
|
3880 { |
|
3881 //check that display lights are on |
|
3882 errVal = GetLightStatusForSystemTarget( myLight, CHWRMExtendedLight::ELightOn ); |
|
3883 if( errVal == KErrNone ) |
|
3884 { |
|
3885 FormatMessageL(EHwrmMessageOpDebug,_L(" ELightOn")); |
|
3886 //wait for light on duration to expire |
|
3887 CTestScheduler::StartAndStopL(3100); |
|
3888 FormatMessageL(EHwrmMessageOpDebug,_L(" Check display light status")); |
|
3889 //lights should be off |
|
3890 errVal = GetLightStatusForSystemTarget( myLight, CHWRMExtendedLight::ELightOff ); |
|
3891 |
|
3892 if(errVal != KErrNone) |
|
3893 { |
|
3894 //All targets might not be reset, so wait for some more time. |
|
3895 FormatMessageL(EHwrmMessageOpDebug,_L(" Wait for more time")); |
|
3896 CTestScheduler::StartAndStopL(KHwrmtestsLightMoreDelay); |
|
3897 errVal = GetLightStatusForSystemTarget( myLight, CHWRMExtendedLight::ELightOff ); |
|
3898 } |
|
3899 |
|
3900 if( errVal != KErrNone ) |
|
3901 { |
|
3902 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK, target:(0x%x"), aTarget ); |
|
3903 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
3904 errVal = KErrGeneral; |
|
3905 } |
|
3906 } |
|
3907 else |
|
3908 { |
|
3909 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK, target:(0x%x"), aTarget ); |
|
3910 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
3911 errVal = KErrGeneral; |
|
3912 } |
|
3913 } |
|
3914 else |
|
3915 { |
|
3916 //check that display lights are on |
|
3917 if (myLight->LightStatus( aTarget ) == CHWRMExtendedLight::ELightOn) |
|
3918 { |
|
3919 FormatMessageL(EHwrmMessageOpDebug,_L(" ELightOn")); |
|
3920 //wait for light on duration to expire |
|
3921 CTestScheduler::StartAndStopL(3100); |
|
3922 |
|
3923 FormatMessageL(EHwrmMessageOpDebug,_L(" Check display light status")); |
|
3924 //lights should be off |
|
3925 if (myLight->LightStatus( aTarget ) != CHWRMExtendedLight::ELightOff) |
|
3926 { |
|
3927 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK, target:(0x%x"), aTarget ); |
|
3928 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
3929 errVal = KErrGeneral; |
|
3930 } |
|
3931 } |
|
3932 else |
|
3933 { |
|
3934 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK, target:(0x%x"), aTarget ); |
|
3935 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
3936 errVal = KErrGeneral; |
|
3937 } |
|
3938 } |
|
3939 //delete light instance |
|
3940 CleanupStack::PopAndDestroy( myLight ); |
|
3941 |
|
3942 return errVal; |
|
3943 } |
|
3944 |
|
3945 // ----------------------------------------------------------------------------- |
|
3946 // CHwrmTestCaseController::LightOffDurationTest |
|
3947 // Call Light Off Duration Test for multiple targets depending on selected API |
|
3948 // ----------------------------------------------------------------------------- |
|
3949 // |
|
3950 void CHwrmTestCaseController::LightOffDurationTest( TInt aTargetMask ) |
|
3951 { |
|
3952 TInt currentTarget(1); |
|
3953 TInt err( KErrNone ); |
|
3954 TInt expectedResult( KErrNone ); |
|
3955 |
|
3956 TBuf<100> msg( KNullDesC ); |
|
3957 |
|
3958 _LIT( KSupportedMessageText, "HWRM [Light Off duration test]: Target 0x%x supported" ); |
|
3959 _LIT( KNotSupportedMessageText, "HWRM [Light Off duration test]: Target 0x%x not supported" ); |
|
3960 |
|
3961 //loop through all possible targets |
|
3962 for( TInt i = 0; i < 31; i++ ) |
|
3963 { |
|
3964 //if current target is not included in the given mask, or not defined in CenRep, KErrNot Supported is expected |
|
3965 if( ( aTargetMask & currentTarget ) & iSupportedTargets ) |
|
3966 { |
|
3967 expectedResult = KErrNone; |
|
3968 msg.Format( KSupportedMessageText, currentTarget ); |
|
3969 } |
|
3970 else |
|
3971 { |
|
3972 expectedResult = KErrNotSupported; |
|
3973 msg.Format( KNotSupportedMessageText, currentTarget ); |
|
3974 } |
|
3975 |
|
3976 |
|
3977 if( iApiType == EHWRMApiTypeSAPI ) |
|
3978 { |
|
3979 err = LightOffDurationTestSDK( currentTarget ); |
|
3980 } |
|
3981 else if( (iApiType == EHWRMApiTypeXAPI) || (iApiType == EHWRMApiTypeEAPI) ) |
|
3982 { |
|
3983 err = LightOffDurationTestExtended( currentTarget ); |
|
3984 } |
|
3985 |
|
3986 |
|
3987 LogResult( msg, err, expectedResult ); |
|
3988 |
|
3989 // shift the target ready for next loop |
|
3990 currentTarget <<= 1; |
|
3991 } |
|
3992 } |
|
3993 // ----------------------------------------------------------------------------- |
|
3994 // CHwrmTestCaseController::LightOffDurationTestSDK |
|
3995 // Set target lights on and set lights off for 3 seconds |
|
3996 // ----------------------------------------------------------------------------- |
|
3997 // |
|
3998 TInt CHwrmTestCaseController::LightOffDurationTestSDK( TInt aTarget ) |
|
3999 { |
|
4000 iObserver.InfoMessage(_L("LightOffDurationTest")); |
|
4001 FormatMessageL(EHwrmMessageOpDebug,_L( " Test case: HWRM SDK [LightOffWithDuration], 0x%x"), aTarget ); |
|
4002 TInt errVal = KErrNone; |
|
4003 //create light instance |
|
4004 CHWRMLight* myLight = CHWRMLight::NewLC(); |
|
4005 |
|
4006 FormatMessageL(EHwrmMessageOpDebug,_L(" Set target (0x%x) lights on"), aTarget); |
|
4007 //Set target light on for infinite duration |
|
4008 TRAP(errVal, myLight->LightOnL( aTarget )); |
|
4009 CTestScheduler::StartAndStopL(100); |
|
4010 if(errVal != KErrNone) |
|
4011 { |
|
4012 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOnL (0x%x) failed [%d]"), aTarget, errVal); |
|
4013 CleanupStack::PopAndDestroy( myLight ); |
|
4014 return errVal; |
|
4015 } |
|
4016 |
|
4017 FormatMessageL(EHwrmMessageOpDebug,_L(" Set target (0x%x) lights off"), aTarget); |
|
4018 //set light off for default intensity and 3 seconds |
|
4019 TRAP(errVal, myLight->LightOffL( aTarget, 3000)); |
|
4020 CTestScheduler::StartAndStopL(100); |
|
4021 if(errVal != KErrNone) |
|
4022 { |
|
4023 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOffL (0x%x) failed [%d]"), aTarget, errVal); |
|
4024 CleanupStack::PopAndDestroy( myLight ); |
|
4025 return errVal; |
|
4026 } |
|
4027 |
|
4028 /*Light status can be checked for one target only. If System Target is included in current target, |
|
4029 GetLightStatusForSystemTarget is called to check light status */ |
|
4030 if( aTarget & CHWRMLight::ESystemTarget ) |
|
4031 { |
|
4032 //check that display lights are off |
|
4033 errVal = GetLightStatusForSystemTarget( myLight, CHWRMLight::ELightOff ); |
|
4034 |
|
4035 if( errVal == KErrNone ) |
|
4036 { |
|
4037 FormatMessageL(EHwrmMessageOpDebug,_L(" ELightOff (0x%x)"), aTarget); |
|
4038 CTestScheduler::StartAndStopL(3100); |
|
4039 |
|
4040 //should be back on baseline (lights on) |
|
4041 errVal = GetLightStatusForSystemTarget( myLight, CHWRMLight::ELightOn ); |
|
4042 |
|
4043 if(errVal != KErrNone) |
|
4044 { |
|
4045 //All targets might not be reset, so wait for some more time. |
|
4046 FormatMessageL(EHwrmMessageOpDebug,_L(" Wait for more time")); |
|
4047 CTestScheduler::StartAndStopL(KHwrmtestsLightMoreDelay); |
|
4048 errVal = GetLightStatusForSystemTarget( myLight, CHWRMLight::ELightOn ); |
|
4049 } |
|
4050 if ( errVal != KErrNone ) |
|
4051 { |
|
4052 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK, target:(0x%x"), aTarget ); |
|
4053 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
4054 errVal = KErrGeneral; |
|
4055 } |
|
4056 } |
|
4057 else |
|
4058 { |
|
4059 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK, target:(0x%x"), aTarget ); |
|
4060 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
4061 errVal = KErrGeneral; |
|
4062 } |
|
4063 } |
|
4064 else |
|
4065 { |
|
4066 //check that display lights are off |
|
4067 if (myLight->LightStatus( aTarget ) == CHWRMLight::ELightOff) |
|
4068 { |
|
4069 FormatMessageL(EHwrmMessageOpDebug,_L(" ELightOff (0x%x)"), aTarget); |
|
4070 CTestScheduler::StartAndStopL(3100); |
|
4071 |
|
4072 //should be back on baseline (lights on) |
|
4073 if(myLight->LightStatus( aTarget ) != CHWRMLight::ELightOn) |
|
4074 { |
|
4075 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK, target:(0x%x"), aTarget ); |
|
4076 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
4077 errVal = KErrGeneral; |
|
4078 } |
|
4079 } |
|
4080 else |
|
4081 { |
|
4082 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK, target:(0x%x"), aTarget ); |
|
4083 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
4084 errVal = KErrGeneral; |
|
4085 } |
|
4086 } |
|
4087 //delete light instance |
|
4088 CleanupStack::PopAndDestroy( myLight ); |
|
4089 |
|
4090 return errVal; |
|
4091 |
|
4092 } |
|
4093 // ----------------------------------------------------------------------------- |
|
4094 // CHwrmTestCaseController::LightOffDurationTestExtended |
|
4095 // Set target lights on and set lights off for 3 seconds |
|
4096 // ----------------------------------------------------------------------------- |
|
4097 // |
|
4098 TInt CHwrmTestCaseController::LightOffDurationTestExtended( TInt aTarget ) |
|
4099 { |
|
4100 iObserver.InfoMessage(_L("LightOffDurationTest")); |
|
4101 FormatMessageL(EHwrmMessageOpDebug,_L( " Test case: HWRM Extended [LightOffWithDuration], 0x%x"), aTarget ); |
|
4102 TInt errVal = KErrNone; |
|
4103 //create light instance |
|
4104 CHWRMExtendedLight* myLight = NULL; |
|
4105 |
|
4106 if ( iApiType == EHWRMApiTypeEAPI ) |
|
4107 { |
|
4108 myLight = CHWRMEnhancedLight::NewLC(); |
|
4109 } |
|
4110 else |
|
4111 { |
|
4112 myLight = CHWRMExtendedLight::NewLC(); |
|
4113 } |
|
4114 |
|
4115 FormatMessageL(EHwrmMessageOpDebug,_L(" Set target (0x%x) lights on"), aTarget); |
|
4116 //Set target light on for infinite duration |
|
4117 TRAP(errVal, myLight->LightOnL( aTarget )); |
|
4118 CTestScheduler::StartAndStopL(100); |
|
4119 if(errVal != KErrNone) |
|
4120 { |
|
4121 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOnL (0x%x) failed [%d]"), aTarget, errVal); |
|
4122 CleanupStack::PopAndDestroy( myLight ); |
|
4123 return errVal; |
|
4124 } |
|
4125 |
|
4126 FormatMessageL(EHwrmMessageOpDebug,_L(" Set target (0x%x) lights off"), aTarget); |
|
4127 //set light off for default intensity and 3 seconds |
|
4128 TRAP(errVal, myLight->LightOffL( aTarget, 3000)); |
|
4129 CTestScheduler::StartAndStopL(100); |
|
4130 if(errVal != KErrNone) |
|
4131 { |
|
4132 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOffL (0x%x) failed [%d]"), aTarget, errVal); |
|
4133 CleanupStack::PopAndDestroy( myLight ); |
|
4134 return errVal; |
|
4135 } |
|
4136 |
|
4137 /*Light status can be checked for one target only. If System Target is included in current target, |
|
4138 GetLightStatusForSystemTarget is called to check light status */ |
|
4139 if( aTarget & CHWRMExtendedLight::ESystemTarget ) |
|
4140 { |
|
4141 //check that display lights are off |
|
4142 errVal = GetLightStatusForSystemTarget( myLight, CHWRMExtendedLight::ELightOff ); |
|
4143 |
|
4144 if( errVal == KErrNone ) |
|
4145 { |
|
4146 FormatMessageL(EHwrmMessageOpDebug,_L(" ELightOff (0x%x)"), aTarget); |
|
4147 CTestScheduler::StartAndStopL(3100); |
|
4148 |
|
4149 //should be back on baseline (lights on) |
|
4150 errVal = GetLightStatusForSystemTarget( myLight, CHWRMExtendedLight::ELightOn ); |
|
4151 |
|
4152 if(errVal != KErrNone) |
|
4153 { |
|
4154 //All targets might not be reset, so wait for some more time. |
|
4155 FormatMessageL(EHwrmMessageOpDebug,_L(" Wait for more time")); |
|
4156 CTestScheduler::StartAndStopL(KHwrmtestsLightMoreDelay); |
|
4157 errVal = GetLightStatusForSystemTarget( myLight, CHWRMExtendedLight::ELightOn ); |
|
4158 } |
|
4159 if ( errVal != KErrNone ) |
|
4160 { |
|
4161 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK, target:(0x%x"), aTarget ); |
|
4162 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
4163 errVal = KErrGeneral; |
|
4164 } |
|
4165 } |
|
4166 else |
|
4167 { |
|
4168 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK, target:(0x%x"), aTarget ); |
|
4169 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
4170 errVal = KErrGeneral; |
|
4171 } |
|
4172 } |
|
4173 else |
|
4174 { |
|
4175 //check that display lights are off |
|
4176 if (myLight->LightStatus( aTarget ) == CHWRMExtendedLight::ELightOff) |
|
4177 { |
|
4178 FormatMessageL(EHwrmMessageOpDebug,_L(" ELightOff (0x%x)"), aTarget); |
|
4179 CTestScheduler::StartAndStopL(3100); |
|
4180 |
|
4181 //should be back on baseline (lights on) |
|
4182 if(myLight->LightStatus( aTarget ) != CHWRMExtendedLight::ELightOn) |
|
4183 { |
|
4184 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK, target:(0x%x"), aTarget ); |
|
4185 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
4186 errVal = KErrGeneral; |
|
4187 } |
|
4188 } |
|
4189 else |
|
4190 { |
|
4191 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK, target:(0x%x"), aTarget ); |
|
4192 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
4193 errVal = KErrGeneral; |
|
4194 } |
|
4195 } |
|
4196 //delete light instance |
|
4197 CleanupStack::PopAndDestroy( myLight ); |
|
4198 |
|
4199 return errVal; |
|
4200 |
|
4201 } |
|
4202 |
|
4203 |
|
4204 // ----------------------------------------------------------------------------- |
|
4205 // CHwrmTestCaseController::LightIntensityTest |
|
4206 // Call LightIntensityTest for multiple targets depending on selected API |
|
4207 // ----------------------------------------------------------------------------- |
|
4208 // |
|
4209 void CHwrmTestCaseController::LightIntensityTest( TInt aTargetMask ) |
|
4210 { |
|
4211 TInt currentTarget(1); |
|
4212 TInt err( KErrNone ); |
|
4213 TInt expectedResult( KErrNone ); |
|
4214 |
|
4215 TBuf<100> msg( KNullDesC ); |
|
4216 |
|
4217 _LIT( KSupportedMessageText, "HWRM [Light intensity test]: Target 0x%x supported" ); |
|
4218 _LIT( KNotSupportedMessageText, "HWRM [Light intensity test]: Target 0x%x not supported" ); |
|
4219 |
|
4220 //loop through all possible targets |
|
4221 for( TInt i = 0; i < 31; i++ ) |
|
4222 { |
|
4223 //if current target is not included in the given mask, or not defined in CenRep, KErrNot Supported is expected |
|
4224 if( ( aTargetMask & currentTarget ) & iSupportedTargets ) |
|
4225 { |
|
4226 expectedResult = KErrNone; |
|
4227 msg.Format( KSupportedMessageText, currentTarget ); |
|
4228 } |
|
4229 else |
|
4230 { |
|
4231 expectedResult = KErrNotSupported; |
|
4232 msg.Format( KNotSupportedMessageText, currentTarget ); |
|
4233 } |
|
4234 |
|
4235 |
|
4236 if( iApiType == EHWRMApiTypeSAPI ) |
|
4237 { |
|
4238 err = LightIntensityTestSDK( currentTarget ); |
|
4239 } |
|
4240 else if( (iApiType == EHWRMApiTypeXAPI) || (iApiType == EHWRMApiTypeEAPI) ) |
|
4241 { |
|
4242 err = LightIntensityTestExtended( currentTarget ); |
|
4243 } |
|
4244 |
|
4245 |
|
4246 LogResult( msg, err, expectedResult ); |
|
4247 |
|
4248 // shift the target ready for next loop |
|
4249 currentTarget <<= 1; |
|
4250 } |
|
4251 } |
|
4252 |
|
4253 // ----------------------------------------------------------------------------- |
|
4254 // CHwrmTestCaseController::LightIntensityTest |
|
4255 // Set target lights on and with different intensity levels. |
|
4256 // ----------------------------------------------------------------------------- |
|
4257 // |
|
4258 TInt CHwrmTestCaseController::LightIntensityTestSDK( TInt aTarget ) |
|
4259 { |
|
4260 iObserver.InfoMessage(_L("LightIntensityTest")); |
|
4261 FormatMessageL(EHwrmMessageOpDebug,_L(" HWRM SDK [LightOnWithIntensity]")); |
|
4262 TInt errVal = KErrNone; |
|
4263 |
|
4264 //create light instance |
|
4265 CHWRMLight* myLight = CHWRMLight::NewLC(); |
|
4266 |
|
4267 //set lights off for infinite duration |
|
4268 TRAP(errVal, myLight->LightOffL( aTarget )); |
|
4269 CTestScheduler::StartAndStopL(100); |
|
4270 if(errVal != KErrNone) |
|
4271 { |
|
4272 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOffL() failed [%d]"), errVal); |
|
4273 CleanupStack::PopAndDestroy( myLight ); |
|
4274 return errVal; |
|
4275 } |
|
4276 |
|
4277 //set lights on with different intensity values |
|
4278 for(TInt i=0; i<=100; i+=10) |
|
4279 { |
|
4280 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights on with %d intensity"), i); |
|
4281 //set light on |
|
4282 TRAP(errVal, myLight->LightOnL( aTarget, 2000, i, ETrue)); |
|
4283 CTestScheduler::StartAndStopL(100); |
|
4284 if(errVal != KErrNone) |
|
4285 { |
|
4286 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOnL() failed [%d]"), errVal ); |
|
4287 CleanupStack::PopAndDestroy( myLight ); |
|
4288 return errVal; |
|
4289 } |
|
4290 |
|
4291 //set timer to wait the duration |
|
4292 CTestScheduler::StartAndStopL(2100); |
|
4293 |
|
4294 |
|
4295 if( aTarget & CHWRMLight::ESystemTarget ) |
|
4296 { |
|
4297 //check that display lights are off |
|
4298 errVal = GetLightStatusForSystemTarget( myLight, CHWRMLight::ELightOff ); |
|
4299 |
|
4300 if(errVal != KErrNone) |
|
4301 { |
|
4302 //All targets might not be reset, so wait for some more time. |
|
4303 FormatMessageL(EHwrmMessageOpDebug,_L(" Wait for more time")); |
|
4304 CTestScheduler::StartAndStopL(KHwrmtestsLightMoreDelay); |
|
4305 errVal = GetLightStatusForSystemTarget( myLight, CHWRMLight::ELightOff ); |
|
4306 } |
|
4307 |
|
4308 if( errVal != KErrNone ) |
|
4309 { |
|
4310 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK, target(0x%x"), aTarget); |
|
4311 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
4312 errVal = KErrGeneral; |
|
4313 } |
|
4314 } |
|
4315 else |
|
4316 { |
|
4317 //check that display lights are off again |
|
4318 if(myLight->LightStatus( aTarget ) != CHWRMLight::ELightOff) |
|
4319 { |
|
4320 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK, target(0x%x"), aTarget); |
|
4321 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
4322 errVal = KErrGeneral; |
|
4323 } |
|
4324 } |
|
4325 } |
|
4326 |
|
4327 //delete light instance |
|
4328 CleanupStack::PopAndDestroy( myLight ); |
|
4329 |
|
4330 return errVal; |
|
4331 |
|
4332 } |
|
4333 |
|
4334 TInt CHwrmTestCaseController::LightIntensityTestExtended( TInt aTarget ) |
|
4335 { |
|
4336 iObserver.InfoMessage(_L("LightIntensityTest")); |
|
4337 FormatMessageL(EHwrmMessageOpDebug,_L(" HWRM Extended [LightOnWithIntensity]")); |
|
4338 TInt errVal = KErrNone; |
|
4339 |
|
4340 //create light instance |
|
4341 CHWRMExtendedLight* myLight = NULL; |
|
4342 |
|
4343 if ( iApiType == EHWRMApiTypeEAPI ) |
|
4344 { |
|
4345 myLight = CHWRMEnhancedLight::NewLC(); |
|
4346 } |
|
4347 else |
|
4348 { |
|
4349 myLight = CHWRMExtendedLight::NewLC(); |
|
4350 } |
|
4351 |
|
4352 //set lights off for infinite duration |
|
4353 TRAP(errVal, myLight->LightOffL( aTarget )); |
|
4354 CTestScheduler::StartAndStopL(100); |
|
4355 if(errVal != KErrNone) |
|
4356 { |
|
4357 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOffL() failed [%d]"), errVal); |
|
4358 CleanupStack::PopAndDestroy( myLight ); |
|
4359 return errVal; |
|
4360 } |
|
4361 |
|
4362 //set lights on with different intensity values |
|
4363 for(TInt i=0; i<=100; i+=10) |
|
4364 { |
|
4365 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights on with %d intensity"), i); |
|
4366 //set light on |
|
4367 TRAP(errVal, myLight->LightOnL( aTarget, 2000, i, ETrue)); |
|
4368 CTestScheduler::StartAndStopL(100); |
|
4369 if(errVal != KErrNone) |
|
4370 { |
|
4371 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOnL() failed [%d]"), errVal ); |
|
4372 CleanupStack::PopAndDestroy( myLight ); |
|
4373 return errVal; |
|
4374 } |
|
4375 |
|
4376 //set timer to wait the duration |
|
4377 CTestScheduler::StartAndStopL(2100); |
|
4378 |
|
4379 |
|
4380 if( aTarget & CHWRMExtendedLight::ESystemTarget ) |
|
4381 { |
|
4382 //check that display lights are off |
|
4383 errVal = GetLightStatusForSystemTarget( myLight, CHWRMExtendedLight::ELightOff ); |
|
4384 |
|
4385 if(errVal != KErrNone) |
|
4386 { |
|
4387 //All targets might not be reset, so wait for some more time. |
|
4388 FormatMessageL(EHwrmMessageOpDebug,_L(" Wait for more time")); |
|
4389 CTestScheduler::StartAndStopL(KHwrmtestsLightMoreDelay); |
|
4390 errVal = GetLightStatusForSystemTarget( myLight, CHWRMExtendedLight::ELightOff ); |
|
4391 } |
|
4392 |
|
4393 if( errVal != KErrNone ) |
|
4394 { |
|
4395 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK, target(0x%x"), aTarget); |
|
4396 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
4397 errVal = KErrGeneral; |
|
4398 } |
|
4399 } |
|
4400 else |
|
4401 { |
|
4402 //check that display lights are off again |
|
4403 if(myLight->LightStatus( aTarget ) != CHWRMExtendedLight::ELightOff) |
|
4404 { |
|
4405 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK, target(0x%x"), aTarget); |
|
4406 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
4407 errVal = KErrGeneral; |
|
4408 } |
|
4409 } |
|
4410 } |
|
4411 |
|
4412 //delete light instance |
|
4413 CleanupStack::PopAndDestroy( myLight ); |
|
4414 |
|
4415 return errVal; |
|
4416 } |
|
4417 |
|
4418 |
|
4419 |
|
4420 // ----------------------------------------------------------------------------- |
|
4421 // CHwrmTestCaseController::LightBlinkTest |
|
4422 // Call LightBlinkTest for multiple targets depending on selected API |
|
4423 // ----------------------------------------------------------------------------- |
|
4424 // |
|
4425 void CHwrmTestCaseController::LightBlinkTest( TInt aTargetMask ) |
|
4426 { |
|
4427 TInt currentTarget(1); |
|
4428 TInt err( KErrNone ); |
|
4429 TInt expectedResult( KErrNone ); |
|
4430 |
|
4431 TBuf<100> msg( KNullDesC ); |
|
4432 |
|
4433 _LIT( KSupportedMessageText, "HWRM [Light blink test]: Target 0x%x supported" ); |
|
4434 _LIT( KNotSupportedMessageText, "HWRM [Light blink test]: Target 0x%x not supported" ); |
|
4435 |
|
4436 //loop through all possible targets |
|
4437 for( TInt i = 0; i < 31; i++ ) |
|
4438 { |
|
4439 //if current target is not included in the given mask, or not defined in CenRep, KErrNot Supported is expected |
|
4440 if( ( aTargetMask & currentTarget ) & iSupportedTargets ) |
|
4441 { |
|
4442 expectedResult = KErrNone; |
|
4443 msg.Format( KSupportedMessageText, currentTarget ); |
|
4444 } |
|
4445 else |
|
4446 { |
|
4447 expectedResult = KErrNotSupported; |
|
4448 msg.Format( KNotSupportedMessageText, currentTarget ); |
|
4449 } |
|
4450 |
|
4451 |
|
4452 if( iApiType == EHWRMApiTypeSAPI ) |
|
4453 { |
|
4454 err = LightBlinkTestSDK( currentTarget ); |
|
4455 } |
|
4456 else if( iApiType == EHWRMApiTypeXAPI || (iApiType == EHWRMApiTypeEAPI) ) |
|
4457 { |
|
4458 err = LightBlinkTestExtended( currentTarget ); |
|
4459 } |
|
4460 |
|
4461 LogResult( msg, err, expectedResult ); |
|
4462 |
|
4463 // shift the target ready for next loop |
|
4464 currentTarget <<= 1; |
|
4465 } |
|
4466 } |
|
4467 |
|
4468 |
|
4469 // ----------------------------------------------------------------------------- |
|
4470 // CHwrmTestCaseController::LightBlinkTestSDK |
|
4471 // Set target lights blink for infinite duration |
|
4472 // ----------------------------------------------------------------------------- |
|
4473 // |
|
4474 TInt CHwrmTestCaseController::LightBlinkTestSDK( TInt aTarget ) |
|
4475 { |
|
4476 iObserver.InfoMessage(_L("LightBlinkTest")); |
|
4477 FormatMessageL(EHwrmMessageOpDebug,_L(" Test case: HWRM SDK [LightBlinkTest] target:0x%x"), aTarget ); |
|
4478 |
|
4479 TInt errVal = KErrNone; |
|
4480 |
|
4481 //create light instance |
|
4482 CHWRMLight* myLight = CHWRMLight::NewLC(); |
|
4483 |
|
4484 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights to blink")); |
|
4485 |
|
4486 //set lights to blink |
|
4487 TRAP(errVal, myLight->LightBlinkL( aTarget )); |
|
4488 |
|
4489 CTestScheduler::StartAndStopL(100); |
|
4490 |
|
4491 if(errVal != KErrNone) |
|
4492 { |
|
4493 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightBlinkL() failed [%d]"), errVal); |
|
4494 CleanupStack::PopAndDestroy( myLight ); |
|
4495 return errVal; |
|
4496 } |
|
4497 |
|
4498 |
|
4499 if( aTarget & CHWRMLight::ESystemTarget ) |
|
4500 { |
|
4501 //check that display lights are blinking |
|
4502 errVal = GetLightStatusForSystemTarget( myLight, CHWRMLight::ELightBlink ); |
|
4503 |
|
4504 |
|
4505 if( errVal == KErrNone ) |
|
4506 { |
|
4507 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights off")); |
|
4508 |
|
4509 //set lights off for 3 sec |
|
4510 TRAP(errVal, myLight->LightOffL( aTarget, 3000)); |
|
4511 |
|
4512 CTestScheduler::StartAndStopL( 100 ); |
|
4513 |
|
4514 if(errVal != KErrNone) |
|
4515 { |
|
4516 FormatMessageL(EHwrmMessageOpDebug, _L(" iMyLight->LightOffL() (0x%x) failed [%d]"), aTarget, errVal ); |
|
4517 CleanupStack::PopAndDestroy( myLight ); |
|
4518 return errVal; |
|
4519 } |
|
4520 |
|
4521 //wait 3+ seconds |
|
4522 CTestScheduler::StartAndStopL( 3100 ); |
|
4523 |
|
4524 //check that lights are blinking again... |
|
4525 errVal = GetLightStatusForSystemTarget( myLight, CHWRMLight::ELightBlink ); |
|
4526 |
|
4527 if(errVal != KErrNone) |
|
4528 { |
|
4529 //All targets might not be reset, so wait for some more time. |
|
4530 FormatMessageL(EHwrmMessageOpDebug,_L(" Wait for more time")); |
|
4531 CTestScheduler::StartAndStopL(KHwrmtestsLightMoreDelay); |
|
4532 errVal = GetLightStatusForSystemTarget( myLight, CHWRMLight::ELightBlink ); |
|
4533 } |
|
4534 |
|
4535 if( errVal != KErrNone ) |
|
4536 { |
|
4537 FormatMessageL(EHwrmMessageOpDebug, _L(" Light status not OK, target: 0x%x"), aTarget ); |
|
4538 FormatMessageL(EHwrmMessageOpDebug, _L(" Display light status: 0x%x"), iMyStatus ); |
|
4539 errVal = KErrGeneral; |
|
4540 } |
|
4541 } |
|
4542 else |
|
4543 { |
|
4544 FormatMessageL(EHwrmMessageOpDebug, _L(" Light status not OK, target: 0x%x"), aTarget ); |
|
4545 FormatMessageL(EHwrmMessageOpDebug, _L(" Display light status: 0x%x"), iMyStatus); |
|
4546 errVal = KErrGeneral; |
|
4547 } |
|
4548 } |
|
4549 else |
|
4550 { |
|
4551 if( myLight->LightStatus( aTarget ) == CHWRMLight::ELightBlink) |
|
4552 { |
|
4553 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights off")); |
|
4554 |
|
4555 //set lights off for 3 sec |
|
4556 TRAP(errVal, myLight->LightOffL( aTarget, 3000)); |
|
4557 |
|
4558 CTestScheduler::StartAndStopL( 100 ); |
|
4559 |
|
4560 if(errVal != KErrNone) |
|
4561 { |
|
4562 FormatMessageL(EHwrmMessageOpDebug, _L(" iMyLight->LightOffL() failed [%d]"), errVal ); |
|
4563 CleanupStack::PopAndDestroy( myLight ); |
|
4564 return errVal; |
|
4565 } |
|
4566 |
|
4567 //wait 3+ seconds |
|
4568 CTestScheduler::StartAndStopL( 3100 ); |
|
4569 |
|
4570 //check that lights are blinking again... |
|
4571 if( myLight->LightStatus( aTarget ) != CHWRMLight::ELightBlink ) |
|
4572 { |
|
4573 FormatMessageL(EHwrmMessageOpDebug, _L(" Light status not OK, target: 0x%x"), aTarget ); |
|
4574 FormatMessageL(EHwrmMessageOpDebug, _L(" Display light status: 0x%x"), iMyStatus ); |
|
4575 errVal = KErrGeneral; |
|
4576 } |
|
4577 } |
|
4578 else |
|
4579 { |
|
4580 FormatMessageL(EHwrmMessageOpDebug, _L(" Light status not OK, target: 0x%x"), aTarget ); |
|
4581 FormatMessageL(EHwrmMessageOpDebug, _L(" Display light status: 0x%x"), iMyStatus); |
|
4582 errVal = KErrGeneral; |
|
4583 } |
|
4584 } |
|
4585 |
|
4586 //delete light instance |
|
4587 CleanupStack::PopAndDestroy( myLight ); |
|
4588 |
|
4589 return errVal; |
|
4590 |
|
4591 } |
|
4592 |
|
4593 // ----------------------------------------------------------------------------- |
|
4594 // CHwrmTestCaseController::LightBlinkTestExtended |
|
4595 // Set target lights blink for infinite duration |
|
4596 // ----------------------------------------------------------------------------- |
|
4597 // |
|
4598 TInt CHwrmTestCaseController::LightBlinkTestExtended( TInt aTarget ) |
|
4599 { |
|
4600 |
|
4601 iObserver.InfoMessage(_L("LightBlinkTest")); |
|
4602 FormatMessageL(EHwrmMessageOpDebug,_L(" Test case: HWRM Extended [LightBlinkTest] target:0x%x"), aTarget ); |
|
4603 |
|
4604 TInt errVal = KErrNone; |
|
4605 |
|
4606 //create light instance |
|
4607 CHWRMExtendedLight* myLight = NULL; |
|
4608 |
|
4609 if ( iApiType == EHWRMApiTypeEAPI ) |
|
4610 { |
|
4611 myLight = CHWRMEnhancedLight::NewLC(); |
|
4612 } |
|
4613 else |
|
4614 { |
|
4615 myLight = CHWRMExtendedLight::NewLC(); |
|
4616 } |
|
4617 |
|
4618 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights to blink")); |
|
4619 |
|
4620 //set lights to blink |
|
4621 TRAP(errVal, myLight->LightBlinkL( aTarget )); |
|
4622 |
|
4623 CTestScheduler::StartAndStopL(100); |
|
4624 |
|
4625 if(errVal != KErrNone) |
|
4626 { |
|
4627 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightBlinkL() failed [%d]"), errVal); |
|
4628 CleanupStack::PopAndDestroy( myLight ); |
|
4629 return errVal; |
|
4630 } |
|
4631 |
|
4632 |
|
4633 if( aTarget & CHWRMExtendedLight::ESystemTarget ) |
|
4634 { |
|
4635 //check that display lights are blinking |
|
4636 errVal = GetLightStatusForSystemTarget( myLight, CHWRMExtendedLight::ELightBlink ); |
|
4637 |
|
4638 |
|
4639 if( errVal == KErrNone ) |
|
4640 { |
|
4641 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights off")); |
|
4642 |
|
4643 //set lights off for 3 sec |
|
4644 TRAP(errVal, myLight->LightOffL( aTarget, 3000)); |
|
4645 |
|
4646 CTestScheduler::StartAndStopL( 100 ); |
|
4647 |
|
4648 if(errVal != KErrNone) |
|
4649 { |
|
4650 FormatMessageL(EHwrmMessageOpDebug, _L(" iMyLight->LightOffL() (0x%x) failed [%d]"), aTarget, errVal ); |
|
4651 CleanupStack::PopAndDestroy( myLight ); |
|
4652 return errVal; |
|
4653 } |
|
4654 |
|
4655 //wait 3+ seconds |
|
4656 CTestScheduler::StartAndStopL( 3100 ); |
|
4657 |
|
4658 //check that lights are blinking again... |
|
4659 errVal = GetLightStatusForSystemTarget( myLight, CHWRMExtendedLight::ELightBlink ); |
|
4660 |
|
4661 if(errVal != KErrNone) |
|
4662 { |
|
4663 //All targets might not be reset, so wait for some more time. |
|
4664 FormatMessageL(EHwrmMessageOpDebug,_L(" Wait for more time")); |
|
4665 CTestScheduler::StartAndStopL(KHwrmtestsLightMoreDelay); |
|
4666 errVal = GetLightStatusForSystemTarget( myLight, CHWRMExtendedLight::ELightBlink ); |
|
4667 } |
|
4668 |
|
4669 if( errVal != KErrNone ) |
|
4670 { |
|
4671 FormatMessageL(EHwrmMessageOpDebug, _L(" Light status not OK, target: 0x%x"), aTarget ); |
|
4672 FormatMessageL(EHwrmMessageOpDebug, _L(" Display light status: 0x%x"), iMyStatus ); |
|
4673 errVal = KErrGeneral; |
|
4674 } |
|
4675 } |
|
4676 else |
|
4677 { |
|
4678 FormatMessageL(EHwrmMessageOpDebug, _L(" Light status not OK, target: 0x%x"), aTarget ); |
|
4679 FormatMessageL(EHwrmMessageOpDebug, _L(" Display light status: 0x%x"), iMyStatus); |
|
4680 errVal = KErrGeneral; |
|
4681 } |
|
4682 } |
|
4683 else |
|
4684 { |
|
4685 if( myLight->LightStatus( aTarget ) == CHWRMExtendedLight::ELightBlink) |
|
4686 { |
|
4687 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights off")); |
|
4688 |
|
4689 //set lights off for 3 sec |
|
4690 TRAP(errVal, myLight->LightOffL( aTarget, 3000)); |
|
4691 |
|
4692 CTestScheduler::StartAndStopL( 100 ); |
|
4693 |
|
4694 if(errVal != KErrNone) |
|
4695 { |
|
4696 FormatMessageL(EHwrmMessageOpDebug, _L(" iMyLight->LightOffL() failed [%d]"), errVal ); |
|
4697 CleanupStack::PopAndDestroy( myLight ); |
|
4698 return errVal; |
|
4699 } |
|
4700 |
|
4701 //wait 3+ seconds |
|
4702 CTestScheduler::StartAndStopL( 3100 ); |
|
4703 |
|
4704 //check that lights are blinking again... |
|
4705 if( myLight->LightStatus( aTarget ) != CHWRMExtendedLight::ELightBlink ) |
|
4706 { |
|
4707 FormatMessageL(EHwrmMessageOpDebug, _L(" Light status not OK, target: 0x%x"), aTarget ); |
|
4708 FormatMessageL(EHwrmMessageOpDebug, _L(" Display light status: 0x%x"), iMyStatus ); |
|
4709 errVal = KErrGeneral; |
|
4710 } |
|
4711 } |
|
4712 else |
|
4713 { |
|
4714 FormatMessageL(EHwrmMessageOpDebug, _L(" Light status not OK, target: 0x%x"), aTarget ); |
|
4715 FormatMessageL(EHwrmMessageOpDebug, _L(" Display light status: 0x%x"), iMyStatus); |
|
4716 errVal = KErrGeneral; |
|
4717 } |
|
4718 } |
|
4719 |
|
4720 //delete light instance |
|
4721 CleanupStack::PopAndDestroy( myLight ); |
|
4722 |
|
4723 return errVal; |
|
4724 } |
|
4725 |
|
4726 |
|
4727 |
|
4728 // ----------------------------------------------------------------------------- |
|
4729 // CHwrmTestCaseController::LightBlinkDurationTest |
|
4730 // Call LightBlinkTest for multiple targets depending on selected API |
|
4731 // ----------------------------------------------------------------------------- |
|
4732 // |
|
4733 void CHwrmTestCaseController::LightBlinkDurationTest( TInt aTargetMask, TBool aIsRGBTest, TInt aRed, TInt aGreen, TInt aBlue ) |
|
4734 { |
|
4735 TInt currentTarget(1); |
|
4736 TInt err( KErrNone ); |
|
4737 TInt expectedResult( KErrNone ); |
|
4738 |
|
4739 TBuf<100> msg( KNullDesC ); |
|
4740 |
|
4741 _LIT( KSupportedMessageText, "HWRM [Light blink duration test]: Target 0x%x supported" ); |
|
4742 _LIT( KNotSupportedMessageText, "HWRM [Light blink duration test]: Target 0x%x not supported" ); |
|
4743 |
|
4744 //loop through all possible targets |
|
4745 for( TInt i = 0; i < 31; i++ ) |
|
4746 { |
|
4747 //if current target is not included in the given mask, or not defined in CenRep, KErrNot Supported is expected |
|
4748 if( ( aTargetMask & currentTarget ) & iSupportedTargets ) |
|
4749 { |
|
4750 expectedResult = KErrNone; |
|
4751 msg.Format( KSupportedMessageText, currentTarget ); |
|
4752 } |
|
4753 else |
|
4754 { |
|
4755 expectedResult = KErrNotSupported; |
|
4756 msg.Format( KNotSupportedMessageText, currentTarget ); |
|
4757 } |
|
4758 |
|
4759 |
|
4760 if( iApiType == EHWRMApiTypeSAPI ) |
|
4761 { |
|
4762 err = LightBlinkDurationTestSDK( currentTarget, aIsRGBTest, aRed, aGreen, aBlue ); |
|
4763 } |
|
4764 else if( iApiType == EHWRMApiTypeXAPI ) |
|
4765 { |
|
4766 err = LightBlinkDurationTestExtended( currentTarget ); |
|
4767 } |
|
4768 else if( iApiType == EHWRMApiTypeEAPI ) |
|
4769 { |
|
4770 err = LightBlinkDurationTestEnhanced( currentTarget, aIsRGBTest, aRed, aGreen, aBlue ); |
|
4771 } |
|
4772 |
|
4773 |
|
4774 LogResult( msg, err, expectedResult ); |
|
4775 |
|
4776 // shift the target ready for next loop |
|
4777 currentTarget <<= 1; |
|
4778 } |
|
4779 } |
|
4780 |
|
4781 // ----------------------------------------------------------------------------- |
|
4782 // CHwrmTestCaseController::LightBlinkDurationTestSDK |
|
4783 // Set target lights to blink for defined duration |
|
4784 // ----------------------------------------------------------------------------- |
|
4785 // |
|
4786 TInt CHwrmTestCaseController::LightBlinkDurationTestSDK( TInt aTarget, TBool aIsRGBTest, TInt aRed, TInt aGreen, TInt aBlue ) |
|
4787 { |
|
4788 |
|
4789 //define duration for lights to blink |
|
4790 TInt duration( 4000 ); |
|
4791 |
|
4792 iObserver.InfoMessage(_L("LightBlinkDurationTest")); |
|
4793 FormatMessageL(EHwrmMessageOpDebug,_L(" Test case: HWRM SDK [LightBlinkWithDuration], target: 0x%x"), aTarget ); |
|
4794 TInt errVal = KErrNone; |
|
4795 |
|
4796 //create light instance |
|
4797 CHWRMLight* myLight = CHWRMLight::NewLC(); |
|
4798 |
|
4799 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights off")); |
|
4800 TRAP(errVal, myLight->LightOffL( aTarget )); |
|
4801 CTestScheduler::StartAndStopL(100); |
|
4802 |
|
4803 if(errVal != KErrNone) |
|
4804 { |
|
4805 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOffL() failed [%d]"), errVal); |
|
4806 CleanupStack::PopAndDestroy( myLight ); |
|
4807 return errVal; |
|
4808 } |
|
4809 |
|
4810 if ( aIsRGBTest ) |
|
4811 { |
|
4812 TRAP(errVal, myLight->SetLightDefaultColorL( aTarget )); |
|
4813 |
|
4814 if(errVal != KErrNone) |
|
4815 { |
|
4816 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->SetLightDefaultColorL() failed [%d]"), errVal); |
|
4817 CleanupStack::PopAndDestroy( myLight ); |
|
4818 return errVal; |
|
4819 } |
|
4820 } |
|
4821 |
|
4822 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights to blink")); |
|
4823 |
|
4824 //set lights to blink for <duration> seconds |
|
4825 if ( aIsRGBTest ) |
|
4826 { |
|
4827 THWRMLightColor aRGBValue; |
|
4828 aRGBValue.iRed = aRed; |
|
4829 aRGBValue.iGreen = aGreen; |
|
4830 aRGBValue.iBlue = aBlue; |
|
4831 TRAP(errVal, myLight->LightBlinkL( aTarget, duration, aRGBValue)); |
|
4832 } |
|
4833 else |
|
4834 { |
|
4835 TRAP(errVal, myLight->LightBlinkL( aTarget, duration )); |
|
4836 } |
|
4837 |
|
4838 CTestScheduler::StartAndStopL(100); |
|
4839 |
|
4840 if(errVal != KErrNone) |
|
4841 { |
|
4842 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightBlinkL() failed [%d]"), errVal); |
|
4843 CleanupStack::PopAndDestroy( myLight ); |
|
4844 return errVal; |
|
4845 } |
|
4846 |
|
4847 |
|
4848 CHWRMLight::TLightStatus expectedStatus( CHWRMLight::ELightBlink ); |
|
4849 |
|
4850 if( aTarget & CHWRMLight::ESystemTarget ) |
|
4851 { |
|
4852 //check that display lights are blinking |
|
4853 errVal = GetLightStatusForSystemTarget( myLight, expectedStatus ); |
|
4854 |
|
4855 if( errVal == KErrNone ) |
|
4856 { |
|
4857 CTestScheduler::StartAndStopL( duration + 100 ); |
|
4858 |
|
4859 //check that target lights are off again |
|
4860 expectedStatus = CHWRMLight::ELightOff; |
|
4861 |
|
4862 errVal = GetLightStatusForSystemTarget( myLight, expectedStatus ); |
|
4863 |
|
4864 if(errVal != KErrNone) |
|
4865 { |
|
4866 //All targets might not be reset, so wait for some more time. |
|
4867 FormatMessageL(EHwrmMessageOpDebug,_L(" Wait for more time")); |
|
4868 CTestScheduler::StartAndStopL(KHwrmtestsLightMoreDelay); |
|
4869 errVal = GetLightStatusForSystemTarget( myLight, expectedStatus ); |
|
4870 } |
|
4871 |
|
4872 if( errVal != KErrNone ) |
|
4873 { |
|
4874 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status (0x%x)no OK"), aTarget ); |
|
4875 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x, expected: 0x%x"), iMyStatus, expectedStatus ); |
|
4876 errVal = KErrGeneral; |
|
4877 } |
|
4878 } |
|
4879 else |
|
4880 { |
|
4881 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status (0x%x) not OK"), aTarget ); |
|
4882 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x, expected: 0x%x"), iMyStatus, expectedStatus); |
|
4883 errVal = KErrGeneral; |
|
4884 } |
|
4885 } |
|
4886 else |
|
4887 { |
|
4888 |
|
4889 if( myLight->LightStatus( aTarget ) == expectedStatus ) |
|
4890 { |
|
4891 CTestScheduler::StartAndStopL( duration + 100 ); |
|
4892 |
|
4893 //check that target lights are off again |
|
4894 expectedStatus = CHWRMLight::ELightOff; |
|
4895 |
|
4896 if(myLight->LightStatus( aTarget ) != expectedStatus) |
|
4897 { |
|
4898 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status no OK")); |
|
4899 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x, expected: 0x%x"), iMyStatus, expectedStatus ); |
|
4900 errVal = KErrGeneral; |
|
4901 } |
|
4902 } |
|
4903 else |
|
4904 { |
|
4905 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status (0x%x) not OK"), aTarget ); |
|
4906 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x, expected: 0x%x"), iMyStatus, expectedStatus); |
|
4907 errVal = KErrGeneral; |
|
4908 } |
|
4909 } |
|
4910 |
|
4911 |
|
4912 //delete light instance |
|
4913 CleanupStack::PopAndDestroy( myLight ); |
|
4914 return errVal; |
|
4915 |
|
4916 } |
|
4917 |
|
4918 |
|
4919 // ----------------------------------------------------------------------------- |
|
4920 // CHwrmTestCaseController::LightBlinkDurationTestExtended |
|
4921 // Set target lights to blink for defined duration |
|
4922 // ----------------------------------------------------------------------------- |
|
4923 // |
|
4924 TInt CHwrmTestCaseController::LightBlinkDurationTestExtended( TInt aTarget ) |
|
4925 { |
|
4926 |
|
4927 //define duration for lights to blink |
|
4928 TInt duration( 4000 ); |
|
4929 |
|
4930 iObserver.InfoMessage(_L("LightBlinkDurationTest")); |
|
4931 FormatMessageL(EHwrmMessageOpDebug,_L(" Test case: HWRM Extended [LightBlinkWithDuration], target: 0x%x"), aTarget ); |
|
4932 TInt errVal = KErrNone; |
|
4933 |
|
4934 //create light instance |
|
4935 CHWRMExtendedLight* myLight = CHWRMExtendedLight::NewLC(); |
|
4936 |
|
4937 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights off")); |
|
4938 TRAP(errVal, myLight->LightOffL( aTarget )); |
|
4939 CTestScheduler::StartAndStopL(100); |
|
4940 |
|
4941 if(errVal != KErrNone) |
|
4942 { |
|
4943 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOffL() failed [%d]"), errVal); |
|
4944 CleanupStack::PopAndDestroy( myLight ); |
|
4945 return errVal; |
|
4946 } |
|
4947 |
|
4948 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights to blink")); |
|
4949 |
|
4950 //set lights to blink for <duration> seconds |
|
4951 TRAP(errVal, myLight->LightBlinkL( aTarget, duration )); |
|
4952 |
|
4953 CTestScheduler::StartAndStopL(100); |
|
4954 |
|
4955 if(errVal != KErrNone) |
|
4956 { |
|
4957 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightBlinkL() failed [%d]"), errVal); |
|
4958 CleanupStack::PopAndDestroy( myLight ); |
|
4959 return errVal; |
|
4960 } |
|
4961 |
|
4962 |
|
4963 CHWRMExtendedLight::TLightStatus expectedStatus( CHWRMExtendedLight::ELightBlink ); |
|
4964 |
|
4965 if( aTarget & CHWRMExtendedLight::ESystemTarget ) |
|
4966 { |
|
4967 //check that display lights are blinking |
|
4968 errVal = GetLightStatusForSystemTarget( myLight, expectedStatus ); |
|
4969 |
|
4970 if( errVal == KErrNone ) |
|
4971 { |
|
4972 CTestScheduler::StartAndStopL( duration + 100 ); |
|
4973 |
|
4974 //check that target lights are off again |
|
4975 expectedStatus = CHWRMExtendedLight::ELightOff; |
|
4976 |
|
4977 errVal = GetLightStatusForSystemTarget( myLight, expectedStatus ); |
|
4978 |
|
4979 if(errVal != KErrNone) |
|
4980 { |
|
4981 //All targets might not be reset, so wait for some more time. |
|
4982 FormatMessageL(EHwrmMessageOpDebug,_L(" Wait for more time")); |
|
4983 CTestScheduler::StartAndStopL(KHwrmtestsLightMoreDelay); |
|
4984 errVal = GetLightStatusForSystemTarget( myLight, expectedStatus ); |
|
4985 } |
|
4986 |
|
4987 if( errVal != KErrNone ) |
|
4988 { |
|
4989 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status (0x%x)no OK"), aTarget ); |
|
4990 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x, expected: 0x%x"), iMyStatus, expectedStatus ); |
|
4991 errVal = KErrGeneral; |
|
4992 } |
|
4993 } |
|
4994 else |
|
4995 { |
|
4996 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status (0x%x) not OK"), aTarget ); |
|
4997 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x, expected: 0x%x"), iMyStatus, expectedStatus); |
|
4998 errVal = KErrGeneral; |
|
4999 } |
|
5000 } |
|
5001 else |
|
5002 { |
|
5003 |
|
5004 if( myLight->LightStatus( aTarget ) == expectedStatus ) |
|
5005 { |
|
5006 CTestScheduler::StartAndStopL( duration + 100 ); |
|
5007 |
|
5008 //check that target lights are off again |
|
5009 expectedStatus = CHWRMExtendedLight::ELightOff; |
|
5010 |
|
5011 if(myLight->LightStatus( aTarget ) != expectedStatus) |
|
5012 { |
|
5013 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status no OK")); |
|
5014 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x, expected: 0x%x"), iMyStatus, expectedStatus ); |
|
5015 errVal = KErrGeneral; |
|
5016 } |
|
5017 } |
|
5018 else |
|
5019 { |
|
5020 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status (0x%x) not OK"), aTarget ); |
|
5021 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x, expected: 0x%x"), iMyStatus, expectedStatus); |
|
5022 errVal = KErrGeneral; |
|
5023 } |
|
5024 } |
|
5025 |
|
5026 |
|
5027 //delete light instance |
|
5028 CleanupStack::PopAndDestroy( myLight ); |
|
5029 return errVal; |
|
5030 |
|
5031 } |
|
5032 |
|
5033 // ----------------------------------------------------------------------------- |
|
5034 // CHwrmTestCaseController::LightBlinkDurationTestEnhanced |
|
5035 // Set target lights to blink for defined duration |
|
5036 // ----------------------------------------------------------------------------- |
|
5037 // |
|
5038 TInt CHwrmTestCaseController::LightBlinkDurationTestEnhanced( TInt aTarget, TBool aIsRGBTest, TInt aRed, TInt aGreen, TInt aBlue ) |
|
5039 { |
|
5040 |
|
5041 //define duration for lights to blink |
|
5042 TInt duration( 4000 ); |
|
5043 |
|
5044 iObserver.InfoMessage(_L("LightBlinkDurationTest")); |
|
5045 FormatMessageL(EHwrmMessageOpDebug,_L(" Test case: HWRM Extended [LightBlinkWithDuration], target: 0x%x"), aTarget ); |
|
5046 TInt errVal = KErrNone; |
|
5047 |
|
5048 //create light instance |
|
5049 CHWRMEnhancedLight* myLight = CHWRMEnhancedLight::NewLC(); |
|
5050 |
|
5051 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights off")); |
|
5052 TRAP(errVal, myLight->LightOffL( aTarget )); |
|
5053 CTestScheduler::StartAndStopL(100); |
|
5054 |
|
5055 if(errVal != KErrNone) |
|
5056 { |
|
5057 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOffL() failed [%d]"), errVal); |
|
5058 CleanupStack::PopAndDestroy( myLight ); |
|
5059 return errVal; |
|
5060 } |
|
5061 |
|
5062 |
|
5063 if ( aIsRGBTest ) |
|
5064 { |
|
5065 TRAP(errVal, myLight->SetLightDefaultColorL( aTarget )); |
|
5066 |
|
5067 if(errVal != KErrNone) |
|
5068 { |
|
5069 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->SetLightDefaultColorL() failed [%d]"), errVal); |
|
5070 CleanupStack::PopAndDestroy( myLight ); |
|
5071 return errVal; |
|
5072 } |
|
5073 } |
|
5074 |
|
5075 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights to blink")); |
|
5076 |
|
5077 //set lights to blink for <duration> seconds |
|
5078 if ( aIsRGBTest ) |
|
5079 { |
|
5080 THWRMLightColor aRGBValue; |
|
5081 aRGBValue.iRed = aRed; |
|
5082 aRGBValue.iGreen = aGreen; |
|
5083 aRGBValue.iBlue = aBlue; |
|
5084 TRAP(errVal, myLight->LightBlinkL( aTarget, duration, aRGBValue)); |
|
5085 } |
|
5086 else |
|
5087 { |
|
5088 TRAP(errVal, myLight->LightBlinkL( aTarget, duration )); |
|
5089 } |
|
5090 |
|
5091 CTestScheduler::StartAndStopL(100); |
|
5092 |
|
5093 if(errVal != KErrNone) |
|
5094 { |
|
5095 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightBlinkL() failed [%d]"), errVal); |
|
5096 CleanupStack::PopAndDestroy( myLight ); |
|
5097 return errVal; |
|
5098 } |
|
5099 |
|
5100 |
|
5101 CHWRMExtendedLight::TLightStatus expectedStatus( CHWRMExtendedLight::ELightBlink ); |
|
5102 |
|
5103 if( aTarget & CHWRMExtendedLight::ESystemTarget ) |
|
5104 { |
|
5105 //check that display lights are blinking |
|
5106 errVal = GetLightStatusForSystemTarget( myLight, expectedStatus ); |
|
5107 |
|
5108 if( errVal == KErrNone ) |
|
5109 { |
|
5110 CTestScheduler::StartAndStopL( duration + 100 ); |
|
5111 |
|
5112 //check that target lights are off again |
|
5113 expectedStatus = CHWRMExtendedLight::ELightOff; |
|
5114 |
|
5115 errVal = GetLightStatusForSystemTarget( myLight, expectedStatus ); |
|
5116 |
|
5117 if(errVal != KErrNone) |
|
5118 { |
|
5119 //All targets might not be reset, so wait for some more time. |
|
5120 FormatMessageL(EHwrmMessageOpDebug,_L(" Wait for more time")); |
|
5121 CTestScheduler::StartAndStopL(KHwrmtestsLightMoreDelay); |
|
5122 errVal = GetLightStatusForSystemTarget( myLight, expectedStatus ); |
|
5123 } |
|
5124 |
|
5125 if( errVal != KErrNone ) |
|
5126 { |
|
5127 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status (0x%x)no OK"), aTarget ); |
|
5128 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x, expected: 0x%x"), iMyStatus, expectedStatus ); |
|
5129 errVal = KErrGeneral; |
|
5130 } |
|
5131 } |
|
5132 else |
|
5133 { |
|
5134 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status (0x%x) not OK"), aTarget ); |
|
5135 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x, expected: 0x%x"), iMyStatus, expectedStatus); |
|
5136 errVal = KErrGeneral; |
|
5137 } |
|
5138 } |
|
5139 else |
|
5140 { |
|
5141 |
|
5142 if( myLight->LightStatus( aTarget ) == expectedStatus ) |
|
5143 { |
|
5144 CTestScheduler::StartAndStopL( duration + 100 ); |
|
5145 |
|
5146 //check that target lights are off again |
|
5147 expectedStatus = CHWRMExtendedLight::ELightOff; |
|
5148 |
|
5149 if(myLight->LightStatus( aTarget ) != expectedStatus) |
|
5150 { |
|
5151 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status no OK")); |
|
5152 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x, expected: 0x%x"), iMyStatus, expectedStatus ); |
|
5153 errVal = KErrGeneral; |
|
5154 } |
|
5155 } |
|
5156 else |
|
5157 { |
|
5158 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status (0x%x) not OK"), aTarget ); |
|
5159 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x, expected: 0x%x"), iMyStatus, expectedStatus); |
|
5160 errVal = KErrGeneral; |
|
5161 } |
|
5162 } |
|
5163 |
|
5164 |
|
5165 //delete light instance |
|
5166 CleanupStack::PopAndDestroy( myLight ); |
|
5167 return errVal; |
|
5168 |
|
5169 } |
|
5170 |
|
5171 |
|
5172 |
|
5173 |
|
5174 // ----------------------------------------------------------------------------- |
|
5175 // CHwrmTestCaseController::LightBlinkDurationTest |
|
5176 // Call LightBlinkTest for multiple targets depending on selected API |
|
5177 // ----------------------------------------------------------------------------- |
|
5178 // |
|
5179 void CHwrmTestCaseController::LightBlinkOnOffTest( TInt aTargetMask ) |
|
5180 { |
|
5181 TInt currentTarget(1); |
|
5182 TInt err( KErrNone ); |
|
5183 TInt expectedResult( KErrNone ); |
|
5184 |
|
5185 TBuf<100> msg( KNullDesC ); |
|
5186 |
|
5187 _LIT( KSupportedMessageText, "HWRM [Light blink on/off test]: Target 0x%x supported" ); |
|
5188 _LIT( KNotSupportedMessageText, "HWRM [Light blink on/off test]: Target 0x%x not supported" ); |
|
5189 |
|
5190 //loop through all possible targets |
|
5191 for( TInt i = 0; i < 31; i++ ) |
|
5192 { |
|
5193 //if current target is not included in the given mask, or not defined in CenRep, KErrNot Supported is expected |
|
5194 if( ( aTargetMask & currentTarget ) & iSupportedTargets ) |
|
5195 { |
|
5196 expectedResult = KErrNone; |
|
5197 msg.Format( KSupportedMessageText, currentTarget ); |
|
5198 } |
|
5199 else |
|
5200 { |
|
5201 expectedResult = KErrNotSupported; |
|
5202 msg.Format( KNotSupportedMessageText, currentTarget ); |
|
5203 } |
|
5204 |
|
5205 |
|
5206 if( iApiType == EHWRMApiTypeSAPI ) |
|
5207 { |
|
5208 err = LightBlinkOnOffTestSDK( currentTarget ); |
|
5209 } |
|
5210 else if( (iApiType == EHWRMApiTypeXAPI) || (iApiType == EHWRMApiTypeEAPI) ) |
|
5211 { |
|
5212 err = LightBlinkOnOffTestExtended( currentTarget ); |
|
5213 } |
|
5214 |
|
5215 |
|
5216 LogResult( msg, err, expectedResult ); |
|
5217 |
|
5218 // shift the target ready for next loop |
|
5219 currentTarget <<= 1; |
|
5220 } |
|
5221 } |
|
5222 |
|
5223 // ----------------------------------------------------------------------------- |
|
5224 // CHwrmTestCaseController::LightBlinkOnOffTestSDK |
|
5225 // |
|
5226 // ----------------------------------------------------------------------------- |
|
5227 // |
|
5228 TInt CHwrmTestCaseController::LightBlinkOnOffTestSDK( TInt aTarget ) |
|
5229 { |
|
5230 iObserver.InfoMessage(_L("LightBlinkOnOff")); |
|
5231 FormatMessageL(EHwrmMessageOpDebug,_L(" Test case: HWRM SDK [LightBlinkOnOff], target: 0x%x"), aTarget ); |
|
5232 |
|
5233 TInt errVal = KErrNone; |
|
5234 |
|
5235 //create light instance |
|
5236 CHWRMLight* myLight = CHWRMLight::NewLC(); |
|
5237 |
|
5238 FormatMessageL(EHwrmMessageOpDebug,_L(" Check light status")); |
|
5239 |
|
5240 if( aTarget & CHWRMLight::ESystemTarget ) |
|
5241 { |
|
5242 errVal = GetLightStatusForSystemTarget( myLight, CHWRMLight::ELightOff ); |
|
5243 if( errVal != KErrNone ) |
|
5244 { |
|
5245 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights off")); |
|
5246 TRAP(errVal, myLight->LightOffL( aTarget )); |
|
5247 CTestScheduler::StartAndStopL(100); |
|
5248 |
|
5249 if(errVal != KErrNone) |
|
5250 { |
|
5251 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOffL() failed [%d]"), errVal); |
|
5252 CleanupStack::PopAndDestroy( myLight ); |
|
5253 return errVal; |
|
5254 } |
|
5255 |
|
5256 } |
|
5257 |
|
5258 } |
|
5259 else |
|
5260 { |
|
5261 if(myLight->LightStatus( aTarget ) != CHWRMLight::ELightOff) |
|
5262 { |
|
5263 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights off")); |
|
5264 TRAP(errVal, myLight->LightOffL( aTarget )); |
|
5265 CTestScheduler::StartAndStopL(100); |
|
5266 |
|
5267 if(errVal != KErrNone) |
|
5268 { |
|
5269 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOffL() failed [%d]"), errVal); |
|
5270 CleanupStack::PopAndDestroy( myLight ); |
|
5271 return errVal; |
|
5272 } |
|
5273 } |
|
5274 } |
|
5275 |
|
5276 |
|
5277 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights to blink")); |
|
5278 |
|
5279 //set lights to blink for 5 sec |
|
5280 TRAP(errVal, myLight->LightBlinkL( aTarget, 5000, 500, 300, 100)); |
|
5281 |
|
5282 CTestScheduler::StartAndStopL(100); |
|
5283 |
|
5284 if(errVal != KErrNone) |
|
5285 { |
|
5286 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightBlinkL() failed [%d]"), errVal); |
|
5287 CleanupStack::PopAndDestroy( myLight ); |
|
5288 return errVal; |
|
5289 } |
|
5290 |
|
5291 |
|
5292 //check that target lights are blinking |
|
5293 if( aTarget & CHWRMLight::ESystemTarget ) |
|
5294 { |
|
5295 errVal = GetLightStatusForSystemTarget( myLight, CHWRMLight::ELightBlink ); |
|
5296 |
|
5297 if(errVal != KErrNone ) |
|
5298 { |
|
5299 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not Ok")); |
|
5300 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
5301 errVal = KErrGeneral; |
|
5302 //wait before returning |
|
5303 CTestScheduler::StartAndStopL(5000); |
|
5304 } |
|
5305 } |
|
5306 else |
|
5307 { |
|
5308 if(myLight->LightStatus( aTarget ) != CHWRMLight::ELightBlink) |
|
5309 { |
|
5310 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not Ok")); |
|
5311 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
5312 errVal = KErrGeneral; |
|
5313 //wait before returning |
|
5314 CTestScheduler::StartAndStopL(5000); |
|
5315 } |
|
5316 } |
|
5317 |
|
5318 // delete light instance |
|
5319 CleanupStack::PopAndDestroy( myLight ); |
|
5320 return errVal; |
|
5321 } |
|
5322 |
|
5323 // ----------------------------------------------------------------------------- |
|
5324 // CHwrmTestCaseController::LightBlinkOnOffTestExtended |
|
5325 // |
|
5326 // ----------------------------------------------------------------------------- |
|
5327 // |
|
5328 TInt CHwrmTestCaseController::LightBlinkOnOffTestExtended( TInt aTarget ) |
|
5329 { |
|
5330 iObserver.InfoMessage(_L("LightBlinkOnOff")); |
|
5331 FormatMessageL(EHwrmMessageOpDebug,_L(" Test case: HWRM Extended [LightBlinkOnOff], target: 0x%x"), aTarget ); |
|
5332 |
|
5333 TInt errVal = KErrNone; |
|
5334 |
|
5335 //create light instance |
|
5336 CHWRMExtendedLight* myLight = NULL; |
|
5337 |
|
5338 if ( iApiType == EHWRMApiTypeEAPI ) |
|
5339 { |
|
5340 myLight = CHWRMEnhancedLight::NewLC(); |
|
5341 } |
|
5342 else |
|
5343 { |
|
5344 myLight = CHWRMExtendedLight::NewLC(); |
|
5345 } |
|
5346 |
|
5347 FormatMessageL(EHwrmMessageOpDebug,_L(" Check light status")); |
|
5348 |
|
5349 if( aTarget & CHWRMExtendedLight::ESystemTarget ) |
|
5350 { |
|
5351 errVal = GetLightStatusForSystemTarget( myLight, CHWRMExtendedLight::ELightOff ); |
|
5352 if( errVal != KErrNone ) |
|
5353 { |
|
5354 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights off")); |
|
5355 TRAP(errVal, myLight->LightOffL( aTarget )); |
|
5356 CTestScheduler::StartAndStopL(100); |
|
5357 |
|
5358 if(errVal != KErrNone) |
|
5359 { |
|
5360 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOffL() failed [%d]"), errVal); |
|
5361 CleanupStack::PopAndDestroy( myLight ); |
|
5362 return errVal; |
|
5363 } |
|
5364 } |
|
5365 } |
|
5366 else |
|
5367 { |
|
5368 if(myLight->LightStatus( aTarget ) != CHWRMExtendedLight::ELightOff) |
|
5369 { |
|
5370 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights off")); |
|
5371 TRAP(errVal, myLight->LightOffL( aTarget )); |
|
5372 CTestScheduler::StartAndStopL(100); |
|
5373 |
|
5374 if(errVal != KErrNone) |
|
5375 { |
|
5376 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightOffL() failed [%d]"), errVal); |
|
5377 CleanupStack::PopAndDestroy( myLight ); |
|
5378 return errVal; |
|
5379 } |
|
5380 } |
|
5381 } |
|
5382 |
|
5383 |
|
5384 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights to blink")); |
|
5385 |
|
5386 //set lights to blink for 5 sec |
|
5387 TRAP(errVal, myLight->LightBlinkL( aTarget, 5000, 500, 300, 100)); |
|
5388 |
|
5389 CTestScheduler::StartAndStopL(100); |
|
5390 |
|
5391 if(errVal != KErrNone) |
|
5392 { |
|
5393 FormatMessageL(EHwrmMessageOpDebug,_L(" iMyLight->LightBlinkL() failed [%d]"), errVal); |
|
5394 CleanupStack::PopAndDestroy( myLight ); |
|
5395 return errVal; |
|
5396 } |
|
5397 |
|
5398 |
|
5399 //check that target lights are blinking |
|
5400 if( aTarget & CHWRMExtendedLight::ESystemTarget ) |
|
5401 { |
|
5402 errVal = GetLightStatusForSystemTarget( myLight, CHWRMExtendedLight::ELightBlink ); |
|
5403 |
|
5404 if(errVal != KErrNone ) |
|
5405 { |
|
5406 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not Ok")); |
|
5407 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
5408 errVal = KErrGeneral; |
|
5409 //wait before returning |
|
5410 CTestScheduler::StartAndStopL(5000); |
|
5411 } |
|
5412 } |
|
5413 else |
|
5414 { |
|
5415 if( myLight->LightStatus( aTarget ) != CHWRMExtendedLight::ELightBlink) |
|
5416 { |
|
5417 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not Ok")); |
|
5418 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), iMyStatus); |
|
5419 errVal = KErrGeneral; |
|
5420 //wait before returning |
|
5421 CTestScheduler::StartAndStopL(5000); |
|
5422 } |
|
5423 } |
|
5424 |
|
5425 // delete light instance |
|
5426 CleanupStack::PopAndDestroy( myLight ); |
|
5427 return errVal; |
|
5428 |
|
5429 } |
|
5430 |
|
5431 // ----------------------------------------------------------------------------- |
|
5432 // CHwrmTestCaseController::LightWithDifferentTargetsSDK |
|
5433 // Set primary display lights off and on with different targets |
|
5434 // ----------------------------------------------------------------------------- |
|
5435 // |
|
5436 TInt CHwrmTestCaseController::LightWithDifferentTargetsSDK( ) |
|
5437 { |
|
5438 iObserver.InfoMessage( _L( "LightWithDifferentTargetsSDK" ) ); |
|
5439 FormatMessageL(EHwrmMessageOpDebug, _L( " Test case: HWRM SDK [LightWithDifferentTargets]" ) ); |
|
5440 |
|
5441 TInt errVal( KErrNone ); |
|
5442 CHWRMLight::TLightStatus myStatus; |
|
5443 |
|
5444 //create light instance |
|
5445 CHWRMLight* myLight = CHWRMLight::NewLC(); |
|
5446 |
|
5447 //set lights off |
|
5448 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights off for primary display and keyboard")); |
|
5449 TRAP( errVal, myLight->LightOffL( CHWRMLight::EPrimaryDisplayAndKeyboard ) ); |
|
5450 CTestScheduler::StartAndStopL(100); |
|
5451 if(errVal != KErrNone) |
|
5452 { |
|
5453 FormatMessageL(EHwrmMessageOpDebug,_L(" myLight->LightOffL() failed [%d]"), errVal); |
|
5454 CleanupStack::PopAndDestroy( myLight ); |
|
5455 return errVal; |
|
5456 } |
|
5457 |
|
5458 //set lights on |
|
5459 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights on for primary display and keyboard")); |
|
5460 //set lights on for 3 sec |
|
5461 TRAP(errVal, myLight->LightOnL(CHWRMLight::EPrimaryDisplayAndKeyboard, 3000)); |
|
5462 CTestScheduler::StartAndStopL(100); |
|
5463 if(errVal != KErrNone) |
|
5464 { |
|
5465 FormatMessageL(EHwrmMessageOpDebug,_L(" myLight->LightOnL() failed [%d]"), errVal); |
|
5466 CleanupStack::PopAndDestroy( myLight ); |
|
5467 return errVal; |
|
5468 } |
|
5469 |
|
5470 //check that display lights are on |
|
5471 myStatus = myLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
5472 if(myStatus != CHWRMLight::ELightOn) |
|
5473 { |
|
5474 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK")); |
|
5475 FormatMessageL(EHwrmMessageOpDebug, _L( "LightWithDifferentTargetsSDK # Display Light status not OK!!! Status: 0x%x" ), myStatus ); |
|
5476 CleanupStack::PopAndDestroy( myLight ); |
|
5477 return KErrGeneral; |
|
5478 } |
|
5479 |
|
5480 //check that keyboard lights are on |
|
5481 myStatus = myLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
5482 if(myStatus != CHWRMLight::ELightOn) |
|
5483 { |
|
5484 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK")); |
|
5485 FormatMessageL(EHwrmMessageOpDebug,_L("LightWithDifferentTargetsSDK # Keyboard Light status not OK!!! Status:0x%x"), myStatus); |
|
5486 CleanupStack::PopAndDestroy( myLight ); |
|
5487 return KErrGeneral; |
|
5488 } |
|
5489 |
|
5490 //wait that lights are off again |
|
5491 CTestScheduler::StartAndStopL(3100); |
|
5492 |
|
5493 //set lights on for primary keyboard |
|
5494 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights on for primary keyboard")); |
|
5495 TRAP(errVal, myLight->LightOnL(CHWRMLight::EPrimaryKeyboard, 5000)); |
|
5496 CTestScheduler::StartAndStopL(1000); |
|
5497 if (errVal != KErrNone) |
|
5498 { |
|
5499 FormatMessageL(EHwrmMessageOpDebug,_L(" myLight->LightOnL() failed [%d]"), errVal); |
|
5500 CleanupStack::PopAndDestroy( myLight ); |
|
5501 return KErrGeneral; |
|
5502 } |
|
5503 |
|
5504 //check that keyboard lights are on |
|
5505 myStatus = myLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
5506 |
|
5507 if( myStatus == CHWRMLight::ELightOn ) |
|
5508 { |
|
5509 //set lights to blink |
|
5510 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights to blink for primary keyboard")); |
|
5511 TRAP(errVal, myLight->LightBlinkL(CHWRMLight::EPrimaryKeyboard, 5000)); |
|
5512 CTestScheduler::StartAndStopL(1000); |
|
5513 //check light status |
|
5514 myStatus = myLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
5515 if(myStatus != CHWRMLight::ELightBlink) |
|
5516 { |
|
5517 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK")); |
|
5518 FormatMessageL(EHwrmMessageOpDebug,_L("LightWithDifferentTargetsSDK # Keyboard light status: 0x%x"), myStatus); |
|
5519 errVal = KErrGeneral; |
|
5520 } |
|
5521 else |
|
5522 { |
|
5523 errVal = KErrNone; |
|
5524 } |
|
5525 CTestScheduler::StartAndStopL(4100); |
|
5526 |
|
5527 } |
|
5528 else |
|
5529 { |
|
5530 FormatMessageL(EHwrmMessageOpDebug, _L( " Light status not OK" ) ); |
|
5531 FormatMessageL(EHwrmMessageOpDebug, _L( " Keyboard light status: 0x%x" ), myStatus ); |
|
5532 errVal = KErrGeneral; |
|
5533 } |
|
5534 |
|
5535 CleanupStack::PopAndDestroy( myLight ); |
|
5536 |
|
5537 return errVal; |
|
5538 } |
|
5539 |
|
5540 // ----------------------------------------------------------------------------- |
|
5541 // CHwrmTestCaseController::LightWithDifferentTargetsExtended |
|
5542 // Set primary display lights off and on with different targets |
|
5543 // ----------------------------------------------------------------------------- |
|
5544 // |
|
5545 TInt CHwrmTestCaseController::LightWithDifferentTargetsExtended( ) |
|
5546 { |
|
5547 iObserver.InfoMessage( _L( "LightWithDifferentTargetsExtended" ) ); |
|
5548 FormatMessageL(EHwrmMessageOpDebug, _L( " Test case: HWRM Extended [LightWithDifferentTargets]" ) ); |
|
5549 |
|
5550 TInt errVal( KErrNone ); |
|
5551 CHWRMExtendedLight::TLightStatus myStatus; |
|
5552 |
|
5553 //create light instance |
|
5554 CHWRMExtendedLight* myLight = NULL; |
|
5555 |
|
5556 if ( iApiType == EHWRMApiTypeEAPI ) |
|
5557 { |
|
5558 myLight = CHWRMEnhancedLight::NewLC(); |
|
5559 } |
|
5560 else |
|
5561 { |
|
5562 myLight = CHWRMExtendedLight::NewLC(); |
|
5563 } |
|
5564 |
|
5565 //set lights off |
|
5566 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights off for primary display and keyboard")); |
|
5567 TRAP( errVal, myLight->LightOffL( CHWRMExtendedLight::EPrimaryDisplayAndKeyboard ) ); |
|
5568 CTestScheduler::StartAndStopL(100); |
|
5569 if(errVal != KErrNone) |
|
5570 { |
|
5571 FormatMessageL(EHwrmMessageOpDebug,_L(" myLight->LightOffL() failed [%d]"), errVal); |
|
5572 CleanupStack::PopAndDestroy( myLight ); |
|
5573 return errVal; |
|
5574 } |
|
5575 |
|
5576 //set lights on |
|
5577 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights on for primary display and keyboard")); |
|
5578 //set lights on for 3 sec |
|
5579 TRAP(errVal, myLight->LightOnL(CHWRMExtendedLight::EPrimaryDisplayAndKeyboard, 3000)); |
|
5580 CTestScheduler::StartAndStopL(100); |
|
5581 if(errVal != KErrNone) |
|
5582 { |
|
5583 FormatMessageL(EHwrmMessageOpDebug,_L(" myLight->LightOnL() failed [%d]"), errVal); |
|
5584 CleanupStack::PopAndDestroy( myLight ); |
|
5585 return errVal; |
|
5586 } |
|
5587 |
|
5588 //check that display lights are on |
|
5589 myStatus = myLight->LightStatus(CHWRMExtendedLight::EPrimaryDisplay); |
|
5590 if(myStatus != CHWRMExtendedLight::ELightOn) |
|
5591 { |
|
5592 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK")); |
|
5593 FormatMessageL(EHwrmMessageOpDebug, _L( "LightWithDifferentTargetsExtended # Display Light status not OK!!! Status: 0x%x" ), myStatus ); |
|
5594 CleanupStack::PopAndDestroy( myLight ); |
|
5595 return KErrGeneral; |
|
5596 } |
|
5597 |
|
5598 //check that keyboard lights are on |
|
5599 myStatus = myLight->LightStatus(CHWRMExtendedLight::EPrimaryKeyboard); |
|
5600 if(myStatus != CHWRMExtendedLight::ELightOn) |
|
5601 { |
|
5602 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK")); |
|
5603 FormatMessageL(EHwrmMessageOpDebug,_L("LightWithDifferentTargetsExtended # Keyboard Light status not OK!!! Status:0x%x"), myStatus); |
|
5604 CleanupStack::PopAndDestroy( myLight ); |
|
5605 return KErrGeneral; |
|
5606 } |
|
5607 |
|
5608 //wait that lights are off again |
|
5609 CTestScheduler::StartAndStopL(3100); |
|
5610 |
|
5611 //set lights on for primary keyboard |
|
5612 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights on for primary keyboard")); |
|
5613 TRAP(errVal, myLight->LightOnL(CHWRMExtendedLight::EPrimaryKeyboard, 5000)); |
|
5614 CTestScheduler::StartAndStopL(1000); |
|
5615 if (errVal != KErrNone) |
|
5616 { |
|
5617 FormatMessageL(EHwrmMessageOpDebug,_L(" myLight->LightOnL() failed [%d]"), errVal); |
|
5618 CleanupStack::PopAndDestroy( myLight ); |
|
5619 return KErrGeneral; |
|
5620 } |
|
5621 |
|
5622 //check that keyboard lights are on |
|
5623 myStatus = myLight->LightStatus(CHWRMExtendedLight::EPrimaryKeyboard); |
|
5624 |
|
5625 if( myStatus == CHWRMExtendedLight::ELightOn ) |
|
5626 { |
|
5627 //set lights to blink |
|
5628 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights to blink for primary keyboard")); |
|
5629 TRAP(errVal, myLight->LightBlinkL(CHWRMExtendedLight::EPrimaryKeyboard, 5000)); |
|
5630 CTestScheduler::StartAndStopL(1000); |
|
5631 //check light status |
|
5632 myStatus = myLight->LightStatus(CHWRMExtendedLight::EPrimaryKeyboard); |
|
5633 if(myStatus != CHWRMExtendedLight::ELightBlink) |
|
5634 { |
|
5635 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK")); |
|
5636 FormatMessageL(EHwrmMessageOpDebug,_L("LightWithDifferentTargetsSDK # Keyboard light status: 0x%x"), myStatus); |
|
5637 errVal = KErrGeneral; |
|
5638 } |
|
5639 else |
|
5640 { |
|
5641 errVal = KErrNone; |
|
5642 } |
|
5643 CTestScheduler::StartAndStopL(4100); |
|
5644 |
|
5645 } |
|
5646 else |
|
5647 { |
|
5648 FormatMessageL(EHwrmMessageOpDebug, _L( " Light status not OK" ) ); |
|
5649 FormatMessageL(EHwrmMessageOpDebug, _L( " Keyboard light status: 0x%x" ), myStatus ); |
|
5650 errVal = KErrGeneral; |
|
5651 } |
|
5652 |
|
5653 CleanupStack::PopAndDestroy( myLight ); |
|
5654 |
|
5655 return errVal; |
|
5656 } |
|
5657 |
|
5658 // ----------------------------------------------------------------------------- |
|
5659 // CHwrmTestCaseController::LightWithInvalidDurationSDK() |
|
5660 // |
|
5661 // ----------------------------------------------------------------------------- |
|
5662 // |
|
5663 TInt CHwrmTestCaseController::LightWithInvalidDurationSDK( ) |
|
5664 { |
|
5665 iObserver.InfoMessage(_L("LightWithInvalidDurationSDK")); |
|
5666 FormatMessageL(EHwrmMessageOpDebug,_L(" Test case: HWRM SDK [LightWithInvalidDuration]")); |
|
5667 |
|
5668 CHWRMLight::TLightStatus myStatus; |
|
5669 TInt retVal1(KErrNone); |
|
5670 TInt retVal2(KErrNone); |
|
5671 TInt retVal3(KErrNone); |
|
5672 TInt retVal4(KErrNone); |
|
5673 TInt maxDuration(KHWRMLightMaxDuration); |
|
5674 TInt infDuration(KHWRMInfiniteDuration); |
|
5675 TInt errVal = KErrNone; |
|
5676 |
|
5677 //create light instance |
|
5678 CHWRMLight* myLight = CHWRMLight::NewLC(); |
|
5679 |
|
5680 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights off for primary display and keyboard")); |
|
5681 //Set lights off for infinite duration |
|
5682 TRAP(errVal, myLight->LightOffL(CHWRMLight::EPrimaryDisplayAndKeyboard)); |
|
5683 CTestScheduler::StartAndStopL(100); |
|
5684 |
|
5685 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights on for primary display and keyboard")); |
|
5686 //set lights on for too long duration KHWRMLightMaxDuration+1 //KErrArgument |
|
5687 TRAP(retVal1, myLight->LightOnL(CHWRMLight::EPrimaryDisplayAndKeyboard, (maxDuration+1))); |
|
5688 CTestScheduler::StartAndStopL(100); |
|
5689 |
|
5690 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights on for primary display and keyboard")); |
|
5691 //set lights on for infinite duration KHWRMInfiniteDuration//KErrArgument |
|
5692 TRAP(retVal2, myLight->LightOnL(CHWRMLight::EPrimaryDisplayAndKeyboard, (infDuration-1))); |
|
5693 CTestScheduler::StartAndStopL(100); |
|
5694 |
|
5695 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights on for primary display and keyboard")); |
|
5696 myLight->LightOnL(CHWRMLight::EPrimaryDisplayAndKeyboard, KHWRMInfiniteDuration); |
|
5697 CTestScheduler::StartAndStopL(100); |
|
5698 |
|
5699 //check light status for primary display |
|
5700 myStatus = myLight->LightStatus( CHWRMLight::EPrimaryDisplay ); |
|
5701 if( myStatus != CHWRMLight::ELightOn ) |
|
5702 { |
|
5703 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK")); |
|
5704 FormatMessageL(EHwrmMessageOpDebug,_L(" Primary display light status: 0x%x"), myStatus); |
|
5705 CleanupStack::PopAndDestroy( myLight ); |
|
5706 return KErrGeneral; |
|
5707 } |
|
5708 //check light status for primary keyboard |
|
5709 myStatus = myLight->LightStatus( CHWRMLight::EPrimaryKeyboard ); |
|
5710 if( myStatus != CHWRMLight::ELightOn ) |
|
5711 { |
|
5712 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK")); |
|
5713 FormatMessageL(EHwrmMessageOpDebug,_L(" Primary keyboard light status: 0x%x"), myStatus); |
|
5714 CleanupStack::PopAndDestroy( myLight ); |
|
5715 return KErrGeneral; |
|
5716 } |
|
5717 |
|
5718 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights off for primary display and keyboard")); |
|
5719 //set lights off for too long duration KHWRMInfiniteDuration-1 //KErrArgument |
|
5720 TRAP(retVal3, myLight->LightOffL(CHWRMLight::EPrimaryDisplayAndKeyboard, (infDuration-1))); |
|
5721 CTestScheduler::StartAndStopL(100); |
|
5722 |
|
5723 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights off for primary display and keyboard")); |
|
5724 //set lights off for too long duration KHWRMLightMaxDuration+1 //KErrArgument |
|
5725 TRAP(retVal4, myLight->LightOffL(CHWRMLight::EPrimaryDisplayAndKeyboard, (maxDuration+1))); |
|
5726 CTestScheduler::StartAndStopL(100); |
|
5727 |
|
5728 FormatMessageL(EHwrmMessageOpDebug,_L(" ret1[%d], ret2[%d], ret3[%d], ret4[%d]"), retVal1, retVal2, retVal3, retVal4); |
|
5729 |
|
5730 if (retVal1 != KErrArgument || retVal2 != KErrArgument || retVal3 != KErrArgument || retVal4 != KErrArgument) |
|
5731 { |
|
5732 errVal = KErrGeneral; |
|
5733 } |
|
5734 else |
|
5735 { |
|
5736 errVal = KErrNone; |
|
5737 } |
|
5738 |
|
5739 CleanupStack::PopAndDestroy( myLight ); |
|
5740 |
|
5741 return errVal; |
|
5742 |
|
5743 } |
|
5744 |
|
5745 // ----------------------------------------------------------------------------- |
|
5746 // CHwrmTestCaseController::LightWithInvalidDurationExtended() |
|
5747 // |
|
5748 // ----------------------------------------------------------------------------- |
|
5749 // |
|
5750 TInt CHwrmTestCaseController::LightWithInvalidDurationExtended() |
|
5751 { |
|
5752 iObserver.InfoMessage(_L("LightWithInvalidDurationExtended")); |
|
5753 FormatMessageL(EHwrmMessageOpDebug,_L(" Test case: HWRM Extended [LightWithInvalidDuration]")); |
|
5754 |
|
5755 CHWRMExtendedLight::TLightStatus myStatus; |
|
5756 TInt retVal1(KErrNone); |
|
5757 TInt retVal2(KErrNone); |
|
5758 TInt retVal3(KErrNone); |
|
5759 TInt retVal4(KErrNone); |
|
5760 TInt maxDuration(KHWRMLightMaxDuration); |
|
5761 TInt infDuration(KHWRMInfiniteDuration); |
|
5762 TInt errVal = KErrNone; |
|
5763 |
|
5764 //create light instance |
|
5765 CHWRMExtendedLight* myLight = NULL; |
|
5766 |
|
5767 if ( iApiType == EHWRMApiTypeEAPI ) |
|
5768 { |
|
5769 myLight = CHWRMEnhancedLight::NewLC(); |
|
5770 } |
|
5771 else |
|
5772 { |
|
5773 myLight = CHWRMExtendedLight::NewLC(); |
|
5774 } |
|
5775 |
|
5776 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights off for primary display and keyboard")); |
|
5777 //Set lights off for infinite duration |
|
5778 TRAP(errVal, myLight->LightOffL(CHWRMExtendedLight::EPrimaryDisplayAndKeyboard)); |
|
5779 CTestScheduler::StartAndStopL(100); |
|
5780 |
|
5781 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights on for primary display and keyboard")); |
|
5782 //set lights on for too long duration KHWRMLightMaxDuration+1 //KErrArgument |
|
5783 TRAP(retVal1, myLight->LightOnL(CHWRMExtendedLight::EPrimaryDisplayAndKeyboard, (maxDuration+1))); |
|
5784 CTestScheduler::StartAndStopL(100); |
|
5785 |
|
5786 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights on for primary display and keyboard")); |
|
5787 //set lights on for infinite duration KHWRMInfiniteDuration//KErrArgument |
|
5788 TRAP(retVal2, myLight->LightOnL(CHWRMExtendedLight::EPrimaryDisplayAndKeyboard, (infDuration-1))); |
|
5789 CTestScheduler::StartAndStopL(100); |
|
5790 |
|
5791 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights on for primary display and keyboard")); |
|
5792 myLight->LightOnL(CHWRMExtendedLight::EPrimaryDisplayAndKeyboard, KHWRMInfiniteDuration); |
|
5793 CTestScheduler::StartAndStopL(100); |
|
5794 |
|
5795 //check light status for primary display |
|
5796 myStatus = myLight->LightStatus( CHWRMExtendedLight::EPrimaryDisplay ); |
|
5797 if( myStatus != CHWRMExtendedLight::ELightOn ) |
|
5798 { |
|
5799 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK")); |
|
5800 FormatMessageL(EHwrmMessageOpDebug,_L(" Primary display light status: 0x%x"), myStatus); |
|
5801 CleanupStack::PopAndDestroy( myLight ); |
|
5802 return KErrGeneral; |
|
5803 } |
|
5804 //check light status for primary keyboard |
|
5805 myStatus = myLight->LightStatus( CHWRMExtendedLight::EPrimaryKeyboard ); |
|
5806 if( myStatus != CHWRMExtendedLight::ELightOn ) |
|
5807 { |
|
5808 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK")); |
|
5809 FormatMessageL(EHwrmMessageOpDebug,_L(" Primary keyboard light status: 0x%x"), myStatus); |
|
5810 CleanupStack::PopAndDestroy( myLight ); |
|
5811 return KErrGeneral; |
|
5812 } |
|
5813 |
|
5814 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights off for primary display and keyboard")); |
|
5815 //set lights off for too long duration KHWRMInfiniteDuration-1 //KErrArgument |
|
5816 TRAP(retVal3, myLight->LightOffL(CHWRMExtendedLight::EPrimaryDisplayAndKeyboard, (infDuration-1))); |
|
5817 CTestScheduler::StartAndStopL(100); |
|
5818 |
|
5819 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights off for primary display and keyboard")); |
|
5820 //set lights off for too long duration KHWRMLightMaxDuration+1 //KErrArgument |
|
5821 TRAP(retVal4, myLight->LightOffL(CHWRMExtendedLight::EPrimaryDisplayAndKeyboard, (maxDuration+1))); |
|
5822 CTestScheduler::StartAndStopL(100); |
|
5823 |
|
5824 FormatMessageL(EHwrmMessageOpDebug,_L(" ret1[%d], ret2[%d], ret3[%d], ret4[%d]"), retVal1, retVal2, retVal3, retVal4); |
|
5825 |
|
5826 if (retVal1 != KErrArgument || retVal2 != KErrArgument || retVal3 != KErrArgument || retVal4 != KErrArgument) |
|
5827 { |
|
5828 errVal = KErrGeneral; |
|
5829 } |
|
5830 else |
|
5831 { |
|
5832 errVal = KErrNone; |
|
5833 } |
|
5834 |
|
5835 CleanupStack::PopAndDestroy( myLight ); |
|
5836 |
|
5837 return errVal; |
|
5838 } |
|
5839 |
|
5840 |
|
5841 |
|
5842 // ----------------------------------------------------------------------------- |
|
5843 // CHwrmTestCaseController::LightIntensitySDK() |
|
5844 // |
|
5845 // ----------------------------------------------------------------------------- |
|
5846 // |
|
5847 TInt CHwrmTestCaseController::LightIntensitySDK( ) |
|
5848 { |
|
5849 //iObserver.InfoMessage(_L("LightIntensity")); |
|
5850 FormatMessageL(EHwrmMessageOpDebug,_L(" Test case: HWRM SDK [LightWithIntensity]")); |
|
5851 |
|
5852 CHWRMLight::TLightStatus myStatus; |
|
5853 TInt defIntensity( KHWRMDefaultIntensity ); |
|
5854 TInt maxIntensity( KHWRMLightMaxIntensity ); |
|
5855 TInt minIntensity( KHWRMLightMinIntensity ); |
|
5856 |
|
5857 TInt errVal( KErrNone ); |
|
5858 |
|
5859 //create light instance |
|
5860 CHWRMLight* myLight = CHWRMLight::NewLC(); |
|
5861 |
|
5862 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights off for primary display and keyboard")); |
|
5863 //Set lights off for infinite duration |
|
5864 TRAP(errVal, myLight->LightOffL(CHWRMLight::EPrimaryDisplayAndKeyboard)); |
|
5865 CTestScheduler::StartAndStopL(100); |
|
5866 |
|
5867 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights on for primary display")); |
|
5868 |
|
5869 TRAP( errVal, myLight->LightOnL( CHWRMLight::EPrimaryDisplay, 2000, defIntensity, ETrue ) ); |
|
5870 CTestScheduler::StartAndStopL(100); |
|
5871 if( errVal != KErrNone ) |
|
5872 { |
|
5873 FormatMessageL(EHwrmMessageOpDebug,_L(" myLight->LightOnL() failed [%d]"), errVal); |
|
5874 CleanupStack::PopAndDestroy( myLight ); |
|
5875 return errVal; |
|
5876 } |
|
5877 |
|
5878 myStatus = myLight->LightStatus( CHWRMLight::EPrimaryDisplay ); |
|
5879 if ( myStatus != CHWRMLight::ELightOn ) |
|
5880 { |
|
5881 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK")); |
|
5882 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), myStatus); |
|
5883 CleanupStack::PopAndDestroy( myLight ); |
|
5884 return KErrGeneral; |
|
5885 } |
|
5886 |
|
5887 CTestScheduler::StartAndStopL(2000); |
|
5888 |
|
5889 |
|
5890 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights on for primary keyboard")); |
|
5891 |
|
5892 TRAP( errVal, myLight->LightOnL( CHWRMLight::EPrimaryKeyboard, 2000, maxIntensity, ETrue ) ); |
|
5893 CTestScheduler::StartAndStopL(100); |
|
5894 |
|
5895 if(errVal != KErrNone) |
|
5896 { |
|
5897 FormatMessageL(EHwrmMessageOpDebug,_L(" myLight->LightOnL() failed [%d]"), errVal); |
|
5898 CleanupStack::PopAndDestroy( myLight ); |
|
5899 return errVal; |
|
5900 } |
|
5901 |
|
5902 myStatus = myLight->LightStatus( CHWRMLight::EPrimaryKeyboard ); |
|
5903 if(myStatus != CHWRMLight::ELightOn) |
|
5904 { |
|
5905 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK")); |
|
5906 FormatMessageL(EHwrmMessageOpDebug,_L(" Keyboard light status: 0x%x"), myStatus); |
|
5907 CleanupStack::PopAndDestroy( myLight ); |
|
5908 return KErrGeneral; |
|
5909 } |
|
5910 |
|
5911 //wait that lights are off |
|
5912 CTestScheduler::StartAndStopL(2000); |
|
5913 |
|
5914 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights on for primary display")); |
|
5915 |
|
5916 TRAP(errVal, myLight->LightOnL(CHWRMLight::EPrimaryDisplay, 2000, minIntensity, ETrue)); |
|
5917 CTestScheduler::StartAndStopL(100); |
|
5918 |
|
5919 if(errVal != KErrNone) |
|
5920 { |
|
5921 FormatMessageL(EHwrmMessageOpDebug,_L(" myLight->LightOnL() failed [%d]"), errVal); |
|
5922 CleanupStack::PopAndDestroy( myLight ); |
|
5923 return errVal; |
|
5924 } |
|
5925 |
|
5926 myStatus = myLight->LightStatus( CHWRMLight::EPrimaryDisplay ); |
|
5927 if( myStatus != CHWRMLight::ELightOn ) |
|
5928 { |
|
5929 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK")); |
|
5930 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), myStatus); |
|
5931 CleanupStack::PopAndDestroy( myLight ); |
|
5932 return KErrGeneral; |
|
5933 } |
|
5934 |
|
5935 CTestScheduler::StartAndStopL(2000); |
|
5936 |
|
5937 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights on for keyboard display (-100)")); //KErrArgument |
|
5938 |
|
5939 TRAP(errVal, myLight->LightOnL(CHWRMLight::EPrimaryDisplay, 2000, -100, ETrue)); |
|
5940 CTestScheduler::StartAndStopL(100); |
|
5941 if( errVal == KErrArgument ) |
|
5942 { |
|
5943 errVal = KErrNone; |
|
5944 } |
|
5945 |
|
5946 CleanupStack::PopAndDestroy( myLight ); |
|
5947 |
|
5948 return errVal; |
|
5949 |
|
5950 } |
|
5951 |
|
5952 // ----------------------------------------------------------------------------- |
|
5953 // CHwrmTestCaseController::LightIntensityExtended() |
|
5954 // |
|
5955 // ----------------------------------------------------------------------------- |
|
5956 // |
|
5957 TInt CHwrmTestCaseController::LightIntensityExtended( ) |
|
5958 { |
|
5959 iObserver.InfoMessage(_L("LightIntensityExtended")); |
|
5960 FormatMessageL(EHwrmMessageOpDebug,_L(" Test case: HWRM Extended [LightWithIntensity]")); |
|
5961 |
|
5962 CHWRMExtendedLight::TLightStatus myStatus; |
|
5963 TInt defIntensity( KHWRMDefaultIntensity ); |
|
5964 TInt maxIntensity( KHWRMLightMaxIntensity ); |
|
5965 TInt minIntensity( KHWRMLightMinIntensity ); |
|
5966 |
|
5967 TInt errVal( KErrNone ); |
|
5968 |
|
5969 //create light instance |
|
5970 CHWRMExtendedLight* myLight = NULL; |
|
5971 |
|
5972 if ( iApiType == EHWRMApiTypeEAPI ) |
|
5973 { |
|
5974 myLight = CHWRMEnhancedLight::NewLC(); |
|
5975 } |
|
5976 else |
|
5977 { |
|
5978 myLight = CHWRMExtendedLight::NewLC(); |
|
5979 } |
|
5980 |
|
5981 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights off for primary display and keyboard")); |
|
5982 //Set lights off for infinite duration |
|
5983 TRAP(errVal, myLight->LightOffL(CHWRMExtendedLight::EPrimaryDisplayAndKeyboard)); |
|
5984 CTestScheduler::StartAndStopL(100); |
|
5985 |
|
5986 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights on for primary display")); |
|
5987 |
|
5988 TRAP( errVal, myLight->LightOnL( CHWRMExtendedLight::EPrimaryDisplay, 2000, defIntensity, ETrue ) ); |
|
5989 CTestScheduler::StartAndStopL(100); |
|
5990 if( errVal != KErrNone ) |
|
5991 { |
|
5992 FormatMessageL(EHwrmMessageOpDebug,_L(" myLight->LightOnL() failed [%d]"), errVal); |
|
5993 CleanupStack::PopAndDestroy( myLight ); |
|
5994 return errVal; |
|
5995 } |
|
5996 |
|
5997 myStatus = myLight->LightStatus( CHWRMExtendedLight::EPrimaryDisplay ); |
|
5998 if ( myStatus != CHWRMExtendedLight::ELightOn ) |
|
5999 { |
|
6000 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK")); |
|
6001 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), myStatus); |
|
6002 CleanupStack::PopAndDestroy( myLight ); |
|
6003 return KErrGeneral; |
|
6004 } |
|
6005 |
|
6006 CTestScheduler::StartAndStopL(2000); |
|
6007 |
|
6008 |
|
6009 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights on for primary keyboard")); |
|
6010 |
|
6011 TRAP( errVal, myLight->LightOnL( CHWRMExtendedLight::EPrimaryKeyboard, 2000, maxIntensity, ETrue ) ); |
|
6012 CTestScheduler::StartAndStopL(100); |
|
6013 |
|
6014 if(errVal != KErrNone) |
|
6015 { |
|
6016 FormatMessageL(EHwrmMessageOpDebug,_L(" myLight->LightOnL() failed [%d]"), errVal); |
|
6017 CleanupStack::PopAndDestroy( myLight ); |
|
6018 return errVal; |
|
6019 } |
|
6020 |
|
6021 myStatus = myLight->LightStatus( CHWRMExtendedLight::EPrimaryKeyboard ); |
|
6022 if(myStatus != CHWRMExtendedLight::ELightOn) |
|
6023 { |
|
6024 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK")); |
|
6025 FormatMessageL(EHwrmMessageOpDebug,_L(" Keyboard light status: 0x%x"), myStatus); |
|
6026 CleanupStack::PopAndDestroy( myLight ); |
|
6027 return KErrGeneral; |
|
6028 } |
|
6029 |
|
6030 //wait that lights are off |
|
6031 CTestScheduler::StartAndStopL(2000); |
|
6032 |
|
6033 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights on for primary display")); |
|
6034 |
|
6035 TRAP(errVal, myLight->LightOnL(CHWRMExtendedLight::EPrimaryDisplay, 2000, minIntensity, ETrue)); |
|
6036 CTestScheduler::StartAndStopL(100); |
|
6037 |
|
6038 if(errVal != KErrNone) |
|
6039 { |
|
6040 FormatMessageL(EHwrmMessageOpDebug,_L(" myLight->LightOnL() failed [%d]"), errVal); |
|
6041 CleanupStack::PopAndDestroy( myLight ); |
|
6042 return errVal; |
|
6043 } |
|
6044 |
|
6045 myStatus = myLight->LightStatus( CHWRMExtendedLight::EPrimaryDisplay ); |
|
6046 if( myStatus != CHWRMExtendedLight::ELightOn ) |
|
6047 { |
|
6048 FormatMessageL(EHwrmMessageOpDebug,_L(" Light status not OK")); |
|
6049 FormatMessageL(EHwrmMessageOpDebug,_L(" Display light status: 0x%x"), myStatus); |
|
6050 CleanupStack::PopAndDestroy( myLight ); |
|
6051 return KErrGeneral; |
|
6052 } |
|
6053 |
|
6054 CTestScheduler::StartAndStopL(2000); |
|
6055 |
|
6056 FormatMessageL(EHwrmMessageOpDebug,_L(" Set lights on for keyboard display (-100)")); //KErrArgument |
|
6057 |
|
6058 TRAP(errVal, myLight->LightOnL(CHWRMExtendedLight::EPrimaryDisplay, 2000, -100, ETrue)); |
|
6059 CTestScheduler::StartAndStopL(100); |
|
6060 if( errVal == KErrArgument ) |
|
6061 { |
|
6062 errVal = KErrNone; |
|
6063 } |
|
6064 |
|
6065 CleanupStack::PopAndDestroy( myLight ); |
|
6066 |
|
6067 return errVal; |
|
6068 } |
|
6069 |
|
6070 |
|
6071 // ----------------------------------------------------------------------------- |
|
6072 // CHwrmTestCaseController::LightWithInvalidTarget |
|
6073 // |
|
6074 // ----------------------------------------------------------------------------- |
|
6075 // |
|
6076 /*TInt CHwrmTestCaseController::LightWithInvalidTarget( ) |
|
6077 { |
|
6078 iObserver.InfoMessage(_L("LightWithInvalidTarget")); |
|
6079 TInt retVal1(0), retVal2(0); |
|
6080 CHWRMLight::TLightTarget invalidTarget = 20; |
|
6081 |
|
6082 errVal = KErrNone; |
|
6083 //create light instance |
|
6084 iMyLight = CHWRMLight::NewL(this); |
|
6085 |
|
6086 //Set lights off for infinite duration |
|
6087 iMyLight->LightOffL(CHWRMLight::EPrimaryDisplayAndKeyboard); |
|
6088 |
|
6089 //try to set lights on for invalid target //KErrNotSupported |
|
6090 TRAP(retVal1, iMyLight->LightOnL(invalidTarget, KHWRMLightMaxDuration)); |
|
6091 |
|
6092 iMyLight->LightOnL(CHWRMLight::EPrimaryDisplayAndKeyboard, KHWRMInfiniteDuration); |
|
6093 CTestScheduler::StartAndStopL(1000); |
|
6094 |
|
6095 if(iMyStatus != ELightOn) |
|
6096 { |
|
6097 delete iMyLight; |
|
6098 return (errVal = KErrGeneral); |
|
6099 } |
|
6100 |
|
6101 //try to set lights off for invalid target //KErrNotSupported |
|
6102 TRAP(retVal2, iMyLight->LightOffL(invalidTarget, KHWRMInfiniteDuration); |
|
6103 |
|
6104 if (retVal1 == KErrNotSupported && retVal2 == KErrNotSupported) |
|
6105 { |
|
6106 errVal = KErrNone; |
|
6107 } |
|
6108 else |
|
6109 { |
|
6110 errVal = KErrGeneral; |
|
6111 } |
|
6112 |
|
6113 delete iMyLight; |
|
6114 return errVal; |
|
6115 |
|
6116 }*/ |
|
6117 |
|
6118 void CHwrmTestCaseController::FormatMessageL(THwrmMessageOp aOp, const TDesC& aMessage) |
|
6119 { |
|
6120 SendMessage(aOp,aMessage); |
|
6121 } |
|
6122 |
|
6123 void CHwrmTestCaseController::FormatMessageL(THwrmMessageOp aOp, const TDesC& aMessage, TInt aArg1) |
|
6124 { |
|
6125 HBufC* message = HBufC::NewLC(aMessage.Length() + 10); |
|
6126 message->Des().Format(aMessage,aArg1); |
|
6127 SendMessage(aOp,*message); |
|
6128 CleanupStack::PopAndDestroy(message); |
|
6129 } |
|
6130 |
|
6131 void CHwrmTestCaseController::FormatMessageL(THwrmMessageOp aOp, const TDesC& aMessage, TInt aArg1, TInt aArg2) |
|
6132 { |
|
6133 HBufC* message = HBufC::NewLC(aMessage.Length() + 20); |
|
6134 message->Des().Format(aMessage,aArg1,aArg2); |
|
6135 SendMessage(aOp,*message); |
|
6136 CleanupStack::PopAndDestroy(message); |
|
6137 } |
|
6138 |
|
6139 void CHwrmTestCaseController::FormatMessageL(THwrmMessageOp aOp, const TDesC& aMessage, TInt aArg1, TInt aArg2, TInt aArg3) |
|
6140 { |
|
6141 HBufC* message = HBufC::NewLC(aMessage.Length() + 30); |
|
6142 message->Des().Format(aMessage,aArg1,aArg2,aArg3); |
|
6143 SendMessage(aOp,*message); |
|
6144 CleanupStack::PopAndDestroy(message); |
|
6145 } |
|
6146 |
|
6147 void CHwrmTestCaseController::FormatMessageL(THwrmMessageOp aOp, const TDesC& aMessage, TInt aArg1, TInt aArg2, TInt aArg3, TInt aArg4) |
|
6148 { |
|
6149 HBufC* message = HBufC::NewLC(aMessage.Length() + 40); |
|
6150 message->Des().Format(aMessage,aArg1,aArg2,aArg3,aArg4); |
|
6151 SendMessage(aOp,*message); |
|
6152 CleanupStack::PopAndDestroy(message); |
|
6153 } |
|
6154 |
|
6155 void CHwrmTestCaseController::FormatMessageL(THwrmMessageOp aOp, const TDesC& aMessage, const TDesC* aArg1) |
|
6156 { |
|
6157 HBufC* message = HBufC::NewLC(aMessage.Length() + aArg1->Length() + 10); |
|
6158 message->Des().Format(aMessage,aArg1); |
|
6159 SendMessage(aOp,*message); |
|
6160 CleanupStack::PopAndDestroy(message); |
|
6161 } |
|
6162 |
|
6163 void CHwrmTestCaseController::FormatMessageL(THwrmMessageOp aOp, const TDesC& aMessage, const TDesC* aArg1, TInt aArg2, TInt aArg3) |
|
6164 { |
|
6165 HBufC* message = HBufC::NewLC(aMessage.Length() + aArg1->Length() + 20); |
|
6166 message->Des().Format(aMessage,aArg1,aArg2,aArg3); |
|
6167 SendMessage(aOp,*message); |
|
6168 CleanupStack::PopAndDestroy(message); |
|
6169 } |
|
6170 |
|
6171 // NOTE: this is not very elegant, but it's just test code... improve in future if needed |
|
6172 void CHwrmTestCaseController::SendMessage(THwrmMessageOp aOp, const TDesC& aMessage) |
|
6173 { |
|
6174 switch(aOp) |
|
6175 { |
|
6176 case EHwrmMessageOpInfo: |
|
6177 iObserver.InfoMessage(aMessage); |
|
6178 break; |
|
6179 case EHwrmMessageOpLog: |
|
6180 iObserver.LogMessage(aMessage); |
|
6181 break; |
|
6182 case EHwrmMessageOpDebug: |
|
6183 iObserver.DebugMessage(aMessage); |
|
6184 break; |
|
6185 default: |
|
6186 break; |
|
6187 } |
|
6188 } |
|
6189 |
|
6190 // |
|
6191 // |
|
6192 // |
|
6193 |
|
6194 /* TeK -> */ |
|
6195 |
|
6196 // ----------------------------------------------------------------------------- |
|
6197 // CHwrmTestCaseController::RunSlaveMode |
|
6198 // |
|
6199 // This method is called when application is started in SLAVE-mode |
|
6200 // |
|
6201 // ----------------------------------------------------------------------------- |
|
6202 // |
|
6203 void CHwrmTestCaseController::RunSlaveMode() |
|
6204 { |
|
6205 if (iMcFramework == NULL) |
|
6206 { |
|
6207 TRAPD(err,iMcFramework = CMcFramework::NewL()); |
|
6208 if (err) |
|
6209 { |
|
6210 _LIT(KErrorMsg,"Failed to instantiate CMcFramework. Aborting multiclient cases (slave mode)"); |
|
6211 iObserver.LogMessage(KErrorMsg); |
|
6212 return; |
|
6213 } |
|
6214 } |
|
6215 |
|
6216 TInt tcase = 0; |
|
6217 TInt recStat = KErrNone; |
|
6218 |
|
6219 while (tcase != EHWRMQuitTest) |
|
6220 { |
|
6221 tcase = iMcFramework->WaitTestToStart(); |
|
6222 |
|
6223 if (tcase != EHWRMQuitTest) |
|
6224 { |
|
6225 switch(tcase) |
|
6226 { |
|
6227 case (EMultiClientCase1): |
|
6228 recStat = MC_Primary_display_light_S(); |
|
6229 iMcFramework->StepExecuted(recStat); |
|
6230 break; |
|
6231 case (EMultiClientCase2): |
|
6232 recStat = MC_Display_on_and_keyboard_blink_S(); |
|
6233 iMcFramework->StepExecuted(recStat); |
|
6234 break; |
|
6235 case (EMultiClientCase3): |
|
6236 recStat = MC_Display_on_and_keyboard_reserved_S(); |
|
6237 iMcFramework->StepExecuted(recStat); |
|
6238 break; |
|
6239 case (EMultiClientCase4): |
|
6240 recStat = MC_Display_and_keyboard_blink_S(); |
|
6241 iMcFramework->StepExecuted(recStat); |
|
6242 break; |
|
6243 case (EMultiClientCase5): |
|
6244 recStat = MC_Vibra_Basic_Usage_S(); |
|
6245 iMcFramework->StepExecuted(recStat); |
|
6246 break; |
|
6247 case (EMultiClientCase6): |
|
6248 recStat = Verify_MCFramework_S(); |
|
6249 iMcFramework->StepExecuted(recStat); |
|
6250 break; |
|
6251 case (EMultiClientCase7): |
|
6252 recStat = MC_Combined_light_and_vibra_usage_S(); |
|
6253 iMcFramework->StepExecuted(recStat); |
|
6254 break; |
|
6255 case (EMultiClientCase8): |
|
6256 recStat = MC_Combined_light_and_vibra_usage_2_S(); |
|
6257 iMcFramework->StepExecuted(recStat); |
|
6258 break; |
|
6259 case (EMultiClientCase9): |
|
6260 recStat = MC_FmTx_Basic_Usage_S(); |
|
6261 iMcFramework->StepExecuted(recStat); |
|
6262 break; |
|
6263 case (EMultiClientCase14): |
|
6264 recStat = MC_Display_RGB_S(); |
|
6265 iMcFramework->StepExecuted(recStat); |
|
6266 break; |
|
6267 default: |
|
6268 iMcFramework->StepExecuted(KErrGeneral); |
|
6269 } |
|
6270 } |
|
6271 |
|
6272 } |
|
6273 } |
|
6274 |
|
6275 // ----------------------------------------------------------------------------- |
|
6276 // CHwrmTestCaseController::Verify_MCFramework_S |
|
6277 // Slave side test case to verify McFramework functionality |
|
6278 // ----------------------------------------------------------------------------- |
|
6279 // |
|
6280 TInt CHwrmTestCaseController::Verify_MCFramework_S() |
|
6281 { |
|
6282 |
|
6283 FormatMessageL(EHwrmMessageOpDebug,_L("Verify_MCFramework_S() starting")); |
|
6284 |
|
6285 CTestScheduler::StartAndStopL(1000); // Testin suoritusta |
|
6286 |
|
6287 iMcFramework->StepExecuted(KErrNone); // palautetaan testistepin tulos |
|
6288 TInt execStep = iMcFramework->WaitNextTestStep(); // mennään odottamaan seuraavaa steppiä |
|
6289 |
|
6290 CTestScheduler::StartAndStopL(1000); // Testin suoritus jatkuu |
|
6291 |
|
6292 //iMcFramework->StepExecuted(KErrNone); last step execution is reported in RunSlaveMode() |
|
6293 |
|
6294 FormatMessageL(EHwrmMessageOpDebug,_L("Verify_MCFramework_S() done")); |
|
6295 |
|
6296 return KErrNone; |
|
6297 |
|
6298 } |
|
6299 |
|
6300 // ----------------------------------------------------------------------------- |
|
6301 // CHwrmTestCaseController::MC_Primary_display_light_S |
|
6302 // Light usage with two applications / This application is on the background |
|
6303 // ----------------------------------------------------------------------------- |
|
6304 // |
|
6305 TInt CHwrmTestCaseController::MC_Primary_display_light_S() |
|
6306 { |
|
6307 |
|
6308 FormatMessageL(EHwrmMessageOpDebug,_L("MC_Primary_display_light_S()")); |
|
6309 TInt iErrVal = KErrNone; |
|
6310 CHWRMLight::TLightStatus currStatus; |
|
6311 CHWRMLight::TLightStatus origStatus; |
|
6312 |
|
6313 //create light instance |
|
6314 TRAP(iErrVal, iMyLight = CHWRMLight::NewL(this)); |
|
6315 |
|
6316 if (iErrVal == KErrNone) |
|
6317 { |
|
6318 |
|
6319 origStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
6320 |
|
6321 //reserve light, Restore state after release = True, Force CoeNoeEnvOn = True |
|
6322 TRAP(iErrVal, iMyLight->ReserveLightL(CHWRMLight::EPrimaryDisplay, ETrue, ETrue)); |
|
6323 |
|
6324 if (iErrVal == KErrNone) |
|
6325 { |
|
6326 // Reservation was OK |
|
6327 |
|
6328 // Set primary display light blinking |
|
6329 iErrVal = TestLightBlink(CHWRMLight::EPrimaryDisplay, 10000, 1000, 1000, 100); |
|
6330 |
|
6331 if (iErrVal == KErrNone) |
|
6332 { |
|
6333 // Check light status |
|
6334 currStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
6335 |
|
6336 if (currStatus == CHWRMLight::ELightBlink ) |
|
6337 { |
|
6338 /* Light status is OK */ |
|
6339 |
|
6340 iMcFramework->StepExecuted(KErrNone); |
|
6341 iErrVal = iMcFramework->WaitNextTestStep(); |
|
6342 |
|
6343 if (iErrVal == KErrNone) |
|
6344 { |
|
6345 /* Test execution was OK in peer-application */ |
|
6346 |
|
6347 /* Check current light status */ |
|
6348 currStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
6349 |
|
6350 if (currStatus == CHWRMLight::ELightBlink) |
|
6351 { |
|
6352 /* OK, light is still blinking */ |
|
6353 |
|
6354 /* Wait 10 seconds */ |
|
6355 CTestScheduler::StartAndStopL(10000); |
|
6356 |
|
6357 // Release light, then status should return in state as it was before reservation |
|
6358 iMyLight->ReleaseLight(CHWRMLight::EPrimaryDisplay); |
|
6359 |
|
6360 CTestScheduler::StartAndStopL(2000); |
|
6361 /* Check light status */ |
|
6362 currStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
6363 |
|
6364 if(currStatus == origStatus) |
|
6365 { |
|
6366 /* OK, light is not blinking anymore */ |
|
6367 iErrVal = KErrNone; |
|
6368 //iMcFramework->StepExecuted(KErrNone); last step execution is reported in RunSlaveMode() |
|
6369 } |
|
6370 else |
|
6371 { |
|
6372 FormatMessageL(EHwrmMessageOpDebug,_L("Wrong light status %d. Expected original: %d"), currStatus, origStatus); |
|
6373 iErrVal = KErrGeneral; |
|
6374 } |
|
6375 |
|
6376 } |
|
6377 else |
|
6378 { |
|
6379 // wrong light status |
|
6380 FormatMessageL(EHwrmMessageOpDebug,_L("Wrong light status:%d. Expected [Blink]"), currStatus); |
|
6381 iErrVal = KErrGeneral; |
|
6382 } |
|
6383 } |
|
6384 else |
|
6385 { |
|
6386 // execution failed in peer-application |
|
6387 FormatMessageL(EHwrmMessageOpDebug,_L("Execution failed peer. Error:%d"), iErrVal); |
|
6388 } |
|
6389 } |
|
6390 else |
|
6391 { |
|
6392 FormatMessageL(EHwrmMessageOpDebug,_L("Wrong light status [%d]. Expected [Blink]"), currStatus); |
|
6393 iErrVal = KErrGeneral; |
|
6394 } |
|
6395 } |
|
6396 else |
|
6397 { |
|
6398 // Set light blinking failed |
|
6399 FormatMessageL(EHwrmMessageOpDebug,_L("Set light blink Error:%d"),iErrVal); |
|
6400 } |
|
6401 } |
|
6402 else |
|
6403 { |
|
6404 FormatMessageL(EHwrmMessageOpDebug,_L("ReserveLightL returned error %d"), iErrVal); |
|
6405 } |
|
6406 } |
|
6407 delete iMyLight; |
|
6408 return iErrVal; |
|
6409 |
|
6410 } |
|
6411 |
|
6412 |
|
6413 // ----------------------------------------------------------------------------- |
|
6414 // CHwrmTestCaseController::MC_Display_on_and_keyboard_blink_S |
|
6415 // Light usage with two applications |
|
6416 // ----------------------------------------------------------------------------- |
|
6417 // |
|
6418 TInt CHwrmTestCaseController::MC_Display_on_and_keyboard_blink_S() |
|
6419 { |
|
6420 FormatMessageL(EHwrmMessageOpDebug,_L("MC_Display_on_and_keyboard_blink_S()")); |
|
6421 TInt iErrVal = KErrNone; |
|
6422 CHWRMLight::TLightStatus currKeybStatus; |
|
6423 CHWRMLight::TLightStatus currDispStatus; |
|
6424 CHWRMLight::TLightStatus origKeybStatus; |
|
6425 CHWRMLight::TLightStatus origDispStatus; |
|
6426 |
|
6427 TRAP(iErrVal, iMyLight = CHWRMLight::NewL(this)); |
|
6428 |
|
6429 if (iErrVal == KErrNone) |
|
6430 { |
|
6431 |
|
6432 origKeybStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
6433 if(origKeybStatus == CHWRMLight::ELightStatusUnknown) |
|
6434 { |
|
6435 origKeybStatus = CHWRMLight::ELightOff; |
|
6436 } |
|
6437 |
|
6438 origDispStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
6439 if(origDispStatus == CHWRMLight::ELightStatusUnknown) |
|
6440 { |
|
6441 origDispStatus = CHWRMLight::ELightOff; |
|
6442 } |
|
6443 |
|
6444 //reserve light |
|
6445 TRAP(iErrVal, iMyLight->ReserveLightL(CHWRMLight::EPrimaryKeyboard, ETrue, ETrue)); |
|
6446 |
|
6447 if (iErrVal == KErrNone) |
|
6448 { |
|
6449 iErrVal = TestLightBlink(CHWRMLight::EPrimaryKeyboard, 10000, 1000, 1000, 100); |
|
6450 |
|
6451 if (iErrVal == KErrNone) |
|
6452 { |
|
6453 currKeybStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
6454 currDispStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
6455 |
|
6456 if(currKeybStatus == CHWRMLight::ELightBlink && currDispStatus == origDispStatus) |
|
6457 { |
|
6458 /* Step executed succesfully */ |
|
6459 |
|
6460 iMcFramework->StepExecuted(KErrNone); |
|
6461 iErrVal = iMcFramework->WaitNextTestStep(); |
|
6462 |
|
6463 if (iErrVal == KErrNone) |
|
6464 { |
|
6465 |
|
6466 currKeybStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
6467 currDispStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
6468 |
|
6469 if(currKeybStatus == CHWRMLight::ELightBlink /*&& currDispStatus == CHWRMLight::ELightOn*/) //SELVITÄ ONKO OK? |
|
6470 { |
|
6471 |
|
6472 CTestScheduler::StartAndStopL(5000); |
|
6473 |
|
6474 iMyLight->ReleaseLight(CHWRMLight::EPrimaryKeyboard); // Muutos 22.6. TeK |
|
6475 |
|
6476 currKeybStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
6477 currDispStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
6478 |
|
6479 if(currKeybStatus == origKeybStatus /*&& currDispStatus == origDispStatus*/) |
|
6480 { |
|
6481 |
|
6482 //iMcFramework->StepExecuted(KErrNone); last step execution is reported in RunSlaveMode() |
|
6483 iErrVal = KErrNone; |
|
6484 } |
|
6485 else |
|
6486 { |
|
6487 FormatMessageL(EHwrmMessageOpDebug,_L("Wrong status Display:%d, Keyboard:%d"),currDispStatus, currKeybStatus); |
|
6488 iErrVal = KErrGeneral; |
|
6489 } |
|
6490 |
|
6491 |
|
6492 } |
|
6493 else |
|
6494 { |
|
6495 FormatMessageL(EHwrmMessageOpDebug,_L("H\xd6\xd6\xd6Wrong status. Expected:%d, received:%d"),CHWRMLight::ELightBlink, currKeybStatus); |
|
6496 iErrVal = KErrGeneral; |
|
6497 } |
|
6498 |
|
6499 } |
|
6500 else |
|
6501 { |
|
6502 // testi feilasi masterissa |
|
6503 FormatMessageL(EHwrmMessageOpDebug,_L("Error from peer application:%d"),iErrVal); |
|
6504 } |
|
6505 } |
|
6506 else |
|
6507 { |
|
6508 // väärä status |
|
6509 FormatMessageL(EHwrmMessageOpDebug,_L("Wrong status! Display:%d, Keyboard:%d"),currDispStatus, currKeybStatus); |
|
6510 iErrVal = KErrGeneral; |
|
6511 } |
|
6512 } |
|
6513 else |
|
6514 { |
|
6515 // Blink failed |
|
6516 FormatMessageL(EHwrmMessageOpDebug,_L("Set keyboard light blink failed:%d"),iErrVal); |
|
6517 } |
|
6518 } |
|
6519 else |
|
6520 { |
|
6521 // valon varaus epäonnistui |
|
6522 FormatMessageL(EHwrmMessageOpDebug,_L("Light reservation failed"),iErrVal); |
|
6523 } |
|
6524 } |
|
6525 |
|
6526 delete iMyLight; |
|
6527 return iErrVal; |
|
6528 } |
|
6529 |
|
6530 |
|
6531 // ----------------------------------------------------------------------------- |
|
6532 // CHwrmTestCaseController::MC_Display_on_and_keyboard_reserved_S |
|
6533 // Light usage with two applications |
|
6534 // ----------------------------------------------------------------------------- |
|
6535 // |
|
6536 TInt CHwrmTestCaseController::MC_Display_on_and_keyboard_reserved_S() |
|
6537 { |
|
6538 FormatMessageL(EHwrmMessageOpDebug,_L("MC_Display_on_and_keyboard_reserved_S()")); |
|
6539 TInt iErrVal = KErrNone; |
|
6540 CHWRMLight::TLightStatus currKeyStatus; |
|
6541 CHWRMLight::TLightStatus currDispStatus; |
|
6542 CHWRMLight::TLightStatus origKeybStatus; |
|
6543 CHWRMLight::TLightStatus origDispStatus; |
|
6544 |
|
6545 TRAP(iErrVal, iMyLight = CHWRMLight::NewL(this)); |
|
6546 |
|
6547 if (iErrVal == KErrNone) |
|
6548 { |
|
6549 |
|
6550 origKeybStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
6551 origDispStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
6552 |
|
6553 //reserve light |
|
6554 TRAP(iErrVal, iMyLight->ReserveLightL(CHWRMLight::EPrimaryDisplayAndKeyboard, ETrue, EFalse)); |
|
6555 |
|
6556 if(iErrVal != KErrNone /*== KErrNotReady*/) |
|
6557 { |
|
6558 // Reservation cannot succeed because trying to reserve while on background |
|
6559 |
|
6560 iErrVal = TestLightBlink(CHWRMLight::EPrimaryDisplayAndKeyboard); |
|
6561 |
|
6562 if(iErrVal != KErrNone /*== KErrInUse*/ ) |
|
6563 { |
|
6564 // Cannot set light because foreground application has reserved display and keyboard |
|
6565 |
|
6566 currKeyStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
6567 currDispStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
6568 |
|
6569 if ( origKeybStatus == currKeyStatus && origDispStatus == currDispStatus ) |
|
6570 { |
|
6571 // Status has not changed -> OK |
|
6572 |
|
6573 CTestScheduler::StartAndStopL(2000); |
|
6574 iMyLight->ReleaseLight(CHWRMLight::EPrimaryDisplayAndKeyboard); |
|
6575 //iMcFramework->StepExecuted(KErrNone); last step execution is reported in RunSlaveMode() |
|
6576 iErrVal = KErrNone; |
|
6577 } |
|
6578 else |
|
6579 { |
|
6580 // Status has changed -> error |
|
6581 FormatMessageL(EHwrmMessageOpDebug,_L("Unexpected status change :From:%d,%d To:%d,%d"),origKeybStatus, origDispStatus, currKeyStatus, currDispStatus); |
|
6582 iErrVal = KErrGeneral; |
|
6583 } |
|
6584 } |
|
6585 else |
|
6586 { |
|
6587 // Test blink antoi väärän errorin |
|
6588 FormatMessageL(EHwrmMessageOpDebug,_L("Wrong error from peer application:%d"),iErrVal); |
|
6589 |
|
6590 } |
|
6591 } |
|
6592 else |
|
6593 { |
|
6594 // varaus epäonnistui |
|
6595 FormatMessageL(EHwrmMessageOpDebug,_L("Reservation failed reason:%d"),iErrVal); |
|
6596 } |
|
6597 } |
|
6598 |
|
6599 delete iMyLight; |
|
6600 return iErrVal; |
|
6601 } |
|
6602 |
|
6603 // ----------------------------------------------------------------------------- |
|
6604 // CHwrmTestCaseController::MC_Display_and_keyboard_blink_S |
|
6605 // Light usage with two applications |
|
6606 // ----------------------------------------------------------------------------- |
|
6607 // |
|
6608 TInt CHwrmTestCaseController::MC_Display_and_keyboard_blink_S() |
|
6609 { |
|
6610 FormatMessageL(EHwrmMessageOpDebug,_L("MC_Display_and_keyboard_blink_S()")); |
|
6611 TInt iErrVal = KErrNone; |
|
6612 CHWRMLight::TLightStatus currKeyStatus(CHWRMLight::ELightBlink); |
|
6613 CHWRMLight::TLightStatus currDispStatus(CHWRMLight::ELightBlink); |
|
6614 CHWRMLight::TLightStatus origKeyStatus; |
|
6615 CHWRMLight::TLightStatus origDispStatus; |
|
6616 |
|
6617 TRAP(iErrVal, iMyLight = CHWRMLight::NewL(this)); |
|
6618 |
|
6619 if (iErrVal == KErrNone) |
|
6620 { |
|
6621 |
|
6622 CTestScheduler::StartAndStopL(1000); |
|
6623 |
|
6624 origKeyStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
6625 origDispStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
6626 |
|
6627 //reserve light |
|
6628 TRAP(iErrVal, iMyLight->ReserveLightL(CHWRMLight::EPrimaryDisplayAndKeyboard, ETrue, EFalse)); |
|
6629 |
|
6630 if(iErrVal == KErrNotReady) // was KErrone |
|
6631 { |
|
6632 iErrVal = TestLightOn(CHWRMLight::EPrimaryDisplayAndKeyboard, 5000, 75, EFalse); |
|
6633 |
|
6634 if(iErrVal == KErrInUse) |
|
6635 { |
|
6636 CTestScheduler::StartAndStopL(2000); |
|
6637 |
|
6638 // Tarkista valo |
|
6639 currKeyStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
6640 currDispStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
6641 |
|
6642 /* Light should be same as at the beginning */ |
|
6643 |
|
6644 if (origKeyStatus == currKeyStatus && origDispStatus == currDispStatus) |
|
6645 { |
|
6646 iMcFramework->StepExecuted(KErrNone); |
|
6647 |
|
6648 iErrVal = iMcFramework->WaitNextTestStep(); |
|
6649 |
|
6650 if (iErrVal == KErrNone) |
|
6651 { |
|
6652 // Light status should be now ON |
|
6653 |
|
6654 currKeyStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
6655 currDispStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
6656 |
|
6657 if (currKeyStatus == CHWRMLight::ELightOn && currDispStatus == CHWRMLight::ELightOn) |
|
6658 { |
|
6659 // status is OK |
|
6660 iMyLight->ReleaseLight(CHWRMLight::EPrimaryDisplayAndKeyboard); |
|
6661 //iMcFramework->StepExecuted(KErrNone); last step execution is reported in RunSlaveMode() |
|
6662 iErrVal = KErrNone; |
|
6663 } |
|
6664 else |
|
6665 { |
|
6666 // Display status has not restóred to original values |
|
6667 FormatMessageL(EHwrmMessageOpDebug,_L("Unexpected status. Keyboard:%d Display:%d"),currKeyStatus, currDispStatus); |
|
6668 iErrVal = KErrGeneral; |
|
6669 |
|
6670 } |
|
6671 |
|
6672 } |
|
6673 else |
|
6674 { |
|
6675 // Test failed peer |
|
6676 FormatMessageL(EHwrmMessageOpDebug,_L("Test failed failed peer:%d"),iErrVal); |
|
6677 } |
|
6678 } |
|
6679 else |
|
6680 { |
|
6681 // light status has changed for some reason??? |
|
6682 // it should not because this client is not allowed to do changes in light |
|
6683 // and client that has reserved light has not ordered any change in light |
|
6684 FormatMessageL(EHwrmMessageOpDebug,_L("Unexpected status. Keyboard:%d Display:%d"),currKeyStatus, currDispStatus); |
|
6685 iErrVal = KErrGeneral; |
|
6686 } |
|
6687 } |
|
6688 else |
|
6689 { |
|
6690 // Light on epäonnistui |
|
6691 FormatMessageL(EHwrmMessageOpDebug,_L("Unexpected status. Keyboard:%d Display:%d"),currKeyStatus, currDispStatus); |
|
6692 iErrVal = KErrGeneral; |
|
6693 } |
|
6694 } |
|
6695 else |
|
6696 { |
|
6697 // varaus epäonnistui |
|
6698 FormatMessageL(EHwrmMessageOpDebug,_L("Reservation failed:%d"),iErrVal); |
|
6699 } |
|
6700 } |
|
6701 |
|
6702 delete iMyLight; |
|
6703 return iErrVal; |
|
6704 } |
|
6705 |
|
6706 // ----------------------------------------------------------------------------- |
|
6707 // CHwrmTestCaseController::MC_Vibra_Basic_Usage_S |
|
6708 // |
|
6709 // ----------------------------------------------------------------------------- |
|
6710 // |
|
6711 TInt CHwrmTestCaseController::MC_Vibra_Basic_Usage_S() |
|
6712 { |
|
6713 |
|
6714 FormatMessageL(EHwrmMessageOpDebug,_L("MC_Vibra_Basic_Usage_S()")); |
|
6715 TInt iErrVal = KErrNone; |
|
6716 CHWRMVibra::TVibraStatus vibraStatus; |
|
6717 |
|
6718 TRAP(iErrVal, iVibra = CHWRMVibra::NewL()); |
|
6719 |
|
6720 if (iErrVal == KErrNone) |
|
6721 { |
|
6722 /*****************/ |
|
6723 /* Reserve Vibra */ |
|
6724 /*****************/ |
|
6725 TRAP(iErrVal, iVibra->ReserveVibraL(ETrue, ETrue)); |
|
6726 |
|
6727 if (iErrVal == KErrNone) |
|
6728 { |
|
6729 /*************************/ |
|
6730 /* S T A R T V I B R A */ |
|
6731 /*************************/ |
|
6732 iErrVal = RunTestVibra(2000); // Run vibra 2s |
|
6733 |
|
6734 if (iErrVal == KErrNone) |
|
6735 { |
|
6736 vibraStatus = iVibra->VibraStatus(); |
|
6737 |
|
6738 if(vibraStatus == CHWRMVibra::EVibraStatusOn /* || vibraStatus == CHWRMVibra::EVibraStatusUnknown*/) |
|
6739 { |
|
6740 CTestScheduler::StartAndStopL(2000); |
|
6741 |
|
6742 vibraStatus = iVibra->VibraStatus(); |
|
6743 |
|
6744 if(vibraStatus == CHWRMVibra::EVibraStatusStopped) |
|
6745 { |
|
6746 /*****************/ |
|
6747 /* Step executed */ |
|
6748 /*****************/ |
|
6749 iMcFramework->StepExecuted(KErrNone); |
|
6750 iErrVal = iMcFramework->WaitNextTestStep(); |
|
6751 |
|
6752 /*************************/ |
|
6753 /* S T A R T V I B R A */ |
|
6754 /*************************/ |
|
6755 iErrVal = RunTestVibra(5000); // Run vibra 5s |
|
6756 if (iErrVal == KErrNone) |
|
6757 { |
|
6758 // Vibra start OK |
|
6759 // Check status |
|
6760 vibraStatus = iVibra->VibraStatus(); |
|
6761 if(vibraStatus == CHWRMVibra::EVibraStatusOn) |
|
6762 { |
|
6763 /*****************/ |
|
6764 /* Step executed */ |
|
6765 /*****************/ |
|
6766 iMcFramework->StepExecuted(KErrNone); |
|
6767 iErrVal = iMcFramework->WaitNextTestStep(); |
|
6768 |
|
6769 if (iErrVal == KErrNone) |
|
6770 { |
|
6771 // Check status |
|
6772 vibraStatus = iVibra->VibraStatus(); |
|
6773 |
|
6774 if(vibraStatus == CHWRMVibra::EVibraStatusOn) |
|
6775 { |
|
6776 //OK |
|
6777 CTestScheduler::StartAndStopL(5000); |
|
6778 |
|
6779 vibraStatus = iVibra->VibraStatus(); |
|
6780 if(vibraStatus == CHWRMVibra::EVibraStatusStopped) |
|
6781 { |
|
6782 // Test is over --> release resources |
|
6783 /*****************/ |
|
6784 /* Step executed */ |
|
6785 /*****************/ |
|
6786 //iMcFramework->StepExecuted(KErrNone); last step execution is reported in RunSlaveMode() |
|
6787 |
|
6788 iErrVal = KErrNone; |
|
6789 } |
|
6790 else |
|
6791 { |
|
6792 // Wrong vibra status |
|
6793 FormatMessageL(EHwrmMessageOpDebug,_L("Wrong vibra status5 (%d), expected STOPPED"),vibraStatus); |
|
6794 iErrVal = KErrGeneral; |
|
6795 } |
|
6796 } |
|
6797 else |
|
6798 { |
|
6799 // Wrong status |
|
6800 FormatMessageL(EHwrmMessageOpDebug,_L("Wrong vibra status4 (%d), expected ON"),vibraStatus); |
|
6801 iErrVal = KErrGeneral; |
|
6802 } |
|
6803 } |
|
6804 else |
|
6805 { |
|
6806 // test failed in master |
|
6807 FormatMessageL(EHwrmMessageOpDebug,_L("Error from peer (%d)"),iErrVal); |
|
6808 } |
|
6809 |
|
6810 } |
|
6811 else |
|
6812 { |
|
6813 // wrong status |
|
6814 FormatMessageL(EHwrmMessageOpDebug,_L("Wrong vibra status3 (%d), expected ON"),vibraStatus); |
|
6815 iErrVal = KErrGeneral; |
|
6816 } |
|
6817 |
|
6818 } |
|
6819 else |
|
6820 { |
|
6821 // Start vibra failed |
|
6822 FormatMessageL(EHwrmMessageOpDebug,_L("Vibra start failed (%d)"),iErrVal); |
|
6823 |
|
6824 } |
|
6825 } |
|
6826 else |
|
6827 { |
|
6828 // Wrong status |
|
6829 FormatMessageL(EHwrmMessageOpDebug,_L("Wrong vibra status2 (%d), expected STOPPED"),vibraStatus); |
|
6830 iErrVal = KErrGeneral; |
|
6831 } |
|
6832 } |
|
6833 else |
|
6834 { |
|
6835 // Wrong vibra status |
|
6836 FormatMessageL(EHwrmMessageOpDebug,_L("Wrong vibra status1 (%d), expected ON"),vibraStatus); |
|
6837 iErrVal = KErrGeneral; |
|
6838 } |
|
6839 } |
|
6840 else |
|
6841 { |
|
6842 FormatMessageL(EHwrmMessageOpDebug,_L("Vibra start failed (%d)"),iErrVal); |
|
6843 |
|
6844 } |
|
6845 |
|
6846 /*****************/ |
|
6847 /* Release vibra */ |
|
6848 /*****************/ |
|
6849 iVibra->ReleaseVibra(); |
|
6850 } |
|
6851 else |
|
6852 { |
|
6853 // Reserve failed |
|
6854 FormatMessageL(EHwrmMessageOpDebug,_L("Vibra reservation failed (%d)"),iErrVal); |
|
6855 |
|
6856 } |
|
6857 } |
|
6858 delete iVibra; iVibra = NULL; |
|
6859 return iErrVal; |
|
6860 |
|
6861 } |
|
6862 |
|
6863 |
|
6864 // ----------------------------------------------------------------------------- |
|
6865 // CHwrmTestCaseController::MC_Combined_light_and_vibra_usage_S |
|
6866 // |
|
6867 // ----------------------------------------------------------------------------- |
|
6868 // |
|
6869 TInt CHwrmTestCaseController::MC_Combined_light_and_vibra_usage_S() |
|
6870 { |
|
6871 |
|
6872 TInt iErrVal = KErrNone; |
|
6873 |
|
6874 // CRepository* iSession; |
|
6875 CHWRMVibra::TVibraStatus vibraStatus; |
|
6876 |
|
6877 // iSession = CRepository::NewL(KCRUidVibraCtrl); |
|
6878 iSession->Set(KVibraCtrlProfileVibraEnabled, 1); |
|
6879 |
|
6880 TRAP(iErrVal, iVibra = CHWRMVibra::NewL()); |
|
6881 |
|
6882 if (iErrVal == KErrNone) |
|
6883 { |
|
6884 // Check status |
|
6885 vibraStatus = iVibra->VibraStatus(); |
|
6886 |
|
6887 if(vibraStatus == CHWRMVibra::EVibraStatusOn) |
|
6888 { |
|
6889 /*************************/ |
|
6890 /* S T A R T V I B R A */ |
|
6891 /*************************/ |
|
6892 iErrVal = RunTestVibra(2000); |
|
6893 |
|
6894 if(iErrVal == KErrInUse) |
|
6895 { |
|
6896 /* Error is expected because another application has reserved vibra */ |
|
6897 |
|
6898 CTestScheduler::StartAndStopL(2000); |
|
6899 |
|
6900 // Check status |
|
6901 vibraStatus = iVibra->VibraStatus(); |
|
6902 |
|
6903 if(vibraStatus == CHWRMVibra::EVibraStatusOn) |
|
6904 { |
|
6905 /*****************/ |
|
6906 /* Step executed */ |
|
6907 /*****************/ |
|
6908 //iMcFramework->StepExecuted(KErrNone); last step execution is reported in RunSlaveMode() |
|
6909 iErrVal = KErrNone; |
|
6910 } |
|
6911 else |
|
6912 { |
|
6913 FormatMessageL(EHwrmMessageOpDebug,_L("Wrong vibra status (%d)"),vibraStatus); |
|
6914 iErrVal = KErrGeneral; |
|
6915 } |
|
6916 |
|
6917 } |
|
6918 else |
|
6919 { |
|
6920 // Wrong status |
|
6921 FormatMessageL(EHwrmMessageOpDebug,_L("Wrong status(%d). Expected KErrInUse"),iErrVal); |
|
6922 } |
|
6923 } |
|
6924 else |
|
6925 { |
|
6926 FormatMessageL(EHwrmMessageOpDebug,_L("Wrong vibra status (%d)"),vibraStatus); |
|
6927 iErrVal = KErrGeneral; |
|
6928 } |
|
6929 } |
|
6930 delete iVibra; iVibra = NULL; |
|
6931 |
|
6932 return iErrVal; |
|
6933 |
|
6934 } |
|
6935 |
|
6936 // ----------------------------------------------------------------------------- |
|
6937 // CHwrmTestCaseController::MC_Combined_light_and_vibra_usage_2_S |
|
6938 // |
|
6939 // ----------------------------------------------------------------------------- |
|
6940 // |
|
6941 TInt CHwrmTestCaseController::MC_Combined_light_and_vibra_usage_2_S() |
|
6942 { |
|
6943 TInt iErrVal = KErrNone; |
|
6944 // CRepository* iSession; |
|
6945 CHWRMVibra::TVibraStatus vibraStatus; |
|
6946 CHWRMLight::TLightStatus dispStatus; |
|
6947 CHWRMLight::TLightStatus keybStatus; |
|
6948 //CHWRMLight::TLightStatus origDispStatus; |
|
6949 //CHWRMLight::TLightStatus origKeybStatus; |
|
6950 |
|
6951 // iSession = CRepository::NewL(KCRUidVibraCtrl); |
|
6952 iSession->Set(KVibraCtrlProfileVibraEnabled, 1); |
|
6953 |
|
6954 TRAP(iErrVal, iVibra = CHWRMVibra::NewL()); |
|
6955 if(iErrVal == KErrNone) |
|
6956 { |
|
6957 |
|
6958 TRAP(iErrVal, iMyLight = CHWRMLight::NewL(this)); |
|
6959 |
|
6960 if(iErrVal == KErrNone) |
|
6961 { |
|
6962 |
|
6963 //Reserve Primary display and keyboard |
|
6964 |
|
6965 //origDispStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
6966 //origKeybStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
6967 vibraStatus = iVibra->VibraStatus(); |
|
6968 |
|
6969 TRAP(iErrVal, iVibra->ReserveVibraL(ETrue, ETrue)); |
|
6970 |
|
6971 if (iErrVal == KErrNone) |
|
6972 { |
|
6973 TRAP(iErrVal, iMyLight->ReserveLightL(CHWRMLight::EPrimaryDisplayAndKeyboard, ETrue, ETrue)); |
|
6974 |
|
6975 if(iErrVal == KErrNone) |
|
6976 { |
|
6977 CTestScheduler::StartAndStopL(5000); |
|
6978 |
|
6979 /*******************/ |
|
6980 /* L I G H T O N */ |
|
6981 /*******************/ |
|
6982 |
|
6983 iErrVal = TestLightOn(CHWRMLight::EPrimaryDisplayAndKeyboard); |
|
6984 |
|
6985 if (iErrVal == KErrNone) |
|
6986 { |
|
6987 keybStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryKeyboard); |
|
6988 dispStatus = iMyLight->LightStatus(CHWRMLight::EPrimaryDisplay); |
|
6989 |
|
6990 if (keybStatus == CHWRMLight::ELightOn && dispStatus == CHWRMLight::ELightOn) |
|
6991 { |
|
6992 CTestScheduler::StartAndStopL(5000); |
|
6993 |
|
6994 /*******************/ |
|
6995 /* V I B R A O N */ |
|
6996 /*******************/ |
|
6997 |
|
6998 iErrVal = RunTestVibra(5000,75); |
|
6999 |
|
7000 if(iErrVal == KErrNone) |
|
7001 { |
|
7002 vibraStatus = iVibra->VibraStatus(); |
|
7003 |
|
7004 if (vibraStatus == CHWRMVibra::EVibraStatusOn) |
|
7005 { |
|
7006 CTestScheduler::StartAndStopL(5000); |
|
7007 |
|
7008 vibraStatus = iVibra->VibraStatus(); |
|
7009 |
|
7010 if(vibraStatus == CHWRMVibra::EVibraStatusStopped) |
|
7011 { |
|
7012 |
|
7013 /*****************/ |
|
7014 /* Release vibra */ |
|
7015 /*****************/ |
|
7016 iVibra->ReleaseVibra(); |
|
7017 |
|
7018 /*****************/ |
|
7019 /* Release light */ |
|
7020 /*****************/ |
|
7021 iMyLight->ReleaseLight(CHWRMLight::EPrimaryDisplayAndKeyboard); |
|
7022 |
|
7023 /*****************/ |
|
7024 /* Step executed */ |
|
7025 /*****************/ |
|
7026 //iMcFramework->StepExecuted(KErrNone); last step execution is reported in RunSlaveMode() |
|
7027 |
|
7028 iErrVal = KErrNone; |
|
7029 } |
|
7030 else |
|
7031 { |
|
7032 // Wrong vibra status |
|
7033 FormatMessageL(EHwrmMessageOpDebug,_L("Wrong status(%d). Expected EVibraStatusStopped"), vibraStatus); |
|
7034 iErrVal = KErrGeneral; |
|
7035 } |
|
7036 } |
|
7037 else |
|
7038 { |
|
7039 // wrong vibra status |
|
7040 FormatMessageL(EHwrmMessageOpDebug,_L("Wrong status(%d). Expected EVibraStatusOn"), vibraStatus); |
|
7041 iErrVal = KErrGeneral; |
|
7042 } |
|
7043 } |
|
7044 else |
|
7045 { |
|
7046 // start vibra failed |
|
7047 FormatMessageL(EHwrmMessageOpDebug,_L("Vibra start failed(%d)."), iErrVal); |
|
7048 } |
|
7049 } |
|
7050 else |
|
7051 { |
|
7052 // wrong status |
|
7053 FormatMessageL(EHwrmMessageOpDebug,_L("Wrong status keyboard(%d) display(%d)"), keybStatus, dispStatus); |
|
7054 iErrVal = KErrGeneral; |
|
7055 } |
|
7056 } |
|
7057 else |
|
7058 { |
|
7059 // Set light on failed |
|
7060 FormatMessageL(EHwrmMessageOpDebug,_L("Light on failed(%d)"), iErrVal); |
|
7061 } |
|
7062 } |
|
7063 else |
|
7064 { |
|
7065 // Reserve light failed |
|
7066 FormatMessageL(EHwrmMessageOpDebug,_L("Reserve light failed(%d)"), iErrVal); |
|
7067 } |
|
7068 } |
|
7069 else |
|
7070 { |
|
7071 // Reserve vibra failed |
|
7072 FormatMessageL(EHwrmMessageOpDebug,_L("Reserve vibra failed(%d)"), iErrVal); |
|
7073 } |
|
7074 } |
|
7075 } |
|
7076 delete iVibra; iVibra = NULL; |
|
7077 delete iMyLight; iMyLight = NULL; |
|
7078 return iErrVal; |
|
7079 |
|
7080 } |
|
7081 |
|
7082 |
|
7083 // ----------------------------------------------------------------------------- |
|
7084 // CHwrmTestCaseController::MC_FmTx_Basic_Usage_S |
|
7085 // |
|
7086 // ----------------------------------------------------------------------------- |
|
7087 // |
|
7088 TInt CHwrmTestCaseController::MC_FmTx_Basic_Usage_S() |
|
7089 { |
|
7090 FormatMessageL(EHwrmMessageOpDebug,_L("MC_FmTx_Basic_Usage_S()")); |
|
7091 TInt iErrVal = KErrNone; |
|
7092 TFmTxState fmTxState; |
|
7093 |
|
7094 TRAP(iErrVal, iFmTx = CHWRMFmTx::NewL(this)); |
|
7095 |
|
7096 if (iErrVal == KErrNone) |
|
7097 { |
|
7098 //Reserve FmTx, Don't force CoeEnv "on" |
|
7099 TRAP(iErrVal, iFmTx->ReserveL(ETrue)); |
|
7100 |
|
7101 if (iErrVal == KErrNone) |
|
7102 { |
|
7103 // Reservation was OK |
|
7104 |
|
7105 // Enable FmTx |
|
7106 iErrVal = RunTestFmTx(89900); //89900 KHz |
|
7107 |
|
7108 if (iErrVal == KErrNone) |
|
7109 { |
|
7110 // Check FmTx status |
|
7111 fmTxState = iFmTx->Status(); |
|
7112 |
|
7113 if(fmTxState == EFmTxStateActive || fmTxState == EFmTxStateInactive) |
|
7114 { |
|
7115 /* FmTx status is OK */ |
|
7116 |
|
7117 iMcFramework->StepExecuted(KErrNone); |
|
7118 iErrVal = iMcFramework->WaitNextTestStep(); |
|
7119 |
|
7120 if (iErrVal == KErrNone) |
|
7121 { |
|
7122 /* Test execution was OK in peer-application */ |
|
7123 |
|
7124 /* Check current FmTx status */ |
|
7125 fmTxState = iFmTx->Status(); |
|
7126 |
|
7127 if( fmTxState == EFmTxStateInactive |
|
7128 || fmTxState == EFmTxStateActive) |
|
7129 { |
|
7130 /* OK, status is Active or Inactive */ |
|
7131 /*****************/ |
|
7132 /* Step executed */ |
|
7133 /*****************/ |
|
7134 iFmTx->Release(); |
|
7135 |
|
7136 } |
|
7137 else |
|
7138 { |
|
7139 // wrong status |
|
7140 FormatMessageL(EHwrmMessageOpDebug,_L("Wrong FmTx status2 (%d), expected ON"),fmTxState); |
|
7141 iErrVal = KErrGeneral; |
|
7142 } |
|
7143 |
|
7144 } |
|
7145 else |
|
7146 { |
|
7147 // Start FmTx failed |
|
7148 FormatMessageL(EHwrmMessageOpDebug,_L("FmTx enable failed (%d)"),iErrVal); |
|
7149 } |
|
7150 } |
|
7151 else |
|
7152 { |
|
7153 // Wrong FmTx status |
|
7154 FormatMessageL(EHwrmMessageOpDebug,_L("Wrong FmTx status1 (%d), expected ON"),fmTxState); |
|
7155 iErrVal = KErrGeneral; |
|
7156 } |
|
7157 } |
|
7158 else |
|
7159 { |
|
7160 FormatMessageL(EHwrmMessageOpDebug,_L("FmTx enable failed (%d)"),iErrVal); |
|
7161 } |
|
7162 } |
|
7163 else |
|
7164 { |
|
7165 // Reserve failed |
|
7166 FormatMessageL(EHwrmMessageOpDebug,_L("FmTx reservation failed (%d)"),iErrVal); |
|
7167 |
|
7168 } |
|
7169 } |
|
7170 delete iFmTx; |
|
7171 iFmTx = NULL; |
|
7172 return iErrVal; |
|
7173 |
|
7174 } |