1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: CaeTestStatesClient.cpp |
|
15 * |
|
16 */ |
|
17 #include <fbs.h> |
|
18 #include <w32std.h> |
|
19 |
|
20 #include "CaeTestStatesClient.h" |
|
21 |
|
22 //_LIT8(KVideoMimeType, "video/3gpp"); |
|
23 //_LIT(KVideoPreferredSupplier, "Nokia"); |
|
24 //_LIT8(KVideoType, "video/H263-2000"); |
|
25 //_LIT8(KVideoAudioType, " AMR"); |
|
26 _LIT8(KVideoAudioTypeInv, " TOYOTA"); |
|
27 const TUid KIllegalUidQltyLevels = {666}; |
|
28 |
|
29 |
|
30 CCaeTestStatesClient::CCaeTestStatesClient() |
|
31 { |
|
32 } |
|
33 |
|
34 |
|
35 CCaeTestStatesClient::~CCaeTestStatesClient() |
|
36 { |
|
37 } |
|
38 |
|
39 |
|
40 CCaeTestStatesClient* CCaeTestStatesClient::NewL() |
|
41 { |
|
42 CCaeTestStatesClient* self = new(ELeave) CCaeTestStatesClient; |
|
43 CleanupStack::PushL( self ); |
|
44 self->ConstructL(); |
|
45 CleanupStack::Pop( self ); |
|
46 return self; |
|
47 } |
|
48 |
|
49 |
|
50 void CCaeTestStatesClient::ConstructL() |
|
51 { |
|
52 CCaeTestClient::ConstructL(); |
|
53 |
|
54 iRunWithViewFinder = EFalse; |
|
55 } |
|
56 |
|
57 |
|
58 void CCaeTestStatesClient::RunTestActionL( TestClientActions aAction ) |
|
59 { |
|
60 |
|
61 iAction = aAction; |
|
62 |
|
63 iActionCycle = 0; |
|
64 |
|
65 // Initialize all state variables. |
|
66 InitStateVariables(); |
|
67 |
|
68 #ifdef CAE_TEST_VERSION |
|
69 switch ( iAction ) |
|
70 { |
|
71 case EEncodingError: |
|
72 CaeSetMcaeseoHBufC8ImageReadyError( KErrAbort ); |
|
73 break; |
|
74 case EDecodingError: |
|
75 CaeSetMcaesdoCFbsBitmapImageReadyError( KErrAbort ); |
|
76 break; |
|
77 case EPowerError: |
|
78 CaeSetPowerOnCompleteError( KErrAbort ); |
|
79 break; |
|
80 case EReserveError: |
|
81 CaeSetReserveCompleteError( KErrAbort ); |
|
82 break; |
|
83 case EStillCaptureError: |
|
84 CaeSetImageReadyError( KErrAbort ); |
|
85 break; |
|
86 case EVideoRecorderOpenError: |
|
87 CaeSetMvruoOpenCompleteError( KErrAbort ); |
|
88 break; |
|
89 case EVideoRecorderPrepareError: |
|
90 CaeSetMvruoPrepareCompleteError( KErrAbort ); |
|
91 break; |
|
92 case EVideoRecordingCompleteError: |
|
93 CaeSetMvruoRecordCompleteError( KErrAbort ); |
|
94 break; |
|
95 case EPrepareVideoSettingsError: |
|
96 CaeSetPrepareVideoSettingsError( KErrAbort ); |
|
97 break; |
|
98 case ESnapImageError: |
|
99 CaeSetCreateAndDeliverSnapImageError( KErrAbort ); |
|
100 break; |
|
101 case EStillImageError: |
|
102 CaeSetCreateAndDeliverStillImageError( KErrAbort ); |
|
103 break; |
|
104 case EStillConvertError1: |
|
105 CaeSetConvertCFbsBitmapToHBufC8Error( KErrAbort ); |
|
106 break; |
|
107 case EStillConvertError3: |
|
108 CaeSetConvertHBufC8ToCFbsBitmapError( KErrAbort ); |
|
109 break; |
|
110 case EStillConvertError2: |
|
111 CaeSetStillConvertError( KErrAbort ); |
|
112 break; |
|
113 default: |
|
114 break; |
|
115 } |
|
116 #endif // CAE_TEST_VERSION |
|
117 |
|
118 |
|
119 switch (iAction) |
|
120 { |
|
121 case ESetDisplayIndex: |
|
122 { |
|
123 delete iCamAppEngine; |
|
124 iCamAppEngine = NULL; |
|
125 iCamAppEngine = CCaeEngine::NewL( 0, iDisplayIndex ); |
|
126 iCamAppEngine->SetCamAppEngineObserver( *this ); |
|
127 iCamAppEngine->SetCaeStillBurstObserver( *this ); |
|
128 iCamAppEngine->GetInfo( iInfo ); |
|
129 } |
|
130 break; |
|
131 case ESetCameraIndexLow: |
|
132 { |
|
133 delete iCamAppEngine; |
|
134 iCamAppEngine = NULL; |
|
135 iCamAppEngine = CCaeEngine::NewL( -1, iDisplayIndex ); |
|
136 iCamAppEngine->SetCamAppEngineObserver( *this ); |
|
137 iCamAppEngine->SetCaeStillBurstObserver( *this ); |
|
138 iCamAppEngine->GetInfo( iInfo ); |
|
139 } |
|
140 break; |
|
141 case ESetCameraIndexHigh: |
|
142 { |
|
143 delete iCamAppEngine; |
|
144 iCamAppEngine = NULL; |
|
145 iCamAppEngine = CCaeEngine::NewL( 123456, iDisplayIndex ); |
|
146 iCamAppEngine->SetCamAppEngineObserver( *this ); |
|
147 iCamAppEngine->SetCaeStillBurstObserver( *this ); |
|
148 iCamAppEngine->GetInfo( iInfo ); |
|
149 } |
|
150 break; |
|
151 case ESpecifiedPrepareAndCaptureStill2nd: |
|
152 { |
|
153 delete iCamAppEngine; |
|
154 iCamAppEngine = NULL; |
|
155 iCamAppEngine = CCaeEngine::NewL( 1 ); |
|
156 iCamAppEngine->SetCamAppEngineObserver( *this ); |
|
157 iCamAppEngine->SetCaeStillBurstObserver( *this ); |
|
158 iCamAppEngine->GetInfo( iInfo ); |
|
159 } |
|
160 |
|
161 default: |
|
162 break; |
|
163 } |
|
164 |
|
165 |
|
166 // If interface after S60 2.1. |
|
167 #ifndef CAE_INTERFACE_21 |
|
168 if ( iAction != ESpecifiedPrepareAndCaptureStill && |
|
169 iAction != ESpecifiedPrepareAndRecordVideoNoInit ) |
|
170 { |
|
171 // Normal case |
|
172 // This starts operations and state changes. |
|
173 if ( iCreateSnapImage ) |
|
174 { |
|
175 iCamAppEngine->InitL(); |
|
176 } |
|
177 else |
|
178 { |
|
179 iCamAppEngine->InitL(); |
|
180 iCamAppEngine->SetSnapImageCreation( EFalse ); |
|
181 } |
|
182 } |
|
183 else if ( iAction == ESpecifiedPrepareAndCaptureStill || |
|
184 iAction == ESpecifiedPrepareAndCaptureStill2nd ) |
|
185 { |
|
186 // |
|
187 // This starts operations and state changes. |
|
188 if ( iCreateSnapImage ) |
|
189 { |
|
190 iCamAppEngine->InitL( EFalse ); |
|
191 iCamAppEngine->SetSnapImageCreation( ETrue ); |
|
192 } |
|
193 else |
|
194 { |
|
195 iCamAppEngine->InitL( ETrue ); |
|
196 iCamAppEngine->SetSnapImageCreation( EFalse ); |
|
197 } |
|
198 } |
|
199 else if ( iAction == ESpecifiedPrepareAndRecordVideoNoInit ) |
|
200 { |
|
201 // No CAE init here, used in 3.2 in case only CAE video features are used |
|
202 |
|
203 #ifdef _DEBUG |
|
204 RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTestActionL() reading cameraHandle" ) ); |
|
205 #endif |
|
206 |
|
207 TInt cameraHandle = iCamAppEngine->CCameraHandle(); |
|
208 |
|
209 #ifdef _DEBUG |
|
210 RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTestActionL() creating obs2 NewDuplicate2L cameraHandle=%d" ),cameraHandle ); |
|
211 #endif |
|
212 |
|
213 // Create a new Camera API duplicate object, if supported |
|
214 TRAPD( err, iCameraDup = CCamera::NewDuplicate2L( static_cast<MCameraObserver2&>(*this), cameraHandle ) ); |
|
215 if ( err ) |
|
216 { |
|
217 #ifdef _DEBUG |
|
218 RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTestActionL() CCamera::NewDuplicate2L return code=%d" ), err ); |
|
219 #endif |
|
220 |
|
221 // Create old Camera API duplicate object. |
|
222 iCameraDup = CCamera::NewDuplicateL( static_cast<MCameraObserver&>(*this), cameraHandle ); |
|
223 } |
|
224 else |
|
225 { |
|
226 #ifdef _DEBUG |
|
227 RDebug::Print( ( _L( "Cae: CCaeTestStatesClient::RunTestActionL() using duplicated MCameraObserver2" )) ); |
|
228 #endif |
|
229 } |
|
230 |
|
231 #ifdef _DEBUG |
|
232 RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTestActionL() calling reserve iCameraDup=%x" ),iCameraDup ); |
|
233 #endif |
|
234 |
|
235 iCameraDup->Reserve(); // Poweron called after this in reservecomplete |
|
236 |
|
237 // Give C-API time to complete operation |
|
238 User::After( 500000 ); |
|
239 |
|
240 #ifdef _DEBUG |
|
241 RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTestActionL() calling cae disable/enable videorecording" ) ); |
|
242 #endif |
|
243 |
|
244 // Let CAE know that camera HW reservation is done, |
|
245 // this will initialize some CAE flags so that video mode can be used |
|
246 iCamAppEngine->DisableVideoRecording(); // Just to test release before reserve |
|
247 iCamAppEngine->EnableVideoRecording(); // |
|
248 iCamAppEngine->DisableVideoRecording(); // test release |
|
249 iCamAppEngine->EnableVideoRecording(); // reserve again |
|
250 iCamAppEngine->EnableVideoRecording(); // double reserve |
|
251 |
|
252 } |
|
253 #else // CAE_INTERFACE_21 |
|
254 // This starts operations and state changes. |
|
255 if ( iCreateSnapImage ) |
|
256 { |
|
257 iCamAppEngine->InitL(); |
|
258 } |
|
259 else |
|
260 { |
|
261 iCamAppEngine->InitL( EFalse ); |
|
262 } |
|
263 #endif |
|
264 |
|
265 // Main part of program is a wait loop. |
|
266 // This function completes when the scheduler stops. |
|
267 CActiveScheduler::Start(); |
|
268 |
|
269 if ( iError ) |
|
270 { |
|
271 #ifdef _DEBUG |
|
272 RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTestActionL() leaving (error detected)" ) ); |
|
273 #endif |
|
274 User::Leave( iError ); |
|
275 } |
|
276 |
|
277 #ifdef _DEBUG |
|
278 RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTestActionL() returning" ) ); |
|
279 #endif |
|
280 } |
|
281 |
|
282 |
|
283 void CCaeTestStatesClient::RunTrappedL() |
|
284 { |
|
285 #ifdef _DEBUG |
|
286 RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTrappedL() entering, iAction=%d" ),iAction ); |
|
287 #endif |
|
288 |
|
289 // This is for timing critical cases |
|
290 TTime currentTime; |
|
291 currentTime.HomeTime(); |
|
292 if ( iNextRunLTime.MicroSecondsFrom( currentTime ) > TTimeIntervalMicroSeconds(0) ) |
|
293 { |
|
294 CTimer::At( iNextRunLTime ); |
|
295 return; |
|
296 } |
|
297 |
|
298 if ( iAction == ENone || iStop ) |
|
299 { |
|
300 if ( iCamAppEngine->IsViewFinding() ) |
|
301 { |
|
302 iCamAppEngine->StopViewFinder(); |
|
303 iViewFinderStarted = EFalse; |
|
304 } |
|
305 iCamAppEngine->CancelCaptureStill(); |
|
306 iCancelCount++; |
|
307 iCamAppEngine->CloseVideoRecording(); |
|
308 CActiveScheduler::Stop(); |
|
309 } |
|
310 else if ( iInitReady ) |
|
311 { |
|
312 iInitReady = EFalse; |
|
313 iViewFinderStarted = EFalse; |
|
314 |
|
315 switch ( iAction ) |
|
316 { |
|
317 case EInit: |
|
318 iStop = ETrue; |
|
319 CTimer::After( KNormalTimingDelay ); |
|
320 break; |
|
321 case ECCameraHandle: |
|
322 iStop = ETrue; |
|
323 iCameraHandle = iCamAppEngine->CCameraHandle(); |
|
324 CTimer::After( KNormalTimingDelay ); |
|
325 break; |
|
326 case EInitVideoRecorder: |
|
327 iCamAppEngine->InitVideoRecorderL(); |
|
328 iStop = ETrue; |
|
329 CTimer::After( KNormalTimingDelay ); |
|
330 break; |
|
331 case EInitVideoRecorderWithUid: |
|
332 iCamAppEngine->InitVideoRecorderL(KIllegalUidQltyLevels); |
|
333 iStop = ETrue; |
|
334 CTimer::After( KNormalTimingDelay ); |
|
335 break; |
|
336 case ESwitchPowerOnWhenInitialized: |
|
337 if ( iStopWhenCompleted ) |
|
338 { |
|
339 iStop = ETrue; |
|
340 CTimer::After( KNormalTimingDelay ); |
|
341 } |
|
342 else |
|
343 { |
|
344 iStopWhenCompleted = ETrue; |
|
345 iInitReady = ETrue; |
|
346 iCamAppEngine->PowerOn(); |
|
347 CTimer::After( KNormalTimingDelay ); |
|
348 } |
|
349 break; |
|
350 case ESwitchPowerOffAndOn: |
|
351 if ( iStopWhenCompleted ) |
|
352 { |
|
353 iStop = ETrue; |
|
354 CTimer::After( KNormalTimingDelay ); |
|
355 } |
|
356 else if ( iPowerOn ) |
|
357 { |
|
358 iCamAppEngine->PowerOff(); |
|
359 iPowerOn = EFalse; |
|
360 iInitReady = ETrue; |
|
361 CTimer::After( KNormalTimingDelay ); |
|
362 } |
|
363 else |
|
364 { |
|
365 iStopWhenCompleted = ETrue; |
|
366 iCamAppEngine->PowerOn(); |
|
367 } |
|
368 break; |
|
369 case EPowerOffPowerOff: |
|
370 iCamAppEngine->PowerOff(); |
|
371 iCamAppEngine->PowerOff(); |
|
372 iStop = ETrue; |
|
373 CTimer::After( KNormalTimingDelay ); |
|
374 break; |
|
375 case EStartVfWhenPowerOff: |
|
376 iCamAppEngine->PowerOff(); |
|
377 iViewFindingUsed = ETrue; |
|
378 iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize ); |
|
379 if( iCamAppEngine->IsViewFinding() ) |
|
380 { |
|
381 User::Leave ( KErrGeneral ); |
|
382 } |
|
383 iStop = ETrue; |
|
384 CTimer::After( KNormalTimingDelay ); // Give some time for all Active objects to react to this command. |
|
385 break; |
|
386 case ERelease: |
|
387 iCamAppEngine->Release(); |
|
388 iStop = ETrue; |
|
389 CTimer::After( KNormalTimingDelay ); |
|
390 break; |
|
391 case EReleaseRelease: |
|
392 iCamAppEngine->Release(); |
|
393 iCamAppEngine->Release(); |
|
394 iStop = ETrue; |
|
395 CTimer::After( KNormalTimingDelay ); |
|
396 break; |
|
397 case EReserveReserve: |
|
398 iCamAppEngine->Reserve(); |
|
399 iStop = ETrue; |
|
400 CTimer::After( KNormalTimingDelay ); // needed because this Reserve after InitL does do nothing (no call-back) |
|
401 break; |
|
402 case EReleaseReserve: |
|
403 if ( iStopWhenCompleted ) |
|
404 { |
|
405 iStop = ETrue; |
|
406 CTimer::After( KNormalTimingDelay ); |
|
407 } |
|
408 else if ( iPowerOn ) |
|
409 { |
|
410 iCamAppEngine->Release(); |
|
411 iPowerOn = EFalse; |
|
412 iInitReady = ETrue; |
|
413 CTimer::After( KNormalTimingDelay ); |
|
414 } |
|
415 else |
|
416 { |
|
417 iStopWhenCompleted = ETrue; |
|
418 iCamAppEngine->Reserve(); |
|
419 } |
|
420 break; |
|
421 case EReleaseReserveCapture: |
|
422 if ( iContinueWhenCompleted ) |
|
423 { |
|
424 iStillPrepareReady = EFalse; |
|
425 iVideoPrepareReady = EFalse; |
|
426 iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex ); |
|
427 } |
|
428 else if ( iPowerOn ) |
|
429 { |
|
430 iCamAppEngine->Release(); |
|
431 iPowerOn = EFalse; |
|
432 iInitReady = ETrue; |
|
433 CTimer::After( KNormalTimingDelay ); |
|
434 } |
|
435 else |
|
436 { |
|
437 iContinueWhenCompleted = ETrue; |
|
438 iCamAppEngine->Reserve(); |
|
439 } |
|
440 break; |
|
441 case EReleaseReserveRecord: |
|
442 if ( iContinueWhenCompleted ) |
|
443 { |
|
444 iStillPrepareReady = EFalse; |
|
445 iVideoPrepareReady = EFalse; |
|
446 iCamAppEngine->InitVideoRecorderL(); |
|
447 iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName ); |
|
448 iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex ); |
|
449 } |
|
450 else if ( iPowerOn ) |
|
451 { |
|
452 iCamAppEngine->Release(); |
|
453 iPowerOn = EFalse; |
|
454 iInitReady = ETrue; |
|
455 CTimer::After( KNormalTimingDelay ); |
|
456 } |
|
457 else |
|
458 { |
|
459 iContinueWhenCompleted = ETrue; |
|
460 iCamAppEngine->Reserve(); |
|
461 } |
|
462 break; |
|
463 case EStartVideoRecordingWhenInitialized: |
|
464 iCamAppEngine->StartVideoRecording(); |
|
465 break; |
|
466 case EStopVideoRecordingWhenInitialized: |
|
467 iCamAppEngine->StopVideoRecording(); |
|
468 break; |
|
469 case EGetStillQualityIndexWhenEngineInitialized: |
|
470 { |
|
471 TInt stillQualityIndex = iCamAppEngine->StillQualityIndex(); |
|
472 if ( stillQualityIndex != -1 ) |
|
473 { |
|
474 User::Leave( KErrGeneral ); |
|
475 } |
|
476 } |
|
477 iStop = ETrue; |
|
478 CTimer::After( KNormalTimingDelay ); |
|
479 break; |
|
480 case EGetVideoQualityIndexWhenEngineInitialized: |
|
481 { |
|
482 TInt videoQualityIndex = iCamAppEngine->VideoQualityIndex(); |
|
483 if ( videoQualityIndex != -1 ) |
|
484 { |
|
485 User::Leave( KErrGeneral ); |
|
486 } |
|
487 } |
|
488 iStop = ETrue; |
|
489 CTimer::After( KNormalTimingDelay ); |
|
490 break; |
|
491 case EEnumerateCaptureSizes: |
|
492 { |
|
493 TSize stillFrameSize; |
|
494 // Tests to get the largest image size (index value 0). |
|
495 iCamAppEngine->EnumerateStillCaptureSizes( stillFrameSize, 0, iStillDataFormat ); |
|
496 if ( stillFrameSize != iStillFrameSize ) |
|
497 { |
|
498 #ifdef _DEBUG |
|
499 RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTrappedL() got stillFrameSize w=%d, h=%d, leaving -2" ), stillFrameSize.iWidth, stillFrameSize.iHeight ); |
|
500 #endif |
|
501 |
|
502 User::Leave( KErrGeneral ); |
|
503 } |
|
504 } |
|
505 iStop = ETrue; |
|
506 CTimer::After( KNormalTimingDelay ); |
|
507 break; |
|
508 case EPrepareStillCapturing: |
|
509 case EPrepareStillCapturingWhenPrepared: |
|
510 case EPrepareAndCaptureStill: |
|
511 case EPrepareAndCaptureAndCancelStill: |
|
512 case EPrepareAndCaptureAndCancelStillAtSnap: |
|
513 // Burst |
|
514 case EPrepareAndCaptureStillBurst: |
|
515 case EPrepareAndCaptureStillBurstCaptureStill: |
|
516 case EPrepareAndCaptureAndCancelStillBurst: |
|
517 case EPrepareAndCaptureAndCancelStillBurstAtMoment: |
|
518 case EPrepareAndCaptureAndCancelStillBurstAtSnap: |
|
519 case EPrepareAndCaptureAndStopStillBurst: |
|
520 case EPrepareAndCaptureCaptureStillBurst: |
|
521 // |
|
522 case EStartAndStopVfWhenStillPreparedAndCaptured: |
|
523 case ECaptureCapture: |
|
524 case ECaptureRecord: |
|
525 case ESwitchPowerOnWhenStillPrepared: |
|
526 case ESwitchPowerOffWhenStillPrepared: |
|
527 case EGetStillQualityIndexWhenPrepared: |
|
528 case EEncodingError: |
|
529 case EStillCaptureError: |
|
530 case EStillConvertError1: |
|
531 case EStillConvertError2: |
|
532 case EStillConvertError3: |
|
533 iStillPrepareReady = EFalse; |
|
534 iVideoPrepareReady = EFalse; |
|
535 iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex ); |
|
536 break; |
|
537 case EPrepareCroppedStillCapturing: |
|
538 iStillPrepareReady = EFalse; |
|
539 iVideoPrepareReady = EFalse; |
|
540 { |
|
541 TRect cropRect; |
|
542 iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex, cropRect ); |
|
543 } |
|
544 break; |
|
545 case EPrepareStillCaptureWhenPowerOff: |
|
546 iCamAppEngine->PowerOff(); |
|
547 iStillPrepareReady = EFalse; |
|
548 iVideoPrepareReady = EFalse; |
|
549 iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex ); |
|
550 break; |
|
551 case EPrepareVideoRecording: |
|
552 case EPrepareVideoRecordingWhenPrepared: |
|
553 case EPrepareAndRecordVideo: |
|
554 case EStartAndStopVfWhenVideoPreparedAndRecorded: |
|
555 case ERecordRecord: |
|
556 case ERecordCapture: |
|
557 case ERecordCaptureComplexSequence1: |
|
558 case ERecordCaptureComplexSequence2: |
|
559 case ESwitchPowerOnWhenVideoPrepared: |
|
560 case ESwitchPowerOffWhenVideoPrepared: |
|
561 case ESwitchPowerOnWhenRecordingVideo: |
|
562 case ESwitchPowerOffWhenRecordingVideo: |
|
563 case EStartVideoRecordingWhenRecording: |
|
564 case EStopVideoRecordingWhenPrepared: |
|
565 case EPauseVideoWhenPrepared: |
|
566 case EResumeVideoWhenPrepared: |
|
567 case EResumeVideoWhenNotPaused: |
|
568 case EPrepareRecordPauseStopVideo: |
|
569 case EPrepareRecordPauseResumeStopVideo: |
|
570 case EPrepareRecordPausePauseStopVideo: |
|
571 case EGetVideoQualityIndexWhenPrepared: |
|
572 case ERemainingTimeWhenVideoPrepared: |
|
573 case EVideoRecorderOpenError: |
|
574 case EVideoRecorderPrepareError: |
|
575 case EVideoRecordingCompleteError: |
|
576 case EPrepareVideoSettingsError: |
|
577 case EPrepareStillCaptureWhenRecording: |
|
578 iStillPrepareReady = EFalse; |
|
579 iVideoPrepareReady = EFalse; |
|
580 iCamAppEngine->InitVideoRecorderL(); |
|
581 iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName ); |
|
582 iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex ); |
|
583 break; |
|
584 case ESpecifiedPrepareStill: |
|
585 case ESpecPrepCaptureCapture: |
|
586 case ESpecifiedPrepareStillWhenPrepared: |
|
587 case ESpecifiedPrepareAndCaptureStill: |
|
588 case ESpecifiedPrepareAndCaptureStill2nd: |
|
589 case EPrepareAndCaptureStillBurstExif: |
|
590 case EPrepareAndCaptureAndCancelStillBurstExif: |
|
591 case EStartVfPrepareCaptureStillStartAndStopVfExif: |
|
592 case EStillImageError: |
|
593 case ESetDisplayIndex: |
|
594 // Burst |
|
595 case ESpecPrepAndCaptureStillBurst: |
|
596 case ESpecPrepAndCaptureCaptureStillBurst: |
|
597 case ESpecPrepAndCaptureStillBurstCaptureStill: |
|
598 // "Destroy Engine" |
|
599 case EDestroyEngineWhenStillPrepareReady: |
|
600 case EDestroyEngineWhenSnapImageReady: |
|
601 case EDestroyEngineWhenStillCaptureReady: |
|
602 case EDestroyEngineWhenStillBurstReady: |
|
603 case EDestroyEngineWhenSnapImageReadyInStillBurst: |
|
604 case EDestroyEngineWhenStillImageReadyInStillBurst: |
|
605 case ECaptureStillSetSnapSizeExif: |
|
606 case ECaptureStillAfterPowerOff: |
|
607 case ECaptureStillAfterPowerOffOn: |
|
608 case ESnapImageError: |
|
609 iStillPrepareReady = EFalse; |
|
610 iVideoPrepareReady = EFalse; |
|
611 iCamAppEngine->PrepareStillCaptureL( iStillFrameSize, |
|
612 iStillDataFormat, |
|
613 iStillCompressionQuality ); |
|
614 break; |
|
615 case EStartVfPrepareCaptureStillStartAndStopVfSnapExif: |
|
616 iStillPrepareReady = EFalse; |
|
617 iVideoPrepareReady = EFalse; |
|
618 iCamAppEngine->PrepareStillCaptureL( iStillFrameSize, |
|
619 iStillDataFormat, |
|
620 iStillCompressionQuality, |
|
621 iCropRect, |
|
622 iSnapImageSize); |
|
623 break; |
|
624 case ECaptureStillSetSnapColorModeExif: |
|
625 iStillPrepareReady = EFalse; |
|
626 iVideoPrepareReady = EFalse; |
|
627 iCamAppEngine->PrepareStillCaptureL( iStillFrameSize, |
|
628 iStillDataFormat, |
|
629 iStillCompressionQuality ); |
|
630 iCamAppEngine->SetSnapImageColorMode( EColor16M ); |
|
631 break; |
|
632 case ESpecifiedPrepareVideo: |
|
633 case ESpecifiedPrepareVideoWhenPrepared: |
|
634 case ESpecifiedPrepareAndRecordVideo: |
|
635 case ESpecifiedPrepareAndRecordVideoNoInit: |
|
636 // "Destroy Engine" |
|
637 case EDestroyEngineWhenVideoPrepareReady: |
|
638 case EDestroyEngineWhenVideoRecordingOn: |
|
639 case EDestroyEngineWhenVideoRecordingPaused: |
|
640 case EDestroyEngineWhenVideoRecordingReady: |
|
641 iStillPrepareReady = EFalse; |
|
642 iVideoPrepareReady = EFalse; |
|
643 iCamAppEngine->InitVideoRecorderL(); |
|
644 iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName ); |
|
645 { |
|
646 iCamAppEngine->PrepareVideoRecordingL( iVideoFrameSize, |
|
647 iVideoFrameRate, |
|
648 iVideoBitRate, |
|
649 iVideoAudioEnabled, |
|
650 *iMimeTypeSet[iVideoCodecSet], |
|
651 *iPreferredSupplierSet[iVideoCodecSet], |
|
652 *iVideoTypeSet[iVideoCodecSet], |
|
653 *iAudioTypeSet[iVideoCodecSet] ); |
|
654 } |
|
655 break; |
|
656 case ESpecifiedPrepareAudioBrAndRecordVideo: |
|
657 iStillPrepareReady = EFalse; |
|
658 iVideoPrepareReady = EFalse; |
|
659 iCamAppEngine->InitVideoRecorderL(); |
|
660 iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName ); |
|
661 { |
|
662 iCamAppEngine->PrepareVideoRecordingL( iVideoFrameSize, |
|
663 iVideoFrameRate, |
|
664 iVideoBitRate, |
|
665 iVideoAudioEnabled, |
|
666 iAudioBitRate, |
|
667 *iMimeTypeSet[iVideoCodecSet], |
|
668 *iPreferredSupplierSet[iVideoCodecSet], |
|
669 *iVideoTypeSet[iVideoCodecSet], |
|
670 *iAudioTypeSet[iVideoCodecSet] ); |
|
671 } |
|
672 break; |
|
673 case ESpecifiedPrepareAudioBrAndRecordVideoAT0: |
|
674 iStillPrepareReady = EFalse; |
|
675 iVideoPrepareReady = EFalse; |
|
676 iCamAppEngine->InitVideoRecorderL(); |
|
677 iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName ); |
|
678 { |
|
679 const TDesC8& audioType = KNullDesC8; |
|
680 iCamAppEngine->PrepareVideoRecordingL( iVideoFrameSize, |
|
681 iVideoFrameRate, |
|
682 iVideoBitRate, |
|
683 iVideoAudioEnabled, |
|
684 iAudioBitRate, |
|
685 *iMimeTypeSet[iVideoCodecSet], |
|
686 *iPreferredSupplierSet[iVideoCodecSet], |
|
687 *iVideoTypeSet[iVideoCodecSet], |
|
688 audioType ); |
|
689 } |
|
690 break; |
|
691 case ESpecifiedPrepareAudioBrAndRecordVideoATInv: |
|
692 iStillPrepareReady = EFalse; |
|
693 iVideoPrepareReady = EFalse; |
|
694 iCamAppEngine->InitVideoRecorderL(); |
|
695 iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName ); |
|
696 { |
|
697 const TDesC8& audioType = KVideoAudioTypeInv; |
|
698 iCamAppEngine->PrepareVideoRecordingL( iVideoFrameSize, |
|
699 iVideoFrameRate, |
|
700 iVideoBitRate, |
|
701 iVideoAudioEnabled, |
|
702 iAudioBitRate, |
|
703 *iMimeTypeSet[iVideoCodecSet], |
|
704 *iPreferredSupplierSet[iVideoCodecSet], |
|
705 *iVideoTypeSet[iVideoCodecSet], |
|
706 audioType ); |
|
707 } |
|
708 break; |
|
709 case EStartAndStopVf: |
|
710 iViewFindingUsed = ETrue; |
|
711 iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize ); |
|
712 // Test IsViewFinding() |
|
713 if ( !iCamAppEngine->IsViewFinding() ) |
|
714 { |
|
715 User::Leave( KErrGeneral ); |
|
716 } |
|
717 iStopViewFinder = ETrue; |
|
718 CTimer::After( iTimeout ); |
|
719 break; |
|
720 case EStartAndStopCroppedVf: |
|
721 iViewFindingUsed = ETrue; |
|
722 { |
|
723 TRect emptyRect; |
|
724 iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize, emptyRect ); |
|
725 } |
|
726 // Test IsViewFinding() |
|
727 if ( !iCamAppEngine->IsViewFinding() ) |
|
728 { |
|
729 User::Leave( KErrGeneral ); |
|
730 } |
|
731 iStopViewFinder = ETrue; |
|
732 CTimer::After( iTimeout ); |
|
733 break; |
|
734 case EStartAndStopDirectVf: |
|
735 iViewFindingUsed = ETrue; |
|
736 { |
|
737 RWsSession* wsSession = NULL; |
|
738 CWsScreenDevice* wsScreenDevice = NULL; |
|
739 RWindowBase* windowBase = NULL; |
|
740 TRect* tRect = NULL; |
|
741 iCamAppEngine->StartViewFinderDirectL( *wsSession, |
|
742 *wsScreenDevice, |
|
743 *windowBase, |
|
744 *tRect); |
|
745 } |
|
746 // Test IsViewFinding() |
|
747 if ( !iCamAppEngine->IsViewFinding() ) |
|
748 { |
|
749 User::Leave( KErrGeneral ); |
|
750 } |
|
751 iStopViewFinder = ETrue; |
|
752 CTimer::After( iTimeout ); |
|
753 break; |
|
754 case EStartAndStopCroppedDirectVf: |
|
755 iViewFindingUsed = ETrue; |
|
756 { |
|
757 RWsSession* wsSession = NULL; |
|
758 CWsScreenDevice* wsScreenDevice = NULL; |
|
759 RWindowBase* windowBase = NULL; |
|
760 TRect* screenRect = NULL; |
|
761 TRect* cropRect = NULL; |
|
762 iCamAppEngine->StartViewFinderDirectL( *wsSession, |
|
763 *wsScreenDevice, |
|
764 *windowBase, |
|
765 *screenRect, |
|
766 *cropRect ); |
|
767 } |
|
768 // Test IsViewFinding() |
|
769 if ( !iCamAppEngine->IsViewFinding() ) |
|
770 { |
|
771 User::Leave( KErrGeneral ); |
|
772 } |
|
773 iStopViewFinder = ETrue; |
|
774 CTimer::After( iTimeout ); |
|
775 break; |
|
776 case ESwitchPowerOffWhenVfRunning: |
|
777 iViewFindingUsed = ETrue; |
|
778 iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize ); |
|
779 CTimer::After( iTimeout ); |
|
780 break; |
|
781 case EStartVfPrepareCaptureStillStartAndStopVf: |
|
782 case EStartVfPrepareRecordVideoStartAndStopVf: |
|
783 case ESetColorToneVideoRecording: |
|
784 iViewFindingUsed = ETrue; |
|
785 iCamAppEngine->InitVideoRecorderL(); |
|
786 iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName ); |
|
787 iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize ); |
|
788 CTimer::After( 500000 ); |
|
789 break; |
|
790 case EIsVideoRecordingWhenPrepared: |
|
791 break; |
|
792 case ECaptureStillWhenEngineInitialized: |
|
793 iCamAppEngine->CaptureStill(); |
|
794 break; |
|
795 case ECancelCaptureStillWhenInitialized: |
|
796 iCamAppEngine->CancelCaptureStill(); |
|
797 iCancelCount++; |
|
798 iStop = ETrue; |
|
799 CTimer::After( KNormalTimingDelay ); |
|
800 break; |
|
801 case EStartVfStartVf: |
|
802 iViewFindingUsed = ETrue; |
|
803 iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize ); |
|
804 iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize ); |
|
805 iStopViewFinder = ETrue; |
|
806 CTimer::After( iTimeout ); |
|
807 break; |
|
808 |
|
809 // If interface after S60 2.1. |
|
810 #ifndef CAE_INTERFACE_21 |
|
811 case EGetCustomInterface: |
|
812 iCustomInterfacePointer = iCamAppEngine->CustomInterface( iCustomInterfaceUid ); |
|
813 iStop = ETrue; |
|
814 CTimer::After( KNormalTimingDelay ); |
|
815 break; |
|
816 case ESetColorTone: |
|
817 case ESetColorToneWrongParams: |
|
818 case ESetColorToneRelease: |
|
819 if ( iAction == ESetColorToneRelease && iReleaseDone ) |
|
820 { |
|
821 // Do the Reserve, note that engine will call |
|
822 // CCaeTestClient::McaeoInitComplete when camera is ready |
|
823 iReleaseDone = EFalse; |
|
824 iReserveDone = ETrue; |
|
825 iInitReady = ETrue; // continue in this case on next run |
|
826 iCamAppEngine->Reserve(); |
|
827 // No timer call here, McaeoInitComplete does it |
|
828 } |
|
829 else if ( iAction == ESetColorToneRelease && iReserveDone ) |
|
830 { |
|
831 // state flags to defaults, release/reserve is done now |
|
832 iReleaseDone = EFalse; |
|
833 iReserveDone = EFalse; |
|
834 |
|
835 // Verify that settings are reset to default after reserve |
|
836 MCameraColorToneSettings* CTptr = NULL; |
|
837 CTptr = static_cast<MCameraColorToneSettings*> ( iCustomInterfacePointer ); |
|
838 if ( CTptr->ColorTone() != MCameraColorToneSettings::ENormal ) |
|
839 { |
|
840 #ifdef _DEBUG |
|
841 RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTrappedL() Error:ColorTone settings not reset after release()" )); |
|
842 #endif |
|
843 iStop = ETrue; |
|
844 CTimer::After( KNormalTimingDelay ); |
|
845 } |
|
846 else |
|
847 { |
|
848 // all ok, capture a picture and verify manually normal settings |
|
849 iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex ); |
|
850 } |
|
851 } |
|
852 else |
|
853 { |
|
854 iCustomInterfacePointer = iCamAppEngine->CustomInterface( iCustomInterfaceUid ); |
|
855 if ( !iCustomInterfacePointer ) |
|
856 { // Interface not supported, exit test case |
|
857 #ifdef _DEBUG |
|
858 RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTrappedL() CustomInterface returns 0 for uid %x" ), iCustomInterfaceUid.iUid ); |
|
859 #endif |
|
860 iStop = ETrue; |
|
861 CTimer::After( KNormalTimingDelay ); |
|
862 } |
|
863 else |
|
864 { |
|
865 MCameraColorToneSettings* CTptr = NULL; |
|
866 TUint32 supportedCT = 0 ; |
|
867 |
|
868 // cast the TAny pointer to the real color tone interface pointer and |
|
869 // read the bitmap of supported color tones |
|
870 CTptr = static_cast<MCameraColorToneSettings*> ( iCustomInterfacePointer ); |
|
871 supportedCT = CTptr->SupportedColorTones(); |
|
872 |
|
873 // Check that given parameter is supported by the interface |
|
874 if ( (iColorToneValue & supportedCT) || |
|
875 iColorToneValue == MCameraColorToneSettings::ENormal || |
|
876 iAction == ESetColorToneWrongParams) |
|
877 { |
|
878 // then set the new color tone and verify that it has been set |
|
879 CTptr->SetColorToneL( iColorToneValue ); |
|
880 if ( CTptr->ColorTone() == iColorToneValue ) |
|
881 { |
|
882 if ( iAction == ESetColorToneRelease ) |
|
883 { |
|
884 // Do now release and then on next run the reserve |
|
885 iCamAppEngine->Release(); |
|
886 iReleaseDone = ETrue; |
|
887 iReserveDone = EFalse; |
|
888 iInitReady = ETrue; // this keeps the same switch active |
|
889 CTimer::After( KNormalTimingDelay ); |
|
890 } |
|
891 else |
|
892 { |
|
893 // all ok, capture a picture and verify manually changes |
|
894 iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex ); |
|
895 } |
|
896 } |
|
897 else // Value not set |
|
898 { |
|
899 #ifdef _DEBUG |
|
900 RDebug::Print( _L( "Cae: ESetColorTone: color iColorToneValue not set to: %d" ), iColorToneValue ); |
|
901 #endif |
|
902 iStop = ETrue; |
|
903 CTimer::After( KNormalTimingDelay ); |
|
904 } |
|
905 } |
|
906 else // Value not supported |
|
907 { |
|
908 #ifdef _DEBUG |
|
909 RDebug::Print( _L( "Cae: ESetColorTone: color iColorToneValue not supported: %d" ), iColorToneValue ); |
|
910 #endif |
|
911 iStop = ETrue; |
|
912 CTimer::After( KNormalTimingDelay ); |
|
913 } |
|
914 } |
|
915 } |
|
916 break; |
|
917 #endif |
|
918 case ERemainingTimeWhenVideoNotInitialized: |
|
919 { |
|
920 iAction = ENone; |
|
921 TTimeIntervalMicroSeconds zeroRemainingTime( 0 ); |
|
922 TTimeIntervalMicroSeconds remainingTime( 1 ); |
|
923 remainingTime = iCamAppEngine->RemainingVideoRecordingTime(); |
|
924 if ( remainingTime != zeroRemainingTime ) |
|
925 { |
|
926 User::Leave( KErrArgument ); |
|
927 } |
|
928 CTimer::After( KNormalTimingDelay ); |
|
929 } |
|
930 break; |
|
931 default: |
|
932 break; |
|
933 } |
|
934 } |
|
935 else if ( iStillPrepareReady ) |
|
936 { |
|
937 |
|
938 if ( iRunWithViewFinder && !iCamAppEngine->IsViewFinding() ) |
|
939 { |
|
940 iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize ); |
|
941 User::After( 1000000 ); // Give some time for camera drivers to settle. |
|
942 } |
|
943 |
|
944 iStillPrepareReady = EFalse; |
|
945 |
|
946 TBool capture = EFalse; |
|
947 |
|
948 switch ( iAction ) |
|
949 { |
|
950 case ESwitchPowerOnWhenStillPrepared: |
|
951 iAction = ENone; |
|
952 iCamAppEngine->PowerOn(); |
|
953 CTimer::After( KNormalTimingDelay ); |
|
954 break; |
|
955 case ESwitchPowerOffWhenStillPrepared: |
|
956 iAction = ENone; |
|
957 iCamAppEngine->PowerOff(); |
|
958 CTimer::After( KNormalTimingDelay ); |
|
959 break; |
|
960 case EGetStillQualityIndexWhenPrepared: |
|
961 { |
|
962 TInt stillQualityIndex = iCamAppEngine->StillQualityIndex(); |
|
963 if ( stillQualityIndex != iStillQualityLevelIndex ) |
|
964 { |
|
965 User::Leave( KErrGeneral ); |
|
966 } |
|
967 } |
|
968 iStop = ETrue; |
|
969 CTimer::After( KNormalTimingDelay ); |
|
970 break; |
|
971 case EStartStillOpModeStopVf: |
|
972 iStopViewFinder = ETrue; |
|
973 CTimer::After( iTimeout ); |
|
974 break; |
|
975 case ESpecifiedPrepareStill: |
|
976 case EPrepareStillCapturing: |
|
977 iAction = ENone; |
|
978 CTimer::After( KNormalTimingDelay ); |
|
979 break; |
|
980 case EPrepareStillCapturingWhenPrepared: |
|
981 if ( iStopWhenCompleted ) |
|
982 { |
|
983 iStop = ETrue; |
|
984 CTimer::After( KNormalTimingDelay ); |
|
985 } |
|
986 else |
|
987 { |
|
988 iStopWhenCompleted = ETrue; |
|
989 iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex ); |
|
990 } |
|
991 break; |
|
992 case ESpecifiedPrepareStillWhenPrepared: |
|
993 if ( iStopWhenCompleted ) |
|
994 { |
|
995 iStop = ETrue; |
|
996 CTimer::After( KNormalTimingDelay ); |
|
997 } |
|
998 else |
|
999 { |
|
1000 iStopWhenCompleted = ETrue; |
|
1001 iCamAppEngine->PrepareStillCaptureL( iStillFrameSize, |
|
1002 iStillDataFormat, |
|
1003 iStillCompressionQuality ); |
|
1004 } |
|
1005 break; |
|
1006 // Burst |
|
1007 case EPrepareAndCaptureStillBurst: |
|
1008 case EPrepareAndCaptureStillBurstExif: |
|
1009 case EPrepareAndCaptureAndCancelStillBurstExif: |
|
1010 case ESpecPrepAndCaptureStillBurst: |
|
1011 case EPrepareAndCaptureAndCancelStillBurst: |
|
1012 case EPrepareAndCaptureAndCancelStillBurstAtMoment: |
|
1013 case EPrepareAndCaptureAndCancelStillBurstAtSnap: |
|
1014 case EPrepareAndCaptureAndStopStillBurst: |
|
1015 case EPrepareAndCaptureCaptureStillBurst: |
|
1016 case ESpecPrepAndCaptureCaptureStillBurst: |
|
1017 case EPrepareAndCaptureStillBurstCaptureStill: |
|
1018 case ESpecPrepAndCaptureStillBurstCaptureStill: |
|
1019 case EDestroyEngineWhenStillBurstReady: |
|
1020 case EDestroyEngineWhenSnapImageReadyInStillBurst: |
|
1021 case EDestroyEngineWhenStillImageReadyInStillBurst: |
|
1022 if ( iImageCountToCapture == 1 ) |
|
1023 { |
|
1024 iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( iStillBurstLength ); |
|
1025 } |
|
1026 if ( iSnapImageSource != CCaeEngine::ESnapImageSourceOriginal ) |
|
1027 { |
|
1028 iCamAppEngine->SetSnapImageSourceL( iSnapImageSource ); |
|
1029 } |
|
1030 capture = ETrue; |
|
1031 break; |
|
1032 case ECaptureStillSetSnapSizeExif: |
|
1033 iCamAppEngine->SetSnapImageSizeL( iSnapImageSize ); |
|
1034 capture = ETrue; |
|
1035 break; |
|
1036 case ECaptureStillAfterPowerOff: |
|
1037 iCamAppEngine->PowerOff(); |
|
1038 capture = ETrue; |
|
1039 iStop = ETrue; // Engine cancels capture if power is not on |
|
1040 CTimer::After( KNormalTimingDelay ); |
|
1041 break; |
|
1042 case ECaptureStillAfterPowerOffOn: |
|
1043 if ( iStopWhenCompleted ) |
|
1044 { |
|
1045 if ( iCountStillPrepareComplete <= 1 ) |
|
1046 { |
|
1047 iCamAppEngine->PrepareStillCaptureL( iStillFrameSize, |
|
1048 iStillDataFormat, |
|
1049 iStillCompressionQuality ); |
|
1050 } |
|
1051 else |
|
1052 { |
|
1053 capture = ETrue; |
|
1054 } |
|
1055 //CTimer::After( KNormalTimingDelay ); |
|
1056 } |
|
1057 else if ( iPowerOn ) |
|
1058 { |
|
1059 iCamAppEngine->PowerOff(); |
|
1060 iPowerOn = EFalse; |
|
1061 iStillPrepareReady = ETrue; // come back here on next run |
|
1062 CTimer::After( KLongTimingDelay ); |
|
1063 } |
|
1064 else |
|
1065 { |
|
1066 iStopWhenCompleted = ETrue; |
|
1067 iCamAppEngine->PowerOn(); |
|
1068 iStillPrepareReady = ETrue; // come back here on next run |
|
1069 // CTimer::After( KLongTimingDelay*100 ); |
|
1070 } |
|
1071 break; |
|
1072 case EDestroyEngineWhenStillPrepareReady: |
|
1073 delete iCamAppEngine; |
|
1074 iCamAppEngine = NULL; |
|
1075 CActiveScheduler::Stop(); |
|
1076 break; |
|
1077 default: |
|
1078 capture = ETrue; |
|
1079 break; |
|
1080 } |
|
1081 |
|
1082 // Special treatments for some specific test actions: |
|
1083 switch ( iAction ) |
|
1084 { |
|
1085 case EPrepareAndCaptureAndStopStillBurst: |
|
1086 iStopStillBurst = ETrue; |
|
1087 break; |
|
1088 case EPrepareAndCaptureAndCancelStillBurstAtMoment: |
|
1089 iCancelStillBurst = ETrue; |
|
1090 break; |
|
1091 case EPrepareAndCaptureAndCancelStillBurstExif: |
|
1092 // Cancel still burst after next view finder frame |
|
1093 iCancelStillBurstAfterVfFrame = ETrue; |
|
1094 break; |
|
1095 case EPrepareAndCaptureAndCancelStillAtSnap: |
|
1096 iRunlForSnapImage = ETrue; |
|
1097 // Added delay so that the encoder has always time to finish before the next RunTrappedL. |
|
1098 // Before is was not so deterministic. |
|
1099 iNextRunLTime.HomeTime(); |
|
1100 iNextRunLTime += TTimeIntervalMicroSeconds32(KLongTimingDelay*1000); |
|
1101 break; |
|
1102 case EPrepareAndCaptureAndCancelStillBurstAtSnap: |
|
1103 case EDestroyEngineWhenSnapImageReady: |
|
1104 case EDestroyEngineWhenSnapImageReadyInStillBurst: |
|
1105 iRunlForSnapImage = ETrue; |
|
1106 break; |
|
1107 case EDestroyEngineWhenStillImageReadyInStillBurst: |
|
1108 iRunlForStillImage = ETrue; |
|
1109 break; |
|
1110 default: |
|
1111 break; |
|
1112 } |
|
1113 |
|
1114 // Capture still if requested for the test action. |
|
1115 if ( capture ) |
|
1116 { |
|
1117 iStillCaptureReady = EFalse; |
|
1118 iStillCapturingOn = ETrue; |
|
1119 iStillCaptured = ETrue; |
|
1120 #ifdef _DEBUG |
|
1121 RDebug::Print( _L( "Cae: CCaeTestStatesClient: calling iCamAppEngine->CaptureStill()" ) ); |
|
1122 #endif |
|
1123 iCamAppEngine->CaptureStill(); |
|
1124 } |
|
1125 |
|
1126 if ( iAction == EPrepareAndCaptureAndCancelStill || |
|
1127 iAction == EPrepareAndCaptureAndCancelStillBurst ) |
|
1128 { |
|
1129 iCamAppEngine->CancelCaptureStill(); |
|
1130 iCancelCount++; |
|
1131 iStop = ETrue; |
|
1132 CTimer::After( KNormalTimingDelay ); |
|
1133 } |
|
1134 |
|
1135 } |
|
1136 else if ( iVideoPrepareReady ) |
|
1137 { |
|
1138 |
|
1139 if ( iRunWithViewFinder && !iCamAppEngine->IsViewFinding() ) |
|
1140 { |
|
1141 iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize ); |
|
1142 User::After( 1000000 ); // Give some time for camera drivers to settle. |
|
1143 } |
|
1144 |
|
1145 iVideoPrepareReady = EFalse; |
|
1146 |
|
1147 TBool record = EFalse; |
|
1148 |
|
1149 switch ( iAction ) |
|
1150 { |
|
1151 case ESwitchPowerOnWhenVideoPrepared: |
|
1152 iAction = ENone; |
|
1153 iCamAppEngine->PowerOn(); |
|
1154 CTimer::After( KNormalTimingDelay ); |
|
1155 break; |
|
1156 case ESwitchPowerOffWhenVideoPrepared: |
|
1157 iAction = ENone; |
|
1158 iCamAppEngine->PowerOff(); |
|
1159 CTimer::After( KNormalTimingDelay ); |
|
1160 break; |
|
1161 case EGetVideoQualityIndexWhenPrepared: |
|
1162 { |
|
1163 TInt videoQualityIndex = iCamAppEngine->VideoQualityIndex(); |
|
1164 if ( videoQualityIndex != iVideoQualityLevelIndex ) |
|
1165 { |
|
1166 User::Leave( KErrGeneral ); |
|
1167 } |
|
1168 } |
|
1169 iStop = ETrue; |
|
1170 CTimer::After( KNormalTimingDelay ); |
|
1171 break; |
|
1172 case EPrepareVideoRecording: |
|
1173 case ESpecifiedPrepareVideo: |
|
1174 iAction = ENone; |
|
1175 CTimer::After( KNormalTimingDelay ); |
|
1176 break; |
|
1177 case EPrepareVideoRecordingWhenPrepared: |
|
1178 if ( iStopWhenCompleted ) |
|
1179 { |
|
1180 iStop = ETrue; |
|
1181 CTimer::After( KNormalTimingDelay ); |
|
1182 } |
|
1183 else |
|
1184 { |
|
1185 iStopWhenCompleted = ETrue; |
|
1186 iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex ); |
|
1187 } |
|
1188 break; |
|
1189 case ESpecifiedPrepareVideoWhenPrepared: |
|
1190 if ( iStopWhenCompleted ) |
|
1191 { |
|
1192 iStop = ETrue; |
|
1193 CTimer::After( KNormalTimingDelay ); |
|
1194 } |
|
1195 else |
|
1196 { |
|
1197 iStopWhenCompleted = ETrue; |
|
1198 iCamAppEngine->PrepareVideoRecordingL( iVideoFrameSize, |
|
1199 iVideoFrameRate, |
|
1200 iVideoBitRate, |
|
1201 iVideoAudioEnabled, |
|
1202 *iMimeTypeSet[iVideoCodecSet], |
|
1203 *iPreferredSupplierSet[iVideoCodecSet], |
|
1204 *iVideoTypeSet[iVideoCodecSet], |
|
1205 *iAudioTypeSet[iVideoCodecSet] ); |
|
1206 } |
|
1207 break; |
|
1208 case EPauseVideoWhenPrepared: |
|
1209 iCamAppEngine->PauseVideoRecording(); |
|
1210 break; |
|
1211 case EResumeVideoWhenPrepared: |
|
1212 iCamAppEngine->ResumeVideoRecording(); |
|
1213 break; |
|
1214 case EStopVideoRecordingWhenPrepared: |
|
1215 iCamAppEngine->StopVideoRecording(); |
|
1216 break; |
|
1217 case EStartVideoOpModeStopVf: |
|
1218 iStopViewFinder = ETrue; |
|
1219 CTimer::After( iTimeout ); |
|
1220 break; |
|
1221 case EIsVideoRecordingWhenPrepared: |
|
1222 iAction = ENone; |
|
1223 { |
|
1224 TBool isRecording = iCamAppEngine->IsVideoRecording(); |
|
1225 if ( isRecording ) |
|
1226 { |
|
1227 User::Leave ( KErrGeneral ); |
|
1228 } |
|
1229 } |
|
1230 break; |
|
1231 case ERemainingTimeWhenVideoPrepared: |
|
1232 { |
|
1233 iAction = ENone; |
|
1234 TTimeIntervalMicroSeconds remainingTime( 0 ); |
|
1235 remainingTime = iCamAppEngine->RemainingVideoRecordingTime(); |
|
1236 CTimer::After( KNormalTimingDelay ); |
|
1237 } |
|
1238 break; |
|
1239 case EDestroyEngineWhenVideoPrepareReady: |
|
1240 delete iCamAppEngine; |
|
1241 iCamAppEngine = NULL; |
|
1242 CActiveScheduler::Stop(); |
|
1243 break; |
|
1244 |
|
1245 // If interface after S60 2.1. |
|
1246 #ifndef CAE_INTERFACE_21 |
|
1247 case ESetColorToneVideoRecording: |
|
1248 iCustomInterfacePointer = iCamAppEngine->CustomInterface( iCustomInterfaceUid ); |
|
1249 if ( !iCustomInterfacePointer ) |
|
1250 { // Interface not supported, exit test case |
|
1251 #ifdef _DEBUG |
|
1252 RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTrappedL() CustomInterface returns 0 for uid %x" ), iCustomInterfaceUid.iUid ); |
|
1253 #endif |
|
1254 iStop = ETrue; |
|
1255 CTimer::After( KNormalTimingDelay ); |
|
1256 } |
|
1257 else |
|
1258 { |
|
1259 MCameraColorToneSettings* CTptr = NULL; |
|
1260 |
|
1261 // cast the TAny pointer to the real color tone interface pointer and |
|
1262 // read the bitfield of supported color tones. All of them are tested once. |
|
1263 CTptr = static_cast<MCameraColorToneSettings*> ( iCustomInterfacePointer ); |
|
1264 iTestedColorTones = CTptr->SupportedColorTones(); |
|
1265 record = ETrue; |
|
1266 } |
|
1267 break; |
|
1268 #endif |
|
1269 default: |
|
1270 record = ETrue; |
|
1271 break; |
|
1272 } |
|
1273 |
|
1274 if ( record ) |
|
1275 { |
|
1276 iVideoRecordingReady = EFalse; |
|
1277 iVideoRecordingOn = EFalse; |
|
1278 iVideoRecorded = ETrue; |
|
1279 #ifdef _DEBUG |
|
1280 RDebug::Print( _L( "Cae: CCaeTestStatesClient: calling iCamAppEngine->StartVideoRecording()" ) ); |
|
1281 #endif |
|
1282 iCamAppEngine->StartVideoRecording(); |
|
1283 } |
|
1284 } |
|
1285 else if ( iSnapImageReady ) |
|
1286 { |
|
1287 iSnapImageReady = EFalse; |
|
1288 |
|
1289 switch ( iAction ) |
|
1290 { |
|
1291 case EPrepareAndCaptureAndCancelStillAtSnap: |
|
1292 case EPrepareAndCaptureAndCancelStillBurstAtSnap: |
|
1293 iCamAppEngine->CancelCaptureStill(); |
|
1294 iCancelCount++; |
|
1295 if ( iCancelCount == 1 ) |
|
1296 { |
|
1297 iCountSnapImageReady--; |
|
1298 // To test that preparing does not ruin cancelling. |
|
1299 iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex ); |
|
1300 } |
|
1301 else |
|
1302 { |
|
1303 iCountSnapImageReady++; |
|
1304 iStillCapturingOn = ETrue; |
|
1305 iStillCaptured = ETrue; |
|
1306 if ( iAction == EPrepareAndCaptureAndCancelStillAtSnap ) |
|
1307 { |
|
1308 iRunlForStillImage = ETrue; |
|
1309 } |
|
1310 iAction = ENone; |
|
1311 iCamAppEngine->CaptureStill(); |
|
1312 } |
|
1313 break; |
|
1314 case EDestroyEngineWhenSnapImageReady: |
|
1315 case EDestroyEngineWhenSnapImageReadyInStillBurst: |
|
1316 iRunlForSnapImage = EFalse; |
|
1317 delete iCamAppEngine; |
|
1318 iCamAppEngine = NULL; |
|
1319 CActiveScheduler::Stop(); |
|
1320 break; |
|
1321 default: |
|
1322 iRunlForSnapImage = EFalse; |
|
1323 break; |
|
1324 } |
|
1325 } |
|
1326 else if ( iStillCaptureReady ) |
|
1327 { |
|
1328 iStillCaptureReady = EFalse; |
|
1329 |
|
1330 switch ( iAction ) |
|
1331 { |
|
1332 case EPrepareAndCaptureStill: |
|
1333 case ESpecifiedPrepareAndCaptureStill: |
|
1334 case ESpecifiedPrepareAndCaptureStill2nd: |
|
1335 case ESetColorTone: |
|
1336 case ESetColorToneWrongParams: |
|
1337 case ESetDisplayIndex: |
|
1338 iAction = ENone; |
|
1339 CTimer::After( KNormalTimingDelay ); |
|
1340 break; |
|
1341 case ECaptureCapture: |
|
1342 case ESpecPrepCaptureCapture: |
|
1343 iAction = ENone; |
|
1344 iStillCapturingOn = ETrue; |
|
1345 iStillCaptured = ETrue; |
|
1346 iCamAppEngine->CaptureStill(); |
|
1347 break; |
|
1348 case ECaptureRecord: |
|
1349 iStillPrepareReady = EFalse; |
|
1350 iVideoPrepareReady = EFalse; |
|
1351 iCamAppEngine->InitVideoRecorderL(); |
|
1352 iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName ); |
|
1353 iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex ); |
|
1354 break; |
|
1355 case ERecordCaptureComplexSequence1: |
|
1356 case ERecordCaptureComplexSequence2: |
|
1357 iVideoRecordingReady = ETrue; |
|
1358 CTimer::After( KNormalTimingDelay ); |
|
1359 break; |
|
1360 case EPrepareAndCaptureStillBurst: |
|
1361 case EPrepareAndCaptureStillBurstExif: |
|
1362 case EPrepareAndCaptureAndCancelStillBurstExif: |
|
1363 case ESpecPrepAndCaptureStillBurst: |
|
1364 case EPrepareAndCaptureAndCancelStillBurst: |
|
1365 case EPrepareAndCaptureAndCancelStillBurstAtSnap: |
|
1366 case EPrepareAndCaptureAndStopStillBurst: |
|
1367 break; |
|
1368 case EDestroyEngineWhenStillCaptureReady: |
|
1369 case EDestroyEngineWhenStillImageReadyInStillBurst: |
|
1370 delete iCamAppEngine; |
|
1371 iCamAppEngine = NULL; |
|
1372 CActiveScheduler::Stop(); |
|
1373 break; |
|
1374 default: |
|
1375 iAction = ENone; |
|
1376 iViewFindingUsed = ETrue; |
|
1377 #ifdef _DEBUG |
|
1378 RDebug::Print( _L( "Cae: CCaeTestStatesClient: calling iCamAppEngine->StartViewFinderBitmapsL()" ) ); |
|
1379 #endif |
|
1380 iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize ); |
|
1381 iStopViewFinder = ETrue; |
|
1382 CTimer::After( iTimeout ); |
|
1383 break; |
|
1384 } |
|
1385 |
|
1386 iRunlForStillImage = EFalse; |
|
1387 |
|
1388 } |
|
1389 else if ( iStillBurstCaptureMoment ) |
|
1390 { |
|
1391 iStillBurstCaptureMoment = EFalse; |
|
1392 |
|
1393 switch ( iAction ) |
|
1394 { |
|
1395 case EPrepareAndCaptureAndCancelStillBurstAtMoment: |
|
1396 // Note: Cancelling is done in the callback. |
|
1397 if ( iCancelCount == 1 ) |
|
1398 { |
|
1399 // To test that preparing does not ruin cancelling. |
|
1400 // The burst emerging from this is also cancelled! |
|
1401 iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex ); |
|
1402 } |
|
1403 else |
|
1404 { |
|
1405 iAction = ENone; |
|
1406 iStillCapturingOn = ETrue; |
|
1407 iStillCaptured = ETrue; |
|
1408 // Do not cancel this burst! |
|
1409 iCancelStillBurst = EFalse; |
|
1410 iCamAppEngine->CaptureStill(); |
|
1411 } |
|
1412 break; |
|
1413 default: |
|
1414 break; |
|
1415 } |
|
1416 } |
|
1417 else if ( iStillBurstReady ) |
|
1418 { |
|
1419 iStillBurstReady = EFalse; |
|
1420 |
|
1421 switch ( iAction ) |
|
1422 { |
|
1423 case EPrepareAndCaptureCaptureStillBurst: |
|
1424 case ESpecPrepAndCaptureCaptureStillBurst: |
|
1425 iAction = ENone; |
|
1426 iStillCapturingOn = ETrue; |
|
1427 iStillCaptured = ETrue; |
|
1428 iCamAppEngine->CaptureStill(); |
|
1429 break; |
|
1430 case EPrepareAndCaptureStillBurstCaptureStill: |
|
1431 case ESpecPrepAndCaptureStillBurstCaptureStill: |
|
1432 // Re-set the image count to one to perform single image capture. |
|
1433 iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( 1 ); |
|
1434 if ( iImageCountToCapture != 1 ) |
|
1435 { |
|
1436 User::Leave( KErrGeneral ); |
|
1437 } |
|
1438 iAction = ENone; |
|
1439 iStillCapturingOn = ETrue; |
|
1440 iStillCaptured = ETrue; |
|
1441 iCamAppEngine->CaptureStill(); |
|
1442 break; |
|
1443 case EPrepareAndCaptureStillBurst: |
|
1444 case EPrepareAndCaptureStillBurstExif: |
|
1445 case EPrepareAndCaptureAndCancelStillBurstExif: |
|
1446 case ESpecPrepAndCaptureStillBurst: |
|
1447 case EPrepareAndCaptureAndCancelStillBurst: |
|
1448 case EPrepareAndCaptureAndStopStillBurst: |
|
1449 iAction = ENone; |
|
1450 iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( 1 ); |
|
1451 if ( iImageCountToCapture != 1 ) |
|
1452 { |
|
1453 User::Leave( KErrGeneral ); |
|
1454 } |
|
1455 CTimer::After( KNormalTimingDelay ); |
|
1456 break; |
|
1457 case ERecordCaptureComplexSequence1: |
|
1458 case ERecordCaptureComplexSequence2: |
|
1459 iVideoRecordingReady = ETrue; |
|
1460 CTimer::After( KNormalTimingDelay ); |
|
1461 break; |
|
1462 case EDestroyEngineWhenStillBurstReady: |
|
1463 delete iCamAppEngine; |
|
1464 iCamAppEngine = NULL; |
|
1465 CActiveScheduler::Stop(); |
|
1466 break; |
|
1467 default: |
|
1468 iAction = ENone; |
|
1469 iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( 1 ); |
|
1470 if ( iImageCountToCapture != 1 ) |
|
1471 { |
|
1472 User::Leave( KErrGeneral ); |
|
1473 } |
|
1474 CTimer::After( KNormalTimingDelay ); |
|
1475 break; |
|
1476 } |
|
1477 } |
|
1478 else if ( iVideoRecordingOn ) |
|
1479 { |
|
1480 |
|
1481 switch ( iAction ) |
|
1482 { |
|
1483 case ESwitchPowerOnWhenRecordingVideo: |
|
1484 iVideoRecordingOn = EFalse; |
|
1485 iAction = ENone; |
|
1486 iCamAppEngine->PowerOn(); |
|
1487 CTimer::After( KNormalTimingDelay ); |
|
1488 break; |
|
1489 case ESwitchPowerOffWhenRecordingVideo: |
|
1490 iVideoRecordingOn = EFalse; |
|
1491 iAction = ENone; |
|
1492 iCamAppEngine->PowerOff(); |
|
1493 CTimer::After( KNormalTimingDelay ); |
|
1494 break; |
|
1495 case EPrepareRecordPauseStopVideo: |
|
1496 case EPrepareRecordPauseResumeStopVideo: |
|
1497 iVideoRecordingOn = EFalse; |
|
1498 if ( !iVideoRecordingResumed ) |
|
1499 { |
|
1500 iCamAppEngine->PauseVideoRecording(); |
|
1501 } |
|
1502 else |
|
1503 { |
|
1504 iCamAppEngine->StopVideoRecording(); |
|
1505 } |
|
1506 break; |
|
1507 case EPrepareRecordPausePauseStopVideo: |
|
1508 iVideoRecordingOn = EFalse; |
|
1509 if ( !iVideoRecordingResumed ) |
|
1510 { |
|
1511 iCamAppEngine->PauseVideoRecording(); |
|
1512 iCamAppEngine->PauseVideoRecording(); |
|
1513 } |
|
1514 else |
|
1515 { |
|
1516 iCamAppEngine->StopVideoRecording(); |
|
1517 } |
|
1518 break; |
|
1519 case EResumeVideoWhenNotPaused: |
|
1520 iCamAppEngine->ResumeVideoRecording(); |
|
1521 break; |
|
1522 case EStartVideoRecordingWhenRecording: |
|
1523 iCamAppEngine->StartVideoRecording(); |
|
1524 break; |
|
1525 case EIsVideoRecordingWhenRecording: |
|
1526 iVideoRecordingOn = EFalse; |
|
1527 iAction = ENone; |
|
1528 { |
|
1529 TBool isRecording = iCamAppEngine->IsVideoRecording(); |
|
1530 if ( !isRecording ) |
|
1531 { |
|
1532 User::Leave ( KErrGeneral ); |
|
1533 } |
|
1534 } |
|
1535 break; |
|
1536 case EPrepareStillCaptureWhenRecording: |
|
1537 iStillPrepareReady = EFalse; |
|
1538 iVideoPrepareReady = EFalse; |
|
1539 iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex ); |
|
1540 break; |
|
1541 case EDestroyEngineWhenVideoRecordingOn: |
|
1542 delete iCamAppEngine; |
|
1543 iCamAppEngine = NULL; |
|
1544 CActiveScheduler::Stop(); |
|
1545 break; |
|
1546 case EDestroyEngineWhenVideoRecordingPaused: |
|
1547 iVideoRecordingOn = EFalse; |
|
1548 iCamAppEngine->PauseVideoRecording(); |
|
1549 break; |
|
1550 |
|
1551 // If interface after S60 2.1. |
|
1552 #ifndef CAE_INTERFACE_21 |
|
1553 case ESetColorToneVideoRecording: |
|
1554 { |
|
1555 MCameraColorToneSettings* CTptr = NULL; |
|
1556 |
|
1557 if ( iTestedColorTones == 0) // All colors tested? |
|
1558 { |
|
1559 //Set the default color tone and stop |
|
1560 CTptr = static_cast<MCameraColorToneSettings*> ( iCustomInterfacePointer ); |
|
1561 CTptr->SetColorToneL( iColorToneValue ); |
|
1562 iCamAppEngine->StopVideoRecording(); |
|
1563 } |
|
1564 else |
|
1565 { |
|
1566 TInt i, nextColor; |
|
1567 |
|
1568 // Find out next not tested color |
|
1569 for ( i = 0, nextColor = 0; i < 32; i++ ) |
|
1570 { |
|
1571 nextColor = (1 << i); |
|
1572 if ( nextColor & iTestedColorTones ) |
|
1573 { |
|
1574 iTestedColorTones &= ~nextColor; // Remove this color (bit) |
|
1575 break; |
|
1576 } |
|
1577 } |
|
1578 // cast the TAny pointer to the real color tone interface pointer and |
|
1579 // then set the new color tone and verify that it has been set |
|
1580 CTptr = static_cast<MCameraColorToneSettings*> ( iCustomInterfacePointer ); |
|
1581 CTptr->SetColorToneL( (MCameraColorToneSettings::TColorTone) nextColor ); |
|
1582 |
|
1583 if ( CTptr->ColorTone() == nextColor ) |
|
1584 { |
|
1585 CTimer::After( iTimeout ); // all ok, continue video recording |
|
1586 } |
|
1587 else |
|
1588 { |
|
1589 #ifdef _DEBUG |
|
1590 RDebug::Print( _L( "Cae: ESetColorToneVideoRecording: color not set to: %d" ), nextColor ); |
|
1591 #endif |
|
1592 iStop = ETrue; |
|
1593 CTimer::After( KNormalTimingDelay ); |
|
1594 } |
|
1595 } |
|
1596 break; |
|
1597 } |
|
1598 #endif |
|
1599 default: |
|
1600 iCamAppEngine->StopVideoRecording(); |
|
1601 break; |
|
1602 } |
|
1603 } |
|
1604 else if ( iVideoRecordingPaused ) |
|
1605 { |
|
1606 |
|
1607 switch ( iAction ) |
|
1608 { |
|
1609 case EPrepareRecordPauseStopVideo: |
|
1610 case EPrepareRecordPausePauseStopVideo: |
|
1611 iStop = ETrue; |
|
1612 iCamAppEngine->StopVideoRecording(); |
|
1613 break; |
|
1614 case EDestroyEngineWhenVideoRecordingPaused: |
|
1615 delete iCamAppEngine; |
|
1616 iCamAppEngine = NULL; |
|
1617 CActiveScheduler::Stop(); |
|
1618 break; |
|
1619 default: |
|
1620 iCamAppEngine->ResumeVideoRecording(); |
|
1621 iVideoRecordingResumed = ETrue; |
|
1622 break; |
|
1623 } |
|
1624 } |
|
1625 else if ( iVideoRecordingReady ) |
|
1626 { |
|
1627 switch ( iAction ) |
|
1628 { |
|
1629 case ERecordRecord: |
|
1630 iAction = EDefault; |
|
1631 iVideoRecordingReady = EFalse; |
|
1632 iVideoRecordingOn = EFalse; |
|
1633 iVideoRecorded = ETrue; |
|
1634 // This leads to video prepare and then recording with the new name. |
|
1635 iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName2 ); |
|
1636 break; |
|
1637 case ERecordCapture: |
|
1638 iAction = EDefault; |
|
1639 iStillPrepareReady = EFalse; |
|
1640 iVideoPrepareReady = EFalse; |
|
1641 iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex ); |
|
1642 break; |
|
1643 case ERecordCaptureComplexSequence1: |
|
1644 #ifdef _DEBUG |
|
1645 RDebug::Print( _L( "Cae: ERecordCaptureComplexSequence1 case: %d" ), iActionCycle ); |
|
1646 #endif |
|
1647 iVideoRecordingReady = EFalse; |
|
1648 iVideoRecordingOn = EFalse; |
|
1649 iVideoRecorded = ETrue; |
|
1650 switch ( iActionCycle ) |
|
1651 { |
|
1652 case 0: |
|
1653 // This leads to video prepare and then recording with the new name. |
|
1654 iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName2 ); |
|
1655 break; |
|
1656 case 1: |
|
1657 // Accept video recording completion error because max clip size. |
|
1658 iAcceptVideoCompletionError = ETrue; |
|
1659 // This leads to video prepare and then recording with the previously given name. |
|
1660 iCamAppEngine->SetVideoClipMaxSizeL( iVideoMaxClipSizeInBytes ); |
|
1661 break; |
|
1662 /* |
|
1663 case 2: |
|
1664 // This leads to video recording with the previous name. |
|
1665 iVideoPrepareReady = ETrue; |
|
1666 CTimer::After( KNormalTimingDelay ); |
|
1667 break; |
|
1668 */ |
|
1669 case 2: |
|
1670 // This leads to video prepare and then recording with the new name. |
|
1671 iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName3 ); |
|
1672 break; |
|
1673 case 3: |
|
1674 // This leads to single still image capture. |
|
1675 iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex ); |
|
1676 break; |
|
1677 case 4: |
|
1678 // Note, this is re-initialization of video recorder. |
|
1679 // Leads to video prepare and then recording with new name. |
|
1680 iAcceptVideoCompletionError = EFalse; |
|
1681 iCamAppEngine->InitVideoRecorderL(); |
|
1682 iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName4 ); |
|
1683 iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex ); |
|
1684 break; |
|
1685 case 5: |
|
1686 // This leads to single still image capture. |
|
1687 iCamAppEngine->CloseVideoRecording(); |
|
1688 iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex ); |
|
1689 break; |
|
1690 case 6: |
|
1691 iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName ); |
|
1692 // Accept video recording completion error because max clip size. |
|
1693 iAcceptVideoCompletionError = ETrue; |
|
1694 iCamAppEngine->SetVideoClipMaxSizeL( iVideoMaxClipSizeInBytes ); |
|
1695 iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex ); |
|
1696 break; |
|
1697 case 7: |
|
1698 // Note, this is re-initialization of the whole engine. |
|
1699 // Leads to video prepare and then recording with the original name. |
|
1700 iAcceptVideoCompletionError = EFalse; |
|
1701 iCamAppEngine->InitL(); |
|
1702 break; |
|
1703 default: |
|
1704 iStop = ETrue; |
|
1705 CTimer::After( KNormalTimingDelay ); |
|
1706 break; |
|
1707 } |
|
1708 iActionCycle++; |
|
1709 break; |
|
1710 case ERecordCaptureComplexSequence2: |
|
1711 #ifdef _DEBUG |
|
1712 RDebug::Print( _L( "Cae: ERecordCaptureComplexSequence2 case: %d" ), iActionCycle ); |
|
1713 #endif |
|
1714 iVideoRecordingReady = EFalse; |
|
1715 iVideoRecordingOn = EFalse; |
|
1716 iVideoRecorded = ETrue; |
|
1717 switch ( iActionCycle ) |
|
1718 { |
|
1719 case 0: |
|
1720 // This leads to still burst capture. |
|
1721 iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( iStillBurstLength ); |
|
1722 iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex ); |
|
1723 break; |
|
1724 case 1: |
|
1725 // This leads to single image capture. |
|
1726 iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( 1 ); |
|
1727 iStillPrepareReady = ETrue; |
|
1728 CTimer::After( KNormalTimingDelay ); |
|
1729 break; |
|
1730 case 2: |
|
1731 // This leads to single image capture. |
|
1732 iStillPrepareReady = ETrue; |
|
1733 CTimer::After( KNormalTimingDelay ); |
|
1734 break; |
|
1735 case 3: |
|
1736 // This leads to still burst capture. |
|
1737 iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( iStillBurstLength ); |
|
1738 iStillPrepareReady = ETrue; |
|
1739 CTimer::After( KNormalTimingDelay ); |
|
1740 break; |
|
1741 case 4: |
|
1742 // This leads to video prepare and then recording with new name. |
|
1743 iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName2 ); |
|
1744 break; |
|
1745 case 5: |
|
1746 // This leads to single image capture. |
|
1747 iCamAppEngine->CloseVideoRecording(); |
|
1748 iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( 1 ); |
|
1749 iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex ); |
|
1750 break; |
|
1751 case 6: |
|
1752 // This leads to video prepare and then recording with new name. |
|
1753 iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName3 ); |
|
1754 // Accept video recording completion error because max clip size. |
|
1755 iAcceptVideoCompletionError = ETrue; |
|
1756 iCamAppEngine->SetVideoClipMaxSizeL( iVideoMaxClipSizeInBytes ); |
|
1757 iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex ); |
|
1758 break; |
|
1759 case 7: |
|
1760 // This leads to video prepare and then recording with new name. |
|
1761 iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName4 ); |
|
1762 break; |
|
1763 default: |
|
1764 iStop = ETrue; |
|
1765 CTimer::After( KNormalTimingDelay ); |
|
1766 break; |
|
1767 } |
|
1768 iActionCycle++; |
|
1769 break; |
|
1770 case EDestroyEngineWhenVideoRecordingReady: |
|
1771 delete iCamAppEngine; |
|
1772 iCamAppEngine = NULL; |
|
1773 CActiveScheduler::Stop(); |
|
1774 break; |
|
1775 default: |
|
1776 iAction = ENone; |
|
1777 iVideoRecordingReady = EFalse; |
|
1778 iStopViewFinder = ETrue; |
|
1779 CTimer::After( KNormalTimingDelay ); |
|
1780 break; |
|
1781 } |
|
1782 } |
|
1783 else if ( !iStillCaptured && !iVideoRecorded && !iVideoRecordingOn && !iStopViewFinder ) |
|
1784 { |
|
1785 switch ( iAction ) |
|
1786 { |
|
1787 case EStartVfPrepareCaptureStillStartAndStopVf: |
|
1788 if ( !iStillPrepareReady ) |
|
1789 { |
|
1790 #ifdef _DEBUG |
|
1791 RDebug::Print( _L( "Cae: CCaeTestStatesClient: calling iCamAppEngine->PrepareStillCaptureL()" ) ); |
|
1792 #endif |
|
1793 iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex ); |
|
1794 } |
|
1795 break; |
|
1796 case EStartVfPrepareRecordVideoStartAndStopVf: |
|
1797 case ESetColorToneVideoRecording: |
|
1798 if ( !iVideoPrepareReady ) |
|
1799 { |
|
1800 #ifdef _DEBUG |
|
1801 RDebug::Print( _L( "Cae: CCaeTestStatesClient: calling iCamAppEngine->PrepareVideoRecordingL()" ) ); |
|
1802 #endif |
|
1803 iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex ); |
|
1804 } |
|
1805 break; |
|
1806 case ESwitchPowerOffWhenVfRunning: |
|
1807 iCamAppEngine->PowerOff(); |
|
1808 iStopViewFinder = ETrue; |
|
1809 CTimer::After( KNormalTimingDelay ); |
|
1810 break; |
|
1811 default: |
|
1812 break; |
|
1813 } |
|
1814 } |
|
1815 else if ( iStopViewFinder ) |
|
1816 { |
|
1817 #ifdef _DEBUG |
|
1818 RDebug::Print( _L( "Cae: CCaeTestStatesClient: calling iCamAppEngine->StopViewFinder()" ) ); |
|
1819 #endif |
|
1820 iCamAppEngine->StopViewFinder(); |
|
1821 // Test IsViewFinding() |
|
1822 if ( iCamAppEngine->IsViewFinding() ) |
|
1823 { |
|
1824 User::Leave( KErrGeneral ); |
|
1825 } |
|
1826 // Test GetViewFinderSize() |
|
1827 TSize sizeVF; |
|
1828 iCamAppEngine->GetViewFinderSize( sizeVF ); |
|
1829 if ( sizeVF != iViewFinderSize ) |
|
1830 { |
|
1831 User::Leave ( KErrGetNotEqualToValuePreviouslySet ); |
|
1832 } |
|
1833 |
|
1834 iViewFinderStarted = EFalse; |
|
1835 iAction = ENone; |
|
1836 CTimer::After( KNormalTimingDelay ); |
|
1837 } |
|
1838 |
|
1839 #ifdef _DEBUG |
|
1840 RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTrappedL() returning" ) ); |
|
1841 #endif |
|
1842 } |
|
1843 |
|
1844 |
|