camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestSettingsClient.cpp
branchRCL_3
changeset 20 e3cdd00b5ae3
parent 19 18fa9327a158
child 21 27fe719c32e6
equal deleted inserted replaced
19:18fa9327a158 20:e3cdd00b5ae3
     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: CaeTestSettingsClient.cpp
       
    15 *
       
    16 */
       
    17 #include <fbs.h>
       
    18 
       
    19 #include "CaeTestSettingsClient.h"
       
    20 //#include "mmcleanup.h"
       
    21 
       
    22 //_LIT8(KVideoMimeType, "video/3gpp");
       
    23 //_LIT(KVideoPreferredSupplier, "Nokia");
       
    24 //_LIT8(KVideoType, "video/H263-2000");
       
    25 //_LIT8(KVideoAudioType, " AMR");
       
    26 
       
    27 const TUid KSdUidQltyLevels = {KNullUidValue};
       
    28 const TUid KSdIllegalUidQltyLevels = {666};
       
    29 
       
    30 CCaeTestSettingsClient::CCaeTestSettingsClient() 
       
    31     {
       
    32     }
       
    33 
       
    34 
       
    35 CCaeTestSettingsClient::~CCaeTestSettingsClient()
       
    36     {
       
    37     }
       
    38 
       
    39 
       
    40 CCaeTestSettingsClient* CCaeTestSettingsClient::NewL()
       
    41     {
       
    42     CCaeTestSettingsClient* self = new(ELeave) CCaeTestSettingsClient;
       
    43     CleanupStack::PushL( self );
       
    44     self->ConstructL();
       
    45     CleanupStack::Pop( self );
       
    46     return self;
       
    47     }
       
    48 
       
    49 
       
    50 void CCaeTestSettingsClient::ConstructL()
       
    51     {
       
    52     CCaeTestClient::ConstructL();
       
    53 
       
    54     iRunWithViewFinder = EFalse;
       
    55     }
       
    56 
       
    57 
       
    58 void CCaeTestSettingsClient::RunTestActionL( TestClientActions aAction )
       
    59     {
       
    60 	#ifdef _DEBUG
       
    61     RDebug::Print( _L( "Cae: CCaeTestVideoSettingsClient::RunTestActionL() entering" ) );
       
    62     #endif
       
    63     
       
    64     iAction = aAction;
       
    65 	iSavedAction = aAction;
       
    66 
       
    67     // Initialize all state variables.
       
    68     InitStateVariables();
       
    69 
       
    70     iCamAppEngine->InitL( KSdUidQltyLevels );
       
    71 
       
    72 	// Main part of program is a wait loop.
       
    73 	// This function completes when the scheduler stops.
       
    74 	CActiveScheduler::Start();
       
    75     
       
    76     if ( iError )
       
    77         {
       
    78     	#ifdef _DEBUG
       
    79         RDebug::Print( _L( "Cae: CCaeTestSettingsClient::RunTestActionL() leaving (error detected)" ) );
       
    80         #endif
       
    81         User::Leave( iError );
       
    82         }
       
    83 	
       
    84     #ifdef _DEBUG
       
    85     RDebug::Print( _L( "Cae: CCaeTestSettingsClient::RunTestActionL() returning" ) );
       
    86     #endif
       
    87     }
       
    88 
       
    89 
       
    90 void CCaeTestSettingsClient::RunTrappedL()
       
    91     {
       
    92 	#ifdef _DEBUG
       
    93     RDebug::Print( _L( "Cae: CCaeTestSettingsClient::RunTrappedL() entering" ) );
       
    94     #endif
       
    95 
       
    96     if ( iStop ) 
       
    97         {
       
    98         if ( iCamAppEngine->IsViewFinding() )
       
    99 	        {
       
   100             iCamAppEngine->StopViewFinder();
       
   101             iViewFinderStarted = EFalse;
       
   102             }
       
   103         iCamAppEngine->CancelCaptureStill();
       
   104         iCamAppEngine->CloseVideoRecording();
       
   105         delete iBitmapSave;
       
   106         iBitmapSave = NULL;
       
   107         delete iDataSave;
       
   108         iDataSave = NULL;
       
   109         CActiveScheduler::Stop();
       
   110         }
       
   111     else if ( iInitReady ) 
       
   112 		{
       
   113         
       
   114         if ( iAction != ESetVideoFileNameWhenNotInitialized &&
       
   115              iAction != ESetAudioWhenVideoNotInitialized &&
       
   116              iAction != ESetClipMaxSizeWhenVideoNotInitialized &&
       
   117              iAction != EGetAudioWhenVideoNotInitialized )
       
   118             {
       
   119             iCamAppEngine->InitVideoRecorderL( KSdUidQltyLevels );
       
   120             }
       
   121 
       
   122         User::After( 1000000 ); // Give some time for camera drivers to settle.
       
   123 
       
   124         switch ( iAction )
       
   125             {
       
   126             case EGetInfo:
       
   127                 iCamAppEngine->GetInfo( iInfo );
       
   128                 iStop = ETrue;
       
   129                 break;
       
   130             case ESetVideoFileNameWhenInitialized:
       
   131             case ESetVideoFileNameWhenNotInitialized:
       
   132                 iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
       
   133                 iStop = ETrue;
       
   134                 break;
       
   135             case ESetEmptyVideoFileNameWhenInitialized:
       
   136                 iCamAppEngine->SetVideoRecordingFileNameL( _L("") );
       
   137                 iStop = ETrue;
       
   138                 break;
       
   139             case ESetDigiZoomWhenInitialized:
       
   140                 iAction = EDefault;
       
   141                 iCamAppEngine->SetZoomModeL( static_cast<CCaeEngine::TZoomMode>( iZoomMode ) );
       
   142                 iCamAppEngine->SetZoomValueL( iDigiZoomValue );
       
   143                 break;
       
   144             case ESetBrightnessWhenInitialized:
       
   145                 iAction = EDefault;
       
   146                 iCamAppEngine->SetBrightnessL( iBrightness );
       
   147                 break;
       
   148             case ESetContrastWhenInitialized:
       
   149                 {
       
   150                 iAction = EDefault;
       
   151 
       
   152                 //Test before setting, value is unknown?
       
   153                 TInt contrast = iCamAppEngine->Contrast();
       
   154 
       
   155                 iCamAppEngine->SetContrastL( iContrast );
       
   156 
       
   157                 //Test immediately that value is right
       
   158                 contrast = iCamAppEngine->Contrast();
       
   159                 if ( contrast != iContrast )
       
   160                     {
       
   161                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
   162                     }
       
   163                 }
       
   164                 break;
       
   165             case ESetExposureModeWhenInitialized:
       
   166                 iAction = EDefault;
       
   167                 iCamAppEngine->SetExposureModeL( static_cast<CCamera::TExposure>( iExposureMode ) );
       
   168                 break;
       
   169             case ESetEvCompensationWhenInitialized:
       
   170                 {
       
   171                 // Read value before setting, should be zero if not supported
       
   172                 TInt evCompensation = iCamAppEngine->EvCompensation();
       
   173                 if ( evCompensation != 0 )
       
   174                     {
       
   175                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
   176                     }
       
   177                 iCamAppEngine->SetEvCompensationL( iEvCompensation );
       
   178                 }
       
   179                 break;
       
   180             case ESetWhiteBalanceModeWhenInitialized:
       
   181                 iAction = EDefault;
       
   182                 iCamAppEngine->SetWhiteBalanceModeL( static_cast<CCamera::TWhiteBalance>( iWhiteBalanceMode ) );
       
   183                 break;
       
   184             case ESetFlashModeWhenInitialized:
       
   185                 iAction = EDefault;
       
   186                 iCamAppEngine->SetFlashModeL( static_cast<CCamera::TFlash>( iFlashMode ) );
       
   187                 break;
       
   188             case EResetToDefaults:
       
   189                 // iAction = EDefault;
       
   190                 iCamAppEngine->SetZoomModeL( static_cast<CCaeEngine::TZoomMode>( iZoomMode ) );
       
   191                 iCamAppEngine->SetZoomValueL( iDigiZoomValue );
       
   192                 if ( TCameraInfo::EBrightnessSupported & iInfo.iOptionsSupported )
       
   193 		            {
       
   194                     iCamAppEngine->SetBrightnessL( iBrightness );
       
   195                     }
       
   196                 if ( TCameraInfo::EContrastSupported & iInfo.iOptionsSupported )
       
   197 		            {
       
   198                     iCamAppEngine->SetContrastL( iContrast );
       
   199                     }
       
   200                 iCamAppEngine->SetExposureModeL( static_cast<CCamera::TExposure>( iExposureMode ) );
       
   201                 iCamAppEngine->SetWhiteBalanceModeL( static_cast<CCamera::TWhiteBalance>( iWhiteBalanceMode ) );
       
   202                 iCamAppEngine->SetFlashModeL( static_cast<CCamera::TFlash>( iFlashMode ) );
       
   203                 break;
       
   204             case ESetViewFinderMirror:
       
   205                 {
       
   206                 TBool mirrorVF = iCamAppEngine->ViewFinderMirror();
       
   207                 if ( mirrorVF )
       
   208                     {
       
   209                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
   210                     }
       
   211                 }
       
   212                 iAction = EDefault;
       
   213                 iCamAppEngine->SetViewFinderMirrorL( ETrue );
       
   214                 break;
       
   215             case EGetStillFrameSizeWhenInitialized:
       
   216                 // Test with invalid quality level index.
       
   217                 iCamAppEngine->GetStillFrameSize( -1, iStillFrameSizeSet );
       
   218                 iCamAppEngine->GetStillFrameSize( 666, iStillFrameSizeSet );
       
   219                 // Test with valid quality level index.
       
   220                 iCamAppEngine->GetStillFrameSize( iStillQualityLevelIndex, iStillFrameSizeSet );
       
   221                 iStop = ETrue;
       
   222                 break;
       
   223             case EEstimatedStillSizeInBytesWhenInitialized:
       
   224                 // Test with invalid quality level index.
       
   225                 iEstimatedStillSizeInBytesSet = 
       
   226                     iCamAppEngine->EstimatedStillSizeInBytes( -1 );
       
   227                 iEstimatedStillSizeInBytesSet = 
       
   228                     iCamAppEngine->EstimatedStillSizeInBytes( 666 );
       
   229                 // Test with valid quality level index.
       
   230                 iEstimatedStillSizeInBytesSet = 
       
   231                     iCamAppEngine->EstimatedStillSizeInBytes( iStillQualityLevelIndex );
       
   232                 iStop = ETrue;
       
   233                 break;
       
   234             case EGetVideoFrameSizeWhenInitialized:
       
   235                 {
       
   236                 // test first with invalid index values: negative and too big, should not modify data
       
   237                     TSize tempFrameSize1( KImgWidthQCIF, KImgHeightQCIF );
       
   238                     TSize tempFrameSize2( KImgWidthQCIF, KImgHeightQCIF );
       
   239 
       
   240                     iCamAppEngine->GetVideoFrameSize( -1, tempFrameSize1 );
       
   241                     if ( tempFrameSize1 != tempFrameSize2 )
       
   242                         {
       
   243                         User::Leave ( KErrArgument );
       
   244                         }
       
   245                     iCamAppEngine->GetVideoFrameSize( 666, tempFrameSize1 );
       
   246                     if ( tempFrameSize1 != tempFrameSize2 )
       
   247                         {
       
   248                         User::Leave ( KErrArgument );
       
   249                         }
       
   250                     iCamAppEngine->GetVideoFrameSize( iVideoQualityLevelIndex, iVideoFrameSizeSet );
       
   251                     iStop = ETrue;
       
   252                 }
       
   253                 break;
       
   254             case EVideoFrameRateWhenInitialized:
       
   255                 {
       
   256                 // test first with invalid index values: negative and too big, should return 0
       
   257                 iVideoFrameRateSet = iCamAppEngine->VideoFrameRate( -1 );
       
   258                 if ( iVideoFrameRateSet != 0 )
       
   259                     {
       
   260                     User::Leave ( KErrArgument );
       
   261                     }
       
   262                 iVideoFrameRateSet = iCamAppEngine->VideoFrameRate( 666 );
       
   263                 if ( iVideoFrameRateSet != 0 )
       
   264                     {
       
   265                     User::Leave ( KErrArgument );
       
   266                     }
       
   267                 iVideoFrameRateSet = iCamAppEngine->VideoFrameRate( iVideoQualityLevelIndex );
       
   268                 iStop = ETrue;
       
   269                 }
       
   270                 break;
       
   271             case EEstimatedVideoRecordingBitRateWhenInitialized:
       
   272                 // test first with invalid index values: negative and too big, should return 0
       
   273                 iEstimatedVideoBitRateSet = 
       
   274                     iCamAppEngine->EstimatedVideoRecordingBitRateL( -1 );
       
   275                 if ( iEstimatedVideoBitRateSet != 0 )
       
   276                     {
       
   277                     User::Leave ( KErrArgument );
       
   278                     }
       
   279                 iEstimatedVideoBitRateSet = 
       
   280                     iCamAppEngine->EstimatedVideoRecordingBitRateL( 666 );
       
   281                 if ( iEstimatedVideoBitRateSet != 0 )
       
   282                     {
       
   283                     User::Leave ( KErrArgument );
       
   284                     }
       
   285                 iEstimatedVideoBitRateSet = 
       
   286                     iCamAppEngine->EstimatedVideoRecordingBitRateL( iVideoQualityLevelIndex );
       
   287                 iStop = ETrue;
       
   288                 break;
       
   289             case ESetClipMaxSizeWhenVideoNotPrepared:
       
   290                 iAction = EDefault;
       
   291                 iCamAppEngine->SetVideoClipMaxSizeL( iVideoMaxClipSizeInBytes );
       
   292                 break;
       
   293             /*
       
   294             case EPrepareAndSetStillBurstCaptureInterval:
       
   295                 iAction = EDefault;
       
   296                 iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
       
   297 			    break;
       
   298             */
       
   299             case EInitUid:
       
   300                 iCamAppEngine->InitL( KSdIllegalUidQltyLevels );// will leave
       
   301                 iStop = ETrue;
       
   302                 break;
       
   303             case ESetAudioWhenVideoNotInitialized:
       
   304                 iAction = EDefault;
       
   305                 iCamAppEngine->SetVideoAudioL( iVideoAudioEnabled );
       
   306                 break;
       
   307             case ESetClipMaxSizeWhenVideoNotInitialized:
       
   308                 iAction = ENone;
       
   309                 iCamAppEngine->SetVideoClipMaxSizeL( iVideoMaxClipSizeInBytes );
       
   310                 break;
       
   311             case EGetAudioWhenVideoNotInitialized:
       
   312                 {
       
   313                 iStop = ETrue;
       
   314                 TBool audio = iCamAppEngine->VideoAudio();
       
   315                 if ( audio != EFalse )
       
   316                     {
       
   317                     User::Leave ( KErrArgument );
       
   318                     }
       
   319                 }
       
   320                 break;
       
   321             case EEnumerateVideoFrameSize:
       
   322                 {
       
   323                 iStop = ETrue;
       
   324                 TInt enumIndVGA;
       
   325                 TInt enumIndCIF;
       
   326                 TInt enumIndQCIF;
       
   327                 TInt enumIndBIG;
       
   328                 TInt enumIndZERO;
       
   329                 TSize sizeVGA( KImgWidthVGA, KImgHeightVGA );
       
   330                 TSize sizeCIF( KImgWidthCIF, KImgHeightCIF );
       
   331                 TSize sizeQCIF( KImgWidthQCIF, KImgHeightQCIF );
       
   332                 TSize sizeBIG( KImgWidthTooBig, KImgHeightTooBig );
       
   333                 TSize sizeZERO( 0, 0 );
       
   334 
       
   335                 enumIndVGA  = iCamAppEngine->EnumerateVideoFrameSizeL( sizeVGA );
       
   336                 enumIndCIF  = iCamAppEngine->EnumerateVideoFrameSizeL( sizeCIF );
       
   337                 enumIndQCIF = iCamAppEngine->EnumerateVideoFrameSizeL( sizeQCIF );
       
   338                 enumIndBIG  = iCamAppEngine->EnumerateVideoFrameSizeL( sizeBIG );
       
   339                 enumIndZERO = iCamAppEngine->EnumerateVideoFrameSizeL( sizeZERO );
       
   340 
       
   341                 if ( ( enumIndVGA < 0 && enumIndCIF < 0 && enumIndQCIF < 0 ) ||
       
   342                     enumIndBIG >= 0 || enumIndZERO >= 0 )
       
   343                     {
       
   344                     User::Leave ( KErrNotSupported );
       
   345                     }
       
   346                 }
       
   347                 break;
       
   348                 
       
   349             case EInstalledExtensionList:
       
   350                 {
       
   351                 RCaeOrderedFeatureList installedExtensions1;
       
   352                 RCaeOrderedFeatureList installedExtensions2;
       
   353                 TCaeOrderedFeatureListItem item;
       
   354 
       
   355                 // call the get function
       
   356                 iCamAppEngine->GetOrderL( installedExtensions1 );
       
   357 
       
   358                 // test that cae resets the parameter before usage
       
   359                 item.iFeatureUid = KSdIllegalUidQltyLevels;
       
   360                 installedExtensions2.Append( item );
       
   361                 iCamAppEngine->GetOrderL( installedExtensions2 );
       
   362                 
       
   363                 // Check that the both arrays are the same
       
   364                 if ( installedExtensions1.Count() != installedExtensions2.Count() )
       
   365                     {
       
   366                     installedExtensions1.Reset();
       
   367                     installedExtensions2.Reset();
       
   368                     RDebug::Print( _L( "Cae: CCaeTestSettingsClient: CAE doesn't reset the array" ) );
       
   369                     User::Leave ( KErrArgument );
       
   370                     }
       
   371                 for(TInt i=0; i < installedExtensions1.Count(); i++ )
       
   372                     {
       
   373                     if ( installedExtensions1[i].iServiceUid != installedExtensions2[i].iServiceUid ||
       
   374                         installedExtensions1[i].iFeatureUid != installedExtensions2[i].iFeatureUid )
       
   375                         {
       
   376                         installedExtensions1.Reset();
       
   377                         installedExtensions2.Reset();
       
   378                         RDebug::Print( _L( "Cae: CCaeTestSettingsClient: CAE the array is not same" ) );
       
   379                         User::Leave ( KErrArgument );
       
   380                         }
       
   381                     }
       
   382                 installedExtensions1.Reset();
       
   383                 installedExtensions2.Reset();
       
   384                 iStop = ETrue;
       
   385                 }
       
   386                 break;
       
   387 
       
   388             case ESkippedExtensionList:
       
   389                 {
       
   390                 RCaeOrderedFeatureList skippedExtensions1;
       
   391                 RCaeOrderedFeatureList skippedExtensions2;
       
   392                 TCaeOrderedFeatureListItem item;
       
   393                 // call get function twice
       
   394                 iCamAppEngine->SkippedExtensionListL( skippedExtensions1 );
       
   395                 // test that cae resets non-empty parameter
       
   396                 item.iFeatureUid = KSdIllegalUidQltyLevels;
       
   397                 skippedExtensions2.Append( item );
       
   398                 iCamAppEngine->SkippedExtensionListL( skippedExtensions2 );
       
   399                 // Check that the both arrays are the same
       
   400                 if ( skippedExtensions1.Count() != skippedExtensions2.Count() )
       
   401                     {
       
   402                     skippedExtensions1.Reset();
       
   403                     skippedExtensions2.Reset();
       
   404                     RDebug::Print( _L( "Cae: CCaeTestSettingsClient: CAE doesn't reset the array" ) );
       
   405                     User::Leave ( KErrArgument );
       
   406                     }
       
   407                 for(TInt i=0; i < skippedExtensions1.Count(); i++ )
       
   408                     {
       
   409                     if ( skippedExtensions1[i].iServiceUid != skippedExtensions2[i].iServiceUid ||
       
   410                         skippedExtensions1[i].iFeatureUid != skippedExtensions2[i].iFeatureUid )
       
   411                         {
       
   412                         skippedExtensions1.Reset();
       
   413                         skippedExtensions2.Reset();
       
   414                         RDebug::Print( _L( "Cae: CCaeTestSettingsClient: array is not same" ) );
       
   415                         User::Leave ( KErrArgument );
       
   416                         }
       
   417                     }
       
   418                 skippedExtensions1.Reset();
       
   419                 skippedExtensions2.Reset();
       
   420                 iStop = ETrue;
       
   421                 }
       
   422                 break;
       
   423                 
       
   424             case ESetSkippedExtensionList:
       
   425                 {
       
   426                 RCaeOrderedFeatureList skippedExtensions1;
       
   427                 RCaeOrderedFeatureList skippedExtensions2;
       
   428                 TCaeOrderedFeatureListItem item;
       
   429 
       
   430                 // call set function twice
       
   431                 iCamAppEngine->SetSkippedExtensionList( skippedExtensions1 );
       
   432                 iCamAppEngine->SetSkippedExtensionList( skippedExtensions1 );
       
   433                 
       
   434                 // read and verify
       
   435                 iCamAppEngine->SkippedExtensionListL( skippedExtensions1 );
       
   436                 if ( skippedExtensions1.Count() != 0 )
       
   437                     {
       
   438                     skippedExtensions1.Reset();
       
   439                     RDebug::Print( _L( "Cae: CCaeTestSettingsClient: get/set error" ) );
       
   440                     User::Leave ( KErrArgument );
       
   441                     }
       
   442 
       
   443                 // Add one UID
       
   444                 item.iFeatureUid = KSdIllegalUidQltyLevels;
       
   445                 skippedExtensions1.Append( item );
       
   446                 iCamAppEngine->SetSkippedExtensionList( skippedExtensions1 );
       
   447                 iCamAppEngine->SetSkippedExtensionList( skippedExtensions1 );
       
   448                 
       
   449                 // read and verify
       
   450                 skippedExtensions1.Reset();
       
   451                 iCamAppEngine->SkippedExtensionListL( skippedExtensions1 );
       
   452                 if ( skippedExtensions1.Count() != 0 )
       
   453                     {
       
   454                     skippedExtensions1.Reset();
       
   455                     RDebug::Print( _L( "Cae: CCaeTestSettingsClient: set inv. error" ) );
       
   456                     User::Leave ( KErrArgument );
       
   457                     }
       
   458 
       
   459                 // call the get function to get installed extensions
       
   460                 iCamAppEngine->GetOrderL( skippedExtensions1 );
       
   461 
       
   462                 // Add one invalid UID and set all skipped
       
   463                 item.iFeatureUid = KSdIllegalUidQltyLevels;
       
   464                 skippedExtensions1.Append( item );
       
   465                 iCamAppEngine->SetSkippedExtensionList( skippedExtensions1 );
       
   466 
       
   467                 // read and verify that both arrays are the same
       
   468                 iCamAppEngine->SkippedExtensionListL( skippedExtensions1 );
       
   469                 iCamAppEngine->GetOrderL( skippedExtensions2 );
       
   470 
       
   471                 // Check that the both arrays are the same
       
   472                 if ( skippedExtensions1.Count() != skippedExtensions2.Count() )
       
   473                     {
       
   474                     skippedExtensions1.Reset();
       
   475                     skippedExtensions2.Reset();
       
   476                     RDebug::Print( _L( "Cae: CCaeTestSettingsClient: CAE doesn't reset the array" ) );
       
   477                     User::Leave ( KErrArgument );
       
   478                     }
       
   479                 for(TInt i=0; i < skippedExtensions1.Count(); i++ )
       
   480                     {
       
   481                     if ( skippedExtensions1[i].iServiceUid != skippedExtensions2[i].iServiceUid ||
       
   482                         skippedExtensions1[i].iFeatureUid != skippedExtensions2[i].iFeatureUid )
       
   483                         {
       
   484                         skippedExtensions1.Reset();
       
   485                         skippedExtensions2.Reset();
       
   486                         RDebug::Print( _L( "Cae: CCaeTestSettingsClient: array is not same" ) );
       
   487                         User::Leave ( KErrArgument );
       
   488                         }
       
   489                     }
       
   490 
       
   491                 skippedExtensions1.Reset();
       
   492                 skippedExtensions2.Reset();
       
   493                 iStop = ETrue;
       
   494                 }
       
   495                 break;
       
   496 
       
   497             default:
       
   498                  //iVideoRecordingOn = EFalse;
       
   499                  //iCamAppEngine->StopVideoRecording();
       
   500                 break;
       
   501             }
       
   502 
       
   503         User::After( 1000000 ); // Give some time for camera drivers to settle.
       
   504         
       
   505         if ( ( iAction != ENone ) && !iStop)
       
   506             {
       
   507             iInitReady = EFalse;
       
   508             iViewFinderStarted = EFalse;
       
   509             iStillPrepareReady = EFalse;
       
   510             iVideoPrepareReady = EFalse;
       
   511             switch ( iOpMode )
       
   512                 {
       
   513                 case EClientOpModeStill:
       
   514 					switch ( iAction )
       
   515 						{
       
   516 						case ESetEvCompensationWhenInitialized:
       
   517 						case ESetEvCompensationWhenStillPrepared:
       
   518 						case ESetJpegQualityWhenStillPrepared:
       
   519 						case EProcessExtCapturedImageBurst:
       
   520 						case EProcessExtCapturedImageBurstTDesC8:
       
   521 							if ( iAction == ESetEvCompensationWhenInitialized )
       
   522 								{
       
   523 								iAction = EDefault;
       
   524 								}
       
   525 							iCamAppEngine->PrepareStillCaptureL( iStillFrameSize, 
       
   526 																 iStillDataFormat, 
       
   527 																 iStillCompressionQuality );
       
   528 							break;
       
   529 						case ESetSnapImageSizeBeforePrepare:
       
   530 							iCamAppEngine->SetSnapImageSizeL( iSnapImageSize );
       
   531 							iCamAppEngine->PrepareStillCaptureL( iStillFrameSize, 
       
   532 																 iStillDataFormat, 
       
   533 																 iStillCompressionQuality );
       
   534 							break;
       
   535 						case ESetSnapImageSizeDuringAndAfterPrepare:
       
   536 							iCamAppEngine->PrepareStillCaptureL( iStillFrameSize, 
       
   537 																 iStillDataFormat, 
       
   538 																 iStillCompressionQuality,
       
   539 																 TRect(),
       
   540 																 iSnapImageSize );
       
   541 							break;
       
   542 		    			case ESetJpegCodecWhenStillPrepared: 
       
   543                 			iCamAppEngine->SetImageCodecsL( iImageDecoderUid, iImageEncoderUid );
       
   544                 			iCamAppEngine->PrepareStillCaptureL( iStillFrameSize, 
       
   545                                                      			 iStillDataFormat, 
       
   546                                                      			 iStillCompressionQuality );
       
   547 			    			break;
       
   548 						default:
       
   549 							iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
       
   550 							break;
       
   551 						}
       
   552 			        break;
       
   553                 case EClientOpModeVideo:
       
   554                     iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
       
   555                     iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex );
       
   556 			        break;
       
   557                 default:
       
   558                     User::Leave( KErrNotSupported );
       
   559                     break;
       
   560                }
       
   561             }
       
   562         else
       
   563             {
       
   564             CTimer::After( KNormalTimingDelay );
       
   565             }
       
   566         }
       
   567     else if ( iStillPrepareReady ) 
       
   568 		{
       
   569 
       
   570         if ( iRunWithViewFinder && !iCamAppEngine->IsViewFinding() )
       
   571 	        {
       
   572             iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize );
       
   573             // User::After( 1000000 ); // Give some time for camera drivers to settle.
       
   574             }
       
   575 
       
   576         iStillPrepareReady = EFalse;
       
   577 
       
   578 	    TBool capture = EFalse;
       
   579 
       
   580         switch ( iAction )
       
   581             {
       
   582             case ESetDigiZoomWhenStillPrepared:
       
   583                 {
       
   584                 iAction = EDefault;
       
   585                 capture = ETrue;
       
   586                 iCamAppEngine->SetZoomModeL( static_cast<CCaeEngine::TZoomMode>( iZoomMode ) );
       
   587                 /*TInt zoomValue1 =*/ iCamAppEngine->ZoomValue();
       
   588 				iCamAppEngine->SetZoomValueL( iDigiZoomValue );
       
   589                 /*TInt zoomValue2 =*/ iCamAppEngine->ZoomValue();
       
   590                 }
       
   591                 break;
       
   592             case ESetBrightnessWhenStillPrepared:
       
   593                 iAction = EDefault;
       
   594                 capture = ETrue;
       
   595                 iCamAppEngine->SetBrightnessL( iBrightness );
       
   596                 break;
       
   597             case ESetContrastWhenStillPrepared:
       
   598                 iAction = EDefault;
       
   599                 capture = ETrue;
       
   600                 iCamAppEngine->SetContrastL( iContrast );
       
   601                 break;
       
   602             case ESetExposureModeWhenStillPrepared:
       
   603                 iAction = EDefault;
       
   604                 capture = ETrue;
       
   605                 iCamAppEngine->SetExposureModeL( static_cast<CCamera::TExposure>( iExposureMode ) );
       
   606                 break;
       
   607             case ESetEvCompensationWhenStillPrepared:
       
   608                 iAction = EDefault;
       
   609                 capture = ETrue;
       
   610                 iCamAppEngine->SetEvCompensationL( iEvCompensation );
       
   611                 break;
       
   612             case ESetWhiteBalanceModeWhenStillPrepared:
       
   613                 iAction = EDefault;
       
   614                 capture = ETrue;
       
   615                 iCamAppEngine->SetWhiteBalanceModeL( static_cast<CCamera::TWhiteBalance>( iWhiteBalanceMode ) );
       
   616                 break;
       
   617             case ESetFlashModeWhenStillPrepared:
       
   618                 iAction = EDefault;
       
   619                 capture = ETrue;
       
   620                 iCamAppEngine->SetFlashModeL( static_cast<CCamera::TFlash>( iFlashMode ) );
       
   621                 break;
       
   622             case ESetJpegQualityWhenStillPrepared:
       
   623                 iAction = EDefault;
       
   624                 capture = ETrue;
       
   625 // If interface after S60 2.1.
       
   626 #ifndef CAE_INTERFACE_21
       
   627                 iCamAppEngine->SetJpegQuality( iStillCompressionQuality );
       
   628 #endif
       
   629                 break;
       
   630             case EResetToDefaults:
       
   631                 iAction = EDefault;
       
   632                 capture = ETrue;
       
   633                 iCamAppEngine->ResetToDefaultsL();
       
   634                 {
       
   635                 CCaeEngine::TZoomMode zoomModeR = iCamAppEngine->ZoomMode();
       
   636                 if ( zoomModeR != CCaeEngine::EZoomModeDigital )
       
   637                     {
       
   638                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
   639                     }
       
   640                 TInt zoomValueR = iCamAppEngine->ZoomValue();
       
   641                 if ( zoomValueR != 0 )
       
   642                     {
       
   643                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
   644                     }
       
   645                 TInt brightnessR = iCamAppEngine->Brightness();
       
   646                 if ( brightnessR != 0 )
       
   647                     {
       
   648                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
   649                     }
       
   650                 TInt contrastR = iCamAppEngine->Contrast();
       
   651                 if ( contrastR != 0 )
       
   652                     {
       
   653                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
   654                     }
       
   655                 TInt exposuremodeR = iCamAppEngine->ExposureMode();
       
   656                 if ( exposuremodeR != CCamera::EExposureAuto )
       
   657                     {
       
   658                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
   659                     }
       
   660                 TInt whitebalancemodeR = iCamAppEngine->WhiteBalanceMode();
       
   661                 if ( whitebalancemodeR != CCamera::EWBAuto )
       
   662                     {
       
   663                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
   664                     }
       
   665                 TInt flashmodeR = iCamAppEngine->FlashMode();
       
   666                 if ( flashmodeR != CCamera::EFlashNone )
       
   667                     {
       
   668                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
   669                     }
       
   670                 }
       
   671                 break;
       
   672             case ESetViewFinderMirror:
       
   673                 {
       
   674                 iAction = EDefault;
       
   675                 TBool mirrorVF = iCamAppEngine->ViewFinderMirror();
       
   676                 capture = ETrue;
       
   677                 if ( !mirrorVF )
       
   678                     {
       
   679                     User::Leave( KErrGetNotEqualToValuePreviouslySet );
       
   680                     }
       
   681                 }
       
   682                 break;
       
   683             case EGetStillFrameSizeWhenPrepared:
       
   684                 // Test with invalid quality level index.
       
   685                 iCamAppEngine->GetStillFrameSize( -1, iStillFrameSizeSet );
       
   686                 iCamAppEngine->GetStillFrameSize( 666, iStillFrameSizeSet );
       
   687                 // Test with valid quality level index.
       
   688                 iCamAppEngine->GetStillFrameSize( iStillQualityLevelIndex, iStillFrameSizeSet );
       
   689                 iStop = ETrue;
       
   690                 break;
       
   691             case ESetSnapImageSizeDuringAndAfterPrepare:
       
   692 				iCamAppEngine->SetSnapImageSizeL( iSnapImageSize );
       
   693                 capture = ETrue;
       
   694                 break;
       
   695             case EEstimatedStillSizeInBytesWhenPrepared:
       
   696                 // Test with invalid quality level index.
       
   697                 iEstimatedStillSizeInBytesSet = 
       
   698                     iCamAppEngine->EstimatedStillSizeInBytes( -1 );
       
   699                 iEstimatedStillSizeInBytesSet = 
       
   700                     iCamAppEngine->EstimatedStillSizeInBytes( 666 );
       
   701                 // Test with valid quality level index.
       
   702                 iEstimatedStillSizeInBytesSet = 
       
   703                     iCamAppEngine->EstimatedStillSizeInBytes( iStillQualityLevelIndex );
       
   704                 iStop = ETrue;
       
   705                 break;
       
   706             case EPrepareAndSetStillBurstCaptureInterval:
       
   707                 {
       
   708                 iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( iStillBurstLength );
       
   709                 iCamAppEngine->SetStillBurstCaptureIntervalL( iStillBurstCaptureInterval );
       
   710                 /*TInt imgCount =*/ iCamAppEngine->StillCaptureImageCount();
       
   711                 capture = ETrue;
       
   712                 // "prepare-version" of burst mode
       
   713                 // iCamAppEngine->PrepareStillBurstL( iStillBurstLength );
       
   714                 }
       
   715                 break;
       
   716             default:
       
   717                 capture = ETrue;
       
   718                 break;
       
   719             }
       
   720 
       
   721         if ( capture )
       
   722 			{
       
   723             iStillCaptureReady = EFalse;
       
   724             iStillCapturingOn = ETrue;
       
   725             iStillCaptured = ETrue;
       
   726 	        #ifdef _DEBUG
       
   727             RDebug::Print( _L( "Cae: CCaeTestSettingsClient: calling iCamAppEngine->CaptureStill()" ) );
       
   728             #endif
       
   729             User::After( 1000000 ); // Give some time for camera drivers to settle.
       
   730 			iCamAppEngine->CaptureStill();
       
   731 			}
       
   732         else 
       
   733             {
       
   734             CTimer::After( KNormalTimingDelay );
       
   735             }
       
   736         
       
   737 		}
       
   738     else if ( iVideoPrepareReady ) 
       
   739 		{
       
   740 
       
   741         if ( iRunWithViewFinder && !iCamAppEngine->IsViewFinding() )
       
   742 	        {
       
   743             iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize );
       
   744             // User::After( 1000000 ); // Give some time for camera drivers to settle.
       
   745             }
       
   746 
       
   747 		TBool record( EFalse );
       
   748 
       
   749         iVideoPrepareReady = EFalse;
       
   750 
       
   751         switch ( iAction )
       
   752             {
       
   753             case ESetDigiZoomWhenVideoPrepared:
       
   754                 record = ETrue;
       
   755                 iCamAppEngine->SetZoomModeL( static_cast<CCaeEngine::TZoomMode>( iZoomMode ) );
       
   756                 iCamAppEngine->SetZoomValueL( iDigiZoomValue );
       
   757                 break;
       
   758             case ESetBrightnessWhenVideoPrepared:
       
   759                 record = ETrue;
       
   760                 iCamAppEngine->SetBrightnessL( iBrightness );
       
   761                 break;
       
   762             case ESetContrastWhenVideoPrepared:
       
   763                 record = ETrue;
       
   764                 iCamAppEngine->SetContrastL( iContrast );
       
   765                 break;
       
   766             case ESetExposureModeWhenVideoPrepared:
       
   767                 record = ETrue;
       
   768                 iCamAppEngine->SetExposureModeL( static_cast<CCamera::TExposure>( iExposureMode ) );
       
   769                 break;
       
   770             case ESetEvCompensationWhenVideoPrepared:
       
   771                 record = ETrue;
       
   772                 iCamAppEngine->SetEvCompensationL( iEvCompensation );
       
   773                 break;
       
   774             case ESetWhiteBalanceModeWhenVideoPrepared:
       
   775                 record = ETrue;
       
   776                 iCamAppEngine->SetWhiteBalanceModeL( static_cast<CCamera::TWhiteBalance>( iWhiteBalanceMode ) );
       
   777                 break;
       
   778             case ESetFlashModeWhenVideoPrepared:
       
   779                 record = ETrue;
       
   780                 iCamAppEngine->SetFlashModeL( static_cast<CCamera::TFlash>( iFlashMode ) );
       
   781                 break;
       
   782             case ESetVideoTimesIntervalWhenVideoPrepared:
       
   783                 record = ETrue;
       
   784                 iCamAppEngine->SetVideoTimesIntervalL( iVideoTimesInterval );
       
   785                 break;
       
   786             case ESetVideoFileNameWhenPrepared:
       
   787                 iAction = EDefault;
       
   788                 iCamAppEngine->StopViewFinder();
       
   789                 iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
       
   790 			    break;
       
   791             case ESetClipMaxSizeWhenVideoPrepared:
       
   792                 iAction = EDefault;
       
   793                 iCamAppEngine->SetVideoClipMaxSizeL( iVideoMaxClipSizeInBytes );
       
   794                 break;
       
   795             case ESetAudioWhenVideoPrepared:
       
   796                 iAction = EDefault;
       
   797                 iCamAppEngine->SetVideoAudioL( iVideoAudioEnabled );
       
   798                 break;
       
   799             case EGetVideoFrameSizeWhenPrepared:
       
   800                 iCamAppEngine->GetVideoFrameSize( iVideoQualityLevelIndex, iVideoFrameSizeSet );
       
   801                 iStop = ETrue;
       
   802                 break;
       
   803             case EVideoFrameRateWhenPrepared:
       
   804                 iVideoFrameRateSet = iCamAppEngine->VideoFrameRate( iVideoQualityLevelIndex );
       
   805                 iStop = ETrue;
       
   806                 break;
       
   807             case EEstimatedVideoRecordingBitRateWhenPrepared:
       
   808                 iEstimatedVideoBitRateSet = 
       
   809                     iCamAppEngine->EstimatedVideoRecordingBitRateL( iVideoQualityLevelIndex );
       
   810                 iStop = ETrue;
       
   811                 break;
       
   812             default:
       
   813                 // iVideoPrepareReady = EFalse;
       
   814                 record = ETrue;
       
   815                 break;
       
   816             }
       
   817         /*
       
   818         iVideoRecordingReady = EFalse;
       
   819         iVideoRecordingOn = EFalse;
       
   820         iVideoRecorded = ETrue;
       
   821 	    #ifdef _DEBUG
       
   822         RDebug::Print( _L( "Cae: CCaeTestSettingsClient: calling iCamAppEngine->StartVideoRecording()" ) );
       
   823         #endif
       
   824 		iCamAppEngine->StartVideoRecording();
       
   825         */
       
   826         if ( record )
       
   827 			{
       
   828             iVideoRecordingReady = EFalse;
       
   829             iVideoRecordingOn = EFalse;
       
   830             iVideoRecorded = ETrue;
       
   831 	        #ifdef _DEBUG
       
   832             RDebug::Print( _L( "Cae: CCaeTestSettingsClient: calling iCamAppEngine->StartVideoRecording()" ) );
       
   833             #endif
       
   834             User::After( 1000000 ); // Give some time for camera drivers to settle.
       
   835 			iCamAppEngine->StartVideoRecording();
       
   836 			}
       
   837         else if ( iAction != EDefault ) 
       
   838             {
       
   839             CTimer::After( KNormalTimingDelay );
       
   840             }
       
   841 		}
       
   842 	else if ( iSnapImageReady )
       
   843 	    {
       
   844 	    iSnapImageReady = EFalse;
       
   845 	    }
       
   846 	else if ( iStillCaptureReady )
       
   847 	    {
       
   848         // Check here if the settings were taken into use.
       
   849         // (For settings with a get-method.)
       
   850         switch ( iSavedAction )
       
   851             {
       
   852             case ESetDigiZoomWhenStillPrepared:
       
   853             case ESetDigiZoomWhenInitialized:
       
   854                 {
       
   855                 CCaeEngine::TZoomMode zoomMode = iCamAppEngine->ZoomMode();
       
   856                 if ( zoomMode != CCaeEngine::EZoomModeDigital )
       
   857                     {
       
   858                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
   859                     }
       
   860                 TInt zoomValue = iCamAppEngine->ZoomValue();
       
   861                 if ( zoomValue != iDigiZoomValue )
       
   862                     {
       
   863                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
   864                     }
       
   865                 }
       
   866                 break;
       
   867             case ESetBrightnessWhenStillPrepared:
       
   868             case ESetBrightnessWhenInitialized:
       
   869                 {
       
   870                 TInt brightness = iCamAppEngine->Brightness();
       
   871                 if ( brightness != iBrightness )
       
   872                     {
       
   873                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
   874                     }
       
   875                 }
       
   876                 break;
       
   877             case ESetContrastWhenStillPrepared:
       
   878             case ESetContrastWhenInitialized:
       
   879                 {
       
   880                 TInt contrast = iCamAppEngine->Contrast();
       
   881                 if ( contrast != iContrast )
       
   882                     {
       
   883                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
   884                     }
       
   885 
       
   886                 // Test poweroff case, contrast should be 0
       
   887                 iCamAppEngine->PowerOff();
       
   888                 contrast = iCamAppEngine->Contrast();
       
   889                 if ( contrast != 0 )
       
   890                     {
       
   891                     User::Leave ( KErrArgument );
       
   892                     }
       
   893                 }
       
   894                 break;
       
   895             case ESetExposureModeWhenStillPrepared:
       
   896             case ESetExposureModeWhenInitialized:
       
   897                 {
       
   898                 TInt exposuremode = iCamAppEngine->ExposureMode();
       
   899                 if ( exposuremode != iExposureMode )
       
   900                     {
       
   901                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
   902                     }
       
   903                 }
       
   904                 break;
       
   905             case ESetEvCompensationWhenStillPrepared:
       
   906             case ESetEvCompensationWhenInitialized:
       
   907                 {
       
   908                 TInt evCompensation = iCamAppEngine->EvCompensation();
       
   909                 if ( evCompensation != iEvCompensation )
       
   910                     {
       
   911                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
   912                     }
       
   913                 }
       
   914                 break;
       
   915             case ESetJpegQualityWhenStillPrepared:
       
   916                 {
       
   917 // If interface after S60 2.1.
       
   918 #ifndef CAE_INTERFACE_21
       
   919                 TInt jpegQuality = iCamAppEngine->JpegQuality();
       
   920                 if ( ( iStillCompressionQuality >= 1 ) && ( iStillCompressionQuality <= 100 ) )
       
   921                     {
       
   922                     if ( jpegQuality != iStillCompressionQuality )
       
   923                         {
       
   924                         User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
   925                         }
       
   926                     }
       
   927                 else
       
   928                     {
       
   929                     // Test clamping to the range 1-100.
       
   930                     if ( iStillCompressionQuality < 1 )
       
   931                         {
       
   932                         if ( jpegQuality != 1 )
       
   933                             {
       
   934                             User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
   935                             }
       
   936                         }
       
   937                     else if ( iStillCompressionQuality > 100 )
       
   938                         {
       
   939                         if ( jpegQuality != 100 )
       
   940                             {
       
   941                             User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
   942                             }
       
   943                         }
       
   944                     }
       
   945 #endif
       
   946                 }
       
   947                 break;            
       
   948             case ESetWhiteBalanceModeWhenStillPrepared:
       
   949             case ESetWhiteBalanceModeWhenInitialized:
       
   950                 {
       
   951                 TInt whitebalancemode = iCamAppEngine->WhiteBalanceMode();
       
   952                 if ( whitebalancemode != iWhiteBalanceMode )
       
   953                     {
       
   954                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
   955                     }
       
   956                 }
       
   957                 break;
       
   958             case ESetFlashModeWhenStillPrepared:
       
   959             case ESetFlashModeWhenInitialized:
       
   960                 {
       
   961                 TInt flashmode = iCamAppEngine->FlashMode();
       
   962                 if ( flashmode != iFlashMode )
       
   963                     {
       
   964                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
   965                     }
       
   966                 }
       
   967                 break;
       
   968             case EPrepareAndSetStillBurstCaptureInterval:
       
   969                 break;
       
   970             default:
       
   971                 break;
       
   972             }
       
   973 
       
   974         iStillCaptureReady = EFalse;
       
   975         
       
   976 	    // #ifdef _DEBUG
       
   977         // RDebug::Print( _L( "Cae: CCaeTestStillSettingsClient: calling iCamAppEngine->StartViewFinderBitmapsL()" ) );
       
   978         // #endif
       
   979         // iViewFindingUsed = ETrue;
       
   980         // iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize );
       
   981 
       
   982         if ( iAction == EProcessExtViewFinderFrameReady ||
       
   983             iAction == EProcessExtSnapImage ||
       
   984             iAction == EProcessExtCapturedImage ||
       
   985             iAction == EProcessExtCapturedImageTDesC8 ||
       
   986             iAction == EProcessExtCapturedImageCFbsBitmap ||
       
   987             iAction == EProcessExtCapturedImageBurst ||
       
   988             iAction == EProcessExtCapturedImageBurstTDesC8 ||
       
   989             iAction == EProcessExtCancel ||
       
   990             iAction == EProcessExtCancel2 )
       
   991             {
       
   992             if ( iAction == EProcessExtCapturedImageTDesC8 )
       
   993                 {
       
   994                 // Test also that release should not stop the extension mode operation
       
   995                 iCamAppEngine->Release();
       
   996                 }
       
   997             iCamAppEngine->SetCaeExtensionModeL( ETrue, EFalse );
       
   998             iExtensionMode = ETrue;
       
   999             CTimer::After( iTimeout );
       
  1000             }
       
  1001         else if ( iAction == EProcessExtCapturedImageNoInit )
       
  1002             {
       
  1003             // test images are captured now, delete observer1 engine and create a new
       
  1004             delete iCamAppEngine;
       
  1005             iCamAppEngine = NULL;
       
  1006             iCamAppEngine = CCaeEngine::NewL( 0 );
       
  1007             iCamAppEngine->SetCamAppEngineObserver( *this );
       
  1008             iCamAppEngine->SetCaeStillBurstObserver( *this );
       
  1009         	iCamAppEngine->GetInfo( iInfo );
       
  1010         
       
  1011             // Move cae to extension mode without initl or prepare call    
       
  1012             iCamAppEngine->SetCaeExtensionModeL( ETrue, EFalse );
       
  1013             iExtensionMode = ETrue;
       
  1014             CTimer::After( iTimeout );
       
  1015             }
       
  1016         else if ( iStillBurstLength == 1 )
       
  1017             {
       
  1018             iStop = ETrue;
       
  1019             CTimer::After( iTimeout );
       
  1020             }
       
  1021 	    }
       
  1022 
       
  1023 	else if ( iStillBurstReady )
       
  1024 	    {
       
  1025         iStillBurstReady = EFalse;
       
  1026 
       
  1027 		switch ( iAction )
       
  1028 		    {
       
  1029             case EPrepareAndSetStillBurstCaptureInterval:
       
  1030 		    default:
       
  1031                 iAction = ENone;
       
  1032                 {
       
  1033                 TTimeIntervalMicroSeconds stillburstcaptureinterval = 
       
  1034                 iCamAppEngine->StillBurstCaptureInterval();
       
  1035                 if ( stillburstcaptureinterval != iStillBurstCaptureInterval )
       
  1036                     {
       
  1037                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
  1038                     }
       
  1039 
       
  1040                 iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( 1 );
       
  1041                 if ( iImageCountToCapture != 1 )
       
  1042                     {
       
  1043                     User::Leave( KErrGeneral );
       
  1044                     }
       
  1045                 }
       
  1046                 iStop = ETrue;
       
  1047                 CTimer::After( KNormalTimingDelay );
       
  1048 			    break;	
       
  1049 		    }
       
  1050         }
       
  1051 
       
  1052 	else if ( iVideoRecordingOn )
       
  1053 	    {
       
  1054         switch ( iAction )
       
  1055             {
       
  1056             case ESetDigiZoomWhenVideoRecording:
       
  1057                 iAction = EDefault;
       
  1058                 iCamAppEngine->SetZoomModeL( static_cast<CCaeEngine::TZoomMode>( iZoomMode ) );
       
  1059                 iCamAppEngine->SetZoomValueL( iDigiZoomValue );
       
  1060                 break;
       
  1061             case ESetBrightnessWhenVideoRecording:
       
  1062                 iAction = EDefault;
       
  1063                 iCamAppEngine->SetBrightnessL( iBrightness );
       
  1064                 break;
       
  1065             case ESetContrastWhenVideoRecording:
       
  1066                 iAction = EDefault;
       
  1067                 iCamAppEngine->SetContrastL( iContrast );
       
  1068                 break;
       
  1069             case ESetExposureModeWhenVideoRecording:
       
  1070                 iAction = EDefault;
       
  1071                 iCamAppEngine->SetExposureModeL( static_cast<CCamera::TExposure>( iExposureMode ) );
       
  1072                 break;
       
  1073             case ESetEvCompensationWhenVideoRecording:
       
  1074                 iAction = EDefault;
       
  1075                 iCamAppEngine->SetEvCompensationL( iEvCompensation );
       
  1076                 break;
       
  1077             case ESetWhiteBalanceModeWhenVideoRecording:
       
  1078                 iAction = EDefault;
       
  1079                 iCamAppEngine->SetWhiteBalanceModeL( static_cast<CCamera::TWhiteBalance>( iWhiteBalanceMode ) );
       
  1080                 break;
       
  1081             case ESetFlashModeWhenVideoRecording:
       
  1082                 iAction = EDefault;
       
  1083                 iCamAppEngine->SetFlashModeL( static_cast<CCamera::TFlash>( iFlashMode ) );
       
  1084                 break;
       
  1085             case ESetVideoTimesIntervalWhenVideoRecording:
       
  1086                 iAction = EDefault;
       
  1087                 iCamAppEngine->SetVideoTimesIntervalL( iVideoTimesInterval );
       
  1088                 break;
       
  1089             case ESetClipMaxSizeWhenVideoRecording:
       
  1090                 iAction = ENone;
       
  1091                 iCamAppEngine->SetVideoClipMaxSizeL( iVideoMaxClipSizeInBytes );
       
  1092                 break;
       
  1093             case ESetAudioWhenVideoRecording:
       
  1094                 iAction = ENone;
       
  1095                 iCamAppEngine->SetVideoAudioL( iVideoAudioEnabled );
       
  1096                 break;
       
  1097             case ESetVideoFileNameWhenRecording:
       
  1098                 iAction = EDefault;
       
  1099                 iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
       
  1100                 iStop = ETrue;
       
  1101                 break;
       
  1102             case ESetVideoTimesIntervalWhenVideoPrepared:
       
  1103                 iAction = ENone;
       
  1104                 iVideoRecordingOn = EFalse;
       
  1105                 iCamAppEngine->PauseVideoRecording();
       
  1106                 break;
       
  1107 
       
  1108             default:
       
  1109                 iAction = ENone;
       
  1110                 iVideoRecordingOn = EFalse;
       
  1111                 iCamAppEngine->StopVideoRecording();
       
  1112                 break;
       
  1113             }
       
  1114             
       
  1115         if ( iAction != ENone )
       
  1116             {
       
  1117             CTimer::After( iTimeout );
       
  1118             }
       
  1119 	    }
       
  1120 	else if ( iVideoRecordingPaused )
       
  1121 	    {
       
  1122         iAction = ENone;
       
  1123         iVideoRecordingPaused = EFalse;
       
  1124         iCamAppEngine->ResumeVideoRecording();
       
  1125 	    }
       
  1126 	else if ( iVideoRecordingReady )
       
  1127 	    {
       
  1128         // Check here if the settings were taken into use.
       
  1129         // (For settings with a get-method.)
       
  1130         switch ( iSavedAction )
       
  1131             {
       
  1132             case ESetDigiZoomWhenVideoPrepared:
       
  1133             case ESetDigiZoomWhenVideoRecording:
       
  1134                 {
       
  1135                 CCaeEngine::TZoomMode zoomMode = iCamAppEngine->ZoomMode();
       
  1136                 if ( zoomMode != CCaeEngine::EZoomModeDigital )
       
  1137                     {
       
  1138                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
  1139                     }
       
  1140                 TInt zoomValue = iCamAppEngine->ZoomValue();
       
  1141                 if ( zoomValue != iDigiZoomValue )
       
  1142                     {
       
  1143                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
  1144                     }
       
  1145                 }
       
  1146                 break;
       
  1147             case ESetBrightnessWhenVideoPrepared:
       
  1148             case ESetBrightnessWhenVideoRecording:
       
  1149                 {
       
  1150                 TInt brightness = iCamAppEngine->Brightness();
       
  1151                 if ( brightness != iBrightness )
       
  1152                     {
       
  1153                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
  1154                     }
       
  1155 
       
  1156                 // Test poweroff case, brightness should be 0
       
  1157                 iCamAppEngine->PowerOff();
       
  1158                 brightness = iCamAppEngine->Brightness();
       
  1159                 if ( brightness != 0 )
       
  1160                     {
       
  1161                     User::Leave ( KErrArgument );
       
  1162                     }
       
  1163                 }
       
  1164                 break;
       
  1165             case ESetContrastWhenVideoPrepared:
       
  1166             case ESetContrastWhenVideoRecording:
       
  1167                 {
       
  1168                 TInt contrast = iCamAppEngine->Contrast();
       
  1169                 if ( contrast != iContrast )
       
  1170                     {
       
  1171                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
  1172                     }
       
  1173                 }
       
  1174                 break;
       
  1175             case ESetExposureModeWhenVideoPrepared:
       
  1176             case ESetExposureModeWhenVideoRecording:
       
  1177                 {
       
  1178                 TInt exposuremode = iCamAppEngine->ExposureMode();
       
  1179                 if ( exposuremode != iExposureMode )
       
  1180                     {
       
  1181                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
  1182                     }
       
  1183                 }
       
  1184                 break;
       
  1185             case ESetEvCompensationWhenVideoPrepared:
       
  1186             case ESetEvCompensationWhenVideoRecording:
       
  1187                 {
       
  1188                 TInt evCompensation = iCamAppEngine->EvCompensation();
       
  1189                 if ( evCompensation != iEvCompensation )
       
  1190                     {
       
  1191                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
  1192                     }
       
  1193                 }
       
  1194                 break;
       
  1195             case ESetWhiteBalanceModeWhenVideoPrepared:
       
  1196             case ESetWhiteBalanceModeWhenVideoRecording:
       
  1197                 {
       
  1198                 TInt whitebalancemode = iCamAppEngine->WhiteBalanceMode();
       
  1199                 if ( whitebalancemode != iWhiteBalanceMode )
       
  1200                     {
       
  1201                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
  1202                     }
       
  1203                 }
       
  1204                 break;
       
  1205             case ESetFlashModeWhenVideoPrepared:
       
  1206             case ESetFlashModeWhenVideoRecording:
       
  1207                 {
       
  1208                 TInt flashmode = iCamAppEngine->FlashMode();
       
  1209                 if ( flashmode != iFlashMode )
       
  1210                     {
       
  1211                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
  1212                     }
       
  1213                 }
       
  1214                 break;
       
  1215             case ESetClipMaxSizeWhenVideoNotPrepared:
       
  1216             case ESetClipMaxSizeWhenVideoPrepared:
       
  1217                 {
       
  1218                 TInt clipmaxsize = iCamAppEngine->VideoClipMaxSize();
       
  1219                 if ( iVideoMaxClipSizeInBytes >= 0 )
       
  1220                     {
       
  1221                     if ( clipmaxsize != iVideoMaxClipSizeInBytes )
       
  1222                         {
       
  1223                         User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
  1224                         }
       
  1225                     }
       
  1226                 else
       
  1227                     {
       
  1228                     if ( clipmaxsize != 0 )
       
  1229                         {
       
  1230                         User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
  1231                         }
       
  1232                     }
       
  1233                 }
       
  1234                 break;
       
  1235             case ESetAudioWhenVideoPrepared:
       
  1236                 {
       
  1237                 TBool audio = iCamAppEngine->VideoAudio();
       
  1238                 if ( audio != iVideoAudioEnabled )
       
  1239                     {
       
  1240                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
  1241                     }
       
  1242                 }
       
  1243                 break;
       
  1244             case ESetVideoTimesIntervalWhenVideoPrepared:
       
  1245                 {
       
  1246                 TTimeIntervalMicroSeconds timesinterval = 
       
  1247                     iCamAppEngine->VideoTimesInterval();
       
  1248                 if ( timesinterval != iVideoTimesInterval )
       
  1249                     {
       
  1250                     User::Leave ( KErrGetNotEqualToValuePreviouslySet );
       
  1251                     }
       
  1252                 }
       
  1253                 break;
       
  1254             default:
       
  1255                 break;
       
  1256             }
       
  1257 
       
  1258 		iAction = ENone;
       
  1259         iVideoRecordingReady = EFalse;
       
  1260         iStopViewFinder = ETrue;
       
  1261         CTimer::After( KNormalTimingDelay );
       
  1262 
       
  1263 	    }
       
  1264     else if ( !iStillCaptured && !iVideoRecorded && 
       
  1265               !iVideoRecordingOn && !iStopViewFinder ) 
       
  1266         {
       
  1267         switch ( iAction )
       
  1268 		    {
       
  1269             case EStartVfPrepareCaptureStillStartAndStopVf:
       
  1270                 if ( !iStillPrepareReady ) 
       
  1271                     {
       
  1272 	                #ifdef _DEBUG
       
  1273                     RDebug::Print( _L( "Cae: CCaeTestSettingsClient: calling iCamAppEngine->PrepareStillCaptureL()" ) );
       
  1274                     #endif
       
  1275                     iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
       
  1276                     }
       
  1277                 break;
       
  1278             case EStartVfPrepareRecordVideoStartAndStopVf:
       
  1279                 if ( !iVideoPrepareReady ) 
       
  1280                     {
       
  1281 	                #ifdef _DEBUG
       
  1282                     RDebug::Print( _L( "Cae: CCaeTestSettingsClient: calling iCamAppEngine->PrepareVideoRecordingL()" ) );
       
  1283                     #endif
       
  1284                     iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex );
       
  1285                     }
       
  1286                 break;
       
  1287             case ESwitchPowerOffWhenVfRunning:
       
  1288                 iCamAppEngine->PowerOff();
       
  1289                 iStopViewFinder = ETrue;
       
  1290                 CTimer::After( KNormalTimingDelay );
       
  1291                 break;
       
  1292             default:
       
  1293 			    break;
       
  1294 		    }
       
  1295         }
       
  1296 	else if ( iStopViewFinder ) 
       
  1297         {
       
  1298 	    #ifdef _DEBUG
       
  1299         RDebug::Print( _L( "Cae: CCaeTestSettingsClient: calling iCamAppEngine->StopViewFinder()" ) );
       
  1300         #endif
       
  1301         iCamAppEngine->StopViewFinder();
       
  1302         iViewFinderStarted = EFalse;
       
  1303         iStop = ETrue;
       
  1304         CTimer::After( KNormalTimingDelay );
       
  1305         }
       
  1306 	else if ( iExtensionMode ) 
       
  1307         {
       
  1308         switch ( iAction )
       
  1309 		    {
       
  1310             case EProcessExtViewFinderFrameReady:
       
  1311             if ( !iBitmapSendDone && iBitmapSave )
       
  1312                 {
       
  1313                 // send the original bitmap to ext handling
       
  1314                 // before sending the iBitmapSave bust be cleared because callback
       
  1315                 // writes the handled bitmap back there
       
  1316                 iBitmapSendDone = ETrue;
       
  1317                 CFbsBitmap* tempBitmap = iBitmapSave;
       
  1318                 iBitmapSave = NULL;
       
  1319                 iCamAppEngine->ProcessExtViewFinderFrameReadyL( *tempBitmap );
       
  1320                 // delete tempBitmap;
       
  1321                 delete tempBitmap;
       
  1322                 tempBitmap = NULL;
       
  1323                 }
       
  1324             else if ( iBitmapSendDone )
       
  1325                 {
       
  1326                 // check that there is new handled bitmap
       
  1327                 if ( !iBitmapSave )
       
  1328                     {
       
  1329             	    #ifdef _DEBUG
       
  1330                     RDebug::Print( _L( "Cae: CCaeTestSettingsClient: iBitmapSave not found after ProcessExtViewFinderFrameReadyL" ) );
       
  1331                     #endif
       
  1332                     User::Leave ( KErrNotFound );
       
  1333                     }
       
  1334                 // all ok, set iAction to default to stop new VF frame copy and delete
       
  1335                 // bitmap, return to normal mode and stop test case
       
  1336                 iAction = EDefault;
       
  1337                 delete iBitmapSave;
       
  1338                 iBitmapSave = NULL;
       
  1339                 iCamAppEngine->SetCaeExtensionModeL( EFalse, ETrue );
       
  1340                 iExtensionMode = EFalse;
       
  1341                 iBitmapSendDone = EFalse;
       
  1342                 iStop = ETrue;
       
  1343                 }
       
  1344 
       
  1345                 CTimer::After( KLongTimingDelay );
       
  1346                 break;
       
  1347                 
       
  1348             case EProcessExtSnapImage:
       
  1349             if ( !iBitmapSendDone && iBitmapSave )
       
  1350                 {
       
  1351                 // send the original snap bitmap to ext handling
       
  1352                 // before sending the iBitmapSave bust be cleared because callback
       
  1353                 // writes the handled bitmap back there
       
  1354                 iBitmapSendDone = ETrue;
       
  1355                 CFbsBitmap* tempBitmap = iBitmapSave;
       
  1356                 iBitmapSave = NULL;
       
  1357                 iCamAppEngine->ProcessExtSnapImageL( *tempBitmap );
       
  1358                 // delete tempBitmap;
       
  1359                 delete tempBitmap;
       
  1360                 tempBitmap = NULL;
       
  1361                 }
       
  1362             else if ( iBitmapSendDone )
       
  1363                 {
       
  1364                 // check that there is new handled bitmap
       
  1365                 if ( !iBitmapSave )
       
  1366                     {
       
  1367             	    #ifdef _DEBUG
       
  1368                     RDebug::Print( _L( "Cae: CCaeTestSettingsClient: iBitmapSave not found after EProcessExtSnapImage" ) );
       
  1369                     #endif
       
  1370                     User::Leave ( KErrNotFound );
       
  1371                     }
       
  1372                 // all ok, set iAction to default to stop new VF frame copy and delete
       
  1373                 // bitmap, return to normal mode and stop test case
       
  1374                 iAction = EDefault;
       
  1375                 delete iBitmapSave;
       
  1376                 iBitmapSave = NULL;
       
  1377                 iCamAppEngine->SetCaeExtensionModeL( EFalse, ETrue );
       
  1378                 iExtensionMode = EFalse;
       
  1379                 iBitmapSendDone = EFalse;
       
  1380                 iStop = ETrue;
       
  1381                 CTimer::After( KLongTimingDelay );
       
  1382                 }
       
  1383                 break;
       
  1384                 
       
  1385             case EProcessExtCapturedImage:
       
  1386             case EProcessExtCapturedImageTDesC8:
       
  1387 		    case EProcessExtCapturedImageCFbsBitmap:
       
  1388             case EProcessExtCapturedImageNoInit:
       
  1389             if ( !iBitmapSendDone && iDataSave )
       
  1390                 {
       
  1391                 // send the original image to ext handling
       
  1392                 // before sending the iDataSave must be cleared because callback
       
  1393                 // writes the handled bitmap back there
       
  1394                 // Note that iBitmapSendDone flag is used even though this there is no bitmap involved
       
  1395                 iBitmapSendDone = ETrue;
       
  1396                 HBufC8* tempData = iDataSave;
       
  1397                 CleanupStack::PushL( tempData );
       
  1398                 iDataSave = NULL;
       
  1399                 if ( iAction == EProcessExtCapturedImage || iAction == EProcessExtCapturedImageNoInit)
       
  1400                     {
       
  1401                     // Test interface with HBufC8, CAE takes ownership of data
       
  1402                     iCamAppEngine->ProcessExtCapturedImageL( tempData, EFalse );
       
  1403                     }
       
  1404                 else if ( iAction == EProcessExtCapturedImageTDesC8 )
       
  1405                     {
       
  1406                     // Test interface with TDesC8
       
  1407                     // Create new pointer
       
  1408                     TDesC8* tempDataDes = tempData;
       
  1409                     tempData = NULL;
       
  1410                     iCamAppEngine->ProcessExtCapturedImageL( *tempDataDes, EFalse );
       
  1411                     delete tempDataDes; // CAE makes own copy of this type
       
  1412                     tempDataDes = NULL;
       
  1413                     }
       
  1414                 else if ( iAction == EProcessExtCapturedImageCFbsBitmap )
       
  1415                     {
       
  1416                     // Test interface with CFbsBitmap
       
  1417                     // Create new pointer
       
  1418 
       
  1419                     CFbsBitmap* tempBitmap = iBitmapSave;
       
  1420                     CleanupStack::PushL( tempBitmap );
       
  1421                     iBitmapSave = NULL;
       
  1422                     delete tempData; // not used in this test case
       
  1423                     tempData = NULL;
       
  1424                     // CAE makes own copy of bitmap data (duplicate)
       
  1425                     iCamAppEngine->ProcessExtCapturedImageL( *tempBitmap, EFalse );
       
  1426                     CleanupStack::PopAndDestroy( tempBitmap );
       
  1427                     }
       
  1428                 CleanupStack::Pop( /*tempData*/ );
       
  1429                 }
       
  1430             else if ( iBitmapSendDone )
       
  1431                 {
       
  1432                 // check that there is new handled image
       
  1433                 if ( !iDataSave )
       
  1434                     {
       
  1435             	    #ifdef _DEBUG
       
  1436                     RDebug::Print( _L( "Cae: CCaeTestSettingsClient: iDataSave not found after EProcessExtCapturedImage" ) );
       
  1437                     #endif
       
  1438                     User::Leave ( KErrNotFound );
       
  1439                     }
       
  1440                 // all ok, set iAction to default to stop new VF frame copy and delete
       
  1441                 // image data, return to normal mode and stop test case
       
  1442                 iAction = EDefault;
       
  1443                 delete iDataSave;
       
  1444                 iDataSave = NULL;
       
  1445                 iCamAppEngine->SetCaeExtensionModeL( EFalse, ETrue );
       
  1446                 iExtensionMode = EFalse;
       
  1447                 iBitmapSendDone = EFalse;
       
  1448                 iStop = ETrue;
       
  1449                 CTimer::After( KLongTimingDelay );
       
  1450                 }
       
  1451                 break;
       
  1452                 
       
  1453             case EProcessExtCancel:
       
  1454                 iCamAppEngine->ProcessExtCancel();
       
  1455                 iAction = EDefault;
       
  1456                 iCamAppEngine->SetCaeExtensionModeL( EFalse, ETrue );
       
  1457                 iExtensionMode = EFalse;
       
  1458                 iBitmapSendDone = EFalse;
       
  1459                 iStop = ETrue;
       
  1460                 CTimer::After( KLongTimingDelay );
       
  1461                 break;
       
  1462             case EProcessExtCancel2:
       
  1463 
       
  1464                 if ( iDataSave )
       
  1465                     {
       
  1466                     // send the original image to ext handling
       
  1467                     iBitmapSendDone = ETrue;
       
  1468                     HBufC8* tempData = iDataSave;
       
  1469                     iDataSave = NULL;
       
  1470                     // Test interface with TDesC8
       
  1471                     TDesC8* tempDataDes = tempData;
       
  1472                     tempData = NULL;
       
  1473                     iCamAppEngine->ProcessExtCapturedImageL( *tempDataDes, EFalse );
       
  1474                     delete tempDataDes; // CAE makes own copy of this type
       
  1475                     tempDataDes = NULL;
       
  1476                     }
       
  1477                 else
       
  1478                     {
       
  1479             	    #ifdef _DEBUG
       
  1480                     RDebug::Print( _L( "Cae: CCaeTestSettingsClient: iDataSave not found after EProcessExtCancel2" ) );
       
  1481                     #endif
       
  1482                     User::Leave ( KErrNotFound );
       
  1483                     }
       
  1484                 
       
  1485                 // Cancel image processing
       
  1486                 iCamAppEngine->ProcessExtCancel();
       
  1487                 
       
  1488                 // return back to normal mode
       
  1489                 iAction = EDefault;
       
  1490                 delete iDataSave;
       
  1491                 iDataSave = NULL;
       
  1492                 iCamAppEngine->SetCaeExtensionModeL( EFalse, ETrue );
       
  1493                 iExtensionMode = EFalse;
       
  1494                 iBitmapSendDone = EFalse;
       
  1495                 iStop = ETrue;
       
  1496                 
       
  1497                 // start timer as all activities are stopped
       
  1498                 CTimer::After( KNormalTimingDelay );
       
  1499                 break;
       
  1500 
       
  1501             case EProcessExtCapturedImageBurst:
       
  1502             case EProcessExtCapturedImageBurstTDesC8:
       
  1503             if ( !iBitmapSendDone && iDataSave && iBitmapSave )
       
  1504                 {
       
  1505                 // send the original snap bitmap and image to ext handling
       
  1506                 // before sending the iBitmapSave and iDataSave must be cleared because callback
       
  1507                 // writes the handled bitmap back there
       
  1508 
       
  1509                 iBitmapSendDone = ETrue;
       
  1510                 CFbsBitmap* tempBitmap = iBitmapSave;
       
  1511                 iBitmapSave = NULL;
       
  1512                 HBufC8* tempData = iDataSave;
       
  1513                 iDataSave = NULL;
       
  1514               
       
  1515                 // Change CAE state to burst mode
       
  1516                 iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( iStillBurstLength );
       
  1517                 iCountSnapImageReady = 0;  // Reset image counters
       
  1518                 iCountStillImageReady = 0;
       
  1519                 
       
  1520                 // Send all burst snapimages and main images at once
       
  1521 
       
  1522                 for ( TInt i=0; i < iStillBurstLength; i++ )              
       
  1523                     {
       
  1524                     // Send bitmap
       
  1525                     iCamAppEngine->ProcessExtSnapImageL( *tempBitmap );
       
  1526                    
       
  1527                     // Copy main image
       
  1528                     HBufC8* msg =  HBufC8::NewL( tempData->Size());
       
  1529                     *msg = *tempData;
       
  1530 
       
  1531                     // Send main image copy
       
  1532                     if ( iAction == EProcessExtCapturedImageBurst )
       
  1533                         {
       
  1534                         // Test interface with HBufC8
       
  1535                         iCamAppEngine->ProcessExtCapturedImageL( msg, i >= (iStillBurstLength - 1) );
       
  1536                         }
       
  1537                   else
       
  1538                         {
       
  1539                         // Test interface with TDesC8
       
  1540                         // Create new pointer
       
  1541                         TDesC8* tempDataDes = msg;
       
  1542                         msg = NULL;
       
  1543                         iCamAppEngine->ProcessExtCapturedImageL( *tempDataDes, i >= (iStillBurstLength - 1) );
       
  1544                         delete tempDataDes; // CAE makes own copy of this type
       
  1545                         tempDataDes = NULL;
       
  1546                         }
       
  1547                     }
       
  1548 
       
  1549                 delete tempBitmap;
       
  1550                 tempBitmap = NULL;
       
  1551                 delete tempData;
       
  1552                 tempData = NULL;
       
  1553                 }
       
  1554             else if ( iBitmapSendDone )
       
  1555                 {
       
  1556                 // check that there is at least one new handled image (snap + main)
       
  1557                 //
       
  1558                 if ( !iBitmapSave )
       
  1559                     {
       
  1560             	    #ifdef _DEBUG
       
  1561                     RDebug::Print( _L( "Cae: CCaeTestSettingsClient: iBitmapSave not found after EProcessExtCapturedImageBurst" ) );
       
  1562                     #endif
       
  1563                     User::Leave ( KErrNotFound );
       
  1564                     }
       
  1565                 if ( !iDataSave )
       
  1566                     {
       
  1567             	    #ifdef _DEBUG
       
  1568                     RDebug::Print( _L( "Cae: CCaeTestSettingsClient: iDataSave not found after EProcessExtCapturedImageBurst" ) );
       
  1569                     #endif
       
  1570                     User::Leave ( KErrNotFound );
       
  1571                     }
       
  1572                 // all ok, set iAction to default to stop new VF frame copy and delete
       
  1573                 // image data, return to normal mode and stop test case
       
  1574                 iAction = EDefault;
       
  1575                 delete iBitmapSave;
       
  1576                 iBitmapSave = NULL;
       
  1577                 delete iDataSave;
       
  1578                 iDataSave = NULL;
       
  1579                 iCamAppEngine->SetCaeExtensionModeL( EFalse, ETrue );
       
  1580                 iExtensionMode = EFalse;
       
  1581                 iBitmapSendDone = EFalse;
       
  1582                 iStop = ETrue;
       
  1583                 CTimer::After( KLongTimingDelay );
       
  1584                 }
       
  1585                 break;
       
  1586 
       
  1587             default:
       
  1588                 break;
       
  1589 		    }
       
  1590 
       
  1591         }
       
  1592 	#ifdef _DEBUG
       
  1593     RDebug::Print( _L( "Cae: CCaeTestSettingsClient::RunTrappedL() returning" ) );
       
  1594     #endif
       
  1595     }
       
  1596 
       
  1597