Revert incorrect RCL_3 drop: RCL_3 PDK_3.0.2
authorPat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:23:23 +0100
branchRCL_3
changeset 21 27fe719c32e6
parent 20 e3cdd00b5ae3
child 22 e4343b9ec2cf
Revert incorrect RCL_3 drop: Revision: 201031 Kit: 201035
camappengine/Build/bld.inf
camappengine/Engine/Bmarm/CAEENGINEU.DEF
camappengine/Engine/Bwins/CAEENGINEU.DEF
camappengine/Engine/Bwinscw/CAEENGINEU.DEF
camappengine/Engine/Eabi/CaeEngineU.DEF
camappengine/Engine/Group/CaeEngine.mmp
camappengine/Engine/Group/CaeEngineTestVersion.mmp
camappengine/Engine/Group/bld.inf
camappengine/Engine/Inc/CaeCallbackActive.h
camappengine/Engine/Inc/CaeCommon.h
camappengine/Engine/Inc/CaeDbgUtilities.h
camappengine/Engine/Inc/CaeEngineImp.h
camappengine/Engine/Inc/CaeEngineImpTestErrors.h
camappengine/Engine/Inc/CaeImageItem.h
camappengine/Engine/Inc/CaeImageItemExtPro.h
camappengine/Engine/Inc/CaeImageQueueExtPro.h
camappengine/Engine/Inc/CaeQualityLevels.h
camappengine/Engine/Inc/CaeSdKeys.h
camappengine/Engine/Inc/CaeStillBurst.h
camappengine/Engine/Inc/CaeStillQualityLevels.h
camappengine/Engine/Inc/CaeStillStatesActive.h
camappengine/Engine/Inc/CaeVideoQualityLevels.h
camappengine/Engine/Inc/CaeVideoTimes.h
camappengine/Engine/Src/CaeCallbackActive.cpp
camappengine/Engine/Src/CaeDbgUtilities.cpp
camappengine/Engine/Src/CaeEngineImpInfo.cpp
camappengine/Engine/Src/CaeEngineImpStillAndVf.cpp
camappengine/Engine/Src/CaeEngineImpTestErrors.cpp
camappengine/Engine/Src/CaeEngineImpVideoName.cpp
camappengine/Engine/Src/CaeEngineImpVideoNameCustom.cpp
camappengine/Engine/Src/CaeEngineImpVideoRecording.cpp
camappengine/Engine/Src/CaeExtension.cpp
camappengine/Engine/Src/CaeImageItem.cpp
camappengine/Engine/Src/CaeImageItemExtPro.cpp
camappengine/Engine/Src/CaeImageQueueExtPro.cpp
camappengine/Engine/Src/CaeQualityLevels.cpp
camappengine/Engine/Src/CaeQualityLevelsNoSd.cpp
camappengine/Engine/Src/CaeStillBurst.cpp
camappengine/Engine/Src/CaeStillQualityLevels.cpp
camappengine/Engine/Src/CaeStillQualityLevelsNoSd.cpp
camappengine/Engine/Src/CaeStillStatesActive.cpp
camappengine/Engine/Src/CaeStillStatesActiveBurst.cpp
camappengine/Engine/Src/CaeStillStatesActiveNoBurst.cpp
camappengine/Engine/Src/CaeVideoQualityLevels.cpp
camappengine/Engine/Src/CaeVideoQualityLevelsNoSd.cpp
camappengine/Engine/Src/CaeVideoTimes.cpp
camappengine/Engine/traces/CamAppEngineTraceDefinitions.h
camappengine/Engine/traces/OstTraceDefinitions.h
camappengine/StillConverter/Bmarm/CAESTILLCONVERTERU.DEF
camappengine/StillConverter/Bwins/CAESTILLCONVERTERU.DEF
camappengine/StillConverter/Bwinscw/CAESTILLCONVERTERU.DEF
camappengine/StillConverter/Eabi/CaeStillConverterU.DEF
camappengine/StillConverter/Group/CaeStillConverter.mmp
camappengine/StillConverter/Group/CaeStillConverterTestVersion.mmp
camappengine/StillConverter/Group/bld.inf
camappengine/StillConverter/Inc/CaeStillCommon.h
camappengine/StillConverter/Inc/CaeStillConverter.h
camappengine/StillConverter/Inc/CaeStillConverterTestErrors.h
camappengine/StillConverter/Inc/CaeStillDecoder.h
camappengine/StillConverter/Inc/CaeStillEncoder.h
camappengine/StillConverter/Src/CaeStillConverter.cpp
camappengine/StillConverter/Src/CaeStillConverterTestErrors.cpp
camappengine/StillConverter/Src/CaeStillDecoder.cpp
camappengine/StillConverter/Src/CaeStillEncoder.cpp
camappengine/asynchfilesavequeue/bwinscw/AsynchFSQu.def
camappengine/asynchfilesavequeue/eabi/AsynchFSQu.def
camappengine/asynchfilesavequeue/group/asynchfsq.mmp
camappengine/asynchfilesavequeue/group/bld.inf
camappengine/asynchfilesavequeue/inc/asynchatom.h
camappengine/asynchfilesavequeue/src/asynchatom.cpp
camappengine/asynchfilesavequeue/src/asynchfsq.cpp
camappengine/asynchfilesavequeue/tsrc/public/basic/Bwinscw/STIFAFSQTestu.def
camappengine/asynchfilesavequeue/tsrc/public/basic/Eabi/STIFAFSQTestu.def
camappengine/asynchfilesavequeue/tsrc/public/basic/data/StifAFSQTest/Nibbles.jpg
camappengine/asynchfilesavequeue/tsrc/public/basic/data/StifAFSQTest/Nibbles2.jpg
camappengine/asynchfilesavequeue/tsrc/public/basic/data/StifAFSQTest/Nibbles3.jpg
camappengine/asynchfilesavequeue/tsrc/public/basic/group/StifAFSQTest.mmp
camappengine/asynchfilesavequeue/tsrc/public/basic/group/bld.inf
camappengine/asynchfilesavequeue/tsrc/public/basic/group/testcollector.mk
camappengine/asynchfilesavequeue/tsrc/public/basic/inc/AFSQTestAsynchSave.h
camappengine/asynchfilesavequeue/tsrc/public/basic/inc/AFSQTestTop.h
camappengine/asynchfilesavequeue/tsrc/public/basic/inc/STIFAFSQTest.h
camappengine/asynchfilesavequeue/tsrc/public/basic/inc/StifFSQTestTop.h
camappengine/asynchfilesavequeue/tsrc/public/basic/inc/TestFramework/AssertFailure.h
camappengine/asynchfilesavequeue/tsrc/public/basic/inc/TestFramework/TestResult.h
camappengine/asynchfilesavequeue/tsrc/public/basic/inc/TestFramework/test.h
camappengine/asynchfilesavequeue/tsrc/public/basic/inc/TestFramework/testCaller.h
camappengine/asynchfilesavequeue/tsrc/public/basic/inc/TestFramework/testCase.h
camappengine/asynchfilesavequeue/tsrc/public/basic/inc/TestFramework/testSuite.h
camappengine/asynchfilesavequeue/tsrc/public/basic/sis/STIFAFSQTest.pkg
camappengine/asynchfilesavequeue/tsrc/public/basic/src/AFSQTestAdd.cpp
camappengine/asynchfilesavequeue/tsrc/public/basic/src/AFSQTestAsynchSave.cpp
camappengine/asynchfilesavequeue/tsrc/public/basic/src/AFSQTestDelete.cpp
camappengine/asynchfilesavequeue/tsrc/public/basic/src/AFSQTestRename.cpp
camappengine/asynchfilesavequeue/tsrc/public/basic/src/STIFAFSQTestBlocks.cpp
camappengine/asynchfilesavequeue/tsrc/public/basic/src/StifFSQTestTop.cpp
camappengine/asynchfilesavequeue/tsrc/public/basic/src/TestFramework/AssertFailure.cpp
camappengine/asynchfilesavequeue/tsrc/public/basic/src/TestFramework/TestSuite.cpp
camappengine/asynchfilesavequeue/tsrc/public/basic/src/TestFramework/testCase.cpp
camappengine/rom/CamAppEngine.iby
camappengine/rom/CamAppEngineStub.SIS
camappengine/rom/CamAppEngineStub.pkg
camcordermmfplugin/mediarecorder/Src/CCMRAudioInput.cpp
camerasrv_plat/asynchronous_file_saving_queue_api/asynchronous_file_saving_queue_api.metaxml
camerasrv_plat/asynchronous_file_saving_queue_api/group/bld.inf
camerasrv_plat/asynchronous_file_saving_queue_api/inc/asynchfsq.h
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/Bwinscw/STIFAFSQTestu.def
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/Eabi/STIFAFSQTestu.def
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/data/mmc/StifAFSQTest/Nibbles.jpg
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/data/mmc/StifAFSQTest/Nibbles2.jpg
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/data/mmc/StifAFSQTest/Nibbles3.jpg
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/group/StifAFSQTest.mmp
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/group/StifAFSQTest.pkg
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/group/bld.inf
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/AFSQTestAsynchSave.h
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/AFSQTestTop.h
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/STIFAFSQTest.h
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/StifFSQTestTop.h
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/TestFramework/AssertFailure.h
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/TestFramework/TestResult.h
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/TestFramework/test.h
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/TestFramework/testCaller.h
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/TestFramework/testCase.h
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/TestFramework/testSuite.h
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/AFSQTestAdd.cpp
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/AFSQTestAsynchSave.cpp
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/AFSQTestDelete.cpp
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/AFSQTestRename.cpp
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/STIFAFSQTestBlocks.cpp
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/StifFSQTestTop.cpp
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/TestFramework/AssertFailure.cpp
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/TestFramework/TestSuite.cpp
camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/TestFramework/testCase.cpp
camerasrv_plat/cae_extentension_api/cae_extentension_api.metaxml
camerasrv_plat/cae_extentension_api/group/bld.inf
camerasrv_plat/cae_extentension_api/inc/CaeEngineExtInterface.h
camerasrv_plat/cae_extentension_api/inc/CaeEngineExtInterface.hrh
camerasrv_plat/camera_application_engine_api/camera_application_engine_api.metaxml
camerasrv_plat/camera_application_engine_api/group/bld.inf
camerasrv_plat/camera_application_engine_api/inc/CaeEngine.h
camerasrv_plat/camera_application_engine_api/tsrc/EABI/STIFCaeTestU.DEF
camerasrv_plat/camera_application_engine_api/tsrc/group/StifCaeTest.mmp
camerasrv_plat/camera_application_engine_api/tsrc/group/StifCaeTest.pkg
camerasrv_plat/camera_application_engine_api/tsrc/group/bld.inf
camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestClient.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestRelease.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestSettingsClient.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestStatesClient.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestStillSettings.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestStillStates.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestTop.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestVariation.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestVideoSettings.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestVideoStates.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/StifCaeTestTop.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/TestFrameWork/AssertFailure.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/TestFrameWork/TestResult.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/TestFrameWork/test.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/TestFrameWork/testCaller.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/TestFrameWork/testCase.h
camerasrv_plat/camera_application_engine_api/tsrc/inc/TestFrameWork/testSuite.h
camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestClient.cpp
camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestRelease.cpp
camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestSettingsClient.cpp
camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestStatesClient.cpp
camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestStillSettings.cpp
camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestStillStates.cpp
camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestTop.cpp
camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestVideoSettings.cpp
camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestVideoStates.cpp
camerasrv_plat/camera_application_engine_api/tsrc/src/StifCaeTestTop.cpp
camerasrv_plat/camera_application_engine_api/tsrc/src/TestFrameWork/AssertFailure.cpp
camerasrv_plat/camera_application_engine_api/tsrc/src/TestFrameWork/TestCase.cpp
camerasrv_plat/camera_application_engine_api/tsrc/src/TestFrameWork/TestSuite.cpp
camerasrv_plat/group/bld.inf
group/bld.inf
layers.sysdef.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Build/bld.inf	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Common build information file to build all CamAppEngine subsystems
+*
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+#include "../asynchfilesavequeue/group/bld.inf"
+
+
+PRJ_PLATFORMS
+
+DEFAULT
+
+
+
+// Exported headers
+
+
+PRJ_EXPORTS
+
+../rom/CamAppEngineStub.SIS /epoc32/data/z/system/install/CamAppEngineStub.sis
+
+../rom/CamAppEngine.iby CORE_MW_LAYER_IBY_EXPORT_PATH(CamAppEngine.iby)
+
+// ROM build files
+
+
+
+PRJ_MMPFILES
+
+../StillConverter/Group/CaeStillConverter.mmp
+
+../Engine/Group/CaeEngine.mmp
+
+
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Bmarm/CAEENGINEU.DEF	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,6 @@
+EXPORTS
+	NewL__10CCaeEngine @ 1 NONAME R3UNUSED ; CCaeEngine::NewL(void)
+	NewL__10CCaeEnginei @ 2 NONAME R3UNUSED ; CCaeEngine::NewL(int)
+	CamerasAvailable__10CCaeEngine @ 3 NONAME R3UNUSED ; CCaeEngine::CamerasAvailable(void)
+	NewL__10CCaeEngineii @ 4 NONAME R3UNUSED ; CCaeEngine::NewL(int, int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Bwins/CAEENGINEU.DEF	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,6 @@
+EXPORTS
+	?NewL@CCaeEngine@@SAPAV1@XZ @ 1 NONAME ; public: static class CCaeEngine * __cdecl CCaeEngine::NewL(void)
+	?NewL@CCaeEngine@@SAPAV1@H@Z @ 2 NONAME ; public: static class CCaeEngine * __cdecl CCaeEngine::NewL(int)
+	?CamerasAvailable@CCaeEngine@@SAHXZ @ 3 NONAME ; public: static int __cdecl CCaeEngine::CamerasAvailable(void)
+	?NewL@CCaeEngine@@SAPAV1@HH@Z @ 4 NONAME ; public: static class CCaeEngine * __cdecl CCaeEngine::NewL(int,int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Bwinscw/CAEENGINEU.DEF	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,6 @@
+EXPORTS
+	?NewL@CCaeEngine@@SAPAV1@XZ @ 1 NONAME ; class CCaeEngine * CCaeEngine::NewL(void)
+	?NewL@CCaeEngine@@SAPAV1@H@Z @ 2 NONAME ; class CCaeEngine * CCaeEngine::NewL(int)
+	?CamerasAvailable@CCaeEngine@@SAHXZ @ 3 NONAME ; int CCaeEngine::CamerasAvailable(void)
+	?NewL@CCaeEngine@@SAPAV1@HH@Z @ 4 NONAME ; class CCaeEngine * CCaeEngine::NewL(int, int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Eabi/CaeEngineU.DEF	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,6 @@
+EXPORTS
+	_ZN10CCaeEngine16CamerasAvailableEv @ 1 NONAME
+	_ZN10CCaeEngine4NewLEi @ 2 NONAME
+	_ZN10CCaeEngine4NewLEii @ 3 NONAME
+	_ZN10CCaeEngine4NewLEv @ 4 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Group/CaeEngine.mmp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET      CaeEngine.dll
+TARGETTYPE  dll
+
+UID         0x1000008d 0x101F8569
+
+CAPABILITY  CAP_GENERAL_DLL
+VENDORID    VID_DEFAULT
+
+// Define directories for the .def-files of WINS and WINSCW builds separately.
+// IMPORTANT NOTICE:  The lines in the example that end with a backslash 
+// must have one space after the backslash.
+#if defined(ARMCC)
+deffile ../Eabi/ 
+#elif defined( WINSCW )
+deffile ../Bwinscw/ 
+#elif defined( WINS )
+deffile ../Bwins/ 
+#else
+deffile ../Bmarm/ 
+#endif
+
+SOURCEPATH  ../Src
+
+SOURCE      CaeEngineImpStillAndVf.cpp
+SOURCE      CaeEngineImpVideoRecording.cpp
+SOURCE      CaeEngineImpInfo.cpp
+SOURCE      CaeQualityLevels.cpp
+SOURCE      CaeStillQualityLevels.cpp
+SOURCE      CaeVideoQualityLevels.cpp
+SOURCE      CaeVideoTimes.cpp
+SOURCE      CaeCallbackActive.cpp
+SOURCE      CaeStillStatesActive.cpp
+SOURCE      CaeExtension.cpp
+
+// Possible definition in features.hrh
+#ifdef __CAE_VR_CUSTOM_COMMANDS
+SOURCE      CaeEngineImpVideoNameCustom.cpp
+#else
+SOURCE      CaeEngineImpVideoName.cpp
+#endif
+
+// Can be removed from here when available in platform.
+// #define     __CAMERA_BURST_MODE
+// #undef      __CAMERA_BURST_MODE
+
+#ifdef __CAMERA_BURST_MODE
+SOURCE      CaeImageItem.cpp
+SOURCE      CaeStillBurst.cpp
+SOURCE      CaeStillStatesActiveBurst.cpp
+#else
+SOURCE      CaeStillStatesActiveNoBurst.cpp
+#endif
+
+SOURCE      CaeImageItemExtPro.cpp
+SOURCE      CaeImageQueueExtPro.cpp
+
+SOURCE      CaeQualityLevelsNoSd.cpp
+SOURCE      CaeStillQualityLevelsNoSd.cpp
+SOURCE      CaeVideoQualityLevelsNoSd.cpp
+
+SOURCE      CaeDbgUtilities.cpp
+
+USERINCLUDE     ../Inc
+USERINCLUDE     ../../StillConverter/Inc
+USERINCLUDE     ../../../inc       // MW level inc dir
+USERINCLUDE     ../traces
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY     euser.lib
+LIBRARY     fbscli.lib
+LIBRARY		hal.lib
+LIBRARY     ECom.lib
+LIBRARY     ECAM.lib
+LIBRARY     MMFControllerFramework.lib
+LIBRARY     mediaclientvideo.lib
+LIBRARY     CaeStillConverter.lib
+LIBRARY     ExifLib.lib
+LIBRARY     efsrv.lib
+LIBRARY     imageconversion.lib
+
+// LIBRARY flogger.lib // Enable if USE_FILE_LOGGER is defined
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Group/CaeEngineTestVersion.mmp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine (TEST VERSION!)
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET      CaeEngine.dll
+TARGETTYPE  dll
+
+UID         0x1000008d 0x101F8569
+
+CAPABILITY  CAP_GENERAL_DLL
+VENDORID    VID_DEFAULT
+
+
+// Define directories for the .def-files of WINS and WINSCW builds separately.
+// IMPORTANT NOTICE:  The lines in the example that end with a backslash 
+// must have one space after the backslash.
+#if defined(ARMCC)
+deffile ../Eabi/ 
+#elif defined( WINSCW )
+deffile ../Bwinscw/ 
+#elif defined( WINS )
+deffile ../Bwins/ 
+#else
+deffile ../Bmarm/ 
+#endif
+
+// To compile error simulations in.
+MACRO       CAE_TEST_VERSION 
+#define     CAE_TEST_VERSION
+
+SOURCEPATH  ../Src       
+
+SOURCE      CaeEngineImpStillAndVf.cpp
+SOURCE      CaeEngineImpVideoRecording.cpp
+SOURCE      CaeEngineImpInfo.cpp
+SOURCE      CaeQualityLevels.cpp
+SOURCE      CaeStillQualityLevels.cpp
+SOURCE      CaeVideoQualityLevels.cpp
+SOURCE      CaeVideoTimes.cpp
+SOURCE      CaeCallbackActive.cpp
+SOURCE      CaeStillStatesActive.cpp
+SOURCE      CaeExtension.cpp
+
+// Possible definition in features.hrh
+#ifdef __CAE_VR_CUSTOM_COMMANDS
+SOURCE      CaeEngineImpVideoNameCustom.cpp
+#else
+SOURCE      CaeEngineImpVideoName.cpp
+#endif
+
+// Can be removed from here when available in platform.
+// #define     __CAMERA_BURST_MODE
+
+#ifdef __CAMERA_BURST_MODE
+SOURCE      CaeImageItem.cpp
+SOURCE      CaeStillBurst.cpp
+SOURCE      CaeEngineImpStillBurstSupport.cpp
+#else
+SOURCE      CaeEngineImpNoStillBurst.cpp
+#endif
+
+SOURCE      CaeQualityLevelsNoSd.cpp
+SOURCE      CaeStillQualityLevelsNoSd.cpp
+SOURCE      CaeVideoQualityLevelsNoSd.cpp
+
+SOURCE      CaeDbgUtilities.cpp
+
+#ifdef CAE_TEST_VERSION
+SOURCE      CaeEngineImpTestErrors.cpp
+#endif
+
+USERINCLUDE ../Inc
+USERINCLUDE ../../StillConverter/Inc
+USERINCLUDE	../../../inc      // MW level inc dir
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY     euser.lib
+LIBRARY     fbscli.lib
+LIBRARY	    hal.lib
+LIBRARY     ECAM.lib
+LIBRARY     MMFControllerFramework.lib
+LIBRARY     mediaclientvideo.lib
+LIBRARY     CaeStillConverter.lib
+LIBRARY     ExifLib.lib
+LIBRARY     efsrv.lib
+LIBRARY     imageconversion.lib
+
+#ifdef EABI
+library ECOM.LIB
+#endif
+
+// LIBRARY flogger.lib // Enable if USE_FILE_LOGGER is defined
+
+EXPORTUNFROZEN
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Group/bld.inf	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+CaeEngine.mmp
+
+PRJ_TESTMMPFILES
+CaeEngineTestVersion.mmp
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeCallbackActive.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,128 @@
+/*
+* Copyright (c) 2003,2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Active object for calling Camera Application Engine methods 
+*                indirectly from callbacks
+*
+*/
+
+
+
+#ifndef CAECALLBACKACTIVE_H
+#define CAECALLBACKACTIVE_H
+
+// INCLUDES
+#include <e32base.h>
+#include <e32std.h>
+
+// FORWARD DECLARATIONS
+class CCaeEngineImp;
+
+
+// CLASS DECLARATION
+
+/**
+* CCaeCallbackActive
+* Active object for calling Camera Application Engine methods 
+* indirectly from callbacks 
+*/
+NONSHARABLE_CLASS( CCaeCallbackActive ) : public CActive
+    {
+    public: // Constructors and destructor
+        
+        /**
+        * Symbian OS two-phased constructor.
+        * @since 2.1
+        * @param aCamAppEngine Reference to CCaeEngineImp instance
+        */
+        static CCaeCallbackActive* NewLC( 
+            CCaeEngineImp& aCamAppEngine );
+
+        /**
+        * Symbian OS two-phased constructor.
+        * @since 2.1
+        * @param aCamAppEngine Reference to CCaeEngineImp instance
+        */
+        static CCaeCallbackActive* NewL( 
+            CCaeEngineImp& aCamAppEngine );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CCaeCallbackActive();
+
+    protected: // Constructors and destructor
+        
+        /**
+        * Symbian OS 2nd phase constructor that can leave.
+        */
+        void ConstructL();
+
+        /**
+        * C++ constructor.
+        * @since 2.1
+        * @param aCamAppEngine Reference to CCaeEngineImp instance
+        */
+        CCaeCallbackActive( 
+            CCaeEngineImp& aCamAppEngine );
+
+    public: // New methods
+
+        /**
+        * Switches camera module power on.
+        * @since 2.1
+        * @return void
+        */
+        void PowerOn();
+
+    public: // Methods from CActive (was protected)
+        
+        /**
+        * Calls Camera Application Engine operation.
+        * @return void
+        */
+        void RunL();
+
+    protected: // Methods from CActive
+
+        /**
+        * Cancels request.
+        * @return void
+        */
+        void DoCancel();
+
+    private:
+
+        // Timer to implement delayed operation calls.
+        RTimer iTimer;
+
+        // Reference to Camera Application Engine.
+        CCaeEngineImp& iCamAppEngine;
+
+        // Requests available.
+        enum TRequest
+            {
+            /** Default */
+            ERequestDefault,
+            /** Switch camera power on */
+            ERequestPowerOn,
+            };
+
+        // Request.
+        TRequest iRequest;
+
+    };
+
+#endif // CAECALLBACKACTIVE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeCommon.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Common definitions
+*
+*/
+
+
+
+#ifndef CAECOMMON_H
+#define CAECOMMON_H
+
+//  INCLUDES
+
+#include <e32std.h>
+
+// CONSTANTS
+
+enum TCaeExtensionInterfaceIndexes
+	{
+	KCaeExtProcessImageInterfaceIndex = 0,
+	KCaeExtSettingsInterfaceIndex = 1
+	};
+
+// Supported extension interfaces
+// The order of this array must match to TCaeExtensionInterfaceIndexes.
+const TUid KCaeSupportedExtensionInterfaceUids[] = 
+	{
+		{ KCaeExtProcessImageInterfaceUidValue },
+		{ KCaeExtSettingsInterfaceUidValue } ,
+		{ NULL } // End mark
+	};
+
+// Supported callback interfaces
+const TUid KCaeSupportedCallbackInterfaceUids[] = 
+	{
+		{ KCaeExtEngineInfoCallbackInterfaceUidValue },
+		{ NULL } // End mark
+	};
+
+// Extension list granularity
+const TInt TCaeExtensionInterfaceImplItemGranularity = 10;
+
+// CLASS DECLARATIONS
+
+/**
+* Struct for the extension interface implementation array item.
+*/
+
+struct TCaeExtensionInterfaceImplItem
+	{
+    // Priority of the specific implementation
+    TInt iInitialPriority;
+
+    // Uid of the specific implementation
+	TUid iImplUid;
+
+    // Pointer to the specific implementation
+	TAny* iImplPtr;
+
+    // Set to ETrue when image processing is enabled
+	TBool iIsActive;
+	};
+
+/**
+* Struct for the extension interface implementation array item.
+*/
+
+struct TCaeExtensionInterfaceImplListItem
+	{
+	// Uid of the interface 
+	TUid iInterfaceUid;
+
+	// List of implementations
+	RArray<TCaeExtensionInterfaceImplItem>* iImplementations;
+	};
+
+/**
+* Struct for the custom interface implementation array item.
+*/
+
+struct TCaeCustomInterfaceImplItem
+	{
+    // Uid of the custom interface that is implemented by the extension 
+	TUid iInterfaceUid;
+
+    // Pointer to the implementation
+	TAny* iImplPtr;
+	};
+
+
+
+#endif // CAECOMMON_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeDbgUtilities.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Utilities for Camera Application Engine. 
+*
+*/
+
+
+#ifndef CAEDBGUTILITIES_H
+#define CAEDBGUTILITIES_H
+
+// MACROS
+
+// Logging support
+// Serial port logging is enabled in _DEBUG builds by default
+// USE_FILE_LOGGER or USE_SERIAL_LOGGER can also be explicitely defined e.g. in MMP file.
+//
+
+// #define USE_FILE_LOGGER
+
+#if defined (_DEBUG) && !defined(USE_FILE_LOGGER)                   
+    #define USE_SERIAL_LOGGER 
+#endif
+                                    
+#if defined (USE_FILE_LOGGER)
+    #include <flogger.h>
+    _LIT(KLogFile,"cae.txt");
+    _LIT(KLogFolder,"cae");
+    #define LOGTEXT(AAA)                RFileLogger::Write(KLogFolder(),KLogFile(),EFileLoggingModeAppend,AAA)
+    #define LOGTEXT2(AAA,BBB)           RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(AAA),BBB)
+    #define LOGTEXT3(AAA,BBB,CC)       RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(AAA),BBB,CC)
+    #define LOGHEXDUMP(AAA,BBB,CC,DDD) RFileLogger::HexDump(KLogFolder(),KLogFile(),EFileLoggingModeAppend,AAA,BBB,CC,DDD)    
+#elif defined (USE_SERIAL_LOGGER) 
+    #include <e32svr.h>
+    #define LOGTEXT(AAA)                RDebug::Print(AAA)
+    #define LOGTEXT2(AAA,BBB)           RDebug::Print(AAA,BBB)
+    #define LOGTEXT3(AAA,BBB,CC)       RDebug::Print(AAA,BBB,CC)
+    #define LOGHEXDUMP(AAA,BBB,CC,DDD)
+#else
+    #define LOGTEXT(AAA)                
+    #define LOGTEXT2(AAA,BBB)           
+    #define LOGTEXT3(AAA,BBB,CC)       
+    #define LOGHEXDUMP(AAA,BBB,CC,DDD) 
+#endif                              
+
+// Memory info logging.
+#ifdef _DEBUG
+    #define MEM() PrintMemoryInfo()
+#else
+    #define MEM()
+#endif
+
+// Define assert to include file & line number
+#define CAE_ASSERT_FILE__(s) _LIT(KPanicFileName,s)
+#define CAE_ASSERT_PANIC__(l) User::Panic(KPanicFileName().Right(12),l) // Note: RVCT compiler puts the full path in __LINE__ 
+#define CAE_ASSERT_DEBUG_PANIC__(c,l) if (!(c)) {LOGTEXT3(_L("Error panic! Assert failed in file: %S, line: %d"), &KPanicFileName, l);User::Panic(KPanicFileName().Right(12),l);}
+
+#ifdef _DEBUG
+#define CAE_ASSERT_DEBUG(x)  { CAE_ASSERT_FILE__(__FILE__); CAE_ASSERT_DEBUG_PANIC__(x,__LINE__);}
+#define CAE_ASSERT_ALWAYS(x) CAE_ASSERT_DEBUG(x)
+#else
+#define CAE_ASSERT_DEBUG(x)
+#define CAE_ASSERT_ALWAYS(x) { CAE_ASSERT_FILE__("CamAppEngine"); __ASSERT_ALWAYS(x, CAE_ASSERT_PANIC__(__LINE__) ); }
+#endif
+
+
+// FUNCTION PROTOTYPES
+
+#ifdef _DEBUG
+    void PrintMemoryInfo();
+#endif
+
+
+#endif // CAEDBGUTILITIES_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeEngineImp.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,835 @@
+/*
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine implementation class
+*
+*/
+
+
+
+#ifndef CAEENGINEIMP_H
+#define CAEENGINEIMP_H
+
+//  INCLUDES
+#include <ecam.h>
+#include <videorecorder.h>
+#include "CamCControllerCustomCommands.h"
+#include "CaeEngine.h"
+#include "CaeEngineExtInterface.h"
+#include "CaeCommon.h"
+#include "CaeStillEncoder.h"
+#include "CaeStillDecoder.h"
+#include "CaeCallbackActive.h"              // For making method calls from callbacks.
+#include "CaeDbgUtilities.h"                // For debugging.
+
+#include <e32std.h>
+
+// CONSTANTS
+const TInt KVideoTimesIntervalDefault = 1000000; // Default time interval for Video Recording times call-back.
+
+const TInt KVideoTimesDelay = 100000; // Delay in starting to generate video times, in microseconds.
+
+const TInt KCameraPriority = -1; // Relative priority (-100...100) of camera HW
+
+const TUid KUidBurstModeVFOptimization = {0x4A758866}; // Custom command interface UID used by some products
+
+// FORWARD DECLARATIONS
+class CVideoRecorderUtility;
+class RWsSession;
+class CWsScreenDevice;
+class RWindowBase;
+class CFbsBitmap;
+class CCaeStillQualityLevelsCont;
+class CCaeVideoQualityLevelsCont;
+class CCaeVideoTimes;
+class CCaeStillBurst;
+class CCaeStillStatesActive;
+
+
+// CLASS DECLARATIONS
+
+/**
+* Camera application engine implementation class.
+*/
+
+NONSHARABLE_CLASS( CCaeEngineImp ): public CCaeEngine, 
+                                    public MCameraObserver,
+                                    public MExtensionCallbackInterface,
+					                public MCaeExtEngineInfoCallbackInterface,
+                                    public MVideoRecorderUtilityObserver,
+                                    public MCameraObserver2
+    {
+
+
+    public: // Construction and destruction
+
+        static CCaeEngineImp* NewL();
+
+        virtual ~CCaeEngineImp();
+
+    
+    public: // General methods / CCaeEngine.h
+
+        void SetCamAppEngineObserver( 
+            MCamAppEngineObserver& aObserver );
+
+        void GetInfo( 
+            TCamAppEngineInfo& aInfo ) const;
+
+        void InitL( 
+            TBool aCreateSnapImage = ETrue );
+
+        void InitL( 
+            TUid  aSdUidStillQltyLevels, 
+            TBool aCreateSnapImage = ETrue );
+
+        void InitVideoRecorderL();
+        
+        void InitVideoRecorderL( 
+            TUid aSdUidVideoQltyLevels );
+
+        void Reserve();
+
+        void Release();
+
+        void PowerOn();
+
+        void PowerOff();
+
+    
+    public: // Camera settings / CCaeEngine.h
+
+        void SetZoomModeL( 
+            TZoomMode aZoomMode = EZoomModeDigital );
+
+        TZoomMode ZoomMode() const;
+
+        void SetZoomValueL( 
+            TInt aZoomValue = 0 );
+
+        TInt ZoomValue() const;
+
+        void SetBrightnessL( 
+            TInt aBrightness = 0 );
+
+        TInt Brightness() const;
+
+        void SetContrastL( 
+            TInt aContrast = 0 );
+
+        TInt Contrast() const;
+
+        void SetExposureModeL( 
+            CCamera::TExposure aExposureMode = CCamera::EExposureAuto );
+
+        CCamera::TExposure ExposureMode() const;
+
+        void SetWhiteBalanceModeL( 
+            CCamera::TWhiteBalance aWhiteBalanceMode = CCamera::EWBAuto );
+
+        CCamera::TWhiteBalance WhiteBalanceMode() const;
+
+        void SetFlashModeL( 
+            CCamera::TFlash aFlashMode = CCamera::EFlashNone );
+
+        CCamera::TFlash FlashMode() const;
+
+        void ResetToDefaultsL();
+    
+    
+    public: // View Finder / CCaeEngine.h
+
+        void SetViewFinderMirrorL( 
+            TBool aMirror );
+
+        TBool ViewFinderMirror() const;
+
+        void StartViewFinderBitmapsL( 
+            TSize& aVfFrameSize );
+
+        void StartViewFinderBitmapsL( 
+            TSize& aVfFrameSize, 
+            TRect& aCropRect );
+        
+        void StartViewFinderDirectL( 
+            RWsSession&      aWs, 
+            CWsScreenDevice& aScreenDevice, 
+            RWindowBase&     aWindow, 
+            TRect&           aScreenRect );
+
+        void StartViewFinderDirectL( 
+            RWsSession&      aWs, 
+            CWsScreenDevice& aScreenDevice, 
+            RWindowBase&     aWindow, 
+            TRect&           aScreenRect, 
+            TRect&           aCropRect );
+        
+        void StopViewFinder();
+
+        TBool IsViewFinding() const;
+
+        void GetViewFinderSize( 
+            TSize& aVfFrameSize );
+
+    
+    public: // Still image capturing / CCaeEngine.h
+
+        void PrepareStillCaptureL( 
+            TInt aStillQualityIndex );
+        
+        void PrepareStillCaptureL( 
+            TInt         aStillQualityIndex, 
+            const TRect& aCropRect );
+
+        void PrepareStillCaptureL( 
+            const TSize&     aSize, 
+            CCamera::TFormat aFormat,
+            TInt             aCompressionQuality );
+
+        void PrepareStillCaptureL( 
+            const TSize&     aSize, 
+            CCamera::TFormat aFormat, 
+            TInt             aCompressionQuality, 
+            const TRect&     aCropRect );
+
+        TInt StillQualityIndex() const;
+
+        void GetStillFrameSize( 
+            TInt   aStillQualityIndex, 
+            TSize& aSize ) const;
+
+        TInt EstimatedStillSizeInBytes( 
+            TInt aStillQualityIndex ) const;
+
+        void CaptureStill(); 
+        
+        void CancelCaptureStill();
+
+    
+    public: // Video recording / CCaeEngine.h
+    
+        void SetVideoRecordingFileNameL( 
+            const TDesC& aVideoClipFileName );
+
+        void PrepareVideoRecordingL( 
+            TInt aVideoQualityIndex );
+
+        void PrepareVideoRecordingL( 
+            const TSize&  aFrameSize, 
+            TReal32       aFrameRate, 
+            TInt          aBitRate, 
+            TBool         aAudioEnabled,
+            const TDesC8& aMimeType, 
+            const TDesC&  aPreferredSupplier, 
+            const TDesC8& aVideoType = KNullDesC8, 
+            const TDesC8& aAudioType = KNullDesC8 );
+
+        void CloseVideoRecording();
+
+        TInt VideoQualityIndex() const;
+
+        void GetVideoFrameSize( 
+            TInt   aVideoQualityIndex, 
+            TSize& aSize ) const;
+
+        TReal32 VideoFrameRate( 
+            TInt aVideoQualityIndex ) const;
+
+        TInt EstimatedVideoRecordingBitRateL( 
+            TInt aVideoQualityIndex ) const;
+
+        void SetVideoClipMaxSizeL( 
+            TInt aMaxClipSizeInBytes = 0 );
+
+        TInt VideoClipMaxSize() const;
+
+        void SetVideoAudioL( 
+            TBool aAudioEnabled );
+
+        TBool VideoAudio() const;
+
+        void SetVideoTimesIntervalL( 
+            TTimeIntervalMicroSeconds aInterval );
+
+        TTimeIntervalMicroSeconds VideoTimesInterval() const;
+
+        void StartVideoRecording();
+
+        void StopVideoRecording();
+
+        void PauseVideoRecording();
+
+        void ResumeVideoRecording();
+
+        TTimeIntervalMicroSeconds RemainingVideoRecordingTime() const;
+
+        TBool IsVideoRecording() const;
+
+    public: // New overloading method for preparing video recording / CCaeEngine.h
+    
+        void PrepareVideoRecordingL( 
+            const TSize&  aFrameSize, 
+            TReal32       aFrameRate, 
+            TInt          aBitRate, 
+            TBool         aAudioEnabled,
+            TInt          aAudioBitRate, 
+            const TDesC8& aMimeType, 
+            const TDesC&  aPreferredSupplier, 
+            const TDesC8& aVideoType, 
+            const TDesC8& aAudioType );
+
+    public: // Still image burst capturing interface methods / CCaeEngine.h
+
+        void SetCaeStillBurstObserver( 
+            MCaeStillBurstObserver& aObserver );
+
+        TInt SetStillCaptureImageCountL( 
+            TInt aImageCount );
+
+        TInt StillCaptureImageCount() const;
+
+        void SetStillBurstCaptureIntervalL( 
+            TTimeIntervalMicroSeconds aInterval );
+
+        TTimeIntervalMicroSeconds StillBurstCaptureInterval() const;
+
+        void StopStillBurstCapture();
+
+        void PrepareStillCaptureL( 
+            TInt         aStillQualityIndex, 
+            TSize&       aSnapSize );
+
+        void PrepareStillCaptureL( 
+            const TSize&     aSize, 
+            CCamera::TFormat aFormat,  
+            TInt             aCompressionQuality, 
+            const TRect&     aCropRect,
+            TSize&           aSnapSize );
+
+        void SetEvCompensationL( 
+            TInt aEvIndex = 0 );
+
+        TInt EvCompensation() const;
+        
+    public: // Method for switching snap-image creation on/off. / CCaeEngine.h
+    
+        void SetSnapImageCreation( 
+            TBool aCreateSnapImage = ETrue );
+
+    public: // New methods since 2.6 and 2.8 / CCaeEngine.h
+
+    	static CCaeEngineImp* NewL(
+    	    TInt aCameraIndex, TInt aDisplayIndex );
+
+    	void EnumerateStillCaptureSizes(
+    	    TSize& aSize,
+    	    TInt aSizeIndex,
+    	    CCamera::TFormat aFormat ) const;
+
+    	void SetJpegQuality(
+    	    TInt aQuality );
+
+    	TInt JpegQuality() const;
+
+        TAny* CustomInterface(
+			TUid aInterface );
+
+        void SetSnapImageSizeL(
+            TSize& aSize );
+
+        void SetSnapImageColorMode(
+            TDisplayMode aMode );
+
+        void GetOrderL( 
+			RCaeOrderedFeatureList& aOrderedFeatureList );
+
+        void SetOrderL( 
+			const RCaeOrderedFeatureList& aOrderedFeatureList );
+
+        void SetSnapImageSourceL(
+            TSnapImageSource aSnapImageSource );
+
+        void SetImageCodecsL( 
+        	TUid aDecoderUid, TUid aEncoderUid );
+
+        TInt EnumerateVideoFrameSizeL(const TSize& aSize);
+        
+        TInt CCameraHandle() const;
+        	
+        void SetCaeExtensionModeL( TBool aExtModeActive, TBool aCreateSnapImage );
+
+        void ProcessExtViewFinderFrameReadyL( CFbsBitmap& aFrame );
+
+        void ProcessExtSnapImageL( CFbsBitmap& aSnapImage );
+
+        void ProcessExtCapturedImageL( CFbsBitmap& aBitmap, TBool aLastImage );
+        
+        void ProcessExtCapturedImageL( HBufC8* aImageData, TBool aLastImage );
+        
+        void ProcessExtCapturedImageL( TDesC8& aImageDataDes, TBool aLastImage );
+
+        void ProcessExtCancel();
+
+        void SkippedExtensionListL( RCaeOrderedFeatureList& aDisabledExtensions );
+
+        void SetSkippedExtensionList( RCaeOrderedFeatureList& aDisabledExtensions );
+
+        void EnableVideoRecording();
+        
+        void DisableVideoRecording();
+
+        TInt SetAsyncVideoStopMode( TBool aAsyncVideoStopEnabled );
+
+    public: // New public methods
+
+        /**
+        * Checks if still image burst capture should be completed.
+        * @since 2.6
+        * @return Boolean indicating if the burst should be completed.
+        */
+        TBool CheckForStillBurstCompletion();
+        
+    private: // From Camera Observer / ECam.h
+
+        void ReserveComplete( 
+            TInt aError );
+
+        void PowerOnComplete( 
+            TInt aError );
+
+        void ViewFinderFrameReady( 
+            CFbsBitmap& aFrame );
+
+        void ImageReady( 
+            CFbsBitmap* aBitmap, 
+            HBufC8*     aData, 
+            TInt        aError );
+
+        void FrameBufferReady( 
+            MFrameBuffer* /*aFrameBuffer*/, 
+            TInt          /*aError*/ ) {}; // Empty default because not in use.
+   
+    private: // From Video Recorder Utility Observer / VideoRecorder.h
+
+        void MvruoOpenComplete( 
+            TInt aError );
+
+        void MvruoPrepareComplete( 
+            TInt aError );
+
+        void MvruoRecordComplete( 
+            TInt aError );
+
+        void MvruoEvent( 
+            const TMMFEvent& aEvent );
+
+    
+    private: // Private member methods
+
+        /**
+        * C++ constructor.
+        */
+        CCaeEngineImp();
+
+        /**
+        * Symbian OS 2nd phase constructor that can leave.
+        * @param aCameraIndex Index from 0 to CamerasAvailable()-1 inclusive 
+        * specifying the camera device to use.
+        * @param aDisplayIndex Display index specifying the display to use.
+        * @return void
+        */
+        void ConstructL( TInt aCameraIndex, TInt aDisplayIndex );
+
+        /**
+        * Finds all extension dlls and populates the extension arrays.
+        * @since 2.8
+        * @return void
+        */
+		void PopulateExtensionArrayL();
+
+    //// General and settings related private methods. ////
+
+        /**
+        * Initializes the info class ("structure").
+        * @since 2.1
+        * @param aCamera Camera object.
+        * @return void
+        */
+        void InitializeInfo( 
+            const CCamera& aCamera );
+
+        /**
+        * Checks that power is on. If not, then leaves.
+        * @since 2.1
+        * @return void
+        */
+        void CheckPowerL();
+
+        /**
+        * Cancels view finder, still capturing, and video recording.
+        * @since 2.1
+        * @return void
+        */
+        void CancelAllActivities();
+
+        /**
+        * Re-sets settings to the previous values (before releasing camera).
+        * @since 2.1
+        * @return void
+        */
+        void ResetToPreviousSettingsL();
+
+    //// Video recording related private methods. ////
+
+        /**
+        * Cancels video recording.
+        * @since 2.1
+        * @return void
+        */
+        void CancelVideoRecording();
+
+        /**
+        * Prepares video recording settings.
+        * @since 2.1
+        * @return void
+        */
+        void PrepareVideoSettingsL();
+
+        /**
+        * Changes video clip file name.
+        * @since 2.1
+        * @return void
+        */
+        void ChangeVideoFileNameL();
+
+        /**
+        * Finds video type and format UIDs using ECOM.
+        * @since 2.1
+        * @param aMimeType MIME type.
+        * @param aPreferredSupplier Preferred supplier of video encoder.
+        * @return void
+        */
+        void FindVideoUidsL(
+            const TDesC8& aMimeType, 
+            const TDesC&  aPreferredSupplier );
+
+        /**
+        * Convert audio type from TDesC8 to TFourCC.
+        * @since 2.1
+        * @param aAudioType Audio type.
+        * @return Audio type TFourCC code
+        */
+        TFourCC ConvertAndSetVideoAudioTypeL(
+            const TDesC8& aAudioType );
+
+        /**
+        * Generates video recording times via
+        * MCamAppEngineObserver::McaeoVideoRecordingTimes implemented by client.
+        * @since 2.1
+        * @param aEngineImp Camera Application Engine implementation object (this) 
+        * @return ETrue
+        */
+        static TInt VideoRecordingTimesCallback( 
+            TAny* aEngineImp );
+
+    //// Still image burst capturing related private methods. ////
+
+        /**
+        * Gets option flag for still burst support.
+        * @since 2.1
+        * @return Option flag for still burst support
+        */
+        TCamAppEngineInfo::TOptions StillBurstSupport();
+
+        /**
+        * Compares two extension interface array items.
+        * @since 2.8
+        * @param aFirst First item
+        * @param aSecond Second item
+        * @return TInt Result of the comparison
+        */
+        static TBool MatchEqualImplUid( const TCaeExtensionInterfaceImplItem& aFirst, const TCaeExtensionInterfaceImplItem& aSecond );
+
+        /**
+        * Compares two extension interface array items.
+        * @since 2.8
+        * @param aFirst First item
+        * @param aSecond Second item
+        * @return TInt Result of the comparison
+        */
+        static TBool MatchEqualImplPtr( const TCaeExtensionInterfaceImplItem& aFirst, const TCaeExtensionInterfaceImplItem& aSecond );
+
+        /**
+        * Compares two extension interface array items.
+        * @since 2.8
+        * @param aFirst First item
+        * @param aSecond Second item
+        * @return TInt Result of the comparison
+        */
+        static TBool MatchSmallerInitialPriorityAndImplUid( const TCaeExtensionInterfaceImplItem& aFirst, const TCaeExtensionInterfaceImplItem& aSecond );
+
+        /**
+        * Compares two extension interface array items.
+        * @since 2.8
+        * @param aFirst First item
+        * @param aSecond Second item
+        * @return TInt Result of the comparison
+        */
+        static TBool Match( const TCaeOrderedFeatureListItem& aFirst, const TCaeOrderedFeatureListItem& aSecond );
+
+        /**
+        * Updates item order in the internal array or checks aOrderedFeatureArray validity.
+        * @since 2.8
+        * @param aOrderedFeatureArray Feature array sorted by the wanted calling order in an interface.
+        * @param iUpdate Whether to update the internal raays or just to check validity of aOrderedFeatureArray.
+        * @return void.
+        */
+		void DoSetOrderL( const RCaeOrderedFeatureList& aOrderedFeatureList, TBool iUpdate );
+
+	private: // From MCaeEngineExtensionInterface
+
+		TBool IsInterfaceSupported( TUid aInterfaceUid );
+
+		TInt AddExtensionInterface( TUid aInterfaceUid, TUid aExtensionUid, TAny* aImplementationPtr, TInt aInitialPriority = 0 );
+
+		TInt RemoveExtensionInterface( TUid aInterfaceUid, TAny* aImplementationPtr );
+
+		TInt AddCustomInterface( TUid aInterfaceUid, TAny* aImplementationPtr );
+
+		TAny* GetCallbackInterface( TUid aInterfaceUid );
+
+        void RegisterFlags( TUint32 aFlags );
+
+        void DeregisterFlags( TUint32 aFlags );
+
+	private: // From MCaeExtEngineInfoCallbackInterface
+
+		TSize McaeExtStillImageSize();
+
+		TSize McaeExtSnapImageSize();
+
+		TSize McaeExtViewFinderSize();
+
+		void McaeExtCheckPowerL();
+
+		TInt McaeExtDisplayIndex();
+
+    private: // From Camera Observer2 / ECam.h
+
+        void HandleEvent(const TECAMEvent& aEvent);
+
+        void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
+
+        void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+    
+        void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+
+    private: // Data
+    
+    //// Pointers. ////
+
+        // Camera API implementation object.
+        CCamera* iCamera;
+
+        // State machine for still capturing.
+        CCaeStillStatesActive* iStillStatesActive; 
+
+		// All CAE Extension modules
+		RPointerArray<MExtension> iExtension;
+
+		// All extension interface implementations.
+		RArray<TCaeExtensionInterfaceImplListItem> iExtInterfaceImplementationLists;
+
+		// All custom interface implementations.
+		RArray<TCaeCustomInterfaceImplItem> iExtCustomInterfaceImplementations;
+
+        // Video Recorder API implementation object.
+        CVideoRecorderUtility* iVideoRecorder;
+
+        // Camera Application Engine observer.
+        MCamAppEngineObserver* iCaeObserver;
+
+        // Camera Application Engine info object.
+        TCamAppEngineInfo* iInfo;
+
+        // Still image capturing quality levels container.
+        CCaeStillQualityLevelsCont* iStillQualityLevelsCont;
+
+        // Video recording quality levels container.
+        CCaeVideoQualityLevelsCont* iVideoQualityLevelsCont;
+
+        // Active object for calling Camera Application Engine methods 
+        // indirectly from callbacks.
+        CCaeCallbackActive* iCallbackActive;
+
+        // Video recording frame size.
+        // This is ptr because video recorder is not necessarily initialized.
+        TSize* iVideoFrameSize;
+
+        // Video recording frame size (to be prepared).
+        // This is ptr because video recorder is not necessarily initialized.
+        TSize* iVideoFrameSizePrep;
+
+        // Video recording times generator.
+        CCaeVideoTimes *iVideoTimes;
+
+        // Video recording times callback.
+        TCallBack* iVideoTimesCallback;
+
+        // Video clip file name.
+        HBufC* iVideoClipFileName;
+        
+        // Video Recorder video type.
+        HBufC8* iVideoType;
+
+    //// Booleans (mostly reporting state). ////
+
+        // Boolean indicating if camera module is reserved for the engine.
+        TBool iReserved;
+
+        // Boolean indicating if camera module power is on.
+        TBool iPowerOn;
+
+        // Boolean indicating if video recording is initialized.
+        TBool iVideoInitialized;
+
+        // Boolean indicating if still image capture is prepared.
+        TBool iStillPrepared;
+
+        // Boolean indicating if video recording is opened.
+        TBool iVideoOpened;
+
+        // Boolean indicating if video recording is prepared.
+        TBool iVideoPrepared;
+
+        // Boolean indicating if view finder is currently running.
+        TBool iViewFinderRunning;
+
+        // Boolean indicating if video recording is currently running.
+        TBool iVideoRecordingRunning;
+
+        // Boolean indicating if video recording is currently paused.
+        TBool iVideoRecordingPaused;
+
+        // Boolean indicating if the engine should reset its basic settings 
+        // to the previous ones when re-reserving.
+        TBool iResetToPreviousSettings;
+
+    //// Camera module settings related variables. ////
+
+        // Current zoom mode.
+        TZoomMode iZoomMode;
+
+        // Current zoom value.
+        TInt iZoomValue;
+
+        // Current brightness value.
+        TInt iBrightness;
+
+        // Current contrast value.
+        TInt iContrast;
+
+        // Camera exposure mode.
+        CCamera::TExposure iExposureMode;
+
+        // Camera white balance mode.
+        CCamera::TWhiteBalance iWhiteBalanceMode;
+
+        // Camera flash mode.
+        CCamera::TFlash iFlashMode;
+
+    //// View finder related variables. ////
+
+        // View finder size when viewfinder has been started.
+        TSize iTrueViewFinderSize;
+
+    //// Still capturing related variables. ////
+
+        // Still image capture quality level index currently prepared.
+        TInt iStillQualityIndex; 
+
+        // Display index
+        TInt iDisplayIndex;
+
+      //// Video recording related variables. ////
+
+        // Video recording quality level index currently prepared.
+        TInt iVideoQualityIndex;
+
+        // Handle to the camera used.
+        TInt iCameraHandle;
+
+        // Video Recorder controller UID.
+        TUid iVideoControllerUid;
+
+        // Video Recorder format UID.
+        TUid iVideoFormatUid;
+
+        // Video Recorder audio type.
+        TFourCC iVideoAudioType;
+
+        // Interval for calling McaeoVideoRecordingTimes.
+        TTimeIntervalMicroSeconds32 iVideoTimesInterval;
+
+		// Previous valid elapsed time value
+    	TTimeIntervalMicroSeconds iPrevTimeElapsed;
+    	
+		// Previous valid remaining time value
+    	TTimeIntervalMicroSeconds iPrevTimeRemaining;
+    	
+    //// Video recording parameters prepared. ////
+        
+        // Video recording frame rate.
+        TReal32 iVideoFrameRate;
+
+        // Video recording bit rate.
+        TInt iVideoBitRate;
+
+        // Boolean indicating if audio is enabled with video recording.
+        TBool iVideoAudioEnabled;
+
+        // Video recording audio bit rate.
+        TInt iVideoAudioBitRate;
+
+        // Video recording maximum clip size in bytes.
+        TInt iMaxClipSizeInBytes;
+
+    //// Video recording parameters to be prepared. ////
+
+        // Video recording frame rate (to be prepared).
+        TReal32 iVideoFrameRatePrep;
+
+        // Video recording bit rate (to be prepared).
+        TInt iVideoBitRatePrep;
+
+        // Boolean indicating if audio is enabled with video recording (to be prepared).
+        TBool iVideoAudioEnabledPrep;
+
+        // Video recording audio bit rate (to be prepared).
+        TInt iVideoAudioBitRatePrep;
+
+        // Video recording maximum clip size in bytes (to be prepared).
+        TInt iMaxClipSizeInBytesPrep;
+
+        // Boolean indicating if parameters are/were prepared in video recording preparation..
+        TBool iPrepPars;
+
+        // Boolean indicating if video audio bit rate should be prepared.
+        TBool iPrepareVideoAudioBitRate;
+        
+        // Boolean indicating if video stopping should be asynchronously or synchronously (default).
+        TBool iAsyncVideoStopEnabled;
+    };
+
+
+#endif // CAEENGINEIMP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeEngineImpTestErrors.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine error simulation global functions  
+*                for testing (CAE_TEST_VERSION only).
+*
+*/
+
+
+#ifdef CAE_TEST_VERSION
+
+#ifndef CAEENGINEIMPTESTERRORS_H
+#define CAEENGINEIMPTESTERRORS_H
+
+IMPORT_C void CaeSetMcaeseoHBufC8ImageReadyError( TInt aError );
+
+IMPORT_C void CaeMcaeseoHBufC8ImageReadyError( TInt& aError );
+
+IMPORT_C void CaeSetMcaesdoCFbsBitmapImageReadyError( TInt aError );
+
+IMPORT_C void CaeMcaesdoCFbsBitmapImageReadyError( TInt& aError );
+
+IMPORT_C void CaeSetPowerOnCompleteError( TInt aError );
+
+IMPORT_C void CaePowerOnCompleteError( TInt& aError );
+
+IMPORT_C void CaeSetReserveCompleteError( TInt aError );
+
+IMPORT_C void CaeReserveCompleteError( TInt& aError );
+
+IMPORT_C void CaeSetImageReadyError( TInt aError );
+
+IMPORT_C void CaeImageReadyError( TInt& aError );
+
+IMPORT_C void CaeSetMvruoOpenCompleteError( TInt aError );
+
+IMPORT_C void CaeMvruoOpenCompleteError( TInt& aError );
+
+IMPORT_C void CaeSetMvruoPrepareCompleteError( TInt aError );
+
+IMPORT_C void CaeMvruoPrepareCompleteError( TInt& aError );
+
+IMPORT_C void CaeSetMvruoRecordCompleteError( TInt aError );
+
+IMPORT_C void CaeMvruoRecordCompleteError( TInt& aError );
+
+IMPORT_C void CaeSetPrepareVideoSettingsError( TInt aError );
+
+IMPORT_C void CaePrepareVideoSettingsErrorL();
+
+IMPORT_C void CaeSetCreateAndDeliverSnapImageError( TInt aError );
+
+IMPORT_C void CaeCreateAndDeliverSnapImageError( TInt& aError );
+
+IMPORT_C void CaeSetCreateAndDeliverStillImageError( TInt aError );
+
+IMPORT_C void CaeCreateAndDeliverStillImageError( TInt& aError );
+
+#endif // CAEENGINEIMPTESTERRORS_H
+
+#endif // #ifdef CAE_TEST_VERSION
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeImageItem.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Still Image Item for Camera Application Engine
+*
+*/
+
+
+
+#ifndef CAEIMAGEITEM_H
+#define CAEIMAGEITEM_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class HBufC8;
+class CFbsBitmap;
+
+// CLASS DECLARATION
+
+// An image item class. Can be used in image queues.
+NONSHARABLE_CLASS( CCaeImageItem ) : public CBase
+    {
+    
+    public:
+        /**
+        * Default constructor.
+        */
+        CCaeImageItem( RHeap& aImageHeap );
+         
+        /**
+        * Destructor.
+        */
+        virtual ~CCaeImageItem();
+        
+    public:
+        // Bitmap pointer.
+        CFbsBitmap* iBitmap;
+        // Image pointer (not in bitmap format).
+        TAny* iImageData;
+        // Size of iImageData
+        TInt iImageDataSize;
+		// Heap for iImageData
+		RHeap& iImageHeap; 
+        // Possible error related to the image (from capturing).
+        TInt iError;
+        
+    };
+
+
+
+#endif // CAEIMAGEITEM_H   
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeImageItemExtPro.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2003-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Still Image Item for Camera Application Engine for extension processing
+*
+*/
+
+
+
+#ifndef CAEIMAGEITEMEXTPRO_H
+#define CAEIMAGEITEMEXTPRO_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class HBufC8;
+class CFbsBitmap;
+
+// CLASS DECLARATION
+
+// An image item class. Can be used in image queues.
+NONSHARABLE_CLASS( CCaeImageItemExtPro ) : public CBase
+    {
+    
+    public:
+        /**
+        * Default constructor.
+        */
+        CCaeImageItemExtPro();
+         
+        /**
+        * Destructor.
+        */
+        virtual ~CCaeImageItemExtPro();
+        
+    public:
+        // Bitmap pointer for snap or captured image.
+        CFbsBitmap* iBitmap;
+        
+        // Image pointer for main captured image.
+        HBufC8* iImageData;
+
+        // Flag for last burst image
+        TBool iLastImage;
+
+        // Flag for indicating if the iBitmap is snap or captured image
+        TBool iSnapImage;
+    };
+
+
+
+#endif // CAEIMAGEITEMEXTPRO_H   
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeImageQueueExtPro.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2003-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine still image queue for extension processing
+*
+*/
+
+
+
+#ifndef CAEIMAGEQUEUEEXTPRO_H
+#define CAEIMAGEQUEUEEXTPRO_H
+
+
+// FORWARD DECLARATIONS
+class HBufC8;
+class CFbsBitmap;
+class CCaeImageItemExtPro;
+template <class T> class RPointerArray;
+
+// CLASS DECLARATION
+
+/**
+* Camera Application Engine still image queue for extension processing class.
+*
+*/
+
+NONSHARABLE_CLASS( CCaeImageQueueExtPro ) : public CBase
+    {
+
+    public: // Construction and destruction
+
+        /**
+        * Two-phased constructor.
+        */
+        static CCaeImageQueueExtPro* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CCaeImageQueueExtPro();
+
+    public:
+
+        /**
+        * Appends an image item into the image queue.
+        * @since 3.2
+        * @param aBitmap Symbian OS bitmap snap image or captured bitmap image.
+        * @param aImageData Other than Symbian OS bitmap image.
+        * @param aLastImage Set when last image of the burst is completed.
+        * @param aSnapImage Set when aBitmap is snap image.
+        * @return Error code KErrNone, if the insertion is successful, 
+        * otherwise one of the system wide error codes.
+        */
+        TInt AppendImage( 
+            CFbsBitmap* aBitmap, 
+            HBufC8*     aImageData,
+            TBool       aLastImage,
+            TBool       aSnapImage );
+
+        /**
+        * Gets the count of image items in the image queue.
+        * @since 3.2
+        * @return The count of image items in the image queue
+        */
+        TInt ImageCount() const;
+            
+        /**
+        * Gets the next image from image queue.
+        * @since 3.2
+        * @param aBitmap Symbian OS bitmap image.
+        * @param aImageData Other than Symbian OS bitmap image.
+        * @param aLastImage Set when last image of the burst is completed.
+        * @param aSnapImage Set when aBitmap is snap image.
+        * @return Error code KErrNone, if the operation is successful, 
+        * otherwise KErrUnderflow (= no images in the queue).
+        */
+        TInt GetNextImage( 
+            CFbsBitmap*& aBitmap, 
+            HBufC8*&     aImageData,
+            TBool&       aLastImage,
+            TBool&       aSnapImage );
+
+        /**
+        * Resets and destroys image items from the image queue.
+        * @since 3.2
+        * @return void
+        */
+        void ResetAndDestroyImages();
+
+    private: // Private member methods
+
+        /**
+        * C++ constructor.
+        */
+        CCaeImageQueueExtPro();
+
+        /**
+        * Symbian OS 2nd phase constructor that can leave.
+        */
+        void ConstructL();
+
+    private: // Data
+
+        // Image queue for the images captured in burst.
+        RPointerArray<CCaeImageItemExtPro>* iImageQueue;
+
+    };
+
+
+#endif // CAEIMAGEQUEUEEXTPRO_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeQualityLevels.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine imaging quality level and container
+*
+*/
+
+
+
+#ifndef CAEQUALITYLEVELS_H
+#define CAEQUALITYLEVELS_H
+
+// INCLUDES
+#include <ecam.h>
+#include <e32base.h>
+#include <e32std.h>
+
+// CONSTANTS
+const TInt KCaeDefaultQltyLevelCount = 3;
+const TInt KCaeMaxSdKeyLength = 10;
+const TInt KCaeMaxQltyLevelStringLength = 256;
+
+// FORWARD DECLARATIONS
+class CQualityLevel;
+class RSharedDataClient;
+
+// CLASS DECLARATION
+
+/**
+* Camera Application Engine image/video quality levels container.
+*
+*/
+NONSHARABLE_CLASS( CCaeQualityLevelsCont ) : public CBase
+    {
+
+    public: // Constructors and destructor
+
+        /**
+        * Destructor.
+        */
+        virtual ~CCaeQualityLevelsCont();
+
+        /**
+        * Two-phased constructor.
+        */
+        static CCaeQualityLevelsCont* NewL();
+
+        /**
+        * Initialize quality levels from Shared Data ini-file.
+        * @since 2.1
+        * @param aSdUidQltyLevels Shared Data ini-file UID
+        * @return Count of quality levels initialized
+        */
+        TInt InitFromSdL( 
+            const TUid&  aSdUidQltyLevels );
+
+        /**
+        * Initializes quality levels to hardcoded default values.
+        * @since 2.1
+        * @return Count of quality levels initialized
+        */
+        virtual TInt InitDefaultsL() = 0;
+        
+        /**
+        * Gets the quality level count.
+        * @since 2.1
+        * @return Quality level count
+        */
+        virtual TInt Count() const = 0;
+
+        /**
+        * Get the specified quality level Shared Data key.
+        * @since 2.1
+        * @param aIndex Quality level index
+        * @return Quality level Shared Data key
+        */
+        virtual const TDes& Key( 
+            TInt aIndex ) const = 0;
+
+    protected:
+
+        /**
+        * C++ constructor.
+        */
+        CCaeQualityLevelsCont();
+
+    private: // Private methods.
+
+        /**
+        * Fetches namebase setting from SharedData Camera ini file.
+        * @since 2.1
+        * @param aSdUidQltyLevels Shared Data ini-file UID
+        * @param aIndex Quality level index
+        * @return void
+        */
+        void FetchQualityLevelL(
+            RSharedDataClient& aSharedData, 
+            const TUid&        aSdUidQltyLevels, 
+            TInt               aIndex );
+
+    private: // Private pure virtual methods.
+
+        /**
+        * Resizes quality level array.
+        * @since 2.1
+        * @param aQualityLevelCount Quality level count for the new array
+        * @return void
+        */
+        virtual void ResizeL( 
+            TInt aQualityLevelCount ) = 0;
+
+        /**
+        * Gets the quality level count Shared Data key.
+        * @since 2.1
+        * @return Quality level count Shared Data key
+        */
+        virtual const TDesC& QltyLevelCountSdKey() const = 0;
+
+        /**
+        * Creates quality level string for SharedData Camera ini file.
+        * @since 2.1
+        * @param aIndex Quality level index
+        * @param aDefaultQualityLevel Output quality level string
+        * @return void
+        */
+        virtual void CreateQualityLevelString( 
+            TInt  aIndex, 
+            TDes& aDefaultQualityLevel ) = 0;
+
+        /**
+        * Parses quality level string to quality level object data.
+        * @since 2.1
+        * @param aQualityLevelString Quality level string to parse
+        * @param aIndex Quality level index
+        * @return void
+        */
+        virtual void ParseQualityLevelFromStringL( 
+            const TDesC& qualityLevelString, 
+            TInt         aIndex ) = 0;
+    };
+
+
+
+// CLASS DECLARATION
+
+/**
+* Camera Application Engine image/video quality level.
+*
+*/
+NONSHARABLE_CLASS( CQualityLevel ) : public CBase
+    {
+    public:
+        
+        /**
+        * Constructor.
+        */
+        CQualityLevel();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CQualityLevel();
+
+    public:
+
+        // Shared Data ini-file key.
+        TBuf<KCaeMaxSdKeyLength> iKey;
+
+    };
+
+#endif // CAEQUALITYLEVELS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeSdKeys.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,174 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine Shared Data UID and keys
+*
+*/
+
+
+
+#ifndef CAESDKEYS_H
+#define CAESDKEYS_H
+
+
+// CONSTANTS
+
+// -----------------------------------------------------------------------------
+// Camera Application Engine 0x101f8569
+// -----------------------------------------------------------------------------
+
+const TUid KSDUidCamAppEngine = {0x101f8569};
+
+/**
+* Count of still image capturing quality levels, integer value
+*
+* Default value: 3
+*/
+_LIT( KCaeStillQltyLevelCount, "StillQltyC" );
+
+/**
+* Still image capturing quality level 0, multiparameter string
+*
+* String format: width height format quality imagesize
+* width: frame/image width in pixels
+* height: frame/image height in pixels
+* format: Camera API CCamera::TFormat code (e.g. EFormatJpeg = 0x0010 ==> value 10 here)
+* quality: compression quality 0...100 
+* 0 corresponds to worst image quality (highest compression), 
+* 100 corresponds to best image quality (lowest compression)
+* bytesize: estimated storage size of an image in bytes (if 0 then no estimate is given)
+*
+* Default value: 640 480 10 90 0
+*/
+_LIT( KCaeStillQltyLevel0, "StillQlty0" );
+
+/**
+* Still image capturing quality level 1, multiparameter string
+*
+* String format: see the comment for level 0
+*
+* Default value: 640 480 10 50 0 
+*/
+_LIT( KCaeStillQltyLevel1, "StillQlty1" );
+
+/**
+* Still image capturing quality level 2, multiparameter string
+*
+* String format: see the comment for level 0
+*
+* Default value: 640 480 10 50 0 
+*/
+_LIT( KCaeStillQltyLevel2, "StillQlty2" );
+
+/**
+* Still image capturing quality level 3, multiparameter string
+*
+* String format: see the comment for level 0
+*
+* Default value: no default
+*/
+_LIT( KCaeStillQltyLevel3, "StillQlty3" );
+
+/**
+* Still image capturing quality level 4, multiparameter string
+*
+* String format: see the comment for level 0
+*
+* Default value: no default
+*/
+_LIT( KCaeStillQltyLevel4, "StillQlty4" );
+
+/**
+* Still image capturing quality level 5, multiparameter string
+*
+* String format: see the comment for level 0
+*
+* Default value: no default
+*/
+_LIT( KCaeStillQltyLevel5, "StillQlty5" );
+
+/**
+* Count of video recording quality levels, integer value
+*
+* Default value: 3
+*/
+_LIT( KCaeVideoQltyLevelCount, "VideoQltyC" );
+
+/**
+* Video recording quality level 0, multiparameter string
+*
+* String format: width height framerate bitrate audio mimetype supplier videotype audiotype byterate 
+* width: frame/image width in pixels
+* height: frame/image height in pixels
+* framerate: encoded video frame rate (frames per second, fps)  
+* bitrate: encoded video bit rate (bits per second, bps) 
+* audio: is audio enabled? (0 = no, 1 = yes) 
+* mimetype: video MIME type 
+* supplier: supplier of video controller  
+* videotype: video type
+* audiotype: audio type (four character code)
+* storagerate: estimated bit rate to storaged (bits per second, bps) (if 0 then no estimate is given)
+*
+* Default value: 176 144 10 50000 1 12200 video/3gpp Nokia video/H263-2000  AMR 0
+*/
+_LIT( KCaeVideoQltyLevel0, "VideoQlty0" );
+
+/**
+* Video image capturing quality level 1, multiparameter string
+*
+* String format: see the comment for level 0
+*
+* Default value: 128 96 10 30000 1 12200 video/3gpp Nokia video/H263-2000  AMR 0
+*/
+_LIT( KCaeVideoQltyLevel1, "VideoQlty1" );
+
+/**
+* Video image capturing quality level 2, multiparameter string
+*
+* String format: see the comment for level 0
+*
+* Default value: 128 96 5 15000 0 12200 video/3gpp Nokia video/H263-2000  AMR 0
+*/
+_LIT( KCaeVideoQltyLevel2, "VideoQlty2" );
+
+/**
+* Video image capturing quality level 3, multiparameter string
+*
+* String format: see the comment for level 0
+*
+* Default value: no default
+*/
+_LIT( KCaeVideoQltyLevel3, "VideoQlty3" );
+
+/**
+* Video image capturing quality level 4, multiparameter string
+*
+* String format: see the comment for level 0
+*
+* Default value: no default
+*/
+_LIT( KCaeVideoQltyLevel4, "VideoQlty4" );
+
+/**
+* Video image capturing quality level 5, multiparameter string
+*
+* String format: see the comment for level 0
+*
+* Default value: no default
+*/
+_LIT( KCaeVideoQltyLevel5, "VideoQlty5" );
+
+
+#endif // CAESDKEYS_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeStillBurst.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,163 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine still image burst class
+*
+*/
+
+
+
+#ifndef CAESTILLBURST_H
+#define CAESTILLBURST_H
+
+
+// FORWARD DECLARATIONS
+class HBufC8;
+class CFbsBitmap;
+class CCaeImageItem;
+template <class T> class RPointerArray;
+
+// CLASS DECLARATION
+
+/**
+* Camera application engine still image burst capturing class.
+*
+*/
+
+NONSHARABLE_CLASS( CCaeStillBurst ) : public CBase
+    {
+
+    public: // Construction and destruction
+
+        /**
+        * Two-phased constructor.
+        */
+        static CCaeStillBurst* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CCaeStillBurst();
+
+    public: // Settings
+
+        /**
+        * Sets the desired length of the burst. That many captures should be done in the burst.
+        * Note that the final burst length really captured may be different if 
+        * there has been memory allocation problems or if the burst has been stopped.
+        * @since 2.1
+        * @param aLength The desired length of the burst
+        * @return void
+        */
+        void SetLengthL( 
+            TInt aLength );
+
+        /**
+        * Gets the length of the burst. That many captures will be done in the burst.
+        * Note that the final burst length really captured may be different if 
+        * there has been memory allocation problems or if the burst has been stopped.
+        * @since 2.1
+        * @return The desired length of the burst
+        */
+        TInt Length() const;
+
+    public: // Burst handling
+
+        /**
+        * Appends an image item into the image queue.
+        * @since 2.1
+        * @param aBitmap Symbian OS bitmap image.
+        * @param aImageData Other than Symbian OS bitmap image.
+        * @param aError Error code related to the image.
+        * @return Error code KErrNone, if the insertion is successful, 
+        * otherwise one of the system wide error codes.
+        */
+        TInt AppendImage( 
+            CFbsBitmap* aBitmap, 
+            HBufC8*     aImageData, 
+            TInt        aError );
+
+        /**
+        * Gets the count of image captures.
+        * @since 2.1
+        * @return The count of image captures
+        */
+        TInt CaptureCount() const;
+
+        /**
+        * Gets the count of image items in the image queue.
+        * @since 2.1
+        * @return The count of image items in the image queue
+        */
+        TInt ImageCount() const;
+            
+        /**
+        * Gets the next image from image queue.
+        * @since 2.1
+        * @param aBitmap Symbian OS bitmap image.
+        * @param aImageData Other than Symbian OS bitmap image.
+        * @param aError Error code related to the image.
+        * @return Error code KErrNone, if the operation is successful, 
+        * otherwise KErrUnderflow (= no images in the queue).
+        */
+        TInt GetNextImage( 
+            CFbsBitmap*& aBitmap, 
+            HBufC8*&     aImageData, 
+            TInt&        aError );
+
+        /**
+        * Returns Boolean indicating if the burst is fully captured or not.
+        * @since 2.1
+        * @return Boolean indicating if the burst is fully captured or not
+        */
+        TBool IsBurstCaptured() const;
+
+        /**
+        * Resets and destroys image items from the image queue.
+        * @since 2.1
+        * @return void
+        */
+        void ResetAndDestroyImages();
+
+    private: // Private member methods
+
+        /**
+        * C++ constructor.
+        */
+        CCaeStillBurst();
+
+        /**
+        * Symbian OS 2nd phase constructor that can leave.
+        */
+        void ConstructL();
+
+    private: // Data
+
+        // Image queue for the images captured in burst.
+        RPointerArray<CCaeImageItem>* iImageQueue;
+
+		// Heap for image data in iImageQueue
+		RHeap* iImageHeap; 
+
+        // Desired burst length (number of images).
+        TInt iDesiredLength;
+
+        // That many (successfull) captures have been made.
+        TInt iCountOfBurstAppends;
+
+        // Additional delay between separate captures.
+        TTimeIntervalMicroSeconds iCaptureInterval;
+    };
+
+
+#endif // CAESTILLBURST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeStillQualityLevels.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,198 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine still image quality level and container
+*
+*/
+
+
+
+#ifndef CAESTILLQUALITYLEVELS_H
+#define CAESTILLQUALITYLEVELS_H
+
+//  INCLUDES
+#include <ecam.h>
+#include <e32base.h>
+#include <e32std.h>
+#include "CaeSdKeys.h"
+#include "CaeQualityLevels.h"
+
+// CONSTANTS
+
+const TInt KCaeMaxStillQltyLevelCount = 6;
+
+const TInt KCaeImgWidthQQVGA    = 160; 
+const TInt KCaeImgHeightQQVGA   = 120; 
+
+const TInt KCaeImgWidthVGA      = 640; 
+const TInt KCaeImgHeightVGA     = 480; 
+
+
+// FORWARD DECLARATIONS
+class CStillQualityLevel;
+
+
+// CLASS DECLARATION
+
+/**
+* Camera Application Engine still image quality levels container.
+*
+*/
+NONSHARABLE_CLASS( CCaeStillQualityLevelsCont ) : public CCaeQualityLevelsCont
+    {
+
+    public: // Constructors and destructor
+
+        /**
+        * Destructor.
+        */
+        virtual ~CCaeStillQualityLevelsCont();
+
+        /**
+        * Two-phased constructor.
+        */
+        static CCaeStillQualityLevelsCont* NewL();
+
+        /**
+        * Initializes quality levels to hardcoded default values.
+        * @since 2.1
+        * @return The count of quality levels initialized
+        */
+        TInt InitDefaultsL();
+        
+        /**
+        * Gets the quality level count.
+        * @since 2.1
+        * @return Quality level count
+        */
+        TInt Count() const;
+
+        /**
+        * Gets the specified quality level.
+        * @since 2.1
+        * @param aIndex Quality level index
+        * @return Still quality level
+        */
+        CStillQualityLevel& At( 
+            TInt aIndex ) const;
+
+        /**
+        * Gets the Shared Data key of specified quality level.
+        * @since 2.1
+        * @param aIndex Quality level index
+        * @return Shared Data key
+        */
+        const TDes& Key( 
+            TInt aIndex ) const;
+
+    private:
+
+        /**
+        * C++ constructor.
+        */
+        CCaeStillQualityLevelsCont();
+
+        /**
+        * Symbian OS 2nd phase constructor that can leave.
+        */
+        void ConstructL();
+
+    private:
+
+        /**
+        * Resizes quality level array.
+        * @since 2.1
+        * @param aQualityLevelCount Quality level count for the new array
+        * @return void
+        */
+        void ResizeL( 
+            TInt aQualityLevelCount );
+
+        /**
+        * Gets the quality level count Shared Data key.
+        * @since 2.1
+        * @return Quality level count Shared Data key
+        */
+        const TDesC& QltyLevelCountSdKey() const;
+
+    private: // For Shared Data support.
+
+        /**
+        * Creates quality level string for SharedData Camera ini file.
+        * @since 2.1
+        * @param aIndex Quality level index
+        * @param aDefaultQualityLevel Output quality level string
+        * @return void
+        */
+        void CreateQualityLevelString( 
+            TInt  aIndex, 
+            TDes& aDefaultQualityLevel );
+
+        /**
+        * Parses quality level string to quality level object data.
+        * @since 2.1
+        * @param aQualityLevelString Quality level string to parse
+        * @param aIndex Quality level index
+        * @return void
+        */
+        void ParseQualityLevelFromStringL( 
+            const TDesC& qualityLevelString, 
+            TInt         aIndex );
+
+    private:
+        
+        // Supported still capture quality levels.
+        CArrayFixFlat<CStillQualityLevel>* iQualityLevels;
+    
+        // Quality level count Shared Data key.
+        const TDesC& iQltyLevelCountSdKey;    
+    };
+
+
+
+// CLASS DECLARATION
+
+/**
+* Camera Application Engine still image quality level.
+*
+*/
+NONSHARABLE_CLASS( CStillQualityLevel ) : public CQualityLevel
+    {
+    public:
+        
+        /**
+        * Constructor.
+        */
+        CStillQualityLevel();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CStillQualityLevel();
+
+    public:
+
+        // Still image frame size.
+        TSize iFrameSize;
+
+        // Still image output format.
+        CCamera::TFormat iOutputFormat;
+
+        // Still image compression quality.
+        TInt iCompressionQuality;
+
+        // Estimated size of an image in bytes.
+        TInt iByteSize;
+    };
+
+#endif // CAESTILLQUALITYLEVELS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeStillStatesActive.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,828 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Still capture state machine implementation class
+*
+*/
+
+
+
+#ifndef CAESTILLSTATESACTIVE_H
+#define CAESTILLSTATESACTIVE_H
+
+// INCLUDES
+#include <e32base.h>
+#include <e32std.h>
+#include <s32file.h>
+#include <fbs.h>
+#include <ecam.h>
+#include "CaeEngineExtInterface.h"
+#include "CaeCommon.h"
+#include "CaeEngine.h"
+#include "CaeStillEncoder.h"
+#include "CaeStillDecoder.h"
+#include "CaeDbgUtilities.h"                // For debugging.
+
+
+// CONSTANTS
+
+#ifdef _DEBUG
+const TInt KOneSecond = 1000000; // This many microseconds in a second
+#endif
+
+// Optimal snap bitmap size concerning memory usage and snap image quality
+const TInt KCaeDefaultSnapWidth = 640;
+const TInt KCaeDefaultSnapHeight = 480;
+
+_LIT(KCaePanicText, "CamAppEngine");
+enum TCaePanic
+    {
+    ECaePanicInvalidState = 1   
+    };
+
+const TInt KCaeDefaultCompressionQuality = 90;
+const CCamera::TFormat KBaseStillInputFormat1 = CCamera::EFormatFbsBitmapColor16M;
+const CCamera::TFormat KBaseStillInputFormat2 = CCamera::EFormatFbsBitmapColor64K;
+const TDisplayMode KCaeDefaultDisplayMode = EColor64K; // The default display mode for the snap image
+
+
+// FORWARD DECLARATIONS
+class CCaeEngineImp;
+class CCaeStillBurst;
+class CCaeImageQueueExtPro;
+
+// CLASS DECLARATION
+
+/**
+* Still capure state machine implementation class
+*/
+
+NONSHARABLE_CLASS( CCaeStillStatesActive ) : public CActive,
+                                             public MCaeStillEncoderObserver, 
+                                             public MCaeStillDecoderObserver
+    {
+    public: // Enums
+
+        /**
+        * Events for the state machine
+        */
+        enum TCaeEvent
+            {
+            // External event
+            ECaeEventNone							= 0,
+
+            // Start 
+            ECaeEventStartStillCapture				= 1,
+
+            // Capturing 
+            ECaeEventImageCaptureReady				= 100,
+            ECaeEventBurstImageCaptureReady			= 101,
+            ECaeEventBurstCaptureReady				= 102,
+            ECaeEventAppendCapturedBurstImageReady	= 103,        
+            ECaeEventViewFinderForBurstReady		= 104, 
+           
+            // Processing
+            ECaeEventBurstImageFetchReady			= 200,
+            ECaeEventDecodeToBitmapReady			= 201,
+            ECaeEventExtractExifMetaDataReady		= 202,
+            ECaeEventProcessCapturedImageStepReady	= 203,
+            ECaeEventProcessCapturedImageAllReady	= 204,
+            ECaeEventProcessSnapImageStepReady		= 205,
+            ECaeEventProcessSnapImageAllReady		= 206,
+            ECaeEventDeliverSnapImageReady			= 207,  
+            ECaeEventProcessStillImageStepReady		= 208,
+            ECaeEventProcessStillImageAllReady		= 209,
+            ECaeEventEncodeToJpegReady				= 210,
+            ECaeEventDeliverStillBurstImageReady	= 211,  
+            ECaeEventDeliverStillImageReady			= 212,  
+           
+            // Processing
+            ECaeEventImageQueueExtPro               = 300,
+
+            // End of process    
+            ECaeEventEnd							= 900
+            };
+   
+    public: // Constructors and destructor
+        
+        /**
+        * Symbian OS two-phased constructor.
+        * @since 2.8
+        * @param aCamera Reference to Camera API.
+        * @param aInfo Reference to the engine info struct
+        * @param aProcessImageImplList Reference to list of the extensions implementing MCaeExtProcessImageInterface.
+        * @return instance of the object
+        */
+        static CCaeStillStatesActive* NewL( 
+            CCamera& aCamera,
+            const TCamAppEngineInfo& aInfo,
+            RArray<TCaeExtensionInterfaceImplItem>& aProcessImageImplList );
+
+        /**
+        * Destructor.
+        * @since 2.8
+        */
+        virtual ~CCaeStillStatesActive();
+
+    public: // Delegated from CCaeEngine class method calls
+
+        void SetCamAppEngineObserver( 
+            MCamAppEngineObserver& aObserver );
+
+        void SetSnapImageCreation( 
+            TBool aCreateSnapImage = ETrue );
+
+        void SetSnapImageSourceL(
+            CCaeEngine::TSnapImageSource aSnapImageSource );
+
+        void SetSnapImageSizeL(
+            TSize& aSize );
+
+        void SetSnapImageColorMode(
+            TDisplayMode aMode );
+
+     	void SetJpegQuality(
+    	    TInt aQuality );
+
+    	TInt JpegQuality() const;
+
+        void SetImageCodecsL( 
+        	TUid aDecoderUid, TUid aEncoderUid );
+
+        void SetCaeStillBurstObserver( 
+            MCaeStillBurstObserver& aObserver );
+
+        TInt SetStillCaptureImageCountL( 
+            TInt aImageCount );
+
+        TInt StillCaptureImageCount() const;
+
+        void SetStillBurstCaptureIntervalL( 
+            TTimeIntervalMicroSeconds aInterval );
+
+        TTimeIntervalMicroSeconds StillBurstCaptureInterval() const;
+
+        void StopStillBurstCapture();
+
+        void CancelCaptureStill();
+
+    public: // New methods
+
+        /**
+        * Called asynchronously when the captured image is ready. 
+        * @since 2.8
+        * @param aBitmap A pointer to an image held in CFbsBitmap form
+        * @param aData A pointer to an image held in HBufC8 in previously specified format.
+        * @param aError SymbianOS standard error code.
+        * @return void.
+        */
+        void ImageReady( 
+            CFbsBitmap* aBitmap, 
+            HBufC8*     aData, 
+            TInt        aError );
+
+        /**
+        * Called asynchronously when the view finder frame is ready. 
+        * @since 2.8
+        * @return void
+        */
+        void ViewFinderFrameReady();
+
+        /**
+        * Get current still image size. 
+        * @since 2.8
+        * @return Still image size in pixels.
+        */
+        TSize StillImageSize() const;
+
+        /**
+        * Get current snap image size. 
+        * @since 2.8
+        * @return Snap image size in pixels.
+        */
+        TSize SnapImageSize() const;
+
+        /**
+        * Set view finder mode enabled or disabled.
+        * @since 2.8
+        * @param aIsEnabled Tell if the view finder is enabled.
+        * @return void.
+        */
+     	void SetViewFinderMode(
+    	    TBool aIsEnabled );
+
+        /**
+        * Check if the state machine has been started. 
+        * @since 2.8
+        * @return State of the state machine.
+        */
+        TBool IsRunning() const;
+
+        /** 
+        * Register flags which affect general extension handling in the engine. 
+        * @since 2.8
+        * @param aFlags Flags to register.
+        * @return void.
+        */
+        void RegisterFlags( TUint32 aFlags );
+
+        /** 
+        * Deregister flags which have been registered before.
+        * @since 2.8
+        * @param aFlags Flags to deregister.
+        * @return void.
+        */
+        void DeregisterFlags( TUint32 aFlags );
+
+        /**
+        * Prepare the state machine for still image capture . 
+        * The returned snap image size is always equal or bigger in both 
+        * dimensions than the given size. The returned size is stepwise 
+        * downscaled  from the captured image size. The parameter aSnapSize 
+        * is ignored if that is not supported for the image format used.
+        * @since 2.8
+        * @param aSize Still image size.
+        * @param aFormat Still image format.
+        * @param aCropRect Desired cropping/clipping rectangle. The size (0,0) means that this parameter is ignored.
+        * @param aSnapSize Desired snap image size. Returns the real snap image size.
+        * @return void
+        */
+        void PrepareStillCaptureL( 
+            const TSize&     aSize, 
+            CCamera::TFormat aFormat,  
+            const TRect&     aCropRect,
+            TSize&           aSnapSize );
+
+        /**
+        * Send event to the state machine. Usually only ECaeEventStartStillCapture
+        * event is send outside the class. 
+        * @since 2.8
+        * @param aEvent Event to the state machine.
+        * @param aDelay The delay that the event will occur after.
+        * @return void.
+        */
+		void Event( TCaeEvent aEvent, TTimeIntervalMicroSeconds32 aDelay = 0 );
+    
+        /**
+        * Recover and handle error cases. This could mean also ending of 
+        * the state machine, but not always (e.g. in burst mode ). 
+        * @since 2.8
+        * @param aError Error code.
+        * @return void.
+        */
+        void ErrorRecovery( TInt aError );
+        
+        /**
+        * Start capturing without active object delay.
+        * @since 3.2
+        * @return void.
+        */
+        void StartQuickCapture();
+
+        /**
+        * Gets the extension mode status.
+        * @since 3.2
+        * @return ETrue if extension mode is avtive.
+        */
+        TBool ExtModeActive();
+
+        /**
+        * Sets the extension mode on/off.
+        * @since 3.2
+        * @return void.
+        */
+        void SetExtModeActiveL( TBool aExtModeActive );
+
+        /**
+        * Do the extension processing for snap image.
+        * @since 3.2
+        * @return error code.
+        */
+        TInt ProcessExtSnapImage( CFbsBitmap* aSnapImage );
+
+
+        /**
+        * Do the extension processing for captured image.
+        * @since 3.2
+        * @return error code.
+        */
+        TInt ProcessExtCapturedImage( HBufC8* aImageData, TBool aLastImage  );
+
+        /**
+        * Do the extension processing for captured bitmap image.
+        * @since 3.2
+        * @return error code.
+        */
+        TInt ProcessExtCapturedImage( CFbsBitmap* aImageBitmapData, TBool aLastImage  );
+
+        /**
+        * Set the burst mode optimization mode  
+        * @since 3.2
+        * @return void.
+        */
+        void SetBurstModeVFOptimization( TBool aBurstModeVFOptimization );
+
+    private: // Enums
+
+        /**
+        * States of the state machine
+        */
+		enum TCaeState
+			{
+			ECaeStateNone                               = 0,
+
+            // Capturing 
+            ECaeStateCapturing                          = 100,
+            ECaeStateCapturingBurst                     = 101,
+            ECaeStateAppendingBurstImage                = 102,
+            ECaeStateBurstWaitingForViewFinder          = 103,
+
+            // Processing
+            ECaeStateFetchingNextBurstImage				= 200,
+            ECaeStateDecodingCapturedImageToBitmap      = 201,
+            ECaeStateExtractingExifMetaData             = 202,
+            ECaeStateExtensionsProcessingCapturedImage  = 203,
+            ECaeStateDecodingToSnapImage                = 204,
+            ECaeStateExtensionsProcessingSnapImage      = 205,
+            ECaeStateDeliveringSnapImage                = 206,
+            ECaeStateExtensionsProcessingStillImage     = 207,
+            ECaeStateEncodingToJpeg                     = 208,
+            ECaeStateDeliveringStillImage               = 209,
+            ECaeStateDeliveringStillBurstImage          = 210,
+            ECaeStateCompletingStillBurst               = 211
+			};
+        
+    private: // Constructors
+        
+        /**
+        * C++ constructor.
+        * @since 2.8
+        * @param aCamAppEngine Reference to CCaeEngineImp instance
+        */
+        CCaeStillStatesActive( 
+            CCamera& aCamera,
+            const TCamAppEngineInfo& aInfo,
+            RArray<TCaeExtensionInterfaceImplItem>& aProcessImageImplList );
+
+        /**
+        * Symbian OS 2nd phase constructor that can leave.
+        * @since 2.8
+        * @return void
+        */
+        void ConstructL();
+
+    private: // Methods from CActive 
+        
+        void RunL();
+
+        void DoCancel();
+
+        void Cancel();
+
+    private: // From Still Encoder Observer / CaeStillConverter.h
+
+        void McaeseoHBufC8ImageReady( 
+            CFbsBitmap* aBitmap, 
+            HBufC8*     aImageData, 
+            TInt        aError,
+            TInt        aImageSize );
+        
+    private: // From Still Decoder Observer / CaeStillConverter.h
+
+       void McaesdoCFbsBitmapImageReady( 
+            HBufC8*     aImageData, 
+            CFbsBitmap* aBitmap, 
+            TInt        aError,
+            TInt        aImageSize );
+        
+    private: // Event handlers for state transitions
+
+        /**
+        * Handle errors from extenal processing, e.g. from the extensions. 
+        * @since 2.8
+        * @return void. 
+        */
+        void HandleExternalError();
+
+        /**
+        * Handle events from extenal processing, e.g. from the extensions. 
+        * @since 2.8
+        * @return void. 
+        */
+        void HandleExternalEvent(); 
+
+        /**
+        * Handle start event. 
+        * @since 2.8
+        * @return void. 
+        */
+        void HandleStart();
+
+        /**
+        * Handle event when an image has been captured. 
+        * @since 2.8
+        * @return void. 
+        */
+        void HandleImageCaptureReady();
+
+        /**
+        * Handle event when a burst image has been appended to the array. 
+        * @since 2.8
+        * @return void. 
+        */
+        void HandleAppendCapturedBurstImageReady();
+
+        /**
+        * Handle event when a burst image has been fetched from the array. 
+        * @since 2.8
+        * @return void. 
+        */
+        void HandleBurstImageFetchReady();
+
+        /**
+        * Handle event when a bitmap has been decoded. 
+        * @since 2.8
+        * @return void. 
+        */
+        void HandleDecodeToBitmapReady();
+
+        /**
+        * Handle event when all the extensions have been processed the captured image. 
+        * @since 2.8
+        * @return void. 
+        */
+        void HandleProcessCapturedImageAllReady();
+
+        /**
+        * Handle event all extensions have been processed the still image.
+        * @since 2.8
+        * @return void. 
+        */
+        void HandleProcessStillImageAllReady();
+
+        /**
+        * Handle event when a still bitmap has been encoded to Jpeg.
+        * @since 2.8
+        * @return void. 
+        */
+       void HandleEncodeToJpegReady();
+
+        /**
+        * Handle event when the still burst image has been delivered to the client. 
+        * @since 2.8
+        * @return void. 
+        */
+        void HandleDeliverStillBurstImageReady();
+        
+        /**
+        * Handle event when there are images in extension processing queue
+        * @since 3.2
+        * @return void. 
+        */
+        void HandleImageQueueExtPro();
+
+    private: // Action functions for states
+
+        /**
+        * Start still (single) image capturing. 
+        * @since 2.8
+        * @return void. 
+        */
+        void DoCaptureStill();
+
+        /**
+        * Start still burst image capturing. 
+        * @since 2.8
+        * @return void. 
+        */
+        void DoCaptureStillBurst();
+
+        /**
+        * Start still burst capturing for one image. 
+        * @since 2.8
+        * @return void. 
+        */
+        void DoCaptureStillBurstImage();
+
+        /**
+        * Start appending captured burst image to the array. 
+        * @since 2.8
+        * @return void. 
+        */
+        void DoAppendCapturedBurstImageToArray();
+
+        /**
+        * Start fetching the next burst image from the array. 
+        * @since 2.8
+        * @return void. 
+        */
+        void DoFetchNextBurstImage();
+
+        /**
+        * Start decoding the captured image to the bitmap. 
+        * @since 2.8
+        * @return void. 
+        */
+        void DoDecodeCapturedImageToBitmap();
+
+        /**
+        * Start processing the captured image in the extensions.
+        * @since 2.8
+        * @return void. 
+        */
+        void DoExtensionsProcessCapturedImage();
+
+        /**
+        * Start processing the snap image in the extensions.
+        * @since 2.8
+        * @return void. 
+        */
+        void DoExtensionsProcessSnapImage();
+
+        /**
+        * Start delivering the snap image to the client.
+        * @since 2.8
+        * @return void. 
+        */
+        void DoDeliverSnapImage();
+
+        /**
+        * Start processing the still image in the extensions.
+        * @since 2.8
+        * @return void. 
+        */
+        void DoExtensionsProcessStillImage();
+
+        /**
+        * Start encoding to Jpeg image.
+        * @since 2.8
+        * @return void. 
+        */
+        void DoEncodeStillImageToJpeg();
+
+        /**
+        * Start delivering the still burst image to the client.
+        * @since 2.8
+        * @return void. 
+        */
+        void DoDeliverStillBurstImage();
+
+        /**
+        * Start delivering the still image to the client.
+        * @since 2.8
+        * @return void. 
+        */
+        void DoDeliverStillImage();
+
+        /**
+        * Start completing the still burst.
+        * @since 2.8
+        * @return void. 
+        */
+        void DoCompleteStillBurst();
+
+    private: // Helper methods
+
+        /**
+        * Get the current display mode from the system.
+        * @since 2.8
+        * @param aDisplayMode Returned display mode.
+        * @return TBool Whether the display mode was found.
+        */
+        TBool GetSystemDisplayMode( TDisplayMode& aDisplayMode );
+
+        /**
+        * If needed, calculates the stepwise downscaled size for the snap bitmap.
+        * @since 2.8
+        * @param aSnapSize Desired snap image size. Returns the real snap image size.
+        * @return void
+        */
+        void CalcDownscaledSnapSize(
+            TSize& aSnapSize ) const;
+
+        /**
+        * Gets the thumbnal from an Exif image.
+        * @since 2.8
+        * @return  
+        */
+        void GetThumbnailL( 
+            HBufC8*& aReadThumbnail, 
+            TSize&   aThumbnailSize );
+            
+        /**
+        * The output image type for the client.
+        * @since 2.8
+        * @return Tell if the output format is bitmap. 
+        */
+        TBool IsBitmapOutput();
+
+        /**
+        * Retrieves/fetches still image size index from Camera API.
+        * @since 2.8
+        * @param aSize Still image frame size
+        * @param aStillDataFormat Still image data format
+        * @return Still image size index
+        */
+        TInt RetrieveStillSizeIndex( 
+            const TSize&     aSize, 
+            CCamera::TFormat aStillDataFormat ) const;
+
+        /**
+        * Cancel the state machine actions and release and cancel internal objects.  
+        * @since 2.8
+        * @return void. 
+        */
+        void CancelAndCleanup();
+
+        /**
+        * Check for still burst completion.
+        * @since 2.8
+        * @return Return whether the still burst should be completed.
+        */
+        TBool CheckForStillBurstCompletion();
+
+        /**
+        * Delete images and continue burst. Ignore error for an individual image.
+        * @since 2.8
+        * @param aError Error code.
+        * @return void.
+        */
+        void BurstErrorRecovery( TInt aError );
+
+        /**
+        * Complete still image burst capture but do not delete still burst object. 
+        * @since 2.8
+        * @return void. 
+        */
+        void CompleteStillBurst();
+
+        /**
+        * Delete still burst object.
+        * @since 2.8
+        * @return void. 
+        */
+        void DeleteStillBurst();
+
+    private:
+
+    //// Objects ////
+
+        // Timer used for delayed calls.
+        RTimer iDelayedCallTimer; 
+
+        // File server handle for file operations.
+        RFs iFs;
+        
+        // Camera API reference.
+        CCamera& iCamera; 
+
+        // Engine info reference.
+        const TCamAppEngineInfo& iInfo;
+
+        // Camera Application Engine observer.
+        MCamAppEngineObserver* iCaeObserver;
+
+        // Still image encoder object.
+        CCaeStillEncoder* iStillEncoder; 
+
+        // Still image decoder object.
+        CCaeStillDecoder* iStillDecoder;
+
+        // Still burst observer.
+        MCaeStillBurstObserver* iCaeStillBurstObserver;
+
+        // Still image burst object, contains all the images captured in a burst.
+        CCaeStillBurst* iStillBurst; 
+
+        // Still image queue object for extension handling (used only when extension mode is active),
+        // contains all the images that are waiting for extension handling and delivery to UI.
+        CCaeImageQueueExtPro* iImageQueueExtPro; 
+
+
+    //// Data ////
+
+		// All extension interface implementations for image processing.
+		RArray<TCaeExtensionInterfaceImplItem>& iProcessImageImplList; 
+
+		// Image data in image format structure.
+		HBufC8* iImageData; 
+
+		// Image data in bitmap.
+		CFbsBitmap* iBitmap;
+		
+		// Snap image.
+		CFbsBitmap* iSnapBitmap; 
+
+		// Exif header.
+		HBufC8* iImageHeaderData; 
+
+        // Empty Snap image.
+        CFbsBitmap* iEmptySnapImage;
+
+        // Snap image source (input for decoding).
+        CCaeEngine::TSnapImageSource iSnapImageSource;
+
+         // Snap image size.
+        TSize iSnapImageSize; 
+
+         // Optimal snap image size.
+        TSize iOptimalSnapImageSize; 
+
+         // Snap image color mode.
+        TDisplayMode iSnapImageColorMode; 
+
+        // Still image capturing frame size.
+        TSize iStillFrameSize;
+
+        // Still image capture input format from Camera API.
+        CCamera::TFormat iStillInputFormat;
+        
+        // Still image capture output format for client.
+        CCamera::TFormat iStillOutputFormat;
+
+        // Still image compression quality value.
+        TInt iStillCompressionQuality;
+
+        // Time delay to be inserted between captures in a burst.
+        TTimeIntervalMicroSeconds32 iStillBurstCaptureInterval;
+
+        // Count of processed (encoded/decoded) burst images.
+        TInt iCountOfProcessedBurstImages;
+
+        // Count of delivered burst images (delivered to the client).
+        TInt iCountOfDeliveredBurstImages;
+
+
+    //// State information ////
+
+		// Current state
+		TCaeState iCurrentState;
+
+        // The first error detected during the burst.
+        TInt iFirstStillBurstError;
+
+		// Current Extension array index 
+		TInt iCurrentExtensionIndex;
+
+        // Delayed event id
+        TCaeEvent iDelayedEvent;
+
+
+    //// Flags ////
+
+        // Boolean indicating if the engine should create the snap image (for client's display purposes).
+        TBool iCreateSnapImage;
+
+        // Boolean indicating if still image capturing is currently cancelled.
+        TBool iStillCancelled;
+
+        // Boolean indicating if delivering burst images has started.
+        TBool iStillBurstDeliveryStarted;
+
+        // Boolean indicating if still burst is stopped.
+        TBool iStillBurstStopped;
+
+        // Boolean indicating if a view finder frame has been received.
+        TBool iViewFinderFrameReceived;
+
+        // Boolean indicating if the view finder has been enabled.
+        TBool iIsViewFinderEnabled;
+
+        // Boolean indicating if the extension mode is selected
+        TBool iExtModeActive;
+      
+        // Boolean indicating if this is the last burst image for extension processing
+        TBool iLastImageExtPro;
+      
+        // Boolean indicating if still image capture is prepared.
+        TBool iStillPrepared;
+
+    //// Flags using reference count ////
+
+        // Boolean indicating if full color snap image is required for extensions.
+        TInt32 iRequireFullColorSnapInputImageRefCount;
+
+        // Boolean indicating if the VF burst optimization is used
+        TBool iBurstModeVFOptimization;
+
+#ifdef _DEBUG
+        // Performance debugging variables
+        TTime iCaptureStartTime;
+        TTime iImageReadyTime;
+        TTime iFinalImageReadyTime;
+#endif
+    };
+
+#endif // CAESTILLSTATESACTIVE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeVideoQualityLevels.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,231 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine video quality level and container
+*
+*/
+
+
+
+#ifndef CAEVIDEOQUALITYLEVELS_H
+#define CAEVIDEOQUALITYLEVELS_H
+
+//  INCLUDES
+#include <ecam.h>
+#include <e32base.h>
+#include <e32std.h>
+#include "CaeSdKeys.h"
+#include "CaeQualityLevels.h"
+
+// CONSTANTS
+
+const TInt KCaeMaxVideoStringParLength = 32;
+const TInt KCaeMaxAudioTypeStringParLength = 4;
+
+const TInt KCaeMaxVideoQltyLevelCount = 6;
+
+const TInt KImgWidthSubQCIF  = 128; 
+const TInt KImgHeightSubQCIF = 96; 
+
+const TInt KImgWidthQCIF     = 176; 
+const TInt KImgHeightQCIF    = 144; 
+
+const TInt KImgWidthCIF      = 352; 
+const TInt KImgHeightCIF     = 288; 
+
+_LIT8(KVideoMimeType, "video/3gpp");
+
+_LIT(KPreferredSupplier, "Nokia");
+
+_LIT8(KVideoType, "video/H263-2000");
+
+_LIT8(KAudioType, " AMR");
+
+
+// FORWARD DECLARATIONS
+class CVideoQualityLevel;
+
+
+// CLASS DECLARATION
+
+/**
+* Camera Application Engine video recording quality levels container.
+*
+*/
+NONSHARABLE_CLASS( CCaeVideoQualityLevelsCont ) : public CCaeQualityLevelsCont
+    {
+
+    public: // Constructors and destructor
+
+        /**
+        * Destructor.
+        */
+        virtual ~CCaeVideoQualityLevelsCont();
+
+        /**
+        * Two-phased constructor.
+        */
+        static CCaeVideoQualityLevelsCont* NewL();
+
+        /**
+        * Initializes quality levels to hardcoded default values.
+        * @since 2.1
+        * @return The count of quality levels initialized
+        */
+        TInt InitDefaultsL();
+        
+        /**
+        * Gets the quality level count.
+        * @since 2.1
+        * @return Quality level count
+        */
+        TInt Count() const;
+
+        /**
+        * Gets the specified quality level.
+        * @since 2.1
+        * @param aIndex Quality level index
+        * @return Video quality level
+        */
+        CVideoQualityLevel& At( 
+            TInt aIndex ) const;
+
+        /**
+        * Gets the Shared Data key of specified quality level.
+        * @since 2.1
+        * @param aIndex Quality level index
+        * @return Shared Data key
+        */
+        const TDes& Key( 
+            TInt aIndex ) const;
+
+    private:
+
+        /**
+        * C++ constructor.
+        */
+        CCaeVideoQualityLevelsCont();
+
+        /**
+        * Symbian OS 2nd phase constructor that can leave.
+        */
+        void ConstructL();
+
+    private:
+
+        /**
+        * Resizes quality level array.
+        * @since 2.1
+        * @param aQualityLevelCount Quality level count for the new array
+        * @return void
+        */
+        void ResizeL( 
+            TInt aQualityLevelCount );
+
+        /**
+        * Gets the quality level count Shared Data key.
+        * @since 2.1
+        * @return Quality level count Shared Data key
+        */
+        const TDesC& QltyLevelCountSdKey() const;
+
+    private: // For Shared Data support.
+
+        /**
+        * Creates quality level string for SharedData Camera ini file.
+        * @since 2.1
+        * @param aIndex Quality level index
+        * @param aDefaultQualityLevel Output quality level string
+        * @return void
+        */
+        void CreateQualityLevelString( 
+            TInt  aIndex, 
+            TDes& aDefaultQualityLevel );
+
+        /**
+        * Parses quality level string to quality level object data.
+        * @since 2.1
+        * @param aQualityLevelString Quality level string to parse
+        * @param aIndex Quality level index
+        * @return void
+        */
+        void ParseQualityLevelFromStringL( 
+            const TDesC& aQualityLevelString, 
+            TInt         aIndex );
+
+    private:
+    
+        // Supported video recording quality levels.
+        CArrayFixFlat<CVideoQualityLevel>* iQualityLevels;
+
+        // Quality level count Shared Data key.
+        const TDesC& iQltyLevelCountSdKey;    
+    };
+
+
+
+// CLASS DECLARATION
+
+/**
+* Camera Application Engine video recording quality level.
+*
+*/
+NONSHARABLE_CLASS( CVideoQualityLevel ) : public CQualityLevel
+    {
+    public:
+        
+        /**
+        * Constructor.
+        */
+        CVideoQualityLevel();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CVideoQualityLevel();
+
+    public:
+
+        // The video recording frame size.
+        TSize iFrameSize;
+
+        // The video recording frame rate.
+        TReal32 iFrameRate;
+
+        // The video recording bit rate.
+        TInt iBitRate;
+
+        // A Boolean indicating if video recording audio is enabled or not.
+        TBool iAudioEnabled;
+
+        // The video recording audio bit rate.
+        TInt iAudioBitRate;
+
+        // The video MIME type (e.g. "video/3gpp").
+        TBuf8<KCaeMaxVideoStringParLength> iMimeType;
+
+        // The preferred supplier of video controller (e.g. "Company X").
+        TBuf<KCaeMaxVideoStringParLength> iPreferredSupplier;
+
+        // The video type (e.g. "video/H263-2000").
+        TBuf8<KCaeMaxVideoStringParLength> iVideoType;
+
+        // The audio type expressed with four characters (e.g. " AMR").
+        TBuf8<KCaeMaxAudioTypeStringParLength> iAudioType;
+
+        // The estimated video recording bit rate to storage (bits per second).
+        TInt iStorageRate;
+    };
+
+
+#endif // CAEVIDEOQUALITYLEVELS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Inc/CaeVideoTimes.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine video times provider class
+*
+*/
+
+
+
+#ifndef CAEVIDEOTIMES_H
+#define CAEVIDEOTIMES_H
+
+// INCLUDES
+#include <e32base.h>
+
+
+// CLASS DECLARATION
+
+/**
+* Video recording times generator class.
+* Generates elapsed and remaining recording time info periodically.
+*/
+NONSHARABLE_CLASS( CCaeVideoTimes ) : public CPeriodic
+    {
+
+    public:  // Constructors and destructor    
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CCaeVideoTimes* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CCaeVideoTimes();
+
+    private: // From CPeriodic base class CActive.
+
+        /**
+        * From CActive, called if CCaeVideoTimes function RunL() leaves.
+        * @param aError Standard Symbian OS error code
+        * @return Error code KErrNone
+        */
+        TInt RunError( 
+            TInt aError );
+
+    private: // Private methods.
+        
+        /**
+        * C++ constructor.
+        */
+        CCaeVideoTimes();
+
+        /**
+        * Symbian OS 2nd phase constructor that can leave.
+        */
+        void ConstructL();
+
+    };
+
+#endif // CAEVIDEOTIMES_H   
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeCallbackActive.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2003,2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Active object for calling Camera Application Engine methods 
+*                indirectly from callbacks
+*
+*/
+
+
+// INCLUDE FILES
+#include "CaeCallbackActive.h"
+#include "CaeEngineImp.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+// ---------------------------------------------------------------------------
+// CCaeCallbackActive::CCaeCallbackActive()
+// C++ constructor.
+// Adds the object to the Active Scheduler.
+// ---------------------------------------------------------------------------
+//
+CCaeCallbackActive::CCaeCallbackActive( 
+    CCaeEngineImp& aCamAppEngine )
+: CActive( EPriorityStandard ), iCamAppEngine( aCamAppEngine )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeCallbackActive::CCaeCallbackActive()
+// Destructor. 
+// Cancels operation and closes the timer.
+// ---------------------------------------------------------------------------
+//
+CCaeCallbackActive::~CCaeCallbackActive()
+    {
+    Cancel();
+    iTimer.Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeCallbackActive::NewLC()
+// Symbian OS two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCaeCallbackActive* CCaeCallbackActive::NewLC( 
+    CCaeEngineImp& aCamAppEngine )
+    {
+    CCaeCallbackActive* self = new( ELeave ) CCaeCallbackActive( aCamAppEngine );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeCallbackActive::NewL()
+// Symbian OS two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCaeCallbackActive* CCaeCallbackActive::NewL( 
+    CCaeEngineImp& aCamAppEngine )
+    {
+    CCaeCallbackActive* self = NewLC( aCamAppEngine );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeCallbackActive::ConstructL()
+// Symbian OS 2nd phase constructor that can leave.
+// ---------------------------------------------------------------------------
+//
+void CCaeCallbackActive::ConstructL()
+    {
+    User::LeaveIfError( iTimer.CreateLocal() );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeCallbackActive::PowerOn()
+// Switches camera power on.
+// ---------------------------------------------------------------------------
+//
+void CCaeCallbackActive::PowerOn()
+    {
+    LOGTEXT( _L( "Cae: CCaeCallbackActive::PowerOn() entering" ) );
+
+    _LIT( KPowerOnPanic, "CCaeCallbackActive::PowerOn");
+    __ASSERT_ALWAYS( !IsActive(), User::Panic( KPowerOnPanic, 1 ) );
+
+    iRequest = CCaeCallbackActive::ERequestPowerOn;
+
+    SetActive();
+    TRequestStatus* statusPtr = &iStatus;
+    User::RequestComplete( statusPtr, KErrNone );
+
+    LOGTEXT( _L( "Cae: CCaeCallbackActive::PowerOn() returning" ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeCallbackActive::RunL()
+// Calls Camera Application Engine operation.
+// ---------------------------------------------------------------------------
+//
+void CCaeCallbackActive::RunL()
+    {
+    LOGTEXT( _L( "Cae: CCaeCallbackActive::RunL() entering" ) );
+
+    switch ( iRequest ) 
+        {
+        case CCaeCallbackActive::ERequestPowerOn:
+            // Call Camera Application Engine to switch camera power on.
+            iCamAppEngine.PowerOn();
+            break;
+        default:
+            break;
+        }
+
+    LOGTEXT( _L( "Cae: CCaeCallbackActive::RunL() returning" ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeCallbackActive::DoCancel()
+// Cancels request.
+// ---------------------------------------------------------------------------
+//
+void CCaeCallbackActive::DoCancel()
+    {
+    iTimer.Cancel();
+    iRequest = CCaeCallbackActive::ERequestDefault;
+    }
+
+
+// End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeDbgUtilities.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Utilities for Camera Application Engine.
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <e32svr.h>
+#include "CaeDbgUtilities.h"
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+#ifdef _DEBUG
+
+// ---------------------------------------------------------------------------
+// PrintMemoryInfo()
+// Print memory info. 
+// Output format: free heap (biggest block), free RAM
+// ---------------------------------------------------------------------------
+//
+void PrintMemoryInfo()
+    {
+    // Print memory info
+    TInt biggestBlock = 0;
+    TInt available = User::Available( biggestBlock );
+
+    TMemoryInfoV1Buf membuf;
+    UserHal::MemoryInfo( membuf );
+    TMemoryInfoV1 minfo = membuf();
+
+    TBuf<256> text;
+    text.Format( _L( "free heap:%d(%d) Kb, free ram: %d Kb" ), 
+        available / 1024, biggestBlock / 1024, minfo.iFreeRamInBytes / 1024 );
+
+    LOGTEXT(text);
+    }
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeEngineImpInfo.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine implementation information getting method
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CaeEngineImp.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::InitializeInfo
+// Initialize Camera Application Engine information class.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::InitializeInfo( 
+    const CCamera& aCamera )
+    {
+
+    // Initialise Camera (API) info.
+
+    TCameraInfo cameraInfo;
+    aCamera.CameraInfo( cameraInfo );
+
+    iInfo->iCaeOptionsSupported = 0;
+
+    iInfo->iHardwareVersion = cameraInfo.iHardwareVersion;
+    iInfo->iSoftwareVersion = cameraInfo.iSoftwareVersion;
+
+    iInfo->iOrientation = cameraInfo.iOrientation;
+
+    iInfo->iOptionsSupported = cameraInfo.iOptionsSupported;
+    
+    iInfo->iFlashModesSupported = cameraInfo.iFlashModesSupported;
+
+    iInfo->iExposureModesSupported = cameraInfo.iExposureModesSupported;
+
+    iInfo->iWhiteBalanceModesSupported = cameraInfo.iWhiteBalanceModesSupported;
+
+    iInfo->iMinZoom = cameraInfo.iMinZoom;
+    iInfo->iMaxZoom = cameraInfo.iMaxZoom;
+    iInfo->iMaxDigitalZoom = cameraInfo.iMaxDigitalZoom;
+
+    iInfo->iMinZoomFactor = cameraInfo.iMinZoomFactor;
+    iInfo->iMaxZoomFactor = cameraInfo.iMaxZoomFactor;
+    iInfo->iMaxDigitalZoomFactor = cameraInfo.iMaxDigitalZoomFactor;
+
+    iInfo->iNumImageSizesSupported = cameraInfo.iNumImageSizesSupported;
+    iInfo->iImageFormatsSupported = cameraInfo.iImageFormatsSupported;
+
+    // Initialize EV compensation info (no supported in this version)
+    iInfo->iMinEvCompensation = 0;
+    iInfo->iMaxEvCompensation = 0;
+    iInfo->iMinEvCompensationValue = 0;
+    iInfo->iMaxEvCompensationValue = 0;
+
+    // Initialize engine info.
+
+    iInfo->iNumStillQualityLevelsSupported = 0; // Quality levels are initialized separately.
+    iInfo->iNumVideoQualityLevelsSupported = 0; // Quality levels are initialized separately.
+
+    iInfo->iCaeOptionsSupported |= StillBurstSupport();
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeEngineImpStillAndVf.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,3029 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine implementation still capturing, 
+*                settings, and view finder methods
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include <fbs.h>                            // For CFbsBitmap
+
+#include "CaeEngineImp.h"                   // Engine implementation header.
+#include "CaeStillQualityLevels.h"          // For still capturing quality levels.
+#include "CaeVideoQualityLevels.h"          // Needed just in destructor.
+#include "CaeVideoTimes.h"                  // Needed just in destructor.
+#include "CaeStillStatesActive.h"                
+
+#ifdef CAE_TEST_VERSION
+#include "CaeEngineImpTestErrors.h"         // For TEST_VERSION compilation only
+#endif
+
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CaeEngineImpStillAndVfTraces.h"
+#endif
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngine::NewL
+// Two-phased constructor. Calls CCaeEngineImp's NewL().
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CCaeEngine* CCaeEngine::NewL()
+    {
+    return CCaeEngineImp::NewL();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::CCaeEngineImp
+// Default constructor.
+// -----------------------------------------------------------------------------
+//
+CCaeEngineImp::CCaeEngineImp(): 
+    iZoomMode( EZoomModeDigital ), 
+    iExposureMode( CCamera::EExposureAuto ),
+    iWhiteBalanceMode( CCamera::EWBAuto ), 
+    iFlashMode( CCamera::EFlashNone ),
+    iVideoTimesInterval( KVideoTimesIntervalDefault ), 
+    iMaxClipSizeInBytes( KMMFNoMaxClipSize ), 
+    iMaxClipSizeInBytesPrep( KMMFNoMaxClipSize )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::~CCaeEngineImp
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CCaeEngineImp::~CCaeEngineImp()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::~CCaeEngineImp() entering" ) );
+
+    // Cancels/closes/stops still capturing, video recording, and view finding.
+    CancelAllActivities();
+
+    // Delete extension implementations
+	iExtension.ResetAndDestroy();
+
+    // Delete the state machine
+    // Note: This must be done after destroying extensions because there is some
+    // validity checking in the iStillStatesActive destructor.
+    delete( iStillStatesActive );
+
+    // Delete interface implementation lists. 
+	// Close for each iImplementations before closing 
+	// iExtInterfaceImplementationLists.
+	for ( TInt i = 0; i < iExtInterfaceImplementationLists.Count(); i++ )
+		{
+		iExtInterfaceImplementationLists[i].iImplementations->Close();
+		delete( iExtInterfaceImplementationLists[i].iImplementations );
+		}
+	iExtInterfaceImplementationLists.Close();
+
+    // Delete custom interface list items
+	iExtCustomInterfaceImplementations.Close();
+
+    delete iVideoType;
+    delete iVideoClipFileName;
+
+    // Turn camera power off first, then release camera.
+    if ( iCamera ) 
+        {
+        if ( iReserved ) 
+            {
+            if ( iPowerOn ) 
+                {
+                iCamera->PowerOff();
+                }
+            iCamera->Release();
+            }
+        }
+
+    delete iVideoFrameSizePrep;
+    delete iVideoFrameSize;
+
+    delete iVideoTimes;
+    delete iVideoTimesCallback;
+    delete iVideoRecorder;
+
+    delete iVideoQualityLevelsCont;
+    delete iStillQualityLevelsCont;
+    
+    delete iCallbackActive;
+
+    delete iInfo;
+
+    delete iCamera;
+
+	REComSession::FinalClose();
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::~CCaeEngineImp() returning" ) );
+
+    // For RTRT code coverage analysis.
+    // #pragma attol insert _ATCPQ_DUMP(0);
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ConstructL
+// Symbian 2nd phase constructor that can leave.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ConstructL( TInt aCameraIndex, TInt aDisplayIndex )
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::ConstructL() entering with camera index %d" ), 
+    	aCameraIndex );
+    
+    OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_CONSTRUCTL, "e_CAM_ENG_INIT 1" );   //CAE_ENGINE_INIT_START
+        
+    if ( ( aCameraIndex < 0 ) || 
+         ( aCameraIndex >= CCamera::CamerasAvailable() ) )
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::ConstructL leaving KErrHardwareNotAvailable, aCameraIndex=%d" ), aCameraIndex );
+        User::Leave( KErrHardwareNotAvailable );
+        }
+
+    // Create a new Camera API implementation object, if supported
+    TRAPD( err, iCamera = CCamera::New2L( static_cast<MCameraObserver2&>(*this), aCameraIndex, KCameraPriority ) );
+    if ( err )
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::ConstructL() CCamera::New2L return code=%d" ), err ); 
+
+        // Create old Camera API implementation object.
+        iCamera = CCamera::NewL( static_cast<MCameraObserver&>(*this), aCameraIndex );
+        LOGTEXT( _L( "Cae: CCaeEngineImp::ConstructL() using MCameraObserver" )); 
+        }
+    else
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::ConstructL() using MCameraObserver2" )); 
+        }
+
+
+    // Get camera handle.
+    iCameraHandle = iCamera->Handle();
+
+    // Set display index
+    iDisplayIndex = aDisplayIndex;
+
+    // Create and initialize info object.
+    iInfo = new( ELeave ) TCamAppEngineInfo;
+    InitializeInfo( *iCamera );
+
+    // Create active object for calling methods from callbacks.
+    iCallbackActive = CCaeCallbackActive::NewL( *this );
+
+    // Create still quality levels container object.
+    iStillQualityLevelsCont = CCaeStillQualityLevelsCont::NewL();
+
+    // Set default value for video recording stopping 
+    iAsyncVideoStopEnabled = EFalse;
+    
+	// Create interface lists. 
+	// The order of interface lists in iExtInterfaceImplementationLists
+	// should not be changed later as the order must always match to 
+	// TCaeExtensionInterfaceIndexes enum.
+	for ( TInt i = 0; KCaeSupportedExtensionInterfaceUids[i].iUid != NULL; i++ )
+		{
+		TCaeExtensionInterfaceImplListItem listItem;
+
+		RArray<TCaeExtensionInterfaceImplItem>* emptyImplementationArray = 
+			new(ELeave) RArray<TCaeExtensionInterfaceImplItem>(
+			TCaeExtensionInterfaceImplItemGranularity );
+
+		listItem.iInterfaceUid = KCaeSupportedExtensionInterfaceUids[i];
+		listItem.iImplementations = emptyImplementationArray; 
+		
+		// Copy the list item to the end of the list.Give ownership of 
+        // emptyImplementationArray.
+        CleanupStack::PushL( emptyImplementationArray );
+		iExtInterfaceImplementationLists.AppendL( listItem ); 
+        CleanupStack::Pop( emptyImplementationArray );
+		}
+
+    // Create the state machine for still capturing
+    iStillStatesActive = CCaeStillStatesActive::NewL( *iCamera, *iInfo,
+        *( iExtInterfaceImplementationLists[KCaeExtProcessImageInterfaceIndex].iImplementations  ) );
+
+	// Create extensions and populate the extension array 
+	PopulateExtensionArrayL();
+    
+    OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_CONSTRUCTL, "e_CAM_ENG_INIT 0" );  //CAE_ENGINE_INIT_END
+    
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ConstructL() returning" ) );
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCaeEngineImp* CCaeEngineImp::NewL()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::NewL() entering" ) );
+
+    CCaeEngineImp* self = new( ELeave ) CCaeEngineImp();
+
+    CleanupStack::PushL( self );
+    self->ConstructL( 0, 0 ); // Construct with default camera index 0 and display index 0
+    CleanupStack::Pop( self );
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::NewL() returning" ) );
+
+    return self;
+    }
+
+    
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PopulateExtensionArrayL
+// Get a list of extension implementations via ECom, construct the extensions and 
+// add those the the array.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PopulateExtensionArrayL()
+	{
+	LOGTEXT( _L( "Cae: CCaeEngineImp::PopulateExtensionArrayL() entering" ) );
+
+	// Get a list of all extensions from ECom
+	TEComResolverParams resolverParams;
+	resolverParams.SetDataType ( KExtensionTypeStringDesc );
+	resolverParams.SetWildcardMatch ( EFalse );
+	RImplInfoPtrArray implInfoArray;
+	REComSession::ListImplementationsL( KExtensionInterfaceUid, resolverParams, 
+		implInfoArray );
+	// This should be called only after ListImplementationsL
+	CleanupResetAndDestroyPushL( implInfoArray ); 
+    
+	LOGTEXT2( _L( "Cae: CCaeEngineImp::PopulateExtensionArrayL: extension count: %d" ),
+		implInfoArray.Count());
+	
+	// Create each extension via ECom and add it to the list 
+	for ( TInt i = 0; i < implInfoArray.Count(); i++ )
+		{		
+		MExtension* extension = NULL;
+		
+		// Trap the construction as if one extension fails to construct it 
+		// should not stop others from constructing
+    	LOGTEXT2( _L( "Cae: CCaeEngineImp::PopulateExtensionArrayL: load extension uid=%x" ),
+	    	implInfoArray[i]->ImplementationUid().iUid);
+		
+		TRAPD( error, extension = MExtension::NewExtensionL( 
+			implInfoArray[i]->ImplementationUid(), 
+			(MExtensionCallbackInterface*) this ));
+
+		if ( error || !extension)
+			{
+			// If one extension is failing we skip that.
+			#ifdef _DEBUG
+			TBuf<256> text;
+			text.Format(_L( "Cae: CCaeEngineImp::PopulateExtensionArrayL: NewExtensionL leaved, uid=%x, error=%d, extension=%x" ),
+				implInfoArray[i]->ImplementationUid().iUid, error, extension );
+			LOGTEXT( text );
+			#endif
+
+			delete( extension );
+			}
+		else
+			{
+			iExtension.AppendL( extension );
+			}
+		}
+
+	CleanupStack::PopAndDestroy( &implInfoArray );
+
+	LOGTEXT( _L( "Cae: CCaeEngineImp::PopulateExtensionArrayL() returning" ) );
+	}
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetCamAppEngineObserver
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetCamAppEngineObserver( MCamAppEngineObserver& aObserver )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetCamAppEngineObserver()" ) );
+
+    iCaeObserver = &aObserver;
+    iStillStatesActive->SetCamAppEngineObserver( aObserver );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::GetInfo
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::GetInfo( TCamAppEngineInfo& aInfo ) const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::GetInfo()" ) );
+ 
+    aInfo = *iInfo;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::InitL
+// Initialise the engine for still image capturing using default parameters.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::InitL( TBool aCreateSnapImage )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::InitL() entering" ) );
+
+    iStillStatesActive->SetSnapImageCreation( aCreateSnapImage );
+
+    // To allow re-initialization, release the camera (first cancels possible 
+    // activities and turns camera power off).
+    Release();
+
+    // Init to default quality levels.
+    iInfo->iNumStillQualityLevelsSupported = 
+        iStillQualityLevelsCont->InitDefaultsL();
+
+    // Reserve camera (and after succesfull reserve, camera power will be 
+    // turned on).
+
+    iResetToPreviousSettings = ETrue; // This requests here to set the camera
+                                      // to default settings after power is on.
+    iCamera->Reserve();
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::InitL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::InitL
+// Initialise the engine for still image capturing either using default 
+// parameters or parameters from ini-file.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::InitL( 
+    TUid aSdUidStillQltyLevels, 
+    TBool aCreateSnapImage )
+    {
+    if( aSdUidStillQltyLevels == KNullUid )
+        {
+        InitL( aCreateSnapImage );
+        }
+    else
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::InitL(aSdUidStillQltyLevels): NOT SUPPORTED, leaving" ) );
+        User::Leave( KErrNotSupported );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::Reserve
+// Calls Camera API Reserve().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::Reserve()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::Reserve() entering" ) );
+
+    if ( !iReserved ) 
+        {
+        iResetToPreviousSettings = ETrue;
+        iCamera->Reserve();
+        }
+    else if ( !iPowerOn ) // in case previous reserve ok, but poweron failed
+        {
+        PowerOn();
+        }
+
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::Reserve() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::Release
+// Calls Camera API Release().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::Release()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::Release() entering" ) );
+
+    if ( iReserved ) 
+        {
+        PowerOff();         // Cancel all activities (if any) and turn power off.
+        iCamera->Release(); // Release Camera HW.
+        iReserved = EFalse;
+        iStillPrepared = EFalse;
+        iVideoPrepared = EFalse;
+        iVideoOpened = EFalse;
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::Release() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PowerOn
+// Calls Camera API PowerOn().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PowerOn()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PowerOn() entering" ) );
+
+    if ( iReserved && !iPowerOn ) 
+        {
+        iCamera->PowerOn();
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PowerOn() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PowerOff
+// Calls Camera API PowerOff().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PowerOff()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PowerOff() entering" ) );
+
+    if ( iPowerOn ) 
+        {
+        CancelAllActivities();
+        iCamera->PowerOff();
+        iPowerOn = EFalse;
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PowerOff() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetZoomModeL
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetZoomModeL( 
+    TZoomMode aZoomMode )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetZoomModeL() entering" ) );
+
+    // Currently supporting digital and optical zooms, not EZoomModeOpticalDigital.
+    if ( ( aZoomMode != EZoomModeDigital ) && ( aZoomMode != EZoomModeOptical ) )
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::SetZoomModeL leaving KErrNotSupported, aZoomMode=%d" ), aZoomMode );
+        User::Leave( KErrNotSupported );
+        }
+
+    iZoomMode = aZoomMode;
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetZoomModeL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ZoomMode
+// -----------------------------------------------------------------------------
+//
+CCaeEngine::TZoomMode CCaeEngineImp::ZoomMode() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ZoomMode()" ) );
+
+    return iZoomMode;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetZoomValueL
+// Calls Camera API SetDigitalZoomFactorL() or SetZoomFactorL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetZoomValueL( 
+    TInt aZoomValue )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetZoomValueL() entering" ) );
+
+    CheckPowerL();
+
+    switch ( iZoomMode )
+        {
+        case EZoomModeDigital:
+            // Leave if zoom factor is out of range.
+            if ( ( aZoomValue < 0 ) || 
+                 ( aZoomValue > iInfo->iMaxDigitalZoom ) )
+                {
+                LOGTEXT2( _L( "Cae: CCaeEngineImp::SetZoomValueL leaving KErrArgument, aZoomValue=%d" ), aZoomValue );
+                User::Leave( KErrArgument );
+                }
+            // Set DIGITAL zoom value.
+            iCamera->SetDigitalZoomFactorL( aZoomValue );
+            iZoomValue = aZoomValue;
+            break;
+        case EZoomModeOptical:
+            // Leave if zoom factor is out of range.
+            if ( ( aZoomValue < iInfo->iMinZoom ) || 
+                 ( aZoomValue > iInfo->iMaxZoom ) )
+                {
+                LOGTEXT2( _L( "Cae: CCaeEngineImp::SetZoomValueL leaving KErrArgument, aZoomValue=%d" ), aZoomValue );
+                User::Leave( KErrArgument );
+                }
+            // Set OPTICAL zoom value.
+            iCamera->SetZoomFactorL( aZoomValue );
+            iZoomValue = aZoomValue;
+            break;
+        default:
+            // EZoomModeOpticalDigital not supported
+            LOGTEXT2( _L( "Cae: CCaeEngineImp::SetZoomValueL leaving KErrNotSupported, iZoomMode=%d" ), iZoomMode );
+            User::Leave( KErrNotSupported );
+            break;
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetZoomValueL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ZoomValue
+// Calls Camera API DigitalZoomFactor() or ZoomFactor().
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::ZoomValue() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ZoomValue()" ) );
+
+    TInt zoomValue( 0 );
+    if ( iPowerOn )
+        {
+        switch ( iZoomMode )
+            {
+            case EZoomModeDigital:
+                zoomValue = iCamera->DigitalZoomFactor();
+                break;
+            case EZoomModeOptical:
+                zoomValue = iCamera->ZoomFactor();
+                break;
+            default:
+                // EZoomModeOpticalDigital not supported
+                break;
+            }
+        }
+    return zoomValue;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetBrightnessL
+// Calls Camera API SetBrightnessL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetBrightnessL( 
+    TInt aBrightness )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetBrightnessL() entering" ) );
+
+    // Leave if not supported.
+    if ( !( iInfo->iOptionsSupported & TCameraInfo::EBrightnessSupported ) )
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::SetBrightnessL leaving KErrNotSupported, aBrightness=%d" ), aBrightness );
+        User::Leave( KErrNotSupported );
+        }
+
+    CheckPowerL();
+
+    iCamera->SetBrightnessL( aBrightness );
+    iBrightness = aBrightness;
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetBrightnessL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::Brightness
+// Calls Camera API Brightness().
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::Brightness() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::Brightness()" ) );
+
+    TInt brightness( 0 );
+    if ( iPowerOn && ( iInfo->iOptionsSupported & TCameraInfo::EBrightnessSupported ) )
+        {
+        brightness = iCamera->Brightness();
+        }
+    return brightness;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetContrastL
+// Calls Camera API SetContrastL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetContrastL( 
+    TInt aContrast )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetContrastL() entering" ) );
+
+    // Leave if not supported.
+    if ( !( iInfo->iOptionsSupported & TCameraInfo::EContrastSupported ) )
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::SetContrastL leaving KErrNotSupported, aContrast=%d" ), aContrast );
+        User::Leave( KErrNotSupported );
+        }
+
+    CheckPowerL();
+
+    iCamera->SetContrastL( aContrast );
+    iContrast = aContrast;
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetContrastL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::Contrast
+// Calls Camera API Contrast().
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::Contrast() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::Contrast()" ) );
+
+    TInt contrast( 0 );
+    if ( iPowerOn && ( iInfo->iOptionsSupported & TCameraInfo::EContrastSupported ) )
+        {
+        contrast = iCamera->Contrast();
+        }
+    return contrast;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetExposureModeL
+// Calls Camera API SetExposureModeL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetExposureModeL( 
+    CCamera::TExposure aExposureMode )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetExposureModeL() entering" ) );
+
+    // Leave is requested exposure mode is not supported, 
+    // EExposureAuto should be always supported.
+    if ( ( ( aExposureMode != CCamera::EExposureAuto ) && 
+          !( aExposureMode & iInfo->iExposureModesSupported ) ) ||
+           ( aExposureMode < 0 ) )
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::SetExposureModeL leaving KErrNotSupported, aExposureMode=%d" ), aExposureMode );
+        User::Leave( KErrNotSupported );
+        }
+
+    CheckPowerL();
+
+    iCamera->SetExposureL( aExposureMode );
+    iExposureMode = aExposureMode;
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetExposureModeL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ExposureMode
+// Calls Camera API Exposure().
+// -----------------------------------------------------------------------------
+//
+CCamera::TExposure CCaeEngineImp::ExposureMode() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ExposureMode()" ) );
+
+    CCamera::TExposure exposureMode( CCamera::EExposureAuto );
+    if ( iPowerOn )
+        {
+        exposureMode = iCamera->Exposure();
+        }
+    return exposureMode;
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetEvCompensationL
+// If the interface exists, calls Camera API SetEvCompensationL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetEvCompensationL( 
+    TInt /*aEvIndex*/ )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetEvCompensationL() (not supported) leaving" ) );
+
+    User::Leave( KErrNotSupported );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::EvCompensation
+// If the interface exists, calls Camera API EvCompensation().
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::EvCompensation() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::EvCompensation() (not supported!)" ) );
+
+    return( 0 );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetWhiteBalanceModeL
+// Calls Camera API SetWhiteBalanceL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetWhiteBalanceModeL( 
+    CCamera::TWhiteBalance aWhiteBalanceMode )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetWhiteBalanceModeL() entering" ) );
+
+    // Leave is requested WB mode is not supported. 
+    // EWBAuto is always supported.
+    if ( ( ( aWhiteBalanceMode != CCamera::EWBAuto ) && 
+          !( aWhiteBalanceMode & iInfo->iWhiteBalanceModesSupported ) ) ||
+           ( aWhiteBalanceMode < 0 ) )
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::SetWhiteBalanceModeL leaving KErrNotSupported, aWhiteBalanceMode=%d" ), aWhiteBalanceMode );
+        User::Leave( KErrNotSupported );
+        }
+    
+    CheckPowerL();
+
+    iCamera->SetWhiteBalanceL( aWhiteBalanceMode );
+    iWhiteBalanceMode = aWhiteBalanceMode;
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetWhiteBalanceModeL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::WhiteBalanceMode
+// Calls Camera API WhiteBalance().
+// -----------------------------------------------------------------------------
+//
+CCamera::TWhiteBalance CCaeEngineImp::WhiteBalanceMode() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::WhiteBalanceMode()" ) );
+
+    CCamera::TWhiteBalance whiteBalanceMode( CCamera::EWBAuto );
+    if ( iPowerOn )
+        {
+        whiteBalanceMode = iCamera->WhiteBalance();
+        }
+    return whiteBalanceMode;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetFlashModeL
+// Calls Camera API SetFlashL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetFlashModeL( 
+    CCamera::TFlash aFlashMode )
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::SetFlashModeL() entering, mode=%d" ), aFlashMode );
+
+    // Leave is requested flash mode is not supported. 
+    // EFlashNone is always supported.
+    if ( ( ( aFlashMode != CCamera::EFlashNone ) && 
+          !( aFlashMode & iInfo->iFlashModesSupported ) ) || 
+           ( aFlashMode < 0 ) )
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::SetFlashModeL leaving KErrNotSupported, aFlashMode=%d" ), aFlashMode );
+        User::Leave( KErrNotSupported );
+        }
+
+    CheckPowerL();
+
+    iCamera->SetFlashL( aFlashMode );
+    iFlashMode = aFlashMode;
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetFlashModeL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::FlashMode
+// Calls Camera API Flash().
+// -----------------------------------------------------------------------------
+//
+CCamera::TFlash CCaeEngineImp::FlashMode() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::FlashMode()" ) );
+
+    CCamera::TFlash flashMode( CCamera::EFlashNone );
+    if ( iPowerOn )
+        {
+        flashMode = iCamera->Flash();
+        }
+    return flashMode;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ResetToDefaultsL
+// Resets the following settings: exposure mode, white balance mode, 
+// zoom mode, zoom value, flash mode, brightness, and contrast.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ResetToDefaultsL()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ResetToDefaultsL() entering" ) );
+
+    SetExposureModeL();
+    SetWhiteBalanceModeL();
+    SetZoomModeL();
+    SetZoomValueL();
+    SetFlashModeL();
+
+    // Reset this setting only if it is supported by Camera API.
+    if ( iInfo->iOptionsSupported & TCameraInfo::EBrightnessSupported )
+        {
+        SetBrightnessL();
+        }
+
+    // Reset this setting only if it is supported by Camera API.
+    if ( iInfo->iOptionsSupported & TCameraInfo::EContrastSupported )
+        {
+        SetContrastL();
+        }
+
+ 	// Process extensions
+	RArray<TCaeExtensionInterfaceImplItem>* settingsImplementationList = 
+		iExtInterfaceImplementationLists[KCaeExtSettingsInterfaceIndex].iImplementations;
+
+	for ( TInt i = 0; i < settingsImplementationList->Count(); i++ )
+		{
+		TRAPD(err, STATIC_CAST( MCaeExtSettingsInterface*, 
+		(*settingsImplementationList)[i].iImplPtr )->ResetToDefaultsL() );
+
+	    #ifdef _DEBUG
+		if ( err )
+		    {
+			LOGTEXT3(_L("Cae: CCaeEngineImp::ResetToDefaultsL(). Error %d in ResetToDefaultsL() for Extension %x"),
+			    err, (*settingsImplementationList)[i].iImplUid.iUid );
+			}
+		#endif
+		
+		User::LeaveIfError( err ); 
+		}
+
+   LOGTEXT( _L( "Cae: CCaeEngineImp::ResetToDefaultsL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetViewFinderMirrorL
+// Calls Camera API SetViewFinderMirrorL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetViewFinderMirrorL( 
+    TBool aMirror )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetViewFinderMirrorL() entering" ) );
+
+    // Leave if not supported.
+    if ( !( iInfo->iOptionsSupported & TCameraInfo::EViewFinderMirrorSupported ) )
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::SetViewFinderMirrorL leaving KErrNotSupported, aMirror=%d" ), aMirror );
+        User::Leave( KErrNotSupported );
+        }
+        
+    CheckPowerL();
+
+    iCamera->SetViewFinderMirrorL( aMirror );    
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetViewFinderMirrorL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ViewFinderMirror
+// Calls Camera API ViewFinderMirror().
+// -----------------------------------------------------------------------------
+//
+TBool CCaeEngineImp::ViewFinderMirror() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ViewFinderMirror()" ) );
+
+    // If supported, query the setting from Camera API.
+    TBool viewFinderMirror( EFalse );
+    if ( iPowerOn && ( iInfo->iOptionsSupported & TCameraInfo::EViewFinderMirrorSupported ) )
+        {
+        viewFinderMirror = iCamera->ViewFinderMirror();
+        }
+    return viewFinderMirror;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::StartViewFinderBitmapsL
+// Calls Camera API StartViewFinderBitmapsL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::StartViewFinderBitmapsL( 
+    TSize& aVfFrameSize )
+    {
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::StartViewFinderBitmapsL() entering aVfFrameSize wxh=%dx%d" ),
+            aVfFrameSize.iWidth, aVfFrameSize.iHeight );
+
+    // Leave if not supported.
+    if ( !( iInfo->iOptionsSupported & TCameraInfo::EViewFinderBitmapsSupported ) )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::StartViewFinderBitmapsL leaving KErrNotSupported" ));
+        User::Leave( KErrNotSupported );
+        }
+
+    if ( iPowerOn ) 
+        {
+        if ( !iCamera->ViewFinderActive() ) 
+            {
+            iTrueViewFinderSize = aVfFrameSize;
+            iCamera->StartViewFinderBitmapsL( iTrueViewFinderSize );
+            iViewFinderRunning = ETrue;
+            iStillStatesActive->SetViewFinderMode( iViewFinderRunning );
+            }
+        }
+
+    if ( !iViewFinderRunning )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::StartViewFinderBitmapsL leaving KErrNotReady (iViewFinderRunning)" ));
+        User::Leave( KErrNotReady );
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::StartViewFinderBitmapsL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::StartViewFinderBitmapsL
+// Cropped version.
+// Calls Camera API StartViewFinderBitmapsL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::StartViewFinderBitmapsL( 
+    TSize& aVfFrameSize, 
+    TRect& aCropRect )
+    {
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::StartViewFinderBitmapsL() entering aVfFrameSize wxh=%dx%d" ),
+            aVfFrameSize.iWidth, aVfFrameSize.iHeight );
+
+    // Leave if not supported.
+    if ( !( iInfo->iOptionsSupported & TCameraInfo::EViewFinderBitmapsSupported ) || 
+         !( iInfo->iOptionsSupported & TCameraInfo::EViewFinderClippingSupported )  )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::StartViewFinderBitmapsL (cropped) leaving KErrNotSupported" ));
+        User::Leave( KErrNotSupported );
+        }
+
+    if ( iPowerOn ) 
+        {
+        if ( !iCamera->ViewFinderActive() ) 
+            {
+            iTrueViewFinderSize = aVfFrameSize;
+            iCamera->StartViewFinderBitmapsL( iTrueViewFinderSize, aCropRect );
+            iViewFinderRunning = ETrue;
+            iStillStatesActive->SetViewFinderMode( iViewFinderRunning );
+            }
+        }
+
+    if ( !iViewFinderRunning )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::StartViewFinderBitmapsL (cropped) leaving KErrNotReady" ));
+        User::Leave( KErrNotReady );
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::StartViewFinderBitmapsL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::StartViewFinderDirectL
+// Calls Camera API StartViewFinderDirectL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::StartViewFinderDirectL( 
+    RWsSession& aWs, 
+    CWsScreenDevice& aScreenDevice, 
+    RWindowBase& aWindow, 
+    TRect& aScreenRect )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::StartViewFinderDirectL() entering" ) );
+
+    // Leave if not supported.
+    if ( !( iInfo->iOptionsSupported & TCameraInfo::EViewFinderDirectSupported ) )
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::StartViewFinderDirectL leaving KErrNotSupported, iOptionsSupported=0x%x" ), iInfo->iOptionsSupported );
+        User::Leave( KErrNotSupported );
+        }
+
+    if ( iPowerOn )
+        {
+        if ( !iCamera->ViewFinderActive() )
+            {
+            iCamera->StartViewFinderDirectL( aWs, aScreenDevice, aWindow, aScreenRect );
+            iViewFinderRunning = ETrue;
+            iStillStatesActive->SetViewFinderMode( iViewFinderRunning );
+            }
+        }
+    
+    if ( !iViewFinderRunning )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::StartViewFinderDirectL leaving KErrNotReady" ));
+        User::Leave( KErrNotReady );
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::StartViewFinderDirectL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::StartViewFinderDirectL
+// Cropped version.
+// Calls Camera API StartViewFinderDirectL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::StartViewFinderDirectL( 
+    RWsSession& aWs,
+    CWsScreenDevice& aScreenDevice,
+    RWindowBase& aWindow,
+    TRect& aScreenRect,
+    TRect& aCropRect )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::StartViewFinderDirectL() entering" ) );
+
+    // Leave if not supported.
+    if ( !( iInfo->iOptionsSupported & TCameraInfo::EViewFinderDirectSupported ) || 
+         !( iInfo->iOptionsSupported & TCameraInfo::EViewFinderClippingSupported ) )
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::StartViewFinderDirectL (cropped) leaving KErrNotSupported, iOptionsSupported=0x%x" ), iInfo->iOptionsSupported );
+        User::Leave( KErrNotSupported );
+        }
+
+    if ( iPowerOn )
+        {
+        if ( !iCamera->ViewFinderActive() )
+            {
+            iCamera->StartViewFinderDirectL( aWs, aScreenDevice, aWindow, aScreenRect, aCropRect );
+            iViewFinderRunning = ETrue;
+            iStillStatesActive->SetViewFinderMode( iViewFinderRunning );
+           }
+        }
+
+    if ( !iViewFinderRunning )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::StartViewFinderDirectL (cropped) leaving KErrNotReady" ));
+        User::Leave( KErrNotReady );
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::StartViewFinderDirectL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::StopViewFinder
+// Calls Camera API ViewFinderActive() and StopViewFinder().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::StopViewFinder()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::StopViewFinder() entering" ) );
+
+    if ( iPowerOn )
+        {
+        if ( iCamera->ViewFinderActive() )
+            {
+            iCamera->StopViewFinder();
+            iViewFinderRunning = EFalse;
+            iStillStatesActive->SetViewFinderMode( iViewFinderRunning );
+            }
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::StopViewFinder() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::IsViewFinding
+// Calls Camera API ViewFinderActive().
+// -----------------------------------------------------------------------------
+//
+TBool CCaeEngineImp::IsViewFinding() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::IsViewFinding()" ) );
+
+    TBool isViewFinding( EFalse );
+    if ( iPowerOn ) 
+        {
+        isViewFinding = iCamera->ViewFinderActive();
+        }
+    return isViewFinding;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::GetViewFinderSize
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::GetViewFinderSize( 
+    TSize& aVfFrameSize )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::GetViewFinderSize()" ) );
+
+    aVfFrameSize = iTrueViewFinderSize;
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetCaeStillBurstObserver
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetCaeStillBurstObserver( 
+    MCaeStillBurstObserver& aObserver )
+    {
+    iStillStatesActive->SetCaeStillBurstObserver( aObserver );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetStillCaptureImageCountL
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::SetStillCaptureImageCountL( 
+    TInt aImageCount )
+    {
+    return ( iStillStatesActive->SetStillCaptureImageCountL( aImageCount ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::StillCaptureImageCount
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::StillCaptureImageCount() const
+    {
+    return ( iStillStatesActive->StillCaptureImageCount() );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetStillBurstCaptureIntervalL
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetStillBurstCaptureIntervalL( 
+    TTimeIntervalMicroSeconds aInterval )
+    {
+    iStillStatesActive->SetStillBurstCaptureIntervalL( aInterval );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::StillBurstCaptureInterval
+// -----------------------------------------------------------------------------
+//
+TTimeIntervalMicroSeconds CCaeEngineImp::StillBurstCaptureInterval() const 
+    {
+    return ( iStillStatesActive->StillBurstCaptureInterval() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::StopStillBurstCapture
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::StopStillBurstCapture()
+    {
+    iStillStatesActive->StopStillBurstCapture();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::StillBurstSupport()
+// Return option flag for still burst support.
+// -----------------------------------------------------------------------------
+//
+TCamAppEngineInfo::TOptions CCaeEngineImp::StillBurstSupport()
+    {
+    return TCamAppEngineInfo::EStillBurstSupported;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PrepareStillCaptureL
+// Retrieves parameters for the specified quality level and calls 
+// overloading PrepareStillCaptureL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PrepareStillCaptureL( 
+    TInt aStillQualityIndex )
+    {
+    TSize size = iStillStatesActive->SnapImageSize();
+    PrepareStillCaptureL( aStillQualityIndex, size);
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PrepareStillCaptureL
+// Retrieves parameters for the specified quality level and calls 
+// overloading PrepareStillCaptureL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PrepareStillCaptureL( 
+    TInt         aStillQualityIndex, 
+    TSize&       aSnapSize )
+    {
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::PrepareStillCaptureL() entering aSnapSize wxh=%dx%d" ),
+            aSnapSize.iWidth, aSnapSize.iHeight );
+
+    if ( aStillQualityIndex < 0 || 
+         aStillQualityIndex >= iStillQualityLevelsCont->Count() ) 
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::PrepareStillCaptureL leaving KErrArgument, aStillQualityIndex=%d" ), aStillQualityIndex );
+        User::Leave( KErrArgument );
+        }
+
+    TSize frameSize         = iStillQualityLevelsCont->At( aStillQualityIndex ).iFrameSize;
+    CCamera::TFormat format = iStillQualityLevelsCont->At( aStillQualityIndex ).iOutputFormat;
+    TInt compressionQuality = iStillQualityLevelsCont->At( aStillQualityIndex ).iCompressionQuality;
+    TRect fullRect( frameSize );
+    
+    PrepareStillCaptureL( frameSize, format, compressionQuality, fullRect, aSnapSize );
+    
+    iStillQualityIndex = aStillQualityIndex;
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareStillCaptureL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PrepareStillCaptureL
+// Cropped version.
+// Not supported.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PrepareStillCaptureL( 
+    TInt /*aStillQualityIndex*/, 
+    const TRect& /*aCropRect*/ )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareStillCaptureL() cropped leaving KErrNotSupported" ) );
+
+    User::Leave( KErrNotSupported );
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PrepareStillCaptureL
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PrepareStillCaptureL( 
+    const TSize&      aFrameSize,
+    CCamera::TFormat  aFormat,  
+    TInt              aCompressionQuality )
+    {    
+    TRect fullRect( aFrameSize );
+    PrepareStillCaptureL( aFrameSize, aFormat, aCompressionQuality, fullRect );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PrepareStillCaptureL
+// Cropped version. Using cropping only if supported by Camera API impl.
+// Calls RetrieveStillSizeIndex() that calls Camera API EnumerateCaptureSizes().
+// Calls Camera API PrepareImageCaptureL().
+// Optionally calls Camera API SetJpegQuality().
+// Finally calls McaeoStillPrepareComplete call-back.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PrepareStillCaptureL( 
+    const TSize&      aFrameSize, 
+    CCamera::TFormat  aFormat, 
+    TInt              aCompressionQuality, 
+    const TRect&      aCropRect )
+    {
+    TSize snapSize = iStillStatesActive->SnapImageSize();
+    PrepareStillCaptureL(aFrameSize, aFormat, aCompressionQuality, aCropRect, snapSize );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PrepareStillCaptureL
+// Cropped version. Using cropping only if supported by Camera API impl.
+// Calls RetrieveStillSizeIndex() that calls Camera API EnumerateCaptureSizes().
+// Calls Camera API PrepareImageCaptureL().
+// Optionally calls Camera API SetJpegQuality().
+// Finally calls McaeoStillPrepareComplete call-back.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PrepareStillCaptureL( 
+    const TSize&      aFrameSize, 
+    CCamera::TFormat  aFormat, 
+    TInt              aCompressionQuality, 
+    const TRect&      aCropRect,
+    TSize&            aSnapSize )
+    {
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::PrepareStillCaptureL() entering aFrameSize wxh=%dx%d" ),
+            aFrameSize.iWidth, aFrameSize.iHeight );
+
+    OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_PREPARESTILLCAPTUREL, "e_CAM_ENG_STILL_INIT 1" );   //CAE_ENGINE_STILL_INIT_START
+
+    // Leave if not supported.
+    if ( !( iInfo->iOptionsSupported & TCameraInfo::EImageCaptureSupported ) )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareStillCaptureL() leaving KErrNotSupported (EImageCaptureSupported)" ) );
+        User::Leave( KErrNotSupported );
+        }
+
+    CheckPowerL();
+
+    // Leave if still capturing or video recording is running.
+    if ( iStillStatesActive->IsRunning() || iVideoRecordingRunning ) 
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareStillCaptureL() leaving KErrNotReady (IsRunning)" ) );
+        User::Leave( KErrNotReady );
+        }
+
+    if ( ( aFormat == CCamera::EFormatJpeg ) || ( aFormat == CCamera::EFormatExif ) ) 
+        {
+    	SetJpegQuality( aCompressionQuality ); 
+        }
+    
+    iStillStatesActive->PrepareStillCaptureL( aFrameSize, aFormat, aCropRect, aSnapSize );
+
+    // Prepare ready now.
+    iStillPrepared = ETrue;
+
+    OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_PREPARESTILLCAPTUREL, "e_CAM_ENG_STILL_INIT 0" );  //CAE_ENGINE_STILL_INIT_END
+
+    // Inform client about the success.
+    iCaeObserver->McaeoStillPrepareComplete( KErrNone );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::StillQualityIndex
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::StillQualityIndex() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::StillQualityIndex()" ) );    
+
+    TInt qualityIndex( -1 );
+    if ( iStillPrepared )
+        {
+        qualityIndex = iStillQualityIndex;
+        }
+    return qualityIndex;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::GetStillFrameSize
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::GetStillFrameSize( 
+    TInt aStillQualityIndex, 
+    TSize& aFrameSize ) const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::GetStillFrameSize()" ) );
+    
+    if ( aStillQualityIndex >= 0 &&  
+         aStillQualityIndex < iStillQualityLevelsCont->Count() )
+        {
+        aFrameSize = iStillQualityLevelsCont->At( aStillQualityIndex ).iFrameSize;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::EstimatedStillSizeInBytes
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::EstimatedStillSizeInBytes( 
+    TInt aStillQualityIndex ) const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::EstimatedStillSizeInBytes()" ) );
+
+    TInt byteSize( 0 );
+    if ( aStillQualityIndex >= 0 &&  
+         aStillQualityIndex < iStillQualityLevelsCont->Count() )
+        {
+        byteSize = iStillQualityLevelsCont->At( aStillQualityIndex ).iByteSize;
+        }
+    return byteSize;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::CaptureStill
+// Starts still capturing.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::CaptureStill()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::CaptureStill() entering" ) );
+
+    OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_CAPTURESTILL, "e_CAM_ENG_SHOT_TO_STILL 1" );    //CAE_ENGINE_SHOT_TO_STILL_START
+
+    if ( !iStillStatesActive->IsRunning() ) 
+        {
+        if ( iStillPrepared && iPowerOn && !iVideoRecordingRunning ) 
+            {
+                // Call CAPI without active object delay (for perf reasons)
+                iStillStatesActive->StartQuickCapture();
+
+            }
+        else
+            {
+            // Handle error
+            iStillStatesActive->ErrorRecovery( KErrNotReady );
+            }    
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::CaptureStill() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::CancelCaptureStill
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::CancelCaptureStill()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::CancelCaptureStill() entering" ) );
+
+    if ( iStillStatesActive ) 
+        {
+        iStillStatesActive->CancelCaptureStill();
+        }
+
+    if ( iCallbackActive ) 
+        {
+        iCallbackActive->Cancel();
+        }
+
+    if ( iCamera ) 
+        {
+        iCamera->CancelCaptureImage();
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::CancelCaptureStill() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetSnapImageCreation
+// Sets snap image creation on/off.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetSnapImageCreation( 
+    TBool aCreateSnapImage )
+    {
+    iStillStatesActive->SetSnapImageCreation( aCreateSnapImage );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetSnapImageSource
+// Sets snap image source.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetSnapImageSourceL( 
+    CCaeEngine::TSnapImageSource aSnapImageSource )
+    {
+    iStillStatesActive->SetSnapImageSourceL( aSnapImageSource );
+    }
+
+
+// -----------------------------------------------------------------------------
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetSnapImageSizeL
+// Sets the size of the snap image.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetSnapImageSizeL( 
+    TSize& aSize )
+    {
+    iStillStatesActive->SetSnapImageSizeL( aSize );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetSnapImageColorMode
+// Sets the color mode of the snap image.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetSnapImageColorMode( 
+    TDisplayMode aMode )
+    {
+    iStillStatesActive->SetSnapImageColorMode( aMode );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngine::NewL
+// Two-phased constructor. Calls CCaeEngineImp's NewL() with camera index and
+// default display index 0.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CCaeEngine* CCaeEngine::NewL( 
+    TInt aCameraIndex )
+    {
+    return CCaeEngineImp::NewL( aCameraIndex, 0 );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngine::NewL
+// Two-phased constructor. Calls CCaeEngineImp's NewL() with camera index.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CCaeEngine* CCaeEngine::NewL( 
+    TInt aCameraIndex, TInt aDisplayIndex )
+    {
+    return CCaeEngineImp::NewL( aCameraIndex, aDisplayIndex );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngine::CamerasAvailable
+// Determines the number of cameras on the device.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CCaeEngine::CamerasAvailable()
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngine::CamerasAvailable(): %d" ), CCamera::CamerasAvailable() );
+    return CCamera::CamerasAvailable();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::NewL
+// Two-phased constructor. Inputs camera index.
+// -----------------------------------------------------------------------------
+//
+CCaeEngineImp* CCaeEngineImp::NewL( 
+    TInt aCameraIndex, TInt aDisplayIndex )
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::NewL() entering with camera index %d" ), aCameraIndex );
+
+    CCaeEngineImp* self = new( ELeave ) CCaeEngineImp();
+
+    CleanupStack::PushL( self );
+    self->ConstructL( aCameraIndex, aDisplayIndex );
+    CleanupStack::Pop( self );
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::NewL() returning" ) );
+
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::EnumerateStillCaptureSizes
+// Enumerates through the available image capture sizes.
+// Calls Camera API EnumerateCaptureSizes().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::EnumerateStillCaptureSizes( 
+    TSize& aSize, 
+    TInt aSizeIndex, 
+    CCamera::TFormat aFormat ) const
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::EnumerateStillCaptureSizes() entering aSizeIndex=%d" ), aSizeIndex );
+    iCamera->EnumerateCaptureSizes( aSize, aSizeIndex, aFormat );
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::EnumerateStillCaptureSizes() returning aSize wxh=%dx%d" ),
+           aSize.iWidth, aSize.iHeight );
+   }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetJpegQuality
+// Sets the compression quality value to use with JPEG and Exif image formats.
+// Calls Camera API SetJpegQuality() and the still state machine SetJpegQuality().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetJpegQuality( 
+    TInt aCompressionQuality )
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::SetJpegQuality() entering with %d" ), aCompressionQuality );
+    // Clamp and memorize the image compression quality.
+    if ( aCompressionQuality < 1 )
+        {
+        aCompressionQuality = 1;
+        }
+    if ( aCompressionQuality > 100 ) 
+        {
+        aCompressionQuality = 100;
+        }
+
+    // Set JPEG quality on Camera API.
+    iCamera->SetJpegQuality( aCompressionQuality );
+
+    // Set JPEG quality on the state machine
+    iStillStatesActive->SetJpegQuality( aCompressionQuality );
+
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::SetJpegQuality() returning, memorized %d" ), aCompressionQuality );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::JpegQuality
+// Gets the current compression quality value setting for 
+// JPEG and Exif image formats.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::JpegQuality() const
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::JpegQuality(): %d" ), iStillStatesActive->JpegQuality() );
+    // Memorized image compression quality, set in  
+    // SetJpegQuality() or PrepareStillCaptureL().
+    return( iStillStatesActive->JpegQuality() );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetImageCodecsL
+// Sets the specific image codec implementation to be used in decoding and 
+// encoding.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetImageCodecsL( 
+	TUid aDecoderUid, TUid aEncoderUid )
+    {
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::SetImageCodecsL(): %x, %x" ), aDecoderUid, aEncoderUid );
+    iStillStatesActive->SetImageCodecsL( aDecoderUid, aEncoderUid );
+    }
+
+        
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ReserveComplete
+// Camera reservation is complete. 
+// Called asynchronously when CCamera::Reserve() completes.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ReserveComplete(                                 
+    TInt aError )
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::ReserveComplete() entering, aError=%d" ), aError );
+
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaeReserveCompleteError( aError );
+    #endif    
+
+    if ( aError == KErrNone )
+        {
+        iReserved = ETrue;
+        // Call the active object to switch the power on indirectly.
+        iCallbackActive->PowerOn();
+        }
+    else
+        {
+        iCaeObserver->McaeoInitComplete( aError );
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ReserveComplete() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PowerOnComplete
+// Indicates camera power on is complete.
+// Called on completion of CCamera:PowerOn().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PowerOnComplete( 
+    TInt aError )
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::PowerOnComplete() entering, aError=%d" ), aError );
+
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaePowerOnCompleteError( aError );
+    #endif    
+
+    if ( aError == KErrNone ) 
+        {
+        iPowerOn = ETrue;
+        if ( iResetToPreviousSettings )
+            {
+            iResetToPreviousSettings = EFalse;
+            TRAP( aError, ResetToPreviousSettingsL() );
+            }
+        }
+    
+    iCaeObserver->McaeoInitComplete( aError );
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PowerOnComplete() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ViewFinderFrameReady
+// Transfers the current view finder image from the camera. The frame is 
+// first delivered to the extensions and then to the client.
+// Called periodically in response to the use of 
+// CCamera::StartViewFinderBitmapsL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ViewFinderFrameReady( 
+    CFbsBitmap& aFrame )
+    {
+    //LOGTEXT( _L( "Cae: CCaeEngineImp::ViewFinderFrameReady() entering" ) );
+
+	// Process extensions
+	RArray<TCaeExtensionInterfaceImplItem>* processImageImplList = 
+		iExtInterfaceImplementationLists[KCaeExtProcessImageInterfaceIndex].iImplementations;
+
+	TInt extError = KErrNone;
+	for ( TInt i = 0; i < processImageImplList->Count() && !extError; i++ )
+		{
+		if ( (*processImageImplList)[i].iIsActive )
+		    {
+    		STATIC_CAST( MCaeExtProcessImageInterface*, 
+	    	(*processImageImplList)[i].iImplPtr )->ProcessViewFinderFrame( aFrame, extError );
+		    }
+		else
+		    {
+			// LOGTEXT2(_L("Cae: CCaeEngineImp::ViewFinderFrameReady(). Skipped extension %x"), (*processImageImplList)[i].iImplUid.iUid );
+		    }
+		
+	    #ifdef _DEBUG
+		if ( extError )
+		    {
+			LOGTEXT3(_L("Cae: CCaeEngineImp::ViewFinderFrameReady(). Error %d in extension processing for Extension %x"),
+			    extError, (*processImageImplList)[i].iImplUid.iUid );
+			}
+		#endif
+		}
+
+    iCaeObserver->McaeoViewFinderFrameReady( aFrame, extError );
+
+    iStillStatesActive->ViewFinderFrameReady();
+
+    //LOGTEXT( _L( "Cae: CCaeEngineImp::ViewFinderFrameReady() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ImageReady
+// Transfers the current image from the camera. 
+// Called asynchronously when CCamera::CaptureImage() completes.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ImageReady( 
+    CFbsBitmap* aBitmap, 
+    HBufC8*     aImageData, 
+    TInt        aError )
+    {
+    iStillStatesActive->ImageReady( aBitmap, aImageData, aError );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::CheckPowerL
+// Leaves with KErrNotReady if power is off.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::CheckPowerL()
+    {
+    if ( !iPowerOn ) 
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::CheckPowerL() leaving KErrNotReady (iPowerOn)" ) );
+        User::Leave( KErrNotReady );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::CancelAllActivities()
+// Cancels/closes/stops still capturing, video recording, and view finding.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::CancelAllActivities()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::CancelAllActivities() entering" ) );
+
+    CancelCaptureStill();
+ 
+    CloseVideoRecording();
+
+    StopViewFinder();
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::CancelAllActivities() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ResetToPreviousSettingsL
+// Resets the following settings to the previous values: 
+// exposure mode, white balance mode, 
+// zoom mode, zoom value, flash mode, brightness, and contrast.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ResetToPreviousSettingsL()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ResetToPreviousSettingsL() entering" ) );
+
+    SetExposureModeL( iExposureMode );
+    SetWhiteBalanceModeL( iWhiteBalanceMode );
+    SetZoomModeL( iZoomMode );
+    SetZoomValueL( iZoomValue );
+    SetFlashModeL( iFlashMode );
+
+    // Try to reset this setting only if it is supported by Camera API.
+    // Otherwise this could cause error when re-reserving camera.
+    if ( iInfo->iOptionsSupported & TCameraInfo::EBrightnessSupported )
+        {
+        SetBrightnessL( iBrightness );
+        }
+
+    // Try to reset this setting only if it is supported by Camera API.
+    // Otherwise this could cause error when re-reserving camera.
+    if ( iInfo->iOptionsSupported & TCameraInfo::EContrastSupported )
+        {
+        SetContrastL( iContrast );
+        }
+
+ 	// Process extensions
+	RArray<TCaeExtensionInterfaceImplItem>* settingsImplementationList = 
+		iExtInterfaceImplementationLists[KCaeExtSettingsInterfaceIndex].iImplementations;
+
+	for ( TInt i = 0; i < settingsImplementationList->Count(); i++ )
+		{
+		TRAPD( err,STATIC_CAST( MCaeExtSettingsInterface*, 
+		    (*settingsImplementationList)[i].iImplPtr )->ResetToPreviousSettingsL() );
+		    
+	    #ifdef _DEBUG
+		if ( err )
+		    {
+			LOGTEXT3(_L("Cae: CCaeEngineImp::ResetToDefaultsL(). Error %d in ResetToDefaultsL() for Extension %x"),
+			    err, (*settingsImplementationList)[i].iImplUid.iUid );
+			}
+		#endif
+		
+		User::LeaveIfError( err );
+		}
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ResetToPreviousSettingsL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::CustomInterface
+// Returns a custom interface  that matches to the given UID.
+// -----------------------------------------------------------------------------
+//
+TAny* CCaeEngineImp::CustomInterface( TUid aInterface )
+    {
+	LOGTEXT2(_L("Cae: CCaeEngineImp::CustomInterface() entering, aIterface=%x"),aInterface.iUid );
+	TAny* interfaceImp = NULL;
+
+	// At first, try to find the interface in CAE extesions
+	TCaeCustomInterfaceImplItem item;
+	item.iInterfaceUid = aInterface;
+	item.iImplPtr = NULL; // This is not used by FindInUnsignedKeyOrder()
+	TInt index = iExtCustomInterfaceImplementations.FindInUnsignedKeyOrder( item ); 
+	if ( index >= 0 )
+		{
+		interfaceImp = iExtCustomInterfaceImplementations[ index ].iImplPtr;
+		}
+
+	if ( !interfaceImp )
+		{
+		// Then, try to find the interface in Camera API
+        interfaceImp = iCamera->CustomInterface( aInterface );
+		}
+
+    // Check if View Finder is stopped during burst sequency to optimize speed of burst
+    // Detection of this feature is based to the fact that the CI UID (KUidBurstModeVFOptimization)
+    // is asked and found from the CAPI.
+    if ( aInterface == KUidBurstModeVFOptimization && interfaceImp )
+        {
+        iStillStatesActive->SetBurstModeVFOptimization( ETrue );
+        }
+        
+	LOGTEXT2(_L("Cae: CCaeEngineImp::CustomInterface() returning, interfaceImp=%x"),interfaceImp );
+    return interfaceImp;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::GetOrder
+// Populate feature array
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::GetOrderL( RCaeOrderedFeatureList& aOrderedFeatureList )
+    {
+    TCaeOrderedFeatureListItem tmpItem;
+    aOrderedFeatureList.Reset();
+    
+	// For all interface implementation lists
+    for ( TInt implListIndex = 0; 
+           implListIndex < iExtInterfaceImplementationLists.Count(); 
+          implListIndex++ )
+        {
+		TCaeExtensionInterfaceImplListItem* implListItem = 
+			&(iExtInterfaceImplementationLists[implListIndex]);
+		RArray<TCaeExtensionInterfaceImplItem>& implementations 
+		    = *(implListItem->iImplementations);
+
+		// For all implementations
+		for ( TInt implIndex = 0; implIndex < implementations.Count(); implIndex++ )
+			{
+
+			// Add to item to the feature array
+			tmpItem.iServiceUid = implListItem->iInterfaceUid;
+			tmpItem.iFeatureUid = implementations[implIndex].iImplUid;
+			aOrderedFeatureList.AppendL( tmpItem );
+			}
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetOrderL
+// The user must first call GetOrder() to get array. After that the user can 
+// change the order of items and call this function. The user shall not remove 
+// items or add new items to the array. 
+//
+// E.g. Typically the user finds two items from the array and switches
+// the positions of these items to get desired effect.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetOrderL( const RCaeOrderedFeatureList& aOrderedFeatureList )
+    {
+	TInt status = KErrNone;
+
+	// Check that aOrderedFeatureList is valid
+	DoSetOrderL( aOrderedFeatureList, EFalse );
+	
+	// Check counts
+	
+	TInt totalImplCount = 0;
+
+	// For all interface implementation lists
+	for ( TInt implListIndex = 0; 
+	      implListIndex < iExtInterfaceImplementationLists.Count(); 
+	      implListIndex++ )
+		{
+		TCaeExtensionInterfaceImplListItem* implListItem = 
+			&(iExtInterfaceImplementationLists[implListIndex]);
+		RArray<TCaeExtensionInterfaceImplItem>& implementations 
+		    = *(implListItem->iImplementations);
+
+		totalImplCount += implementations.Count();
+		}
+
+	if ( totalImplCount != aOrderedFeatureList.Count() )
+		{
+		status = KErrArgument;
+		}
+	else
+		{
+		// Check duplicates
+		status = KErrNone;
+		for ( TInt i =  aOrderedFeatureList.Count() - 1; 
+		      ( i >= 0 ) && ( !status ); 
+		      i-- )
+			{
+			// Find always starts at index 0
+			TInt index = aOrderedFeatureList.Find( 
+				aOrderedFeatureList[i], CCaeEngineImp::Match ); 
+			if (index != i)
+				{
+				status = KErrAlreadyExists;
+				}
+			}
+		
+		// Finally, update internal array
+		if ( !status )
+			{
+			DoSetOrderL( aOrderedFeatureList, ETrue );
+			}
+		}
+
+	User::LeaveIfError( status );
+	}
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::DoSetOrderL
+//
+// For each item the old item is removed and the new appended to the end of 
+// iExtInterfaceImplementationLists[i].iImplementations.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::DoSetOrderL( 
+	const RCaeOrderedFeatureList& aOrderedFeatureList, 
+	TBool iUpdate )
+    {
+	TInt status = KErrNone;
+
+	// For all items in given array
+    for (TInt i = 0; i < aOrderedFeatureList.Count() && !status; i++ )
+        {
+        TUid interfaceUid = aOrderedFeatureList[i].iServiceUid;
+        TUid itemImplUid = aOrderedFeatureList[i].iFeatureUid;
+
+		// Find correct interface list
+
+		TCaeExtensionInterfaceImplListItem listItem;
+		listItem.iInterfaceUid = interfaceUid;
+		listItem.iImplementations =  NULL;
+		TInt index = iExtInterfaceImplementationLists.Find( listItem );
+		if ( index < 0 )
+			{
+			status = index; // Invalid interface uid
+			}
+		else
+			{
+			
+			// Find implementation by uid
+
+			TCaeExtensionInterfaceImplItem item;
+			item.iInitialPriority = 0;
+			item.iImplUid.iUid = itemImplUid.iUid;
+			item.iImplPtr = 0;
+			item.iIsActive = ETrue;
+			RArray<TCaeExtensionInterfaceImplItem>& implementations = 
+				*( iExtInterfaceImplementationLists[index].iImplementations );
+
+			TInt itemIndex = implementations.Find( item, CCaeEngineImp::MatchEqualImplUid );
+			if ( itemIndex < 0 ) 
+				{
+				status = itemIndex; // Invalid feature/implementation uid
+				}
+			else
+				{
+				if ( iUpdate )
+					{
+					// Remove current item and add new implementation item to 
+					// end of the array
+
+					item = implementations[itemIndex];
+
+					implementations.Remove( itemIndex );
+
+					status = implementations.Append( item );
+					}
+				}
+			}
+        }
+
+    User::LeaveIfError( status );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::MatchEqualImplUid 
+// Compares two extension array items
+// -----------------------------------------------------------------------------
+//
+TBool CCaeEngineImp::MatchEqualImplUid( 
+    const TCaeExtensionInterfaceImplItem& aFirst, 
+    const TCaeExtensionInterfaceImplItem& aSecond )
+    {
+	return ( aFirst.iImplUid.iUid == aSecond.iImplUid.iUid ); 
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::MatchEqualImplPtr 
+// Compares two extension array items
+// -----------------------------------------------------------------------------
+//
+TBool CCaeEngineImp::MatchEqualImplPtr( 
+    const TCaeExtensionInterfaceImplItem& aFirst, 
+    const TCaeExtensionInterfaceImplItem& aSecond )
+    {
+	return ( aFirst.iImplPtr == aSecond.iImplPtr ); 
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::MatchSmallerInitialPriorityAndImplUid 
+// Compares two extension array items
+// -----------------------------------------------------------------------------
+//
+TBool CCaeEngineImp::MatchSmallerInitialPriorityAndImplUid( 
+    const TCaeExtensionInterfaceImplItem& aFirst, 
+    const TCaeExtensionInterfaceImplItem& aSecond )
+    {
+	if (  ( aSecond.iInitialPriority == aFirst.iInitialPriority )
+		  && ( aSecond.iImplUid.iUid < aFirst.iImplUid.iUid ) )
+		{
+		return ETrue;
+		}
+
+	else if ( aSecond.iInitialPriority < aFirst.iInitialPriority )
+		{
+		return ETrue;
+		}
+
+	else
+		{
+		return EFalse;
+		}
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::Match 
+// Compares two extension array items
+// -----------------------------------------------------------------------------
+//
+TBool CCaeEngineImp::Match( 
+    const TCaeOrderedFeatureListItem& aFirst, 
+    const TCaeOrderedFeatureListItem& aSecond )
+    {
+	return ( ( aFirst.iServiceUid == aSecond.iServiceUid ) 
+		     && ( aFirst.iFeatureUid == aSecond.iFeatureUid ) ); 
+    }
+
+
+// From MCaeExtEngineInfoCallbackInterface
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::McaeExtStillImageSize
+// Returns current still image size.
+// -----------------------------------------------------------------------------
+//
+TSize CCaeEngineImp::McaeExtStillImageSize()
+	{
+	return( iStillStatesActive->StillImageSize() );
+	}
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::McaeExtSnapImageSize
+// Returns current snap image size.
+// -----------------------------------------------------------------------------
+//
+TSize CCaeEngineImp::McaeExtSnapImageSize()
+	{
+	return( iStillStatesActive->SnapImageSize() );
+	}
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::McaeExtViewFinderSize
+// Returns current view finder size.
+// -----------------------------------------------------------------------------
+//
+TSize CCaeEngineImp::McaeExtViewFinderSize()
+	{
+	return( iTrueViewFinderSize );
+	}
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::McaeExtCheckPowerL
+// Check camera power.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::McaeExtCheckPowerL()
+	{
+	CheckPowerL();
+	}
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::McaeExtDisplayIndex
+// Returns display index.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::McaeExtDisplayIndex()
+	{
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::McaeExtDisplayIndex() iDisplayIndex=%d" ), iDisplayIndex );
+	return( iDisplayIndex );
+	}
+
+// From MExtensionCallbackInterface
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::IsInterfaceSupported
+// Check that the interface is supported. 
+// -----------------------------------------------------------------------------
+//
+TBool CCaeEngineImp::IsInterfaceSupported( TUid aInterfaceUid )
+	{
+	TBool found = EFalse;
+	TInt i = 0;
+
+	TCaeExtensionInterfaceImplListItem listItem;
+	listItem.iInterfaceUid = aInterfaceUid;
+	listItem.iImplementations =  NULL;
+
+	// Check extension interface uids
+	if ( iExtInterfaceImplementationLists.Find( listItem ) >= 0 )
+		{
+		found = ETrue;
+		}
+
+	// Check callback interface uids
+	for ( i = 0; (KCaeSupportedCallbackInterfaceUids[i].iUid != NULL) && !found; i++ )
+		{
+		if ( KCaeSupportedCallbackInterfaceUids[i] == aInterfaceUid )
+			{
+			found = ETrue;
+			}
+		}
+
+	return found;
+	}
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::AddExtensionInterface
+// Add an extension implemented interface to the list.
+// Note: Returns KErrNotFound if the interface is not supported.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::AddExtensionInterface( 
+	TUid aInterfaceUid, 
+	TUid aExtensionUid, 
+	TAny* aImplementationPtr, 
+	TInt aInitialPriority )
+	{
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::AddExtensionInterface() entering: ifUid=%x, exUid=%x" ), aInterfaceUid.iUid, aExtensionUid.iUid );
+
+	TInt status = KErrNone;
+
+	// Check for invalid pointer
+	if ( !aImplementationPtr )
+		{
+		status = KErrArgument;
+		}
+	else
+		{
+
+		// Add implementation to the list
+
+		TCaeExtensionInterfaceImplListItem listItem;
+		listItem.iInterfaceUid = aInterfaceUid;
+		listItem.iImplementations =  NULL;
+
+		TInt index = iExtInterfaceImplementationLists.Find( listItem );
+		if ( index < 0 )
+			{
+			status = index; // Error code
+			}
+		else
+			{
+
+			// Add new implementation item to the array
+
+			RArray<TCaeExtensionInterfaceImplItem>& implementations = 
+				*( iExtInterfaceImplementationLists[index].iImplementations );
+
+			TCaeExtensionInterfaceImplItem item;
+			item.iInitialPriority = aInitialPriority;
+			item.iImplUid  = aExtensionUid;
+			item.iImplPtr  = aImplementationPtr;
+			item.iIsActive = ETrue;
+
+			// Check for duplicates
+			TInt itemIndex = implementations.Find( item, CCaeEngineImp::MatchEqualImplUid );
+			if ( itemIndex >= 0 ) 
+				{
+				status = KErrAlreadyExists; // Error code
+				}
+			else
+				{
+				itemIndex = implementations.Find( 
+				    item, CCaeEngineImp::MatchSmallerInitialPriorityAndImplUid );
+				if ( itemIndex < 0 ) 
+					{
+					// All have bigger or equal priority. Add to the end of list.
+					itemIndex = implementations.Count();
+					}
+
+				// Finally, add item to the list
+				status =  implementations.Insert( item, itemIndex ); 
+				}
+			}
+		}
+
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::AddExtensionInterface() returning: status=%d" ), status );
+
+	return( status );
+	}
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::RemoveExtensionInterface
+// Remove an extension implemented interface from the list.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::RemoveExtensionInterface( 
+	TUid aInterfaceUid, 
+	TAny* aImplementationPtr )
+	{
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::RemoveExtensionInterface() entering: ifUid=%x, ptr=%d" ), aInterfaceUid.iUid, aImplementationPtr );
+	TInt status = KErrNone;
+
+	// Check for invalid pointer
+	if ( !aImplementationPtr )
+		{
+		status = KErrArgument;
+		}
+	else
+		{
+		// Remove implementation to the list
+		TCaeExtensionInterfaceImplListItem listItem;
+		listItem.iInterfaceUid = aInterfaceUid;
+		listItem.iImplementations =  NULL;
+
+		TInt index = iExtInterfaceImplementationLists.Find( listItem );
+
+		if ( index < 0 )
+			{
+			status = index; // Error code
+			}
+		else
+			{
+			TCaeExtensionInterfaceImplItem item;
+			item.iInitialPriority = 0;
+			item.iImplUid.iUid = 0;
+			item.iImplPtr = aImplementationPtr;
+			item.iIsActive = ETrue;
+			
+			RArray<TCaeExtensionInterfaceImplItem>& implementations = 
+				*( iExtInterfaceImplementationLists[index].iImplementations );
+
+			TInt itemIndex = implementations.Find( item, CCaeEngineImp::MatchEqualImplPtr );
+
+			if ( itemIndex < 0 ) 
+				{
+				status = itemIndex; // Return error
+				}
+			else
+				{
+				implementations.Remove( itemIndex );
+				}
+			}
+		}
+
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::RemoveExtensionInterface() returning: status=%d" ), status );
+
+	return( status );
+	}
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::AddCustomInterface
+// Add an extension implemented custom interface to the list.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::AddCustomInterface( 
+    TUid aInterfaceUid, 
+    TAny* aImplementationPtr )
+	{
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::AddCustomInterface() entering: ifUid=%x, ptr=%d" ), aInterfaceUid.iUid, aImplementationPtr );
+
+	TInt status = KErrNone;
+
+	if ( !aImplementationPtr )
+		{
+		status = KErrArgument;
+		}
+	else
+		{
+		TCaeCustomInterfaceImplItem item;
+		item.iInterfaceUid = aInterfaceUid;
+		item.iImplPtr = aImplementationPtr;
+		
+	    // Do not allow duplicate uid's
+		status = iExtCustomInterfaceImplementations.InsertInUnsignedKeyOrder( item ); 	
+		}
+	
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::AddCustomInterface() returning: status=%d" ), status );
+
+	return ( status );
+	}
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::GetCallbackInterface
+// Return an engine implemented callback interface.
+// -----------------------------------------------------------------------------
+//
+TAny* CCaeEngineImp::GetCallbackInterface( TUid aInterfaceUid )
+	{
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::GetCallbackInterface() entering: ifUid=%x" ), aInterfaceUid.iUid );
+	TAny* callbackInterface =  NULL;
+
+	if ( aInterfaceUid == KCaeExtEngineInfoCallbackInterfaceUid )
+		{
+		callbackInterface = (MCaeExtEngineInfoCallbackInterface*) this;
+		}
+
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::GetCallbackInterface() returning: callbackInterface=%d" ), callbackInterface );
+	return ( callbackInterface );
+	}
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::RegisterFlags
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::RegisterFlags( TUint32 aFlags )
+	{
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::RegisterFlags() aFlags=%x" ), aFlags );
+    iStillStatesActive->RegisterFlags( aFlags );
+	}
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::DeregisterFlags
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::DeregisterFlags( TUint32 aFlags )
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::DeregisterFlags() aFlags=%x" ), aFlags );
+    iStillStatesActive->DeregisterFlags( aFlags );    
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::CCameraHandle
+// Gets handle of camera object owned by the CCaeEngine.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::CCameraHandle() const
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::CCameraHandle(): %d" ), iCameraHandle );
+    return ( iCameraHandle );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetCaeExtensionModeL
+// Sets CAE to Extension mode
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetCaeExtensionModeL( TBool aExtModeActive, TBool aCreateSnapImage )
+    {
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::SetCaeExtensionModeL(): %d, %d" ), aExtModeActive, aCreateSnapImage );
+
+    iStillStatesActive->SetExtModeActiveL( aExtModeActive );
+    iStillStatesActive->SetSnapImageCreation( aCreateSnapImage );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ProcessExtViewFinderFrameReadyL
+// Process extension for view finder
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ProcessExtViewFinderFrameReadyL( CFbsBitmap& aFrame )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtViewFinderFrameReadyL()" ));
+
+    // Leave if not in extension mode.
+    if ( !iStillStatesActive->ExtModeActive() )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtViewFinderFrameReadyL() leaving KErrPermissionDenied" ) );
+        User::Leave( KErrPermissionDenied );
+        }
+
+    ViewFinderFrameReady( aFrame );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ProcessExtSnapImageL
+// Process extension for snap image
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ProcessExtSnapImageL( CFbsBitmap& aSnapImage )
+    {
+    TSize sizeEmpty;
+    CFbsBitmap* bitmapSave = NULL;
+    TSize snapSize = aSnapImage.SizeInPixels();
+    
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::ProcessExtSnapImageL() size wxh=%dx%d" ),
+            snapSize.iWidth, snapSize.iHeight );
+        
+    // Leave if not in extension mode.
+    if ( !iStillStatesActive->ExtModeActive() )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtSnapImageL() leaving KErrPermissionDenied" ) );
+        User::Leave( KErrPermissionDenied );
+        }
+
+    // Create a duplicate bitmap
+    if ( snapSize != sizeEmpty ) 
+        {
+        bitmapSave = new CFbsBitmap;
+        if ( bitmapSave )
+            {
+            TInt err = bitmapSave->Duplicate( aSnapImage.Handle() );
+            if ( err ) 
+                {
+                    LOGTEXT2( _L( "Cae: CCaeEngineImp::ProcessExtSnapImageL(): Duplicate error:%d, leaving" ), err);
+                    delete bitmapSave;
+                    bitmapSave = NULL;
+                    User::Leave( err );
+                 }
+            }
+        else
+            {
+            LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtSnapImageL(): new CFbsBitmap failed, leaving KErrNoMemory" ));
+            User::Leave( KErrNoMemory );
+            }
+        }
+    else
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtSnapImageL(): got empty bitmap, ignore" ));
+        }
+        
+    if ( bitmapSave )
+        {
+        // Send bitmap for extension handling
+        TInt result = iStillStatesActive->ProcessExtSnapImage( bitmapSave );
+        if ( result )
+            {
+            LOGTEXT2( _L( "Cae: CCaeEngineImp::ProcessExtSnapImageL(): ProcessExtSnapImage failed %d, leaving" ), result);
+            delete bitmapSave;
+            bitmapSave = NULL;
+            User::Leave( result );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ProcessExtCapturedImageL
+// Process extension for captured image
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ProcessExtCapturedImageL( CFbsBitmap& aBitmap, TBool aLastImage )
+    {
+    TSize sizeEmpty;
+    CFbsBitmap* bitmapSave = NULL;
+    TSize bitmapSize = aBitmap.SizeInPixels();
+    
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL() CFbsBitmap ExtMode=%d, last=%d" ), iStillStatesActive->ExtModeActive(), aLastImage);
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL() bitmap size WxH=%dx%d" ), bitmapSize.iWidth, bitmapSize.iHeight );
+        
+    // Leave if not in extension mode.
+    if ( !iStillStatesActive->ExtModeActive() )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL leaving KErrPermissionDenied" ));
+        User::Leave( KErrPermissionDenied );
+        }
+
+    // Create a duplicate bitmap
+    if ( bitmapSize != sizeEmpty )
+        {
+        bitmapSave = new CFbsBitmap;
+        if ( bitmapSave )
+            {
+            TInt err = bitmapSave->Duplicate( aBitmap.Handle() );
+            if ( err ) 
+                {
+                    LOGTEXT2( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL(): Duplicate error:%d, leaving" ), err);
+                    delete bitmapSave;
+                    bitmapSave = NULL;
+                    User::Leave( err );
+                 }
+            }
+        else
+            {
+            LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL(): new CFbsBitmap failed, leaving KErrNoMemory" ));
+            User::Leave( KErrNoMemory );
+            }
+
+        }
+    else
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL(): got empty bitmap, ignore" ));
+        }
+        
+    if ( bitmapSave )
+        {
+        // Send bitmap for extension handling
+        TInt result = iStillStatesActive->ProcessExtCapturedImage( bitmapSave, aLastImage );
+        if ( result )
+            {
+            LOGTEXT2( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL(): ProcessExtCapturedImage failed %d, leaving" ), result);
+            delete bitmapSave;
+            bitmapSave = NULL;
+            User::Leave( result );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ProcessExtCapturedImageL
+// Process extension for captured image
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ProcessExtCapturedImageL( HBufC8* aImageData, TBool aLastImage )
+    {
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL() HBufC8 ExtMode=%d, last=%d" ), iStillStatesActive->ExtModeActive(), aLastImage);
+    // Leave if not in extension mode.
+    if ( !iStillStatesActive->ExtModeActive() )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL leaving KErrPermissionDenied" ));
+        User::Leave( KErrPermissionDenied );
+        }
+    if ( aImageData )
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL() processing HBufC8 size=%d" ), aImageData->Size() );
+        TInt result = iStillStatesActive->ProcessExtCapturedImage( aImageData, aLastImage );
+        if ( result )
+            {
+            LOGTEXT2( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL(): ProcessExtCapturedImage failed %d, leaving" ), result);
+            delete aImageData;
+            aImageData = NULL;
+            User::Leave( result );
+            }
+        }
+    else
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL(): got empty HBufC8, ignore" ));
+        }
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ProcessExtCapturedImageL
+// Process extension for captured image
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ProcessExtCapturedImageL( TDesC8& aImageDataDes, TBool aLastImage )
+    {
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL() TDesC8 ExtMode=%d, last=%d" ), iStillStatesActive->ExtModeActive(), aLastImage);
+    // Leave if not in extension mode.
+    if ( !iStillStatesActive->ExtModeActive() )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL leaving KErrPermissionDenied" ));
+        User::Leave( KErrPermissionDenied );
+        }
+    // TDesC8 is used with C-API V2 features
+    if ( aImageDataDes.Size() )
+        {
+        // Make a new HBufC8 copy from the TDesC8
+        HBufC8* tempImageData = aImageDataDes.AllocL();
+        // Do not delete aImageDataDes, it is part of the class MCameraBuffer
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL() New HBufC8 created, size=%d" ), tempImageData->Size() );
+        
+        TInt result = iStillStatesActive->ProcessExtCapturedImage( tempImageData, aLastImage );
+        if ( result )
+            {
+            LOGTEXT2( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL(): ProcessExtCapturedImage failed %d, leaving" ), result);
+            delete tempImageData;
+            tempImageData = NULL;
+            User::Leave( result );
+            }
+        }
+    else
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtCapturedImageL(): got empty TDesC8, ignore" ));
+        }
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ProcessExtCancel
+// Cancels processing
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ProcessExtCancel()
+    {
+    CancelCaptureStill();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SkippedExtensionListL
+// Get list of skipped extensions. Application may define which extensions are
+// skipped during image processing. Only installed and skipped are listed.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SkippedExtensionListL( RCaeOrderedFeatureList& aDisabledExtensions )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SkippedExtensionListL() entering" ) );
+    TCaeOrderedFeatureListItem tmpItem;
+    aDisabledExtensions.Reset();
+    
+	// For all interface implementation lists
+    for ( TInt implListIndex = 0; 
+           implListIndex < iExtInterfaceImplementationLists.Count(); 
+          implListIndex++ )
+        {
+		TCaeExtensionInterfaceImplListItem* implListItem = 
+			&(iExtInterfaceImplementationLists[implListIndex]);
+		RArray<TCaeExtensionInterfaceImplItem>& implementations 
+		    = *(implListItem->iImplementations);
+
+		// For all implementations
+		for ( TInt implIndex = 0; implIndex < implementations.Count(); implIndex++ )
+			{
+			// Add the item to the skipped array if it is not active
+			if ( !implementations[implIndex].iIsActive )
+			    {
+			    tmpItem.iServiceUid = implListItem->iInterfaceUid;
+			    tmpItem.iFeatureUid = implementations[implIndex].iImplUid;
+			    aDisabledExtensions.AppendL( tmpItem );
+                LOGTEXT3( _L( "Cae: CCaeEngineImp::SkippedExtensionListL(), serviceUid %x, featureUid %x" ),
+                    tmpItem.iServiceUid.iUid, tmpItem.iFeatureUid.iUid  );
+			    }
+			}
+        }
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::SkippedExtensionListL() returning, count %d" ), aDisabledExtensions.Count() );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetSkippedExtensionList
+// Set list of skipped extensions. Application may define which extensions are
+// skipped during image processing.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetSkippedExtensionList( RCaeOrderedFeatureList& aDisabledExtensions )
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::SetSkippedExtensionList() entering Count %d" ), aDisabledExtensions.Count() );
+
+	// Set all extensions first active
+
+	// For all interfaces
+    for ( TInt implListIndex = 0; 
+           implListIndex < iExtInterfaceImplementationLists.Count(); 
+          implListIndex++ )
+        {
+		TCaeExtensionInterfaceImplListItem* implListItem = 
+			&(iExtInterfaceImplementationLists[implListIndex]);
+		RArray<TCaeExtensionInterfaceImplItem>& implementations 
+		    = *(implListItem->iImplementations);
+
+		// For all implementations
+		for ( TInt implIndex = 0; implIndex < implementations.Count(); implIndex++ )
+			{
+			implementations[implIndex].iIsActive = ETrue;
+			}
+        }
+
+    // Disable wanted extensions
+    
+	// For all items in given array
+    for (TInt i = 0; i < aDisabledExtensions.Count(); i++ )
+        {
+        TUid interfaceUid = aDisabledExtensions[i].iServiceUid;
+        TUid itemImplUid = aDisabledExtensions[i].iFeatureUid;
+
+		// Find correct interface list
+
+		TCaeExtensionInterfaceImplListItem listItem;
+		listItem.iInterfaceUid = interfaceUid;
+		listItem.iImplementations =  NULL;
+		TInt index = iExtInterfaceImplementationLists.Find( listItem );
+		if ( index >= 0 ) // Interface was found
+			{
+			// Find implementation by uid
+
+			TCaeExtensionInterfaceImplItem item;
+			item.iInitialPriority = 0;
+			item.iImplUid.iUid = itemImplUid.iUid;
+			item.iImplPtr = 0;
+			item.iIsActive = ETrue;
+			RArray<TCaeExtensionInterfaceImplItem>& implementations = 
+				*( iExtInterfaceImplementationLists[index].iImplementations );
+
+			TInt itemIndex = implementations.Find( item, CCaeEngineImp::MatchEqualImplUid );
+			if ( itemIndex >= 0 ) 
+				{
+				implementations[itemIndex].iIsActive = EFalse;
+                LOGTEXT3( _L( "Cae: CCaeEngineImp::SetSkippedExtensionList(), serviceUid %x, featureUid %x" ),
+                    interfaceUid.iUid, itemImplUid.iUid  );
+				}
+			}
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetSkippedExtensionList() returning" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::EnableVideoRecording
+// Set CAE internal camera status flags.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::EnableVideoRecording()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::EnableVideoRecording() entering" ) );
+
+    // Set the flags to enable the video usage without InitL() call
+    iReserved = ETrue;
+    iPowerOn = ETrue;
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::EnableVideoRecording() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::DisableVideoRecording
+// Set CAE internal camera status flags.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::DisableVideoRecording()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::DisableVideoRecording() entering" ) );
+
+    if ( iReserved ) 
+        {
+        if ( iPowerOn ) 
+            {
+            CancelAllActivities();
+            iPowerOn = EFalse;
+            }
+        iReserved = EFalse;
+        iStillPrepared = EFalse;
+        iVideoPrepared = EFalse;
+        iVideoOpened = EFalse;
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::DisableVideoRecording() returning" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::HandleEvent
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::HandleEvent( const TECAMEvent& aEvent)
+    {
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::HandleEvent() entering, type=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode );
+
+    if ( iStillStatesActive->ExtModeActive() )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::HandleEvent() Extension mode active, skipping event handling" ) );
+        }
+    else
+        {
+        // Cae is in use when capturing images
+        if ( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
+            {
+            LOGTEXT( _L( "Cae: CCaeEngineImp::HandleEvent() KUidECamEventCameraNoLongerReserved" ) );
+            CancelAllActivities();
+            iPowerOn = EFalse;
+            iReserved = EFalse;
+            iStillPrepared = EFalse;
+            iVideoPrepared = EFalse;
+            iVideoOpened = EFalse;
+            iCaeObserver->McaeoInitComplete( KErrInUse ); // Tell the client that other application has taken the camera
+            }
+        else if ( aEvent.iEventType == KUidECamEventPowerOnComplete )
+    	    {
+            LOGTEXT( _L( "Cae: CCaeEngineImp::HandleEvent() KUidECamEventPowerOnComplete" ) );
+            PowerOnComplete( aEvent.iErrorCode );
+	        }
+    	else if ( aEvent.iEventType == KUidECamEventReserveComplete )
+    	    {
+            LOGTEXT( _L( "Cae: CCaeEngineImp::HandleEvent() KUidECamEventReserveComplete" ) );
+            ReserveComplete( aEvent.iErrorCode );
+    	    }
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::HandleEvent() returning" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ViewFinderReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ViewFinderReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::ViewFinderReady() entering, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() );
+
+    if ( !aError )
+        {
+        if ( aCameraBuffer.NumFrames() > 0 )
+	        {
+            CFbsBitmap* bitmap = NULL;
+	        TRAPD( err, bitmap = &aCameraBuffer.BitmapL( 0 ) );
+	        if ( !err )
+	            {
+	            ViewFinderFrameReady( *bitmap );
+	            }
+	        else
+	            {
+                LOGTEXT2( _L( "Cae: CCaeEngineImp::ViewFinderReady() BitmapL failed err=%d" ), err );
+	            }
+	        }
+	    aCameraBuffer.Release();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ImageBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ImageBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::ImageBufferReady() entering, err=%d, NumFrames=%d" ), aError, aCameraBuffer.NumFrames() );
+	
+    if ( !aError )
+        {
+        TDesC8* data = NULL;
+        TRAPD( err, data = aCameraBuffer.DataL( 0 ) );
+        if ( err == KErrNotSupported )
+            {
+            // Got the image as a CFbsBitmap
+            CFbsBitmap* bitmap = NULL;
+
+            TRAP( err, bitmap = &aCameraBuffer.BitmapL( 0 ) );
+
+            if ( !err )
+                {
+                // Create a duplicate bitmap
+                CFbsBitmap* bitmapSave = NULL;
+                bitmapSave = new CFbsBitmap;
+                if ( bitmapSave )
+                    {
+                    err = bitmapSave->Duplicate( bitmap->Handle() );
+                    if ( !err ) 
+                        {
+                        // All OK, send duplicated bitmap to old observer interface
+                        ImageReady( bitmapSave, NULL, aError );
+                        }
+                    else
+                        {
+                        LOGTEXT2( _L( "Cae: CCaeEngineImp::ImageBufferReady(): Duplicate error:%d" ), err);
+                        delete bitmapSave;
+                        bitmapSave = NULL;
+                        ImageReady( NULL, NULL, err );
+                        }
+                    }
+                else
+                    {
+                    LOGTEXT( _L( "Cae: CCaeEngineImp::ImageBufferReady(): new CFbsBitmap failed" ));
+                    ImageReady( NULL, NULL, KErrNoMemory );
+                    }
+
+                }
+            else
+                {
+                LOGTEXT( _L( "Cae: CCaeEngineImp::ImageBufferReady(): BitmapL failed" ));
+                ImageReady( NULL, NULL, err );
+                }
+            }
+        else if ( !err )
+            {
+            // Got the image as a descriptor
+            // Make a new HBufC8 copy from the TDesC8
+            HBufC8* tempImageData = NULL;
+            tempImageData = data->Alloc();
+            
+            if ( tempImageData )
+                {
+                // All OK, send buffer to old observer interface
+                LOGTEXT2( _L( "Cae: CCaeEngineImp::ImageBufferReady() New HBufC8 created, size=%d" ), tempImageData->Size() );
+                ImageReady( NULL, tempImageData, aError );
+                }
+            else
+                {
+                LOGTEXT( _L( "Cae: CCaeEngineImp::ImageBufferReady() Alloc of HBufC8 failed" ) );
+                ImageReady( NULL, NULL, KErrNoMemory );
+                }
+            
+            
+            }
+        else
+            {
+            LOGTEXT2( _L( "Cae: CCaeEngineImp::ImageBufferReady() DataL returned error code=%d" ), err );
+            ImageReady( NULL, NULL, err );
+            }
+
+        // Release buffer only when no error
+	    aCameraBuffer.Release();
+        }
+    else
+        {
+        ImageReady( NULL, NULL, aError );
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::VideoBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::VideoBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::VideoBufferReady() entering, err=%d" ), aError );
+	
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeEngineImpTestErrors.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,276 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine error simulations (CAE_TEST_VERSION only)
+*
+*/
+
+
+#ifdef CAE_TEST_VERSION
+
+//  INCLUDES
+#include <e32base.h>
+#include "CaeEngineImpTestErrors.h"
+
+
+// Error simulation variables.
+TInt CaeMcaeseoHBufC8ImageReadyErrorValue( 0 );
+TInt CaeCaeMcaesdoCFbsBitmapImageReadyErrorValue( 0 );
+TInt CaePowerOnCompleteErrorValue( 0 );
+TInt CaeReserveCompleteErrorValue( 0 );
+TInt CaeImageReadyErrorValue( 0 );
+TInt CaeMvruoOpenCompleteErrorValue( 0 );
+TInt CaeMvruoPrepareCompleteErrorValue( 0 );
+TInt CaeMvruoRecordCompleteErrorValue( 0 );
+TInt CaePrepareVideoSettingsErrorValue( 0 );
+TInt CaeCreateAndDeliverSnapImageErrorValue( 0 );
+TInt CaeCreateAndDeliverStillImageErrorValue( 0 );
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CaeSetMcaeseoHBufC8ImageReadyError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetMcaeseoHBufC8ImageReadyError( TInt aError )
+    {
+    CaeMcaeseoHBufC8ImageReadyErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaeMcaeseoHBufC8ImageReadyError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeMcaeseoHBufC8ImageReadyError( TInt& aError )
+    {
+    if ( aError == KErrNone ) 
+        {
+        aError = CaeMcaeseoHBufC8ImageReadyErrorValue;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CaeSetMcaesdoCFbsBitmapImageReadyError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetMcaesdoCFbsBitmapImageReadyError( TInt aError )
+    {
+    CaeCaeMcaesdoCFbsBitmapImageReadyErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaeMcaesdoCFbsBitmapImageReadyError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeMcaesdoCFbsBitmapImageReadyError( TInt& aError )
+    {
+    if ( aError == KErrNone ) 
+        {
+        aError = CaeCaeMcaesdoCFbsBitmapImageReadyErrorValue;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CaeSetPowerOnCompleteError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetPowerOnCompleteError( TInt aError )
+    {
+    CaePowerOnCompleteErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaePowerOnCompleteError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaePowerOnCompleteError( TInt& aError )
+    {
+    if ( aError == KErrNone ) 
+        {
+        aError = CaePowerOnCompleteErrorValue;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CaeSetReserveCompleteError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetReserveCompleteError( TInt aError )
+    {
+    CaeReserveCompleteErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaeReserveCompleteError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeReserveCompleteError( TInt& aError )
+    {
+    if ( aError == KErrNone ) 
+        {
+        aError = CaeReserveCompleteErrorValue;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CaeSetImageReadyError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetImageReadyError( TInt aError )
+    {
+    CaeImageReadyErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaeImageReadyError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeImageReadyError( TInt& aError )
+    {
+    if ( aError == KErrNone ) 
+        {
+        aError = CaeImageReadyErrorValue;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CaeSetMvruoOpenCompleteError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetMvruoOpenCompleteError( TInt aError )
+    {
+    CaeMvruoOpenCompleteErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaeMvruoOpenCompleteError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeMvruoOpenCompleteError( TInt& aError )
+    {
+    if ( aError == KErrNone ) 
+        {
+        aError = CaeMvruoOpenCompleteErrorValue;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CaeSetMvruoPrepareCompleteError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetMvruoPrepareCompleteError( TInt aError )
+    {
+    CaeMvruoPrepareCompleteErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaeMvruoPrepareCompleteError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeMvruoPrepareCompleteError( TInt& aError )
+    {
+    if ( aError == KErrNone ) 
+        {
+        aError = CaeMvruoPrepareCompleteErrorValue;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CaeSetMvruoRecordCompleteError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetMvruoRecordCompleteError( TInt aError )
+    {
+    CaeMvruoRecordCompleteErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaeMvruoRecordCompleteError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeMvruoRecordCompleteError( TInt& aError )
+    {
+    if ( aError == KErrNone ) 
+        {
+        aError = CaeMvruoRecordCompleteErrorValue;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CaeSetPrepareVideoSettingsError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetPrepareVideoSettingsError( TInt aError )
+    {
+    CaePrepareVideoSettingsErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaePrepareVideoSettingsErrorL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaePrepareVideoSettingsErrorL()
+    {
+    if ( CaePrepareVideoSettingsErrorValue != KErrNone )
+        {
+        User::Leave( CaePrepareVideoSettingsErrorValue );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CaeSetCreateAndDeliverSnapImageError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetCreateAndDeliverSnapImageError( TInt aError )
+    {
+    CaeCreateAndDeliverSnapImageErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaeCreateAndDeliverSnapImageError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeCreateAndDeliverSnapImageError( TInt& aError )
+    {
+    if ( aError == KErrNone ) 
+        {
+        aError = CaeCreateAndDeliverSnapImageErrorValue;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CaeSetCreateAndDeliverStillImageError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetCreateAndDeliverStillImageError( TInt aError )
+    {
+    CaeCreateAndDeliverStillImageErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaeCreateAndDeliverStillImageError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeCreateAndDeliverStillImageError( TInt& aError )
+    {
+    if ( aError == KErrNone ) 
+        {
+        aError = CaeCreateAndDeliverStillImageErrorValue;
+        }
+    }
+
+#endif // CAE_TEST_VERSION
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeEngineImpVideoName.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine implementation for changing 
+*                video file name.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CaeEngineImp.h"   // For Camera Application Engine implementation.
+#include <mmf/server/mmffile.h>        // For MMF definitions (as TMMFFileConfig)
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ChangeVideoFileNameL
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ChangeVideoFileNameL()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ChangeVideoFileNameL() entering" ) );
+
+    // Close if previously prepared.
+    CloseVideoRecording();
+    // Open video recorder.
+    iVideoOpened = ETrue; // This is always set to ETrue when 
+                          // OpenFileL has been called to allow 
+                          // freeing resources by CloseVideoRecording().
+    iVideoRecorder->OpenFileL( iVideoClipFileName->Des(),
+                               iCameraHandle,
+                               iVideoControllerUid,
+                               iVideoFormatUid, 
+                               iVideoType->Des(),  
+                               iVideoAudioType );
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ChangeVideoFileNameL() returning" ) );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeEngineImpVideoNameCustom.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine implementation for changing 
+*                video file name using MMF Video Recorder custom command interface
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "CaeEngineImp.h" // For Camera Application Engine implementation.
+#include "CamCControllerCustomCommands.h" // For Camcorder plug-in custom commands and UId.
+#include <mmf/server/mmffile.h> // For MMF definitions (as TMMFFileConfig)
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CaeEngineImpVideoNameCustomTraces.h"
+#endif
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ChangeVideoFileNameL
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ChangeVideoFileNameL()
+    {
+    OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_CHANGEVIDEOFILENAMEL, "e_CAM_CAE_CHANGE_VIDEO_FILE_NAME 1" );
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ChangeVideoFileNameL() entering" ) );
+
+    if ( iVideoControllerUid == KCamCControllerImplementationUid ) 
+        {
+        // Use custom command interface of Video Recorder to change the file name.
+        // We know that the custom command is available with this specific implementation.
+        TMMFFileConfig pckg;
+        pckg().iPath = iVideoClipFileName->Des();
+        OstTrace0( CAMERASRV_PERFORMANCE, DUP2_CCAEENGINEIMP_CHANGEVIDEOFILENAMEL, "e_CAM_CAE_CUSTOM_COMMAND 1" );
+        TInt err = iVideoRecorder->CustomCommandSync( TMMFMessageDestination( iVideoControllerUid, 
+                                                                   KMMFObjectHandleController ), 
+                                           ECamCControllerCCNewFilename, 
+                                           pckg, 
+                                           KNullDesC8 );
+        OstTrace0( CAMERASRV_PERFORMANCE, DUP3_CCAEENGINEIMP_CHANGEVIDEOFILENAMEL, "e_CAM_CAE_CUSTOM_COMMAND 0" );
+        if (err)
+            {
+            LOGTEXT2( _L( "Cae: CCaeEngineImp::ChangeVideoFileNameL() CustomCommandSync failed err=%d, leaving" ), err );
+            User::Leave(err);
+            }
+        iPrepPars = EFalse;
+        OstTrace0( CAMERASRV_PERFORMANCE, DUP4_CCAEENGINEIMP_CHANGEVIDEOFILENAMEL, "e_CAM_CAE_VIDEORECORDER_PREPARE 1" );
+        iVideoRecorder->Prepare();
+        OstTrace0( CAMERASRV_PERFORMANCE, DUP5_CCAEENGINEIMP_CHANGEVIDEOFILENAMEL, "e_CAM_CAE_VIDEORECORDER_PREPARE 0" );
+        }
+    else 
+        {
+        // With 3rd party video controllers we need to re-open video recording because
+        // we can not rely on using custom command for changing the file name.
+        CloseVideoRecording();
+        // Open video recorder.
+        iVideoOpened = ETrue; // This is always set to ETrue when 
+                              // OpenFileL has been called to allow 
+                              // freeing resources by CloseVideoRecording().
+        OstTrace0( CAMERASRV_PERFORMANCE, DUP6_CCAEENGINEIMP_CHANGEVIDEOFILENAMEL, "e_CAM_CAE_VIDEORECORDER_OPENFILE 1" );
+        iVideoRecorder->OpenFileL( iVideoClipFileName->Des(),
+                                   iCameraHandle,
+                                   iVideoControllerUid,
+                                   iVideoFormatUid, 
+                                   iVideoType->Des(),  
+                                   iVideoAudioType );
+        OstTrace0( CAMERASRV_PERFORMANCE, DUP7_CCAEENGINEIMP_CHANGEVIDEOFILENAMEL, "e_CAM_CAE_VIDEORECORDER_OPENFILE 0" );
+        }
+    OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_CHANGEVIDEOFILENAMEL, "e_CAM_CAE_CHANGE_VIDEO_FILE_NAME 0" );
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ChangeVideoFileNameL() returning" ) );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeEngineImpVideoRecording.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,1365 @@
+/*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine implementation video recording methods
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <mmf/server/mmffile.h>                        // For MMF definitions (as TMMFFileConfig)
+#include <AudioPreference.h>                // For MMF audio preference definitions.
+
+
+#include "CaeEngineImp.h"                   // Engine implementation header.
+#include "CaeVideoQualityLevels.h"          // For video recording quality levels.
+#include "CaeVideoTimes.h"                  // For generating video recording time estimates.
+#include "CaeStillStatesActive.h"                
+
+#ifdef CAE_TEST_VERSION
+#include "CaeEngineImpTestErrors.h"         // For TEST_VERSION compilation only
+#endif
+
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CaeEngineImpVideoRecordingTraces.h"
+#endif
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::InitVideoRecorderL
+// Initialise the engine for video recording using default parameters.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::InitVideoRecorderL()
+    {
+    OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_INITVIDEORECORDERL, "e_CAM_CAE_INITVIDEORECORDER 1" );
+    LOGTEXT( _L( "Cae: CCaeEngineImp::InitVideoRecorderL() entering" ) );
+
+    iVideoInitialized = EFalse;
+
+    // Close video recording if previously opened/prepared.
+    CloseVideoRecording();
+
+    // (Re-)initialize these.
+    iVideoTimesInterval = KVideoTimesIntervalDefault; 
+    iMaxClipSizeInBytes = KMMFNoMaxClipSize; 
+    iMaxClipSizeInBytesPrep = KMMFNoMaxClipSize;
+
+    // Create video quality levels container object.
+    delete iVideoQualityLevelsCont;
+    iVideoQualityLevelsCont = NULL;
+    iVideoQualityLevelsCont = CCaeVideoQualityLevelsCont::NewL();
+
+    // Destroy possible video clip file name. (Its allocated elsewhere when file name is set.)
+    delete iVideoClipFileName;
+    iVideoClipFileName = NULL;
+
+    // Create video recorder.
+    delete iVideoRecorder;
+    iVideoRecorder = NULL;
+    iVideoRecorder = CVideoRecorderUtility::NewL( *this , KAudioPriorityVideoRecording,
+    	TMdaPriorityPreference( KAudioPrefVideoRecording ) );
+
+    delete iVideoFrameSize;
+    iVideoFrameSize = NULL;
+    iVideoFrameSize = new( ELeave ) TSize();
+    
+    delete iVideoFrameSizePrep;
+    iVideoFrameSizePrep = NULL;
+    iVideoFrameSizePrep = new( ELeave ) TSize();
+
+    // Create video times generator object.
+    delete iVideoTimes;
+    iVideoTimes = NULL;
+    iVideoTimes = CCaeVideoTimes::NewL();
+
+    // Create call-back function for video times generation.
+    delete iVideoTimesCallback;
+    iVideoTimesCallback = NULL;
+    iVideoTimesCallback = new( ELeave ) TCallBack( VideoRecordingTimesCallback, this );
+
+    // Initialize default video recording quality levels.
+    iInfo->iNumVideoQualityLevelsSupported = 
+        iVideoQualityLevelsCont->InitDefaultsL();
+
+    iVideoInitialized = ETrue;
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::InitVideoRecorderL() returning" ) );
+    OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_INITVIDEORECORDERL, "e_CAM_CAE_INITVIDEORECORDER 0" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::InitVideoRecorderL
+// Initialise the engine for video recording using either using default 
+// parameters or parameters from ini-file.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::InitVideoRecorderL( 
+    TUid aSdUidVideoQltyLevels )
+    {
+    if( aSdUidVideoQltyLevels == KNullUid )
+        {
+        InitVideoRecorderL();
+        }
+    else
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::InitVideoRecorderL(aSdUidVideoQltyLevels): NOT SUPPORTED, leaving" ) );
+        User::Leave( KErrNotSupported );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetVideoRecordingFileNameL
+// If video recording is not prepared then just memorizes the file name.
+// If video recording is prepared, then calls variated ChangeVideoFileNameL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetVideoRecordingFileNameL( 
+    const TDesC& aVideoClipFileName )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoRecordingFileNameL() entering" ) );
+
+    if ( !iVideoInitialized || iVideoRecordingRunning ) 
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoRecordingFileNameL leaving KErrNotReady" ));
+        User::Leave( KErrNotReady );
+        }
+
+    if ( aVideoClipFileName.Length() > 0 )
+        {
+        // Memorize the video clip file name.
+        delete iVideoClipFileName;
+        iVideoClipFileName = NULL;
+        iVideoClipFileName = aVideoClipFileName.AllocL();
+        }
+    else 
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoRecordingFileNameL leaving KErrArgument (aVideoClipFileName)" ));
+        User::Leave( KErrArgument );
+        }
+
+    if ( iVideoPrepared ) 
+        {
+        // Does the actual change of file name, only if video is prepared.
+        // Note: Variated implementation
+        ChangeVideoFileNameL();
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoRecordingFileNameL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PrepareVideoRecordingL
+// Retrieves video recording parameters from the specified quality level and
+// calls overloading PrepareVideoRecordingL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PrepareVideoRecordingL( 
+    TInt aVideoQualityIndex )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareVideoRecordingL() entering" ) );
+
+    if ( ( aVideoQualityIndex < 0 ) || 
+         ( aVideoQualityIndex >= iVideoQualityLevelsCont->Count() ) ) 
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareVideoRecordingL() leaving KErrArgument" ) );
+        User::Leave( KErrArgument );
+        }
+    
+    PrepareVideoRecordingL( iVideoQualityLevelsCont->At( aVideoQualityIndex ).iFrameSize, 
+                            iVideoQualityLevelsCont->At( aVideoQualityIndex ).iFrameRate, 
+                            iVideoQualityLevelsCont->At( aVideoQualityIndex ).iBitRate, 
+                            iVideoQualityLevelsCont->At( aVideoQualityIndex ).iAudioEnabled,
+                            iVideoQualityLevelsCont->At( aVideoQualityIndex ).iAudioBitRate, 
+                            iVideoQualityLevelsCont->At( aVideoQualityIndex ).iMimeType, 
+                            iVideoQualityLevelsCont->At( aVideoQualityIndex ).iPreferredSupplier, 
+                            iVideoQualityLevelsCont->At( aVideoQualityIndex ).iVideoType,    
+                            iVideoQualityLevelsCont->At( aVideoQualityIndex ).iAudioType );
+    
+    iVideoQualityIndex = aVideoQualityIndex;
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareVideoRecordingL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PrepareVideoRecordingL
+// Finds first the UIDs needed for opening a video recording, uses ECOM.
+// Then gets camera handle from Camera API.
+// Finally calls Video Recorder API OpenFileL().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PrepareVideoRecordingL( 
+    const TSize&  aFrameSize, 
+    TReal32       aFrameRate, 
+    TInt          aBitRate, 
+    TBool         aAudioEnabled,
+    const TDesC8& aMimeType, 
+    const TDesC&  aPreferredSupplier, 
+    const TDesC8& aVideoType, 
+    const TDesC8& aAudioType )
+    {
+    OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_PREPAREVIDEORECORDINGL, "e_CAM_CAE_PREPAREVIDEORECORDING 1" );
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::PrepareVideoRecordingL() entering aFrameSize wxh=%dx%d" ),
+            aFrameSize.iWidth, aFrameSize.iHeight );
+
+    // Leave if not initialized properly or busy doing something else.
+    if ( !iVideoInitialized || 
+         !iVideoClipFileName || 
+         iStillStatesActive->IsRunning() || 
+         iVideoRecordingRunning   ) 
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::PrepareVideoRecordingL leaving KErrNotReady, iVideoInitialized=%d" ), iVideoInitialized );
+        User::Leave( KErrNotReady );
+        }
+
+    CheckPowerL();
+
+    // Leave if video clip file name is not set properly.
+    if ( iVideoClipFileName->Length() == 0 )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareVideoRecordingL() leaving KErrArgument (iVideoClipFileName)" ) );
+        User::Leave( KErrArgument );
+        }
+
+    // Close if previously opened/prepared.
+    CloseVideoRecording();
+
+    // Find values for iVideoControllerUid and iVideoFormatUid.
+    // Those are also needed if clip file name is changed when prepared.
+    FindVideoUidsL( aMimeType, aPreferredSupplier );
+
+    // Memorize video type.
+    delete iVideoType;
+    iVideoType = NULL;
+    iVideoType = aVideoType.AllocL();
+
+    // Convert audio type from TDesC8 to TFourCC.
+    iVideoAudioType = ConvertAndSetVideoAudioTypeL( aAudioType );
+
+    // Memorize the parameters to be prepared.
+    *iVideoFrameSizePrep   = aFrameSize;
+    iVideoFrameRatePrep    = aFrameRate;
+    iVideoBitRatePrep      = aBitRate;
+    iVideoAudioEnabledPrep = aAudioEnabled;
+
+    // Open video recorder.
+    iVideoOpened = ETrue; // This is always set to ETrue when 
+                          // OpenFileL has been called to allow 
+                          // freeing resources by CloseVideoRecording().
+    OstTrace0( CAMERASRV_PERFORMANCE, DUP2_CCAEENGINEIMP_PREPAREVIDEORECORDINGL, "e_CAM_CAE_VIDEORECORDER_OPENFILE 1" );
+    iVideoRecorder->OpenFileL( iVideoClipFileName->Des(),
+                               iCameraHandle,
+                               iVideoControllerUid,
+                               iVideoFormatUid, 
+                               iVideoType->Des(),  
+                               iVideoAudioType );
+    OstTrace0( CAMERASRV_PERFORMANCE, DUP3_CCAEENGINEIMP_PREPAREVIDEORECORDINGL, "e_CAM_CAE_VIDEORECORDER_OPENFILE 0" );
+    
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareVideoRecordingL() returning" ) );
+    OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_PREPAREVIDEORECORDINGL, "e_CAM_CAE_PREPAREVIDEORECORDING 0" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::CloseVideoRecording
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::CloseVideoRecording()
+    {
+    OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_CLOSEVIDEORECORDING, "e_CAM_CAE_CLOSEVIDEORECORDING 1" );
+    LOGTEXT( _L( "Cae: CCaeEngineImp::CloseVideoRecording() entering" ) );
+
+    if ( iVideoPrepared ) 
+        {
+        CancelVideoRecording();
+        iVideoPrepared = EFalse;
+        }
+
+    if ( iVideoOpened )
+        {
+        OstTrace0( CAMERASRV_PERFORMANCE, DUP2_CCAEENGINEIMP_CLOSEVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_CLOSE 1" );
+        iVideoRecorder->Close();
+        OstTrace0( CAMERASRV_PERFORMANCE, DUP3_CCAEENGINEIMP_CLOSEVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_CLOSE 0" );
+        iVideoOpened = EFalse;
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::CloseVideoRecording() returning" ) );
+    OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_CLOSEVIDEORECORDING, "e_CAM_CAE_CLOSEVIDEORECORDING 0" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::VideoQualityIndex
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::VideoQualityIndex() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::VideoQualityIndex()" ) );
+
+    TInt qualityIndex( -1 );
+    if ( iVideoPrepared )
+        {
+        qualityIndex = iVideoQualityIndex;
+        }
+    return qualityIndex;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::GetVideoFrameSize
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::GetVideoFrameSize( 
+    TInt aVideoQualityIndex, 
+    TSize& aFrameSize ) const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::GetVideoFrameSize()" ) );
+    
+    if ( aVideoQualityIndex >= 0 &&  
+         aVideoQualityIndex < iVideoQualityLevelsCont->Count() )
+        {
+        aFrameSize = iVideoQualityLevelsCont->At( aVideoQualityIndex ).iFrameSize;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::VideoFrameRate
+// -----------------------------------------------------------------------------
+//
+TReal32 CCaeEngineImp::VideoFrameRate( 
+    TInt aVideoQualityIndex ) const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::VideoFrameRate()" ) );
+
+    TReal32 frameRate( 0.0 );
+    if ( aVideoQualityIndex >= 0 &&  
+         aVideoQualityIndex < iVideoQualityLevelsCont->Count() )
+        {
+        frameRate = iVideoQualityLevelsCont->At( aVideoQualityIndex ).iFrameRate;
+        }
+    return frameRate;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::EstimatedVideoRecordingBitRateL
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::EstimatedVideoRecordingBitRateL( 
+    TInt aVideoQualityIndex ) const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::EstimatedVideoRecordingBitRateL()" ) );
+
+    TInt storageRate( 0 );
+    if ( aVideoQualityIndex >= 0 &&  
+         aVideoQualityIndex < iVideoQualityLevelsCont->Count() )
+        {
+        storageRate = iVideoQualityLevelsCont->At( aVideoQualityIndex ).iStorageRate;
+        }
+    return storageRate;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetVideoClipMaxSizeL
+// If video recording is not prepared then just memorizes the clip max size.
+// If video recording is prepared, then calls Video Recorder API 
+// SetMaxClipSizeL() and Prepare().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetVideoClipMaxSizeL( 
+    TInt aMaxClipSizeInBytes )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoClipMaxSizeL() entering" ) );
+
+    if ( !iVideoInitialized || iVideoRecordingRunning ) 
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::SetVideoClipMaxSizeL leaving KErrNotReady, iVideoInitialized=%d" ), iVideoInitialized );
+        User::Leave( KErrNotReady );
+        }
+
+    if ( aMaxClipSizeInBytes > 0 ) 
+        {
+        iMaxClipSizeInBytesPrep = aMaxClipSizeInBytes;
+        }
+    else 
+        {
+        iMaxClipSizeInBytesPrep = KMMFNoMaxClipSize;
+        }
+
+    if ( iVideoPrepared )
+        {
+        iPrepPars = ETrue;
+        iVideoRecorder->SetMaxClipSizeL( iMaxClipSizeInBytesPrep );
+        OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_SETVIDEOCLIPMAXSIZEL, "e_CAM_CAE_VIDEORECORDER_PREPARE 1" );
+        iVideoRecorder->Prepare();
+        OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_SETVIDEOCLIPMAXSIZEL, "e_CAM_CAE_VIDEORECORDER_PREPARE 0" );
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoClipMaxSizeL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::VideoClipMaxSize
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::VideoClipMaxSize() const 
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::VideoClipMaxSize()" ) );
+
+    TInt maxClipSizeInBytes( 0 );
+    if ( iMaxClipSizeInBytes != KMMFNoMaxClipSize ) 
+        {
+        maxClipSizeInBytes = iMaxClipSizeInBytes;
+        }
+
+    return maxClipSizeInBytes;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetVideoAudioL
+// Calls Video Recorder API SetAudioEnabledL() and Prepare().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetVideoAudioL( 
+    TBool aAudioEnabled )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoAudioL() entering" ) );
+
+    if ( !iVideoInitialized || iVideoRecordingRunning ) 
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::SetVideoAudioL leaving KErrNotReady, iVideoInitialized=%d" ), iVideoInitialized );
+        User::Leave( KErrNotReady );
+        }
+
+    iVideoAudioEnabledPrep = aAudioEnabled;
+    iVideoRecorder->SetAudioEnabledL( iVideoAudioEnabledPrep );
+    iPrepPars = ETrue;
+    OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_SETVIDEOAUDIOL, "e_CAM_CAE_VIDEORECORDER_PREPARE 1" );
+    iVideoRecorder->Prepare();
+    OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_SETVIDEOAUDIOL, "e_CAM_CAE_VIDEORECORDER_PREPARE 0" );
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoAudioL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::VideoAudio
+// Calls Video Recorder API AudioEnabledL().
+// -----------------------------------------------------------------------------
+//
+TBool CCaeEngineImp::VideoAudio() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::VideoAudio()" ) );
+
+    TBool audioEnabled( EFalse );
+    if ( iVideoRecorder )
+        {
+        TRAPD( error, { audioEnabled = iVideoRecorder->AudioEnabledL(); } );
+        if ( error != KErrNone ) 
+            {
+            audioEnabled = EFalse;
+            }
+        }
+    return audioEnabled;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::SetVideoTimesIntervalL
+// Converts from TTimeIntervalMicroSeconds used in the interface to 
+// TTimeIntervalMicroSeconds32 used internally.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::SetVideoTimesIntervalL( 
+    TTimeIntervalMicroSeconds aInterval )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoTimesIntervalL()" ) );
+
+    if ( iVideoRecordingRunning ) 
+        {
+        LOGTEXT2( _L( "Cae: CCaeEngineImp::SetVideoTimesIntervalL leaving KErrNotReady, iVideoRecordingRunning=%d" ), iVideoRecordingRunning );
+        User::Leave( KErrNotReady );
+        }
+
+    // Note: KMaxTInt32 in microseconds is about 35 minutes
+    if ( aInterval < TTimeIntervalMicroSeconds( 0 ) || 
+         aInterval > TTimeIntervalMicroSeconds( KMaxTInt32 ) )
+        {
+        LOGTEXT( _L( "Cae: CCaeEngineImp::SetVideoTimesIntervalL leaving KErrArgument" ));
+        User::Leave( KErrArgument );
+        }
+
+    iVideoTimesInterval = I64INT( aInterval.Int64() );
+    }
+        
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::VideoTimesInterval
+// Converts to TTimeIntervalMicroSeconds used in the interface from  
+// TTimeIntervalMicroSeconds32 used internally.
+// -----------------------------------------------------------------------------
+//
+TTimeIntervalMicroSeconds CCaeEngineImp::VideoTimesInterval() const 
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::VideoTimesInterval()" ) );
+    
+    TInt64 intInterval = iVideoTimesInterval.Int();
+
+    TTimeIntervalMicroSeconds interval( intInterval );
+
+    return interval;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::StartVideoRecording
+// Calls Video Recorder API Record().
+// Starts generating video recording time information for the client.
+// Finally calls McaeoVideoRecordingOn().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::StartVideoRecording()
+    {
+    OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_STARTVIDEORECORDING, "e_CAM_CAE_STARTVIDEORECORDING 1" );
+    LOGTEXT( _L( "Cae: CCaeEngineImp::StartVideoRecording() entering" ) );
+
+    TInt error( KErrNone );
+
+    if ( iVideoPrepared && !iVideoRecordingRunning ) 
+        {
+        iVideoRecordingRunning = ETrue;
+        iVideoRecordingPaused = EFalse;
+        
+ 		// Reset previous time information
+    	iPrevTimeElapsed = 0;
+    	iPrevTimeRemaining = 0;
+    	
+       // Start video recording.
+        OstTrace0( CAMERASRV_PERFORMANCE, DUP2_CCAEENGINEIMP_STARTVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_RECORD 1" );
+        iVideoRecorder->Record();
+        OstTrace0( CAMERASRV_PERFORMANCE, DUP3_CCAEENGINEIMP_STARTVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_RECORD 0" );
+        if ( iVideoTimesInterval > TTimeIntervalMicroSeconds32( 0 ) ) 
+            {
+            // Start generating video recording time information for the client.
+            iVideoTimes->Start( KVideoTimesDelay,       // delay
+                                iVideoTimesInterval,    // interval
+                                *iVideoTimesCallback ); // callback
+            }
+        }
+    else 
+        {
+        error = KErrNotReady;
+        }
+
+
+    OstTrace0( CAMERASRV_PERFORMANCE, DUP4_CCAEENGINEIMP_STARTVIDEORECORDING, "e_CAM_CAE_MCAEOVIDEORECORDINGON 1" );
+    iCaeObserver->McaeoVideoRecordingOn( error );
+    OstTrace0( CAMERASRV_PERFORMANCE, DUP5_CCAEENGINEIMP_STARTVIDEORECORDING, "e_CAM_CAE_MCAEOVIDEORECORDINGON 0" ); 
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::StartVideoRecording() returning" ) );
+    OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_STARTVIDEORECORDING, "e_CAM_CAE_STARTVIDEORECORDING 0" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::StopVideoRecording
+// Calls Video Recorder API Record(), DurationL(), and RecordTimeAvailable().
+// Stops generating video recording time information for the client.
+// Delivers video recording time info to the client once right after stopping, 
+// by calling McaeoVideoRecordingTimes().
+// Finally calls McaeoVideoRecordingComplete().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::StopVideoRecording()
+    {
+    OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_STOPVIDEORECORDING 1" );
+    LOGTEXT( _L( "Cae: CCaeEngineImp::StopVideoRecording() entering" ) );
+        
+    TInt stoppingError( KErrNone );
+    TInt asyncStopErr( KErrNone );
+    
+    if ( iVideoRecordingRunning ) 
+        {
+        TInt timesError( KErrNone );
+        TTimeIntervalMicroSeconds timeElapsed( 0 );
+                
+        iVideoRecordingRunning = EFalse;
+        
+        // Stop generating video recording time information for the client. 
+        iVideoTimes->Cancel();
+        
+        if ( iVideoTimesInterval > TTimeIntervalMicroSeconds32( 0 ) ) 
+            {
+            // Query elapsed time before stop (it is set to zero after stop).
+            TRAP( timesError, { timeElapsed = iVideoRecorder->DurationL(); } );
+            // Possible error is ignored locally because not so crucial. Error code is delivered by call-back.
+            }
+                    
+        // Stop video recording.
+        if ( iAsyncVideoStopEnabled )
+            {
+       		LOGTEXT( _L( "Cae: CCaeEngineImp::StopVideoRecording(). using custom command ECamCControllerCCVideoStopAsync" )); 
+            OstTrace0( CAMERASRV_PERFORMANCE, DUP2_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_STOP_ASYNC 1" );
+            asyncStopErr = iVideoRecorder->CustomCommandSync( TMMFMessageDestination( iVideoControllerUid, KMMFObjectHandleController ), 
+                                                        ECamCControllerCCVideoStopAsync, 
+                                                        KNullDesC8, 
+                                                        KNullDesC8 );
+       		OstTrace0( CAMERASRV_PERFORMANCE, DUP3_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_STOP_ASYNC 0" );
+       		if ( asyncStopErr ) // async stop was not supported, use sync stop
+       		    {
+           		LOGTEXT2( _L( "Cae: CCaeEngineImp::StopVideoRecording(). async stop err=%d, using sync stop" ), asyncStopErr); 
+                OstTrace0( CAMERASRV_PERFORMANCE, DUP4_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_STOP 1" );
+                stoppingError = iVideoRecorder->Stop();
+                OstTrace0( CAMERASRV_PERFORMANCE, DUP5_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_STOP 0" );
+                OstTrace0( CAMERASRV_PERFORMANCE, DUP8_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_MCAEOVIDEORECORDINGSTOPPED 1" );
+                iCaeObserver->McaeoVideoRecordingStopped();
+       		    OstTrace0( CAMERASRV_PERFORMANCE, DUP9_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_MCAEOVIDEORECORDINGSTOPPED 0" );
+       		    }
+            }
+        else
+            {
+            // Synchronous, quaranteed that video recording is stopped when returning.
+            OstTrace0( CAMERASRV_PERFORMANCE, DUP6_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_STOP 1" );
+            stoppingError = iVideoRecorder->Stop();
+            OstTrace0( CAMERASRV_PERFORMANCE, DUP7_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_STOP 0" );
+            }
+        
+        // Can't be paused anymore.
+        iVideoRecordingPaused = EFalse;
+
+        /*
+        #ifdef CAE_TEST_VERSION
+        // For simulating errors when compiled as special "test version".
+        CaeStopVideoRecordingError( stoppingError );
+        #endif
+        */
+        
+        if ( iVideoTimesInterval > TTimeIntervalMicroSeconds32( 0 ) ) 
+            {    
+            // Query remaining time after stop.
+            TTimeIntervalMicroSeconds timeRemaining = iVideoRecorder->RecordTimeAvailable();
+            
+        	// The elapsed time could have been reseted to zero by the video recorder 
+        	// if there is stopping ongoing in video recorder, even if we do 
+        	// not have had the notification yet. In that case McaeoVideoRecordingTimes
+        	// should be called with previous valid values.
+        	if ( ( timeElapsed == 0 ) && ( iPrevTimeElapsed != 0 ) )
+        		{
+        		// Invalid time. Use previous time information
+       			LOGTEXT2( _L( "Cae: CCaeEngineImp::StopVideoRecording(). Got invalid elapsed time from the video recorder: %f s." ), 
+       				I64LOW( timeElapsed.Int64() ) * 1.0 / KOneSecond);
+       			LOGTEXT3( _L( "Cae: CCaeEngineImp::StopVideoRecording(). Use previous valid elapsed time %f s. and remaining time %f s." ), 
+       				I64LOW( iPrevTimeElapsed.Int64() ) * 1.0 / KOneSecond,  
+       				I64LOW( iPrevTimeRemaining.Int64() ) * 1.0 / KOneSecond );
+        		timeElapsed = iPrevTimeElapsed;
+        		timeRemaining =iPrevTimeRemaining;
+        		}
+       
+            // Deliver video times (elapsed, remaining) information.
+            iCaeObserver->McaeoVideoRecordingTimes( timeElapsed, timeRemaining, timesError );
+            }
+        }
+    else 
+        {
+        stoppingError = KErrNotReady;
+        }
+
+	// Reset previous time information
+    iPrevTimeElapsed = 0;
+    iPrevTimeRemaining = 0;
+
+    if ( !iAsyncVideoStopEnabled || asyncStopErr )
+        {
+        OstTrace0( CAMERASRV_PERFORMANCE, DUP10_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_MCAEOVIDEORECORDINGCOMPLETE 1" );
+        iCaeObserver->McaeoVideoRecordingComplete( stoppingError );
+        OstTrace0( CAMERASRV_PERFORMANCE, DUP11_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_MCAEOVIDEORECORDINGCOMPLETE 0" );
+        }
+
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::StopVideoRecording() returning" ) );
+    OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_STOPVIDEORECORDING, "e_CAM_CAE_STOPVIDEORECORDING 0" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PauseVideoRecording
+// Stops generating video recording time info for the client.
+// Calls Video Recorder API PauseL().
+// Delivers video recording time info to the client once right after pausing
+// by calling VideoRecordingTimesCallback() that calls Video Recorder API 
+// DurationL() and RecordTimeAvailable(), and then McaeoVideoRecordingTimes().
+// Finally calls McaeoVideoRecordingPaused().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PauseVideoRecording()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PauseVideoRecording() entering" ) );
+
+    TInt error( KErrNone );
+
+    if ( iVideoRecordingRunning && !iVideoRecordingPaused ) 
+        {
+        // Stop generating video recording time info for the client.
+        iVideoTimes->Cancel();
+        // Pause video recording.
+        TRAP( error, iVideoRecorder->PauseL() );
+        if ( iVideoTimesInterval > TTimeIntervalMicroSeconds32( 0 ) ) 
+            {
+            // Deliver video recording times (elapsed, remaining) info once.
+            VideoRecordingTimesCallback( this );
+            }
+        // Intentionally setting iVideoRecordingPaused after (possibly) calling VideoRecordingTimesCallback().
+        if ( error == KErrNone ) 
+            {
+            iVideoRecordingPaused = ETrue;
+            }
+        }
+    else 
+        {
+        error = KErrNotReady;
+        }
+
+    iCaeObserver->McaeoVideoRecordingPaused( error );
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PauseVideoRecording() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ResumeVideoRecording
+// Calls Video Recorder API Record().
+// Starts generating video recording time information for the client.
+// Finally calls McaeoVideoRecordingOn().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::ResumeVideoRecording()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ResumeVideoRecording() entering" ) );
+
+    TInt error( KErrNone );
+
+    if ( iVideoRecordingRunning && iVideoRecordingPaused ) 
+        {
+        // Start video recording.
+        OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_RESUMEVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_RECORD 1" );
+        iVideoRecorder->Record();
+        OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_RESUMEVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_RECORD 0" );
+        iVideoRecordingPaused = EFalse;
+        if ( iVideoTimesInterval > TTimeIntervalMicroSeconds32( 0 ) ) 
+            {
+            // Start generating video recording time information for the client.
+            iVideoTimes->Start( KVideoTimesDelay,       // delay
+                                iVideoTimesInterval,    // interval
+                                *iVideoTimesCallback ); // callback
+            }
+        }
+    else 
+        {
+        error = KErrNotReady;
+        }
+
+    iCaeObserver->McaeoVideoRecordingOn( error );
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::ResumeVideoRecording() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::RemainingVideoRecordingTime
+// Calls Video Recorder API RecordTimeAvailable().
+// -----------------------------------------------------------------------------
+//
+TTimeIntervalMicroSeconds CCaeEngineImp::RemainingVideoRecordingTime() const
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::RemainingVideoRecordingTime()" ) );
+    
+    TTimeIntervalMicroSeconds remaining( 0 );
+    if ( iVideoRecorder )
+        {
+        remaining = iVideoRecorder->RecordTimeAvailable();
+        }
+    return remaining;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::IsVideoRecording
+// -----------------------------------------------------------------------------
+//
+TBool CCaeEngineImp::IsVideoRecording() const
+    {
+    return iVideoRecordingRunning;    
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PrepareVideoRecordingL
+// Overloading version with audio bit rate argument.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PrepareVideoRecordingL( 
+    const TSize&  aFrameSize, 
+    TReal32       aFrameRate, 
+    TInt          aBitRate, 
+    TBool         aAudioEnabled,
+    TInt          aAudioBitRate, 
+    const TDesC8& aMimeType, 
+    const TDesC&  aPreferredSupplier, 
+    const TDesC8& aVideoType, 
+    const TDesC8& aAudioType )
+    {
+    OstTrace0( CAMERASRV_PERFORMANCE, DUP4_CCAEENGINEIMP_PREPAREVIDEORECORDINGL, "e_CAM_CAE_PREPAREVIDEORECORDINGL 1" );
+    // Memorize video audio bit rate value to be prepared.
+    iVideoAudioBitRatePrep = aAudioBitRate;
+    // Force audio bit rate preparation.
+    iPrepareVideoAudioBitRate = ETrue;
+
+    // Call the version without audio bit rate argument.
+    // This is possible because the separate PrepareVideoSettingsL() is doing
+    // settings after succesfull opening of video recording.
+    PrepareVideoRecordingL( aFrameSize, 
+                            aFrameRate, 
+                            aBitRate, 
+                            aAudioEnabled, 
+                            aMimeType, 
+                            aPreferredSupplier, 
+                            aVideoType, 
+                            aAudioType );
+    OstTrace0( CAMERASRV_PERFORMANCE, DUP5_CCAEENGINEIMP_PREPAREVIDEORECORDINGL, "e_CAM_CAE_PREPAREVIDEORECORDINGL 0" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::MvruoOpenComplete
+// The status of the video recorder after initialisation.
+// This is either KErrNone if the open has completed successfully,
+// or one of the system wide error codes
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::MvruoOpenComplete( 
+    TInt aError )
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::MvruoOpenComplete() entering, aError=%d" ), aError );
+
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaeMvruoOpenCompleteError( aError );
+    #endif    
+
+    if ( aError == KErrNone )
+        {
+        // To get default video audio bit rate.
+        TRAP( aError, { iVideoAudioBitRate = iVideoRecorder->AudioBitRateL(); } );
+        // (ignore possible error)
+        // Prepare settings only if no errors in opening.
+        TRAP( aError, PrepareVideoSettingsL() );
+        if ( aError != KErrNone ) 
+            {
+            OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_MVRUOOPENCOMPLETE, "e_CAM_CAE_MCAEOVIDEOPREPARECOMPLETE 1" );
+            iCaeObserver->McaeoVideoPrepareComplete( aError );
+            OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_MVRUOOPENCOMPLETE, "e_CAM_CAE_MCAEOVIDEOPREPARECOMPLETE 0" );
+            }
+        }
+    else
+        {
+        OstTrace0( CAMERASRV_PERFORMANCE, DUP2_CCAEENGINEIMP_MVRUOOPENCOMPLETE, "e_CAM_CAE_MCAEOVIDEOPREPARECOMPLETE 1" );
+        iCaeObserver->McaeoVideoPrepareComplete( aError );
+        OstTrace0( CAMERASRV_PERFORMANCE, DUP3_CCAEENGINEIMP_MVRUOOPENCOMPLETE, "e_CAM_CAE_MCAEOVIDEOPREPARECOMPLETE 0" );
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::MvruoOpenComplete() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::MvruoPrepareComplete
+// Notification that video recorder is ready to begin recording. This callback
+// is generated in response to a call to VR's Prepare.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::MvruoPrepareComplete( 
+    TInt aError )
+    {
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::MvruoPrepareComplete() entering, aError=%d" ), aError );
+
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaeMvruoPrepareCompleteError( aError );
+    #endif    
+
+    if ( iVideoOpened && ( aError == KErrNone ) )
+        {
+        iVideoPrepared = ETrue; // Later errors with settings after 
+                                // do not change the value.
+        }
+
+    if ( iPrepPars )
+        {
+        iPrepPars = EFalse;
+        // If no error, then fresh parameters are valid.
+        // Otherwise, old parameters are kept.
+        if ( aError == KErrNone )
+            {
+            *iVideoFrameSize    = *iVideoFrameSizePrep;
+            iVideoFrameRate     = iVideoFrameRatePrep;
+            iVideoBitRate       = iVideoBitRatePrep;
+            iVideoAudioEnabled  = iVideoAudioEnabledPrep;
+            iVideoAudioBitRate  = iVideoAudioBitRatePrep;
+            iMaxClipSizeInBytes = iMaxClipSizeInBytesPrep;
+            }
+        else 
+            {
+            *iVideoFrameSizePrep    = *iVideoFrameSize;
+            iVideoFrameRatePrep     = iVideoFrameRate;
+            iVideoBitRatePrep       = iVideoBitRate;
+            iVideoAudioEnabledPrep  = iVideoAudioEnabled;
+            iVideoAudioBitRatePrep  = iVideoAudioBitRate;
+            iMaxClipSizeInBytesPrep = iMaxClipSizeInBytes;
+            }
+        }
+
+    OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_MVRUOPREPARECOMPLETE, "e_CAM_CAE_MCAEOVIDEOPREPARECOMPLETE 1" );
+    iCaeObserver->McaeoVideoPrepareComplete( aError );
+    OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_MVRUOPREPARECOMPLETE, "e_CAM_CAE_MCAEOVIDEOPREPARECOMPLETE 0" );
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::MvruoPrepareComplete() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::MvruoRecordComplete
+// Notification that video recording has completed. This is not called if 
+// recording is explicitly stopped by calling Stop.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::MvruoRecordComplete( 
+    TInt aError )
+    {
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::MvruoRecordComplete() entering, aError=%d, iVideoRecordingRunning=%d" ), aError, iVideoRecordingRunning );
+    
+    // Stop generating video recording time information for the client. 
+    iVideoTimes->Cancel();
+    // Recording stopped: can't be paused anymore.
+    iVideoRecordingPaused = EFalse; 
+        
+ 	// Reset previous time information
+    iPrevTimeElapsed = 0;
+    iPrevTimeRemaining = 0;
+    	
+    if ( iVideoRecordingRunning || iAsyncVideoStopEnabled ) // To ensure that McaeoVideoRecordingComplete 
+        {                                                   // gets called just once per recording.
+        iVideoRecordingRunning = EFalse;
+        
+        #ifdef CAE_TEST_VERSION
+        // For simulating errors when compiled as special "test version".
+        CaeMvruoRecordCompleteError( aError );
+        #endif
+        
+        // Close video recording always in error case. Otherwise the camcorder plugin would
+        // be in indeterminated state. 
+        // The code KErrCompletion means that video reocording has been completed by timer
+        if ( aError && aError != KErrCompletion && aError != KErrDiskFull ) 
+        	{ 
+        	CloseVideoRecording();
+        	}
+        	
+        // In async stop mode call also the other call-back to play stop sound
+        if ( iAsyncVideoStopEnabled )
+            {
+            OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_MVRUORECORDCOMPLETE, "e_CAM_CAE_MCAEOVIDEORECORDINGSTOPPED 1" );
+            iCaeObserver->McaeoVideoRecordingStopped();
+            OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_MVRUORECORDCOMPLETE, "e_CAM_CAE_MCAEOVIDEORECORDINGSTOPPED 0" );
+            }
+        OstTrace0( CAMERASRV_PERFORMANCE, DUP2_CCAEENGINEIMP_MVRUORECORDCOMPLETE, "e_CAM_CAE_MCAEOVIDEORECORDINGCOMPLETE 1" );
+        iCaeObserver->McaeoVideoRecordingComplete( aError );
+        OstTrace0( CAMERASRV_PERFORMANCE, DUP3_CCAEENGINEIMP_MVRUORECORDCOMPLETE, "e_CAM_CAE_MCAEOVIDEORECORDINGCOMPLETE 0" );
+        }
+    
+    LOGTEXT( _L( "Cae: CCaeEngineImp::MvruoRecordComplete() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::MvruoEvent
+// Event Notification from controller 
+// -----------------------------------------------------------------------------
+//
+
+void CCaeEngineImp::MvruoEvent( 
+    const TMMFEvent& aEvent )
+    {
+    LOGTEXT3( _L( "Cae: CCaeEngineImp::MvruoEvent() entering, uid=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode );
+    
+    if ( aEvent.iEventType.iUid == KCamCControllerCCVideoRecordStopped.iUid )
+        {
+        OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_MVRUOEVENT, "e_CAM_CAE_MCAEOVIDEORECORDINGSTOPPED 1" );
+        iCaeObserver->McaeoVideoRecordingStopped();
+        OstTrace0( CAMERASRV_PERFORMANCE, DUP3_CCAEENGINEIMP_MVRUOEVENT, "e_CAM_CAE_MCAEOVIDEORECORDINGSTOPPED 0" );
+        }
+    else if ( aEvent.iEventType.iUid == KCamCControllerCCVideoFileComposed.iUid )
+        {
+        OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_MVRUOEVENT, "e_CAM_CAE_MCAEOVIDEORECORDINGCOMPLETE 1" );
+        iCaeObserver->McaeoVideoRecordingComplete( aEvent.iErrorCode );
+        OstTrace0( CAMERASRV_PERFORMANCE, DUP2_CCAEENGINEIMP_MVRUOEVENT, "e_CAM_CAE_MCAEOVIDEORECORDINGCOMPLETE 0" );
+        }
+    else
+        {
+        // Send others events as error to UI 
+        iVideoPrepared = EFalse;    // mark that re-preparation is needed 
+        OstTrace0( CAMERASRV_PERFORMANCE, DUP4_CCAEENGINEIMP_MVRUOEVENT, "e_CAM_CAE_MCAEOVIDEOPREPARECOMPLETE 1" );
+        iCaeObserver->McaeoVideoPrepareComplete( aEvent.iErrorCode );
+        OstTrace0( CAMERASRV_PERFORMANCE, DUP5_CCAEENGINEIMP_MVRUOEVENT, "e_CAM_CAE_MCAEOVIDEOPREPARECOMPLETE 0" );
+        }
+    
+    LOGTEXT( _L( "Cae: CCaeEngineImp::MvruoEvent() returning" ) );
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::CancelVideoRecording
+// Calls Video Recorder API Stop().
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::CancelVideoRecording()
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::CancelVideoRecording() entering" ) );
+    
+    if ( iVideoRecordingRunning ) 
+        {
+        // This also prevents McaeoVideoRecordingComplete() call from MvruoRecordComplete()  
+        // and McaeoVideoRecordingTimes() call from VideoRecordingTimesCallback().
+        iVideoRecordingRunning = EFalse;
+        // Stop generating video recording time information for the client. 
+        iVideoTimes->Cancel();
+        
+ 		// Reset previous time information
+    	iPrevTimeElapsed = 0;
+    	iPrevTimeRemaining = 0;
+    	
+        // Stop video recording. Do not call McaeoVideoRecordingComplete()
+        OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_CANCELVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_STOP 1" );
+        (void) iVideoRecorder->Stop();
+        OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_CANCELVIDEORECORDING, "e_CAM_CAE_VIDEORECORDER_STOP 0" );
+        iVideoRecordingPaused = EFalse;
+        }
+    
+    LOGTEXT( _L( "Cae: CCaeEngineImp::CancelVideoRecording() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PrepareVideoSettingsL
+// Calls Video Recorder API setting methods to set video recording paramaters.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::PrepareVideoSettingsL()
+    {
+    OstTrace0( CAMERASRV_PERFORMANCE, CCAEENGINEIMP_PREPAREVIDEOSETTINGSL, "e_CAM_CAE_PREPAREVIDEOSETTINGS 1" );
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareVideoSettingsL() entering" ) );
+
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaePrepareVideoSettingsErrorL();
+    #endif    
+
+    iVideoRecorder->SetVideoFrameSizeL( *iVideoFrameSizePrep );
+    iVideoRecorder->SetVideoFrameRateL( iVideoFrameRatePrep );
+    iVideoRecorder->SetVideoBitRateL( iVideoBitRatePrep );
+    iVideoRecorder->SetAudioEnabledL( iVideoAudioEnabledPrep );
+    if ( iPrepareVideoAudioBitRate )
+        {
+        iVideoRecorder->SetAudioBitRateL( iVideoAudioBitRatePrep );
+        iPrepareVideoAudioBitRate = EFalse;
+        }
+    iVideoRecorder->SetMaxClipSizeL( iMaxClipSizeInBytesPrep );
+
+    // Set the recording gain to the maximum
+    TInt gain = iVideoRecorder->GainL();
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::PrepareVideoSettingsL() GainL was %d" ), gain );
+    gain = iVideoRecorder->MaxGainL();
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::PrepareVideoSettingsL() MaxGainL is %d" ), gain );
+    iVideoRecorder->SetGainL( gain );
+    gain = iVideoRecorder->GainL();
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::PrepareVideoSettingsL() GainL set to %d" ), gain );
+
+    iPrepPars = ETrue;
+    OstTrace0( CAMERASRV_PERFORMANCE, DUP2_CCAEENGINEIMP_PREPAREVIDEOSETTINGSL, "e_CAM_CAE_VIDEORECORDER_PREPARE 1" );
+    iVideoRecorder->Prepare();
+    OstTrace0( CAMERASRV_PERFORMANCE, DUP3_CCAEENGINEIMP_PREPAREVIDEOSETTINGSL, "e_CAM_CAE_VIDEORECORDER_PREPARE 0" );
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::PrepareVideoSettingsL() returning" ) );
+    OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAEENGINEIMP_PREPAREVIDEOSETTINGSL, "e_CAM_CAE_PREPAREVIDEOSETTINGS 0" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::FindVideoUidsL
+// Finds UIDs for opening video recording. Uses ECOM.
+// -----------------------------------------------------------------------------
+//
+void CCaeEngineImp::FindVideoUidsL(
+    const TDesC8& aMimeType, 
+    const TDesC&  aPreferredSupplier )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::FindVideoUidsL() entering" ) );
+
+    iVideoControllerUid.iUid = 0;
+    iVideoFormatUid.iUid = 0; 
+
+    // Retrieve a list of possible controllers from ECOM.
+    //
+    // Controller must support recording the requested mime type.
+    // Controller must be provided by preferred supplier.
+
+    CMMFControllerPluginSelectionParameters* cSelect = 
+        CMMFControllerPluginSelectionParameters::NewLC();
+    CMMFFormatSelectionParameters* fSelect = 
+        CMMFFormatSelectionParameters::NewLC();
+
+    fSelect->SetMatchToMimeTypeL( aMimeType );
+    cSelect->SetRequiredRecordFormatSupportL( *fSelect );
+    cSelect->SetPreferredSupplierL( aPreferredSupplier,
+       CMMFPluginSelectionParameters::EOnlyPreferredSupplierPluginsReturned );
+
+    RMMFControllerImplInfoArray controllers;
+    CleanupResetAndDestroyPushL( controllers );
+    cSelect->ListImplementationsL( controllers );
+
+    if ( controllers.Count() < 1 )
+        {
+        // No appropriate controllers found.
+        LOGTEXT( _L( "Cae: CCaeEngineImp::FindVideoUidsL() leaving KErrNotSupported (no controllers found)" ) );
+        User::Leave( KErrNotSupported );
+        }
+
+    TBool found( EFalse );
+    for ( TInt contInd = 0; contInd < controllers.Count() && !found; contInd++ ) // there can be more than one controller, search from all of them
+        {
+        // Get the controller UID.
+        iVideoControllerUid = controllers[contInd]->Uid();
+        LOGTEXT3( _L("Cae: CCaeEngineImp::FindVideoUidsL() contInd=%d, Uid=%x"), contInd, iVideoControllerUid.iUid );
+
+        // Inquires the controller about supported formats.
+        RMMFFormatImplInfoArray formats = controllers[contInd]->RecordFormats();
+
+        // Get the first format that supports our mime type.
+        for ( TInt i = 0; i < formats.Count(); i++ )
+            {
+            if ( formats[i]->SupportsMimeType( aMimeType ) )
+                {
+                iVideoFormatUid = formats[i]->Uid(); // set the UID
+                found = ETrue;
+                LOGTEXT3( _L("Cae: CCaeEngineImp::FindVideoUidsL() Found iVideoFormatUid=%x, index=%d"), iVideoFormatUid.iUid, i );
+                break;
+                }
+            }
+        }
+    if ( !found )
+        {
+        // No appropriate video format found.
+        LOGTEXT( _L( "Cae: CCaeEngineImp::FindVideoUidsL() leaving KErrNotSupported (no video format found)" ) );
+        User::Leave( KErrNotSupported );
+        }
+
+    CleanupStack::PopAndDestroy( 3, cSelect ); // cselect, fselect, controllers
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::FindVideoUidsL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::ConvertAndSetVideoAudioTypeL
+// Convert audio type from TDesC8 to TFourCC, set to iVideoAudioType.
+// -----------------------------------------------------------------------------
+//
+TFourCC CCaeEngineImp::ConvertAndSetVideoAudioTypeL(
+    const TDesC8& aAudioType )
+    {
+    if ( aAudioType == KNullDesC8 )
+        {
+        return KMMFFourCCCodeNULL;
+        }
+    else
+        {
+        if ( aAudioType.Length() != 4 ) 
+            {
+            User::Leave( KErrArgument );
+            }
+        return TFourCC( aAudioType[0], aAudioType[1], aAudioType[2], aAudioType[3] );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::VideoRecordingTimesCallback
+// Calls Video Recorder API DurationL() and RecordTimeAvailable().
+// Finally calls McaeoVideoRecordingTimes().
+// -----------------------------------------------------------------------------
+//
+TInt CCaeEngineImp::VideoRecordingTimesCallback( 
+    TAny* aEngineImp )
+    {
+    LOGTEXT( _L( "Cae: CCaeEngineImp::VideoRecordingTimesCallback() entering" ) );
+
+    CCaeEngineImp* thisEngineImp = static_cast<CCaeEngineImp*>( aEngineImp );
+
+    if ( thisEngineImp->iVideoRecordingRunning && !thisEngineImp->iVideoRecordingPaused )
+        {
+        // Query elapsed recording time.
+        TTimeIntervalMicroSeconds timeElapsed( 0 );
+        TRAPD( error, { timeElapsed = thisEngineImp->iVideoRecorder->DurationL(); } );
+        
+        // Query remaining recording time.
+        TTimeIntervalMicroSeconds timeRemaining = thisEngineImp->iVideoRecorder->RecordTimeAvailable();
+        	
+        // The elapsed time could have been reseted to zero by the video recorder 
+        // if there is stopping ongoing in video recorder, even if we do 
+        // not have had the notification yet. In that case McaeoVideoRecordingTimes
+        // should be called with previous valid values.
+        if ( ( timeElapsed == 0 ) && ( thisEngineImp->iPrevTimeElapsed != 0 ) )
+        	{
+        	// Invalid time. Use previous time information
+   			LOGTEXT2( _L( "Cae: CCaeEngineImp::VideoRecordingTimesCallback(). Got invalid elapsed time from the video recorder: %f s." ), 
+   				I64LOW( timeElapsed.Int64() ) * 1.0 / KOneSecond);
+   			LOGTEXT3( _L( "Cae: CCaeEngineImp::VideoRecordingTimesCallback(). Use previous valid elapsed time %f s. and remaining time %f s." ), 
+   				I64LOW( thisEngineImp->iPrevTimeElapsed.Int64() ) * 1.0 / KOneSecond,  
+   				I64LOW( thisEngineImp->iPrevTimeRemaining.Int64() ) * 1.0 / KOneSecond );
+        	timeElapsed = thisEngineImp->iPrevTimeElapsed;
+        	timeRemaining = thisEngineImp->iPrevTimeRemaining;
+        	}
+        else
+         	{
+         	// Store current time information
+        	thisEngineImp->iPrevTimeElapsed = timeElapsed;
+        	thisEngineImp->iPrevTimeRemaining = timeRemaining;
+        	}
+       
+       	// Deliver video recording times information.
+       	thisEngineImp->iCaeObserver->McaeoVideoRecordingTimes( timeElapsed, timeRemaining, error );
+        }
+
+    LOGTEXT( _L( "Cae: CCaeEngineImp::VideoRecordingTimesCallback() returning" ) );
+
+    return ETrue;
+    }
+
+// ---------------------------------------------------------
+// CCaeEngineImp::EnumerateVideoFrameSizeL
+// Checks that camera HW supports given framesize
+// ---------------------------------------------------------
+//
+TInt CCaeEngineImp::EnumerateVideoFrameSizeL(const TSize& aSize)
+    {
+
+    LOGTEXT3( _L("Cae: CCaeEngineImp::EnumerateVideoFrameSizeL(), In, size: %dx%d"), aSize.iWidth, aSize.iHeight );
+
+    TCameraInfo cameraInfo;
+    iCamera->CameraInfo( cameraInfo );
+    
+    TSize size;
+    TInt i = 0;
+    TInt j = 0;
+    TInt sizeIndex = -1;
+
+    if ( cameraInfo.iVideoFrameFormatsSupported & CCamera::EFormatYUV420Planar )
+        {
+        // check YUV420 planar
+        for ( i = 0; i < cameraInfo.iNumVideoFrameSizesSupported; i++ )
+            {
+            iCamera->EnumerateVideoFrameSizes(size, i, CCamera::EFormatYUV420Planar);
+			LOGTEXT3(_L("Cae: CCaeEngineImp::EnumerateVideoFrameSizeL() Camera EFormatYUV420Planar %d x %d found from camera"), size.iWidth, size.iHeight ); 
+        
+            if ( size == aSize )
+                {
+				LOGTEXT3(_L("Cae: CCaeEngineImp::EnumerateVideoFrameSizeL() Camera EFormatYUV420Planar %d x %d Matched."), size.iWidth, size.iHeight ); 
+                sizeIndex = i;
+                break;
+                }
+            }
+        }
+    else
+    	{
+		LOGTEXT(_L("Cae: CCaeEngineImp::EnumerateVideoFrameSizeL() Camera doesn't support EFormatYUV420Planar"));
+    	}
+
+    if ( cameraInfo.iVideoFrameFormatsSupported & CCamera::EFormatYUV422 )
+        {
+        // check YUV422 interleaved
+        for ( j = 0; j < cameraInfo.iNumVideoFrameSizesSupported; j++ )
+            {
+            iCamera->EnumerateVideoFrameSizes(size, j, CCamera::EFormatYUV422 );
+			LOGTEXT3(_L("Cae: CCaeEngineImp::EnumerateVideoFrameSizeL() Camera EFormatYUV422 %d x %d found from camera"), size.iWidth, size.iHeight );
+        
+            if ( size == aSize )
+                {
+                LOGTEXT3(_L("Cae: CCaeEngineImp::EnumerateVideoFrameSizeL() Camera EFormatYUV422 %d x %d Matched."), size.iWidth, size.iHeight );
+                sizeIndex = j;
+                break;
+                }
+            }
+        }
+    else
+    	{
+		LOGTEXT(_L("Cae: CCaeEngineImp::EnumerateVideoFrameSizeL() Camera doesn't support EFormatYUV422"));	
+    	}
+
+    if ( sizeIndex == -1 )
+        {
+        LOGTEXT(_L("Cae: CCaeEngineImp::EnumerateVideoFrameSizeL(), Camera does not support this resolution"));
+        }
+
+
+    LOGTEXT(_L("Cae: CCaeEngineImp::EnumerateVideoFrameSizeL(), Out"));
+    return ( sizeIndex );
+    }
+
+// ---------------------------------------------------------
+// CCaeEngineImp::SetAsyncVideoStopMode
+// Enables/disables async stopping
+// ---------------------------------------------------------
+//
+TInt CCaeEngineImp::SetAsyncVideoStopMode( TBool aAsyncVideoStopEnabled )
+    {
+    LOGTEXT2( _L("Cae: CCaeEngineImp::SetAsyncVideoStop(%d) entering"), aAsyncVideoStopEnabled );
+    TInt err;
+
+    // Check if async stopping is supported
+    if ( iVideoControllerUid == KCamCControllerImplementationUid ) 
+        {
+        iAsyncVideoStopEnabled = aAsyncVideoStopEnabled; 
+        err = KErrNone;
+        }
+    else
+        {
+        err = KErrNotSupported;
+        }
+
+    LOGTEXT2(_L("Cae: CCaeEngineImp::SetAsyncVideoStop() err=%d, returning"), err);
+    return ( err );
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeExtension.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine Extension creation proxy
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CaeEngineExtInterface.h"                   // Engine implementation header.
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// class MExtension
+
+// -----------------------------------------------------------------------------
+// MExtension::NewExtensionL
+// Create and construct the extension object via ECom.
+// -----------------------------------------------------------------------------
+// 
+MExtension* MExtension::NewExtensionL( TUid aImplementationUid, MExtensionCallbackInterface* aEngine  )
+	{
+	TAny* extInterface = REComSession::CreateImplementationL( 
+		aImplementationUid, _FOFF (MExtension, iDtor_ID_Key), (TAny*) aEngine);
+	return reinterpret_cast <MExtension*> (extInterface);
+	}
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeImageItem.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Still Image Item for Camera Application Engine
+*
+*/
+
+
+// INCLUDE FILES
+#include "CaeImageItem.h"                   // Still image item class.
+#include <fbs.h>                            // For CFbsBitmap
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCaeImageItem::CCaeImageItem
+// -----------------------------------------------------------------------------
+//
+CCaeImageItem::CCaeImageItem( RHeap& aImageHeap ) 
+	: iImageHeap( aImageHeap ) 
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeImageItem::~CCaeImageItem
+// Destroys image queue.
+// -----------------------------------------------------------------------------
+//
+CCaeImageItem::~CCaeImageItem()
+    {
+    delete iBitmap;
+    iImageHeap.Free(iImageData);
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeImageItemExtPro.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2003-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Still Image Item Extension Processing for Camera Application Engine
+*
+*/
+
+
+// INCLUDE FILES
+#include "CaeImageItemExtPro.h"             // Still image item class.
+#include <fbs.h>                            // For CFbsBitmap
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCaeImageItemExtPro::CCaeImageItemExtPro
+// -----------------------------------------------------------------------------
+//
+CCaeImageItemExtPro::CCaeImageItemExtPro() 
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeImageItemExtPro::CCaeImageItemExtPro
+// Destroys image data.
+// -----------------------------------------------------------------------------
+//
+CCaeImageItemExtPro::~CCaeImageItemExtPro()
+    {
+    delete iBitmap;
+    delete iImageData;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeImageQueueExtPro.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,214 @@
+/*
+* Copyright (c) 2003-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine image queue extension processing class
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CaeEngineImp.h"                   // For LOGTEXT
+#include <fbs.h>                            // For CFbsBitmap
+
+#include "CaeImageQueueExtPro.h"            // Still image burst capturing class.
+#include "CaeImageItemExtPro.h"             // Still image item class.
+
+
+// CONSTANTS
+const TInt KCaeStillBurstImageQueueGranularity = 6; // optimized count of burst images
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCaeImageQueueExtPro::NewL
+// -----------------------------------------------------------------------------
+//
+CCaeImageQueueExtPro* CCaeImageQueueExtPro::NewL()
+    {
+    LOGTEXT( _L( "Cae: CCaeImageQueueExtPro::NewL() entering" ) );
+
+    CCaeImageQueueExtPro* self = new( ELeave ) CCaeImageQueueExtPro;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOGTEXT( _L( "Cae: CCaeImageQueueExtPro::NewL() returning" ) );
+
+    return self;
+    }
+
+    
+// -----------------------------------------------------------------------------
+// CCaeImageQueueExtPro::CCaeImageQueueExtPro
+// Destroys image queue.
+// -----------------------------------------------------------------------------
+//
+CCaeImageQueueExtPro::~CCaeImageQueueExtPro()
+    {
+    LOGTEXT( _L( "Cae: CCaeImageQueueExtPro::CaeImageQueueExtPro() entering" ) );
+
+    ResetAndDestroyImages();
+    delete iImageQueue;
+
+    LOGTEXT( _L( "Cae: CCaeImageQueueExtPro::CaeImageQueueExtPro() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeImageQueueExtPro::CaeImageQueueExtPro
+// -----------------------------------------------------------------------------
+//
+CCaeImageQueueExtPro::CCaeImageQueueExtPro() 
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeImageQueueExtPro::ConstructL
+// Allocates image queue.
+// -----------------------------------------------------------------------------
+//
+void CCaeImageQueueExtPro::ConstructL()
+    {
+    LOGTEXT( _L( "Cae: CCaeImageQueueExtPro::ConstructL() entering" ) );
+
+    iImageQueue = new( ELeave ) RPointerArray<CCaeImageItemExtPro>( 
+        KCaeStillBurstImageQueueGranularity );
+
+    LOGTEXT( _L( "Cae: CCaeImageQueueExtPro::ConstructL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeImageQueueExtPro::AppendImage
+// Appends an image item object to image queue.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeImageQueueExtPro::AppendImage( 
+    CFbsBitmap*  aBitmap, 
+    HBufC8*      aImageData,
+    TBool        aLastImage,
+    TBool        aSnapImage )
+    {
+    LOGTEXT( _L( "Cae: CCaeImageQueueExtPro::AppendImage() entering" ) );
+
+    TInt result( KErrNone );
+
+    CCaeImageItemExtPro* imageItem = new CCaeImageItemExtPro();
+    if ( imageItem ) 
+        {
+        // Move image data to image item
+        imageItem->iImageData = aImageData;
+        imageItem->iBitmap = aBitmap;
+        imageItem->iLastImage = aLastImage;
+        imageItem->iSnapImage = aSnapImage;
+
+        // Add image to the queue.
+        result = iImageQueue->Append( imageItem );
+        if ( result != KErrNone ) 
+            {
+            // In case of error, delete only imageItem, not the actual data
+            imageItem->iBitmap = NULL;
+            imageItem->iImageData = NULL;
+            delete imageItem;
+            imageItem = NULL;
+            }
+        }
+    else 
+        {
+        result = KErrNoMemory;
+        }
+
+    LOGTEXT( _L( "Cae: CCaeImageQueueExtPro::AppendImage() returning" ) );
+
+    return result;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeImageQueueExtPro::ImageCount
+// -----------------------------------------------------------------------------
+//
+TInt CCaeImageQueueExtPro::ImageCount() const
+    {
+    // Return the count of image items.
+    return iImageQueue->Count();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeImageQueueExtPro::GetNextImage
+// Fetches and deletes the next image from image queue.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeImageQueueExtPro::GetNextImage( 
+    CFbsBitmap*&   aBitmap,     // output
+    HBufC8*&       aImageData,  // output
+    TBool&         aLastImage,  // output
+    TBool&         aSnapImage ) // output
+    {
+    LOGTEXT2( _L( "Cae: CCaeImageQueueExtPro::GetNextImage() entering, %d images in queue" ), iImageQueue->Count() );
+
+    TInt error( KErrNone );
+
+    if ( iImageQueue->Count() > 0 )
+        {
+        // Get image data and bitmap pointer from the queue image item.
+        aImageData = (*iImageQueue)[0]->iImageData;
+        aBitmap    = (*iImageQueue)[0]->iBitmap;
+        aLastImage = (*iImageQueue)[0]->iLastImage;
+        aSnapImage = (*iImageQueue)[0]->iSnapImage;
+
+        // Do not delete the data. Delete the image item and remove from queue.
+        (*iImageQueue)[0]->iBitmap = NULL;
+        (*iImageQueue)[0]->iImageData = NULL;
+        delete (*iImageQueue)[0];
+        iImageQueue->Remove( 0 );
+        }
+    else 
+        {
+        aBitmap = NULL;
+        aImageData = NULL;
+        aLastImage = EFalse;
+        aSnapImage = EFalse;
+        error = KErrUnderflow;
+        }
+
+    LOGTEXT2( _L( "Cae: CCaeImageQueueExtPro::GetNextImage() returning: %d" ), error );
+
+    return error;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeImageQueueExtPro::ResetAndDestroyImages()
+// Reset and destroy image queue.
+// -----------------------------------------------------------------------------
+//
+void CCaeImageQueueExtPro::ResetAndDestroyImages()
+    {
+    LOGTEXT( _L( "Cae: CCaeImageQueueExtPro::ResetAndDestroyImages()" ) );
+
+    if ( iImageQueue ) 
+        {
+        // Reset and destroy the image items from queue.
+        iImageQueue->ResetAndDestroy();
+        }
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeQualityLevels.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine imaging quality level and container
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CaeQualityLevels.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCaeQualityLevelsCont::CCaeQualityLevelsCont
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CCaeQualityLevelsCont::CCaeQualityLevelsCont()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeQualityLevelsCont::~CCaeQualityLevelsCont
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CCaeQualityLevelsCont::~CCaeQualityLevelsCont()
+    {
+    }
+
+
+/////////////////////////////
+// CQualityLevel methods 
+/////////////////////////////
+
+
+// -----------------------------------------------------------------------------
+// CQualityLevel::CQualityLevel
+// Default constructor.
+// -----------------------------------------------------------------------------
+//
+CQualityLevel::CQualityLevel()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CQualityLevel::~CQualityLevel
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CQualityLevel::~CQualityLevel()
+    {
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeQualityLevelsNoSd.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine imaging quality levels container 
+*                methods without Shared Data ini-file support.
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CaeQualityLevels.h"
+
+#include "CaeEngineImp.h"       // For LOGTEXT
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCaeQualityLevelsCont::InitFromSdL
+// -----------------------------------------------------------------------------
+//
+TInt CCaeQualityLevelsCont::InitFromSdL( 
+    const TUid&  /*aSdUidQltyLevels*/ )
+    {
+    LOGTEXT( _L( "Cae: CCaeQualityLevelsCont::InitFromSdL(): NOT SUPPORTED, leaving" ) );
+
+    User::Leave( KErrNotSupported );
+
+    return 0;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeQualityLevelsCont::FetchQualityLevelL
+// ---------------------------------------------------------------------------
+//
+void CCaeQualityLevelsCont::FetchQualityLevelL( 
+    RSharedDataClient& /*aSharedData*/, 
+    const TUid&        /*aSdUidQltyLevels*/, 
+    TInt               /*aIndex*/ )
+    {
+    LOGTEXT( _L( "Cae: CCaeQualityLevelsCont::FetchQualityLevelL(): NOT SUPPORTED, leaving" ) );
+
+    User::Leave( KErrNotSupported );
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeStillBurst.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,353 @@
+/*
+* Copyright (c) 2003,2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine still image burst class
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CaeEngineImp.h"                   // For LOGTEXT
+#include <fbs.h>                            // For CFbsBitmap
+#include <hal.h>                            // For HAL
+
+#include "CaeStillBurst.h"                  // Still image burst capturing class.
+#include "CaeImageItem.h"                   // Still image item class.
+
+
+// CONSTANTS
+const TInt KCaeStillBurstImageQueueGranularity = 6;
+const TInt KCaeMinImageHeapSize = 0; 
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillBurst::NewL
+// -----------------------------------------------------------------------------
+//
+CCaeStillBurst* CCaeStillBurst::NewL()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillBurst::NewL() entering" ) );
+
+    CCaeStillBurst* self = new( ELeave ) CCaeStillBurst;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOGTEXT( _L( "Cae: CCaeStillBurst::NewL() returning" ) );
+
+    return self;
+    }
+
+    
+// -----------------------------------------------------------------------------
+// CCaeStillBurst::~CCaeStillBurst
+// Destroys image queue.
+// -----------------------------------------------------------------------------
+//
+CCaeStillBurst::~CCaeStillBurst()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillBurst::~CCaeStillBurst() entering" ) );
+
+    ResetAndDestroyImages();
+
+    if ( iImageHeap )
+        {
+        iImageHeap->Close();
+        }
+
+    delete iImageQueue;
+
+    LOGTEXT( _L( "Cae: CCaeStillBurst::~CCaeStillBurst() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillBurst::CCaeStillBurst
+// -----------------------------------------------------------------------------
+//
+CCaeStillBurst::CCaeStillBurst() 
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillBurst::ConstructL
+// Allocates image queue.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillBurst::ConstructL()
+    {
+    LOGTEXT2( _L( "Cae: CCaeStillBurst::ConstructL() entering, min heap: %d" ), KCaeMinImageHeapSize );
+
+    iImageQueue = new( ELeave ) RPointerArray<CCaeImageItem>( 
+        KCaeStillBurstImageQueueGranularity );
+
+    TInt maxMem;
+    User::LeaveIfError( HAL::Get( HAL::EMemoryRAM, maxMem ) );
+    #if (defined (__WINS__) || defined (__WINSCW__))
+    maxMem /= 2; // Fix emulator -4 error
+    #endif
+
+    iImageHeap = User::ChunkHeap( NULL, KCaeMinImageHeapSize, maxMem );
+
+    #ifdef _DEBUG
+    if ( !iImageHeap )
+        {
+        LOGTEXT( _L( "Cae: CCaeStillBurst::ConstructL() Error: Cannot create iImageHeap !" ) );
+        }
+    #endif
+
+    User::LeaveIfNull( iImageHeap );
+
+    LOGTEXT( _L( "Cae: CCaeStillBurst::ConstructL() returning" ) );
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillBurst::SetLengthL
+// -----------------------------------------------------------------------------
+//
+void CCaeStillBurst::SetLengthL( 
+    TInt aLength )
+    {
+    LOGTEXT2( _L( "Cae: CCaeStillBurst::SetLengthL(): length: %d" ), aLength );
+
+    // Leave if not supported.
+    if ( aLength < 1 )
+        {
+        LOGTEXT( _L( "Cae: CCaeStillBurst::SetLengthL(): leaving KErrArgument" ));
+        User::Leave( KErrArgument );
+        }
+
+    iDesiredLength = aLength;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillBurst::Length
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillBurst::Length() const
+    {
+    LOGTEXT2( _L( "Cae: CCaeStillBurst::Length(): length: %d" ), iDesiredLength );
+
+    return iDesiredLength;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillBurst::AppendImage
+// Appends an image item object to image queue.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillBurst::AppendImage( 
+    CFbsBitmap*  aBitmap, 
+    HBufC8*      aImageData, 
+    TInt         aError )
+    {
+    LOGTEXT2( _L( "Cae: CCaeStillBurst::AppendImage() entering: %d" ), aError );
+
+    TInt result( KErrNone );
+
+    CCaeImageItem* imageItem = new CCaeImageItem( *iImageHeap );
+    if ( imageItem ) 
+        {
+        if (aImageData)
+            {
+            // Copy image data from HBufC8 to image heap
+            imageItem->iImageData = iImageHeap->Alloc( aImageData->Size() );
+            if ( imageItem->iImageData )
+                {
+                imageItem->iImageDataSize = aImageData->Size();
+                Mem::Copy( imageItem->iImageData, aImageData->Ptr(), 
+                    imageItem->iImageDataSize );
+                }
+            else
+                {
+                result = KErrNoMemory;
+                }
+            }
+        if ( result == KErrNone ) 
+            {
+            imageItem->iBitmap = aBitmap;
+            imageItem->iError  = aError;
+            // Add image to the queue.
+            result = iImageQueue->Append( imageItem );
+            }
+        if ( result == KErrNone ) 
+            {
+            iCountOfBurstAppends++;
+            LOGTEXT2( _L( "Cae: CCaeStillBurst::AppendImage(): count of burst appends = %d" ), iCountOfBurstAppends );
+
+            // Given aImageData can be deleted now as it has successfully 
+            // been copied to imageItem->iImageData
+            delete aImageData;
+            }
+        else
+            {
+            // Do not delete the bitmap if error, delete just imageItem 
+            // which deletes also iImageData.
+            imageItem->iBitmap = NULL;
+            delete imageItem;
+            imageItem = NULL;
+            }
+        }
+    else 
+        {
+        result = KErrNoMemory;
+        }
+
+    LOGTEXT( _L( "Cae: CCaeStillBurst::AppendImage() returning" ) );
+
+    return result;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillBurst::CaptureCount
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillBurst::CaptureCount() const
+    {
+    // Return the count of appends (captures) made.
+    return iCountOfBurstAppends;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillBurst::ImageCount
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillBurst::ImageCount() const
+    {
+    // Return the count of image items.
+    return iImageQueue->Count();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillBurst::GetNextImage
+// Fetches and deletes the next image from image queue.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillBurst::GetNextImage( 
+    CFbsBitmap*&   aBitmap,     // output
+    HBufC8*&       aImageData,  // output
+    TInt&          aError )     // output
+    {
+    LOGTEXT2( _L( "Cae: CCaeStillBurst::GetNextImage() entering, %d images in queue" ), iImageQueue->Count() );
+
+    TInt error( KErrNone );
+
+    if ( iImageQueue->Count() > 0 )
+        {
+
+        if ( (*iImageQueue)[0]->iImageData )
+            {
+            // Copy image data from queue image item.
+            aImageData = HBufC8::New( (*iImageQueue)[0]->iImageDataSize );
+            if ( aImageData )
+                {
+                aImageData->Des().Copy( (TUint8*)(*iImageQueue)[0]->iImageData, 
+                    (*iImageQueue)[0]->iImageDataSize );
+                }
+            else
+                {
+                error = KErrNoMemory;
+                }
+            }
+
+        if ( error == KErrNone )
+            {
+            // Get bitmap pointer and image error value from the queue image item.
+            aBitmap     = (*iImageQueue)[0]->iBitmap;
+            aError      = (*iImageQueue)[0]->iError;
+
+            #ifdef _DEBUG
+            if ( aError )
+                {
+                LOGTEXT2( _L( "Cae: CCaeStillBurst::GetNextImage(): This image has error: %d" ), aError );
+                }
+            #endif
+
+            // Do not delete the bitmap. Delete the image item which deletes iImageData also.
+            (*iImageQueue)[0]->iBitmap = NULL;
+            delete (*iImageQueue)[0];
+            iImageQueue->Remove( 0 );
+            }
+
+        if ( ( iImageQueue->Count() == 0 ) || error ) 
+            {
+            // Give free memory to system from the top of heap.
+            iImageHeap->Compress(); 
+            LOGTEXT( _L( "Cae: CCaeStillBurst::GetNextImage(): last image fetched, compressed the heap" ) );
+            MEM();
+            }
+        }
+    else 
+        {
+        aBitmap = NULL;
+        aImageData = NULL;
+        error = KErrUnderflow;
+        }
+
+    LOGTEXT2( _L( "Cae: CCaeStillBurst::GetNextImage() returning: %d" ), error );
+
+    return error;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillBurst::IsBurstCaptured
+// -----------------------------------------------------------------------------
+//
+TBool CCaeStillBurst::IsBurstCaptured() const
+    {
+    TBool isComplete( EFalse );
+    if ( iCountOfBurstAppends >= iDesiredLength )
+        {
+        isComplete = ETrue;
+        }    
+    return isComplete;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillBurst::ResetAndDestroyImages()
+// Reset and destroy image queue.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillBurst::ResetAndDestroyImages()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillBurst::ResetAndDestroyImages()" ) );
+
+    if ( iImageQueue ) 
+        {
+        // Reset and destroy the image items from queue.
+        iImageQueue->ResetAndDestroy();
+        }
+    if ( iImageHeap )
+        {
+        iImageHeap->Compress(); // Give free memory to system from the top of heap
+        }
+    iCountOfBurstAppends = 0;
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeStillQualityLevels.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,228 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine still image quality level and container
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CaeStillQualityLevels.h"
+
+#include "CaeEngineImp.h"       // For LOGTEXT
+
+
+// CONSTANTS
+const TInt KQualityLevelArrayGranularity = 3;
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillQualityLevelsCont::CCaeStillQualityLevelsCont
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CCaeStillQualityLevelsCont::CCaeStillQualityLevelsCont()
+: iQltyLevelCountSdKey( KCaeStillQltyLevelCount )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillQualityLevelsCont::~CCaeStillQualityLevelsCont
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CCaeStillQualityLevelsCont::~CCaeStillQualityLevelsCont()
+    {
+    delete iQualityLevels;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillQualityLevelsCont::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillQualityLevelsCont::ConstructL()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillQualityLevelsCont::ConstructL() entering" ) );
+
+    iQualityLevels = new( ELeave ) CArrayFixFlat<CStillQualityLevel>( KQualityLevelArrayGranularity );
+
+    LOGTEXT( _L( "Cae: CCaeStillQualityLevelsCont::ConstructL() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillQualityLevelsCont::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCaeStillQualityLevelsCont* CCaeStillQualityLevelsCont::NewL()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillQualityLevelsCont::NewL() entering" ) );
+
+    CCaeStillQualityLevelsCont* self = new( ELeave ) CCaeStillQualityLevelsCont;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOGTEXT( _L( "Cae: CCaeStillQualityLevelsCont::NewL() returning" ) );
+
+    return self;
+    }
+
+    
+// -----------------------------------------------------------------------------
+// CCaeStillQualityLevelsCont::InitDefaultsL
+// Sets hardcoded default parameters for default still quality levels that 
+// are created.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillQualityLevelsCont::InitDefaultsL()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillQualityLevelsCont::InitDefaultsL() entering" ) );
+
+    // Delete all elements from the array and 
+    // free the memory allocated to the array buffer.
+    iQualityLevels->Reset();
+
+    // Initialize hardcoded default quality levels.
+
+    TSize size;
+
+    CStillQualityLevel* stillQualityLevel = new( ELeave ) CStillQualityLevel;
+    CleanupStack::PushL( stillQualityLevel );
+
+    // Level 0:
+    size.SetSize( KCaeImgWidthVGA, KCaeImgHeightVGA );
+    stillQualityLevel->iFrameSize = size;
+    stillQualityLevel->iOutputFormat = CCamera::EFormatJpeg;
+    stillQualityLevel->iCompressionQuality = 90; // From range [0,100] [worst,best]
+    stillQualityLevel->iByteSize = 90000; // Estimate only for a typical size in bytes.
+    stillQualityLevel->iKey = KCaeStillQltyLevel0;
+    iQualityLevels->AppendL( *stillQualityLevel );
+
+    // Level 1:
+    size.SetSize( KCaeImgWidthVGA, KCaeImgHeightVGA );
+    stillQualityLevel->iFrameSize = size;
+    stillQualityLevel->iOutputFormat = CCamera::EFormatJpeg;
+    stillQualityLevel->iCompressionQuality = 50; // From range [0,100] [worst,best]
+    stillQualityLevel->iByteSize = 35000; // Estimate only for a typical size in bytes.
+    stillQualityLevel->iKey = KCaeStillQltyLevel1;
+    iQualityLevels->AppendL( *stillQualityLevel );
+
+    // Level 2:
+    size.SetSize( KCaeImgWidthQQVGA, KCaeImgHeightQQVGA );
+    stillQualityLevel->iFrameSize = size;
+    stillQualityLevel->iOutputFormat = CCamera::EFormatJpeg;
+    stillQualityLevel->iCompressionQuality = 90; // From range [0,100] [worst,best]
+    stillQualityLevel->iByteSize = 12000; // Estimate only for a typical size in bytes.
+    stillQualityLevel->iKey = KCaeStillQltyLevel2;
+    iQualityLevels->AppendL( *stillQualityLevel );
+
+    CleanupStack::PopAndDestroy( stillQualityLevel );
+    
+    LOGTEXT( _L( "Cae: CCaeStillQualityLevelsCont::InitDefaultsL() returning" ) );
+
+    return iQualityLevels->Count();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillQualityLevelsCont::Count
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillQualityLevelsCont::Count() const
+    {
+    return iQualityLevels->Count();
+    }
+
+        
+// -----------------------------------------------------------------------------
+// CCaeStillQualityLevelsCont::At
+// -----------------------------------------------------------------------------
+//
+CStillQualityLevel& CCaeStillQualityLevelsCont::At( 
+    TInt aIndex ) const 
+    {
+    return iQualityLevels->At( aIndex );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillQualityLevelsCont::Key
+// -----------------------------------------------------------------------------
+//
+const TDes& CCaeStillQualityLevelsCont::Key( 
+    TInt aIndex ) const
+    {
+    return iQualityLevels->At( aIndex ).iKey;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillQualityLevelsCont::ResizeL
+// -----------------------------------------------------------------------------
+//
+void CCaeStillQualityLevelsCont::ResizeL( 
+    TInt aQualityLevelCount )
+    {
+    iQualityLevels->ResizeL( aQualityLevelCount );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillQualityLevelsCont::QltyLevelCountSdKey
+// -----------------------------------------------------------------------------
+//
+const TDesC& CCaeStillQualityLevelsCont::QltyLevelCountSdKey() const
+    {
+    return iQltyLevelCountSdKey;
+    }
+
+
+/////////////////////////////
+// CStillQualityLevel methods 
+/////////////////////////////
+
+
+// -----------------------------------------------------------------------------
+// CStillQualityLevel::CStillQualityLevel
+// Default constructor.
+// -----------------------------------------------------------------------------
+//
+CStillQualityLevel::CStillQualityLevel()
+:CQualityLevel()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CStillQualityLevel::~CStillQualityLevel
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CStillQualityLevel::~CStillQualityLevel()
+    {
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeStillQualityLevelsNoSd.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine still image quality levels container
+*                without Shared Data API support.
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CaeStillQualityLevels.h"
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillQualityLevelsCont::CreateQualityLevelString
+// Creates quality level string for SharedData Camera ini file.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillQualityLevelsCont::CreateQualityLevelString( 
+    TInt  /*aIndex*/,
+    TDes& /*aDefaultQualityLevel*/ )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillQualityLevelsCont::ParseQualityLevelFromStringL
+// Parses quality level string to quality level object data.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillQualityLevelsCont::ParseQualityLevelFromStringL( 
+    const TDesC& /*aQualityLevelString*/, 
+    TInt         /*aIndex*/ )
+    {
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeStillStatesActive.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,2144 @@
+/*
+* Copyright (c) 2005 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Still capture state machine implementation class
+*
+*/
+
+
+// INCLUDE FILES
+#include <hal.h>                    // For getting the display mode
+#include <ExifRead.h>
+#include "CaeStillStatesActive.h"
+#include "CaeImageQueueExtPro.h"
+
+#ifdef CAE_TEST_VERSION
+#include "CaeEngineImpTestErrors.h" // For TEST_VERSION compilation only
+#endif
+
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "CaeStillStatesActiveTraces.h"
+#endif
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::CCaeStillStatesActive()
+// C++ constructor.
+// Adds the object to the Active Scheduler.
+// ---------------------------------------------------------------------------
+//
+CCaeStillStatesActive::CCaeStillStatesActive( 
+    CCamera& aCamera,
+    const TCamAppEngineInfo& aInfo,
+    RArray<TCaeExtensionInterfaceImplItem>& aProcessImageImplList )
+    : CActive( EPriorityStandard ), 
+      iCamera( aCamera ),
+      iInfo( aInfo ),
+      iProcessImageImplList( aProcessImageImplList ),
+      iStillInputFormat( CCamera::EFormatFbsBitmapColor16M ), 
+      iStillOutputFormat( CCamera::EFormatFbsBitmapColor16M ), 
+      iStillCompressionQuality( KCaeDefaultCompressionQuality ),
+      iCurrentExtensionIndex( -1 )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::~CCaeStillStatesActive()
+// Destructor. 
+// Cancels operation and closes the timer.
+// ---------------------------------------------------------------------------
+//
+CCaeStillStatesActive::~CCaeStillStatesActive()
+    {
+    Cancel();
+
+    iDelayedCallTimer.Close();
+    
+    DeleteStillBurst(); // Using this removes dependency to still burst class
+
+    CancelAndCleanup();
+
+    // Check that extensions handle flag registration properly
+    CAE_ASSERT_DEBUG( iRequireFullColorSnapInputImageRefCount == 0 );
+
+    delete iEmptySnapImage;
+
+    delete iStillDecoder;
+    delete iStillEncoder;
+
+	delete iSnapBitmap;
+	delete iBitmap;
+	delete iImageData;
+	delete iImageHeaderData;
+    delete iImageQueueExtPro;
+    iFs.Close();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::NewL()
+// Symbian OS two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CCaeStillStatesActive* CCaeStillStatesActive::NewL( 
+    CCamera& aCamera,
+    const TCamAppEngineInfo& aInfo,
+    RArray<TCaeExtensionInterfaceImplItem>& aProcessImageImplList )
+    {
+    CCaeStillStatesActive* self = new( ELeave ) CCaeStillStatesActive( aCamera, aInfo, 
+        aProcessImageImplList );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::ConstructL()
+// Symbian OS 2nd phase constructor that can leave.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::ConstructL()
+    {
+    // Get native screen mode. This can be used as default mode for the snap bitmap.
+    iSnapImageColorMode = KCaeDefaultDisplayMode;
+    (void)GetSystemDisplayMode( iSnapImageColorMode );
+    LOGTEXT2( _L( "Cae: CCaeStillStatesActive::ConstructL(). Use display mode %d for the snap image" ), iSnapImageColorMode );
+
+    // Create still image encoder object, e.g. for JPEG encoding.
+    iStillEncoder = CCaeStillEncoder::NewL();
+    iStillEncoder->SetObserver( this );
+
+    // Create still image decoder object, e.g. for JPEG decoding.
+    iStillDecoder = CCaeStillDecoder::NewL();
+    iStillDecoder->SetObserver( this );
+
+    // This empty snap image is currently used just for error cases.
+    iEmptySnapImage = new( ELeave ) CFbsBitmap;
+
+    // Create timer 
+    iDelayedCallTimer.CreateLocal();
+    
+    // Connect to file server.
+    User::LeaveIfError( iFs.Connect() );
+
+    // Start in normal mode    
+  	iExtModeActive = EFalse;
+    iStillPrepared = EFalse;
+    
+    // Burst mode VF stopping optimization is not used as default
+    iBurstModeVFOptimization = EFalse;
+
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::GetSystemDisplayMode()
+// In some devices Hal:Get(HAL::EDisplayMode) returns directly TDisplayMode, 
+// in other devices it returns a display mode index.
+// ---------------------------------------------------------------------------
+//
+TBool CCaeStillStatesActive::GetSystemDisplayMode( TDisplayMode& aDisplayMode )
+    {
+    TBool found = EFalse;
+    TInt halInOut = 0;
+    TInt err = HAL::Get( HAL::EDisplayMode, halInOut );
+    if (  err == KErrNone )
+        {       
+        if ( halInOut >= EColor256)
+            {
+            // halInOut contains TDisplayMode
+            aDisplayMode = (TDisplayMode) halInOut;
+            found = ETrue;
+            LOGTEXT( _L( "Cae: CCaeStillStatesActive::GetSystemDisplayMode(). HAL returned a display mode." ) );
+            }
+        else
+            {
+             // halInOut contains index
+           LOGTEXT( _L( "Cae: CCaeStillStatesActive::GetSystemDisplayMode(). HAL returned index." ) );
+            err = HAL::Get( HAL::EDisplayBitsPerPixel, halInOut );
+            
+            // Get the color mode. Note: grayscale modes are not supported. 
+            if (  err == KErrNone )
+                {
+				switch (halInOut)
+					{
+				    case 4:
+					    aDisplayMode = EColor16;
+                        found = ETrue;
+                        break;
+			    	case 8:
+					    aDisplayMode = EColor256;
+                        found = ETrue;
+                        break;
+				    case 12:
+				    	aDisplayMode = EColor4K;
+                        found = ETrue;
+                        break;
+				    case 16:
+					    aDisplayMode = EColor64K;
+                        found = ETrue;
+                        break;
+				    case 24:
+					    aDisplayMode = EColor16M;
+                        found = ETrue;
+                        break;
+			    	case 32:
+					    aDisplayMode = EColor16MU;
+                        found = ETrue;
+                        break;
+				    default:
+					    break;
+					}
+                }
+            }
+        } 
+
+    #ifdef _DEBUG
+    if ( err || !found )
+        {
+        TBuf<256> text;
+        text.Format(_L( "Cae: CCaeStillStatesActive::GetSystemDisplayMode(). Cannot get the display mode from HW. Err:%d, found:%d" ), err, found );
+        LOGTEXT( text );        
+        }
+    else
+        {   
+        LOGTEXT2( _L( "Cae: CCaeStillStatesActive::GetSystemDisplayMode(). Found the display mode:%d" ), aDisplayMode );
+        }
+    #endif
+
+    if ( found && !err && aDisplayMode == EColor16MA )
+        {
+        aDisplayMode = EColor16MU;
+        LOGTEXT2( _L( "Cae: CCaeStillStatesActive::GetSystemDisplayMode(). Display mode EColor16MA changed to EColor16MU (%d)" ), aDisplayMode );
+        }
+
+    return found;   
+    }
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::SetCamAppEngineObserver()
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetCamAppEngineObserver( MCamAppEngineObserver& aObserver )
+    {
+    iCaeObserver = &aObserver;    
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetSnapImageCreation()
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetSnapImageCreation( 
+    TBool aCreateSnapImage )
+    {
+    iCreateSnapImage = aCreateSnapImage;
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetSnapImageSourceL()
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetSnapImageSourceL( 
+    CCaeEngine::TSnapImageSource aSnapImageSource )
+    {
+    LOGTEXT2( _L( "Cae: CCaeStillStatesActive::SetSnapImageSourceL(). aSnapImageSource=%d" ), aSnapImageSource );
+    if ( ( aSnapImageSource < 0 ) || 
+         ( aSnapImageSource > CCaeEngine::ESnapImageSourceThumbnail ) )
+        {
+        LOGTEXT( _L( "Cae: CCaeStillStatesActive::SetSnapImageSourceL(). leaving KErrNotSupported" ));
+        User::Leave( KErrNotSupported );
+        }
+
+    iSnapImageSource = aSnapImageSource;
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetSnapImageSizeL()
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetSnapImageSizeL( 
+    TSize& aSize )
+    {
+    LOGTEXT3( _L( "Cae: CCaeStillStatesActive::SetSnapImageSizeL(). iWidth=%d, iHeight=%d" ), aSize.iWidth, aSize.iHeight );
+	// Calc downscaled size.
+    // Use always the default snap size for the snap image. It is the best compromise 
+    // between memory usage and image quality.
+    TSize stepwiseScaledOptimalSize( KCaeDefaultSnapWidth, KCaeDefaultSnapHeight);
+    CalcDownscaledSnapSize( stepwiseScaledOptimalSize ); 
+
+    // Empty calculated size means that PrepareStillCapture() has not been called.
+    if ( stepwiseScaledOptimalSize == TSize() ) 
+        {
+        LOGTEXT( _L( "Cae: CCaeStillStatesActive::SetSnapImageSizeL(). leaving KErrNotReady (no prepare)" ));
+		User::Leave( KErrNotReady ); 
+        }
+    else
+        {
+        iOptimalSnapImageSize = stepwiseScaledOptimalSize;
+        // If empty, use the still image size
+        if ( aSize == TSize() )
+            {
+            aSize = iStillFrameSize;
+            }
+        iSnapImageSize = aSize;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SnapImageSize
+// -----------------------------------------------------------------------------
+TSize CCaeStillStatesActive::SnapImageSize() const
+    {
+    return( iSnapImageSize );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::StillImageSize
+// -----------------------------------------------------------------------------
+TSize CCaeStillStatesActive::StillImageSize() const
+    {
+    return( iStillFrameSize );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetSnapImageColorMode
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetSnapImageColorMode( 
+    TDisplayMode aMode )
+    {
+    iSnapImageColorMode = aMode;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetJpegQuality
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetJpegQuality(
+    TInt aQuality )
+    {
+    iStillCompressionQuality = aQuality;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::JpegQuality
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillStatesActive::JpegQuality() const
+    {
+    return( iStillCompressionQuality );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetImageCodecsL
+// Sets the specific image codec implementation to be used in decoding and 
+// encoding.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetImageCodecsL( 
+	TUid aDecoderUid, TUid aEncoderUid )
+    {
+    iStillEncoder->SetImageCodecL( aEncoderUid );
+    iStillDecoder->SetImageCodecL( aDecoderUid );
+    }
+
+        
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetViewFinderMode
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetViewFinderMode(
+    TBool aIsEnabled )
+    {
+    iIsViewFinderEnabled = aIsEnabled;
+
+    // Issue event, if the view finder is stopped, and the state machine is 
+    // waiting for it. Do not issue the same event twice (it will panic).
+    if ( !iIsViewFinderEnabled 
+         && ( iCurrentState == CCaeStillStatesActive::ECaeStateBurstWaitingForViewFinder ) 
+         && !( IsActive() && ( iStatus == CCaeStillStatesActive::ECaeEventViewFinderForBurstReady ) ) )
+        {
+        Event( CCaeStillStatesActive::ECaeEventViewFinderForBurstReady );        
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::IsRunning
+// Check if the state is other than ECaeStateNone.
+// -----------------------------------------------------------------------------
+//
+TBool CCaeStillStatesActive::IsRunning() const
+    {
+    return( iCurrentState != CCaeStillStatesActive::ECaeStateNone );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::RegisterFlags
+// Increment reference counters.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::RegisterFlags( TUint32 aFlags )
+	{
+    if ( aFlags & ECaeExtFlagRequireFullColorSnapInputImage )
+        { 
+        CAE_ASSERT_DEBUG( iRequireFullColorSnapInputImageRefCount < KMaxTInt32 );
+        if ( iRequireFullColorSnapInputImageRefCount < KMaxTInt32 )
+            {
+            iRequireFullColorSnapInputImageRefCount++;
+            }
+        }
+	}
+
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::DeregisterFlags
+// Decrement reference counters.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DeregisterFlags( TUint32 aFlags )
+    {
+    if ( aFlags & ECaeExtFlagRequireFullColorSnapInputImage )
+        {
+        CAE_ASSERT_DEBUG( iRequireFullColorSnapInputImageRefCount > 0 );
+        if ( iRequireFullColorSnapInputImageRefCount > 0 )
+            {
+            iRequireFullColorSnapInputImageRefCount--;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::PrepareStillCaptureL
+// Using cropping only if supported by Camera API impl.
+// Calls RetrieveStillSizeIndex() that calls Camera API EnumerateCaptureSizes().
+// Calls Camera API PrepareImageCaptureL().
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::PrepareStillCaptureL( 
+    const TSize&      aFrameSize, 
+    CCamera::TFormat  aFormat, 
+    const TRect&      aCropRect,
+    TSize&            aSnapSize )
+    {
+    LOGTEXT3( _L( "Cae: CCaeStillStatesActive::PrepareStillCaptureL() entering aFrameSize=(w=%d,h=%d)" ), aFrameSize.iWidth, aFrameSize.iHeight );
+
+    // Handle empty crop rect
+    TRect cropRect( aCropRect );
+    if ( cropRect.IsEmpty() )
+        cropRect = TRect(TPoint(0, 0 ), aFrameSize);
+
+    CCamera::TFormat stillOutputFormat = aFormat;
+    CCamera::TFormat stillInputFormat = aFormat;
+
+    // Try if this size and format is supported by the Camera API.
+    TInt sizeIndex = RetrieveStillSizeIndex( aFrameSize, aFormat );
+    if ( sizeIndex != -1 )
+        {
+        stillInputFormat = aFormat;
+        }
+    // If the application requires Jpeg we can encode it from bitmap
+    else if ( aFormat == CCamera::EFormatJpeg )
+        {
+        // Try if this size and format KBaseStillInputFormat1 
+        // is supported by the Camera API.
+        stillInputFormat = KBaseStillInputFormat1;
+        sizeIndex = RetrieveStillSizeIndex( aFrameSize, stillInputFormat );
+        if ( sizeIndex == -1 )
+            {
+            // Try if this size and format KBaseStillInputFormat2 
+            // is supported by the Camera API.
+            stillInputFormat = KBaseStillInputFormat2;
+            sizeIndex = RetrieveStillSizeIndex( aFrameSize, stillInputFormat );
+            if ( sizeIndex == -1 )
+                {
+                LOGTEXT2( _L( "Cae: CCaeStillStatesActive::PrepareStillCaptureL() leaving KErrNotSupported, stillInputFormat=%d" ), stillInputFormat );
+                User::Leave( KErrNotSupported );
+                }
+            }
+        }
+    else 
+        {
+        LOGTEXT2( _L( "Cae: CCaeStillStatesActive::PrepareStillCaptureL() leaving KErrNotSupported, aFormat=%d" ), aFormat );
+        User::Leave( KErrNotSupported );
+        }
+
+    // Prepare still image capturing on Camera API.
+    if ( !( iInfo.iOptionsSupported & TCameraInfo::EImageClippingSupported ) ) 
+        {
+        iCamera.PrepareImageCaptureL( stillInputFormat, sizeIndex );
+        }
+    else 
+        {
+        iCamera.PrepareImageCaptureL( stillInputFormat, sizeIndex, cropRect );
+        }
+
+    // Store values 
+    iStillFrameSize = aFrameSize;
+    iStillInputFormat = stillInputFormat;
+    iStillOutputFormat = stillOutputFormat;
+
+    // Calc downscaled size if needed
+    SetSnapImageSizeL( aSnapSize );     
+    
+    // Prepare done
+    iStillPrepared = ETrue;
+    
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::PrepareStillCaptureL() returning" ) );    
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::RetrieveStillSizeIndex
+// Retrieves/fetches still image size index from Camera API.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillStatesActive::RetrieveStillSizeIndex( 
+    const TSize& aFrameSize, 
+    CCamera::TFormat aStillDataFormat ) const
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::RetrieveStillSizeIndex() entering" ) );
+
+    TInt index( -1 );
+    TInt i( 0 );
+    TSize size;
+    while ( ( i < iInfo.iNumImageSizesSupported ) && ( index == -1 ) )
+        {
+        iCamera.EnumerateCaptureSizes ( size, i, aStillDataFormat );
+        if ( size == aFrameSize )
+            {
+            index = i;
+            }
+        i++;
+        }
+
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::RetrieveStillSizeIndex() returning" ) );
+
+    return index;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::CalcDownscaledSnapSize
+// Calc suitable downscaled snap size. Assumed that integer arithmetic is used 
+// also in CImageDecoder class for calculating image scaling to 1/2, 1/4 or 1/8 
+// of size (i.e. no rounding). The scaled snap size is not allowed to be smaller
+// than given snap size in any dimension. Do not do downscaling if aSnapSize is 
+// empty.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::CalcDownscaledSnapSize(
+    TSize& aSnapSize) const
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::CalcDownscaledSnapSize() entering" ) );    
+
+    // The new snap image size is equal to frame size by default
+    TSize newSnapSize = iStillFrameSize;
+
+    // Calculate downscaled snap size
+    if ( aSnapSize != TSize( 0, 0 ) 
+        && ( ( iStillInputFormat == CCamera::EFormatExif ) || 
+             ( iStillInputFormat == CCamera::EFormatJpeg )   ) )
+        {
+        // Try scaling to 1/8, 1/4 and 1/2
+        for  ( TInt divider = 8; divider >= 2;  divider /= 2 ) 
+            {
+            TInt scaledWidth = iStillFrameSize.iWidth / divider;
+            TInt scaledHeight = iStillFrameSize.iHeight / divider;
+            if ( scaledHeight >= aSnapSize.iHeight && scaledWidth >= aSnapSize.iWidth ) 
+                {
+                newSnapSize = TSize( scaledWidth, scaledHeight );
+                divider = -1; // exit loop
+                }
+            }
+        }
+
+    // Return new size
+    aSnapSize = newSnapSize;
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::CalcDownscaledSnapSize() returning" ) );    
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::GetThumbnailL()
+// Extracts thumbnail image and its size from Exif image.
+// Uses Exif reader to extract the thumbnail and 
+// ICL decoder to extract the size.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::GetThumbnailL( 
+    HBufC8*& aReadThumbnail, 
+    TSize&   aThumbnailSize )
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::GetThumbnailL()" ) );    
+
+    if ( iImageData && ( iStillOutputFormat == CCamera::EFormatExif ) )
+        {
+        // Instantiate exif reader.
+        CExifRead* read = NULL;
+        read = CExifRead::NewL( *iImageData );
+        CleanupStack::PushL( read );
+        
+        // Get thumbnail.
+        aReadThumbnail = read->GetThumbnailL();
+        CleanupStack::PopAndDestroy( read );
+        
+        // Find out thumbnail size by using ICL decoder.
+        // Check first that the size is valid.
+        CImageDecoder* decoder = CImageDecoder::DataNewL( iFs, *aReadThumbnail ); 
+        TFrameInfo frameInfo = decoder->FrameInfo();
+        delete decoder;
+
+        if ( frameInfo.iOverallSizeInPixels.iWidth > 0 && 
+             frameInfo.iOverallSizeInPixels.iHeight > 0 )
+            {
+            aThumbnailSize = frameInfo.iOverallSizeInPixels;
+            LOGTEXT3( _L( "Cae: CCaeStillStatesActive::GetThumbnailL(): extracted %dx%d thumbnail" ), 
+                aThumbnailSize.iWidth, aThumbnailSize.iHeight );
+            }
+        else
+            {
+            LOGTEXT3(_L("Cae: CCaeStillStatesActive::GetThumbnailL(): leaving KErrCorrupt due invalid thumbnail size=(w=%d,h=%d)"), 
+                frameInfo.iOverallSizeInPixels.iWidth, frameInfo.iOverallSizeInPixels.iHeight );
+            delete aReadThumbnail;
+            aReadThumbnail = NULL;
+            aThumbnailSize = TSize( 0, 0 );
+            User::Leave( KErrCorrupt );
+            }
+        }
+    else if ( iImageData && ( iStillOutputFormat != CCamera::EFormatExif ) )
+        {
+        // we can't get the thumbnail from exif header if the exif header doesn't exist
+        LOGTEXT( _L( "Cae: CCaeStillStatesActive::GetThumbnailL() leaving because iStillOutputFormat is not EFormatExif" ) );
+        User::Leave( KErrNotFound );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::IsBitmapOutput()
+// ---------------------------------------------------------------------------
+//
+TBool CCaeStillStatesActive::IsBitmapOutput()
+    {
+    return ( !( ( iStillOutputFormat == CCamera::EFormatJpeg ) 
+              || ( iStillOutputFormat == CCamera::EFormatExif ) ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::Event()
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::Event( TCaeEvent aEvent, TTimeIntervalMicroSeconds32 aDelay )
+    {
+    LOGTEXT2( _L( "Cae: CCaeStillStatesActive::Event(). aEvent=%d" ), aEvent );
+    CAE_ASSERT_ALWAYS( !IsActive() );
+
+    iDelayedEvent = CCaeStillStatesActive::ECaeEventNone;
+
+    if ( aEvent != CCaeStillStatesActive::ECaeEventEnd )
+        {
+        if ( aDelay == TTimeIntervalMicroSeconds32( 0 ) )
+            {
+            // Issue request
+            TRequestStatus* statusPtr = &iStatus;
+            User::RequestComplete( statusPtr, aEvent );
+            }
+        else
+            {
+            // Use delayed request
+            iDelayedCallTimer.After( iStatus, aDelay );
+            iDelayedEvent = aEvent;
+            }
+    	SetActive();
+        }
+    else
+        {
+        iCurrentState = CCaeStillStatesActive::ECaeStateNone; // The end
+        if ( ExtModeActive() )
+            {
+            // If there are no images in the queue, then extension processing is ended
+            TInt count = iImageQueueExtPro->ImageCount();
+            if ( count > 0 )
+                {  // Continue and read next image from the queue
+                Event( CCaeStillStatesActive::ECaeEventImageQueueExtPro );
+                }
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::CancelCaptureStill()
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::CancelCaptureStill()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::CancelCaptureStill()" ) );
+
+    if ( !ExtModeActive() ) // in extension mode capture/cancelling is not possible
+        {
+        iStillCancelled = ETrue;
+        Cancel();
+        CancelAndCleanup();
+        }
+
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::Cancel()
+// Calls the base class Cancel().
+// As calling this is not allowed outside this class, this is a private method
+// and it overrides CActive::Cancel(). 
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::Cancel()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::Cancel()" ) );
+    CActive::Cancel();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::DoCancel()
+// Cancel all pending actions. This does not cancel actions that use callback
+// for signaling for completion, e.g. image encoding and decoding.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoCancel()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCancel()" ) );
+    if ( iStatus == KRequestPending )
+        {
+        if ( ( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingCapturedImage )
+             || ( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingSnapImage ) 
+             || ( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingStillImage ) )
+            {
+            // Cancel extension processing            
+            CAE_ASSERT_ALWAYS( iCurrentExtensionIndex != -1 );
+            TAny* interfacePtr = iProcessImageImplList[iCurrentExtensionIndex].iImplPtr;
+	        STATIC_CAST( MCaeExtProcessImageInterface*, interfacePtr )->CaeExtensionCancel();   
+            }
+        else if ( iDelayedEvent != CCaeStillStatesActive::ECaeEventNone )
+            {
+            // Cancel timer
+            iDelayedCallTimer.Cancel();
+            iDelayedEvent = CCaeStillStatesActive::ECaeEventNone;
+            }
+        else
+            {
+            User::Panic( KCaePanicText, ECaePanicInvalidState );
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::ErrorRecovery
+//
+// For still capture recovery: Delete images, cancel and cleanup. Client 
+// callbacks should be called also in error cases, except when user has 
+// cancelled the action. 
+//
+// Burst case is handled differently in BurstErrorRecovery().
+//
+// Note: If ownership is transferred, the image pointers should be NULLed before
+// calling the observer method. That is because the observer method can call back
+// CancelStill() which tries to delete images. That is no allowed if an image 
+// should be owned by the observer.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::ErrorRecovery( TInt aError )
+    {
+    LOGTEXT2( _L( "Cae: CCaeStillStatesActive::ErrorRecovery(): %d" ), aError );
+
+    // Check if snap image callback should be called. Do not call it twice.
+
+    if ( ( iCurrentState <= CCaeStillStatesActive::ECaeStateDeliveringSnapImage ) // Callback not yet called
+         && !iStillCancelled 
+         && iCreateSnapImage ) 
+        {
+        if ( iCurrentState == CCaeStillStatesActive::ECaeStateDecodingCapturedImageToBitmap ) 
+            {
+            // Give decoded image to the client even if there is decoding error
+            iCaeObserver->McaeoSnapImageReady( *iBitmap, aError );
+
+            // Not needed any more. Delete now to free memory.
+            delete iBitmap;
+            iBitmap = NULL;
+            }
+        else
+            {
+            // Give empty snap image to the client
+            iCaeObserver->McaeoSnapImageReady( *iEmptySnapImage, aError );
+            }
+        }
+
+    // Check if still image callback should be called. Do not call it twice.
+
+    if ( ( iCurrentState <= CCaeStillStatesActive::ECaeStateDeliveringStillImage ) // Callback not yet called
+         && !iStillCancelled )
+        {
+        if ( iCurrentState == CCaeStillStatesActive::ECaeStateDecodingCapturedImageToBitmap ) 
+            {
+            // Give original image to the client even if there is decoding error.
+            HBufC8* tmpImageData = iImageData;   
+            iImageData = NULL; 
+            iCaeObserver->McaeoStillImageReady( NULL, tmpImageData, aError );
+            }
+        else if ( iCurrentState == CCaeStillStatesActive::ECaeStateEncodingToJpeg )
+            {
+            // Give original image to the client even if there is encoding error
+            HBufC8* tmpImageData = iImageData;   
+            iImageData = NULL; // Ownership tranferred
+            iCaeObserver->McaeoStillImageReady( NULL, tmpImageData, aError );            
+            }
+        else
+            {
+            // Give error to the client
+            iCaeObserver->McaeoStillImageReady( NULL, NULL, aError );
+            }
+
+        // In burst case, increment delivery counter. 
+        if ( iStillBurst )
+            {
+            iCountOfDeliveredBurstImages++;
+            }
+        }
+
+    if ( !iStillCancelled )
+        {
+        // Handle still burst
+        if ( iStillBurst )
+            {
+            BurstErrorRecovery( aError );
+            }
+        else
+            {
+            Cancel();
+            CancelAndCleanup();
+            }  
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::CancelAndCleanup
+// Cancel all actions and free resources.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::CancelAndCleanup()
+    {
+    iDelayedEvent = CCaeStillStatesActive::ECaeEventNone;
+
+    CompleteStillBurst();
+
+    if ( iStillEncoder )
+        {
+        iStillEncoder->Cancel();
+        iStillEncoder->Cleanup(); 
+        }
+
+    if ( iStillDecoder )
+        {
+        iStillDecoder->Cancel();
+        iStillDecoder->Cleanup();
+        }    
+
+    // Delete all that is not NULL already. 
+    delete iSnapBitmap;
+    iSnapBitmap = NULL;
+    delete iBitmap;
+    iBitmap = NULL;
+    delete iImageData;
+    iImageData = NULL;
+    delete iImageHeaderData;
+    iImageHeaderData = NULL;
+    if ( iImageQueueExtPro )
+        {
+        iImageQueueExtPro->ResetAndDestroyImages();
+        }    
+
+    iCurrentState = CCaeStillStatesActive::ECaeStateNone;   
+    }
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::RunL()
+// The main function that receives all events. Simple events are also handled 
+// here. For more complex events, specific handler functions are called.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::RunL()
+    {
+    LOGTEXT3( _L( "Cae: CCaeStillStatesActive::RunL() entering, iStatus=%d, iCurrentState=%d" ), iStatus.Int(), iCurrentState );
+
+    // Handle external errors 
+
+    if ( iStatus.Int() < 0 )
+        {
+        HandleExternalError();
+        return;
+        }
+
+    // Handle all state transitions
+
+    switch( iStatus.Int() )
+        {
+        case CCaeStillStatesActive::ECaeEventNone:
+            HandleExternalEvent();
+            break;
+
+        case CCaeStillStatesActive::ECaeEventStartStillCapture:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateNone );
+            HandleStart();
+            break;
+
+        case CCaeStillStatesActive::ECaeEventImageCaptureReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateCapturing );
+            HandleImageCaptureReady();
+            break;
+
+        case CCaeStillStatesActive::ECaeEventBurstImageCaptureReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateCapturingBurst );
+            iCurrentState = CCaeStillStatesActive::ECaeStateAppendingBurstImage;            
+            DoAppendCapturedBurstImageToArray();
+            break;
+
+        case CCaeStillStatesActive::ECaeEventAppendCapturedBurstImageReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateAppendingBurstImage );
+            HandleAppendCapturedBurstImageReady();            
+            break;
+
+        case CCaeStillStatesActive::ECaeEventViewFinderForBurstReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateBurstWaitingForViewFinder );
+            iCurrentState = CCaeStillStatesActive::ECaeStateCapturingBurst;            
+            DoCaptureStillBurstImage();            
+            break;
+
+        case CCaeStillStatesActive::ECaeEventBurstCaptureReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateCapturingBurst );
+            iCurrentState = CCaeStillStatesActive::ECaeStateFetchingNextBurstImage;    
+            iStatus = CCaeStillStatesActive::ECaeEventNone;
+            DoFetchNextBurstImage();
+            break;
+
+        case CCaeStillStatesActive::ECaeEventBurstImageFetchReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateFetchingNextBurstImage );
+            HandleBurstImageFetchReady();
+            break;
+
+        case CCaeStillStatesActive::ECaeEventDecodeToBitmapReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateDecodingCapturedImageToBitmap );
+            HandleDecodeToBitmapReady();
+            break;
+
+        case CCaeStillStatesActive::ECaeEventExtractExifMetaDataReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateExtractingExifMetaData );
+            iCurrentState = CCaeStillStatesActive::ECaeStateExtensionsProcessingCapturedImage;         
+            iStatus = CCaeStillStatesActive::ECaeEventNone;
+            DoExtensionsProcessCapturedImage();    
+            break;
+
+        case CCaeStillStatesActive::ECaeEventProcessCapturedImageStepReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingCapturedImage );
+            iStatus = CCaeStillStatesActive::ECaeEventNone;
+            DoExtensionsProcessCapturedImage();
+            break;
+
+        case CCaeStillStatesActive::ECaeEventProcessCapturedImageAllReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingCapturedImage );
+            HandleProcessCapturedImageAllReady();
+            break;
+
+        case CCaeStillStatesActive::ECaeEventProcessSnapImageStepReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingSnapImage );
+            iStatus = CCaeStillStatesActive::ECaeEventNone;
+            DoExtensionsProcessSnapImage();    
+            break;
+
+        case CCaeStillStatesActive::ECaeEventProcessSnapImageAllReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingSnapImage );
+            iCurrentState = CCaeStillStatesActive::ECaeStateDeliveringSnapImage;         
+            iStatus = CCaeStillStatesActive::ECaeEventNone;
+            DoDeliverSnapImage();    
+            break;
+
+        case CCaeStillStatesActive::ECaeEventDeliverSnapImageReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateDeliveringSnapImage );
+            iCurrentState = CCaeStillStatesActive::ECaeStateExtensionsProcessingStillImage;         
+            iStatus = CCaeStillStatesActive::ECaeEventNone;
+            DoExtensionsProcessStillImage();    
+            break;
+
+        case CCaeStillStatesActive::ECaeEventProcessStillImageStepReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingStillImage );
+            iStatus = CCaeStillStatesActive::ECaeEventNone;
+            DoExtensionsProcessStillImage();
+            break;
+
+        case CCaeStillStatesActive::ECaeEventProcessStillImageAllReady:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingStillImage );
+            HandleProcessStillImageAllReady();
+            break;
+
+        case CCaeStillStatesActive::ECaeEventEncodeToJpegReady:
+             CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateEncodingToJpeg );
+            HandleEncodeToJpegReady();
+            break;
+
+        case CCaeStillStatesActive::ECaeEventDeliverStillBurstImageReady:
+            // We can end up here from any state, if there occurs an error
+            HandleDeliverStillBurstImageReady();
+            break;
+
+        case CCaeStillStatesActive::ECaeEventImageQueueExtPro:
+            CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateNone );
+            HandleImageQueueExtPro();
+            break;
+
+        default:
+            CAE_ASSERT_DEBUG( iCurrentState != iCurrentState ); // Always false
+            break;
+        }
+
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::RunL() returning" ) );
+    }
+
+
+// ---------------------------------------------------------------------------
+// EVENT HANDLERS
+//
+// Event handlers should decide what is the next state and next action after the 
+// current event. Modes and flags are checked here leaving the actual action 
+// functions as simple as possible. 
+// ---------------------------------------------------------------------------
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleExternalError
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleExternalError() 
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleExternalError()" ));
+
+    CAE_ASSERT_DEBUG( ( ( iDelayedEvent != CCaeStillStatesActive::ECaeEventNone )
+                       || ( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingCapturedImage ) 
+                       || ( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingSnapImage ) 
+                       || ( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingStillImage ) ) ); 
+         
+    // Cancelling delayed event timer is not considered as error, but early completion              
+    if ( (iStatus.Int() == KErrCancel ) && ( iDelayedEvent != CCaeStillStatesActive::ECaeEventNone ) )
+        {
+    	LOGTEXT2( _L( "Cae: CCaeStillStatesActive::HandleExternalError(). Delayed event %d completed early." ), iDelayedEvent);
+    	HandleExternalEvent();
+        }
+    else
+    	{
+    	ErrorRecovery( iStatus.Int() );                        		
+    	}    
+
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleExternalEvent
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleExternalEvent() 
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleExternalEvent()" ));
+    CAE_ASSERT_DEBUG( ( ( iDelayedEvent != CCaeStillStatesActive::ECaeEventNone )
+                       || ( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingCapturedImage ) 
+                       || ( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingSnapImage ) 
+                       || ( iCurrentState == CCaeStillStatesActive::ECaeStateExtensionsProcessingStillImage ) ) ); 
+
+        
+    if ( iDelayedEvent != CCaeStillStatesActive::ECaeEventNone )
+        {
+        // Timer has finished, issue delayed event now
+        Event( iDelayedEvent );
+        }
+    else          
+        {
+        switch ( iCurrentState )
+            {
+            case ECaeStateExtensionsProcessingCapturedImage:
+                Event( CCaeStillStatesActive::ECaeEventProcessCapturedImageStepReady );
+                break;
+
+            case ECaeStateExtensionsProcessingSnapImage:
+                Event( CCaeStillStatesActive::ECaeEventProcessSnapImageStepReady );
+                break;
+
+            case ECaeStateExtensionsProcessingStillImage:
+                Event( CCaeStillStatesActive::ECaeEventProcessStillImageStepReady );
+                break;
+
+            default:
+                CAE_ASSERT_DEBUG( iCurrentState !=  iCurrentState ); // Always false
+                break;
+
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleStart()
+// Start either single or burst image capture.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleStart()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleStart()" ));
+    CAE_ASSERT_ALWAYS( ( iBitmap == NULL ) && ( iSnapBitmap == NULL ) );
+    CAE_ASSERT_ALWAYS( ( iImageData == NULL ) && ( iImageHeaderData == NULL ) );
+    
+    iStatus = CCaeStillStatesActive::ECaeEventNone;
+    if ( iStillBurst )
+        {               
+        iCurrentState = CCaeStillStatesActive::ECaeStateCapturingBurst;            
+        DoCaptureStillBurst();
+        }
+    else
+        {
+        iCurrentState = CCaeStillStatesActive::ECaeStateCapturing;            
+        DoCaptureStill();
+        }   
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleImageCaptureReady()
+// Decode the captured image, extract Exif metadata, or process the 
+// image by the extensions.  
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleImageCaptureReady()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleImageCaptureReady()" ));
+
+    iStatus = CCaeStillStatesActive::ECaeEventNone;
+
+    if ( !iBitmap                   // Does not already exist
+         && ( iCreateSnapImage ) )    // Snap bitmap required by UI
+            /* Not yet implemented
+            || iRequireStillImageAsBitmapRefCount ) ) // Still bitmap required by any extensions
+            */
+        {
+        iCurrentState = CCaeStillStatesActive::ECaeStateDecodingCapturedImageToBitmap;            
+        DoDecodeCapturedImageToBitmap();
+        }
+    else
+        {
+        /* Not yet implemented
+        if ( iRequireImageFormatHeaderRefCount )
+            {
+            iCurrentState = CCaeStillStatesActive::ECaeStateExtractingExifMetaData;            
+            DoExtractExifMetaData();
+           }
+        else
+        */
+            {
+            iCurrentState = CCaeStillStatesActive::ECaeStateExtensionsProcessingCapturedImage;            
+            DoExtensionsProcessCapturedImage();    
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleDecodeToBitmapReady()
+// Extract Exif metadata, or process the captured image by the 
+// extensions.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleDecodeToBitmapReady()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleDecodeToBitmapReady()" ));
+    CAE_ASSERT_ALWAYS( ( iBitmap != NULL ) && ( iSnapBitmap == NULL ) );
+    CAE_ASSERT_ALWAYS( ( iImageData != NULL ) && ( iImageHeaderData == NULL ) );
+
+    iStatus = CCaeStillStatesActive::ECaeEventNone;
+
+    if ( iCreateSnapImage )    // Snap bitmap required by UI
+        /* Not yet implemented
+       && !iRequireStillImageAsBitmapRefCount ) // Still bitmap not required by any extensions
+       */
+        {
+        // Decoded bitmap is used for the snap bitmap only
+        iSnapBitmap = iBitmap;
+        iBitmap = NULL;
+        }    
+
+     /* Not yet implemented
+    if ( iRequireImageFormatHeaderRefCount )
+        {
+        iCurrentState = CCaeStillStatesActive::ECaeStateExtractingExifMetaData;            
+        DoExtractExifMetaData();
+        }
+    else
+    */
+        {
+        iCurrentState = CCaeStillStatesActive::ECaeStateExtensionsProcessingCapturedImage;            
+        DoExtensionsProcessCapturedImage();    
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleProcessCapturedImageAllReady()
+// Process the snap image or the still image by the extensions.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleProcessCapturedImageAllReady()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleProcessCapturedImageAllReady()" ));
+
+    iStatus = CCaeStillStatesActive::ECaeEventNone;
+    if ( iCreateSnapImage )
+        {
+        iCurrentState = CCaeStillStatesActive::ECaeStateExtensionsProcessingSnapImage;            
+        DoExtensionsProcessSnapImage();    
+        }
+    else
+        {
+        iCurrentState = CCaeStillStatesActive::ECaeStateExtensionsProcessingStillImage;            
+        DoExtensionsProcessStillImage();
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleProcessStillImageAllReady()
+// Encode the still bitmap to Jpeg, or deliver the 
+// still image to the client.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleProcessStillImageAllReady()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleProcessStillImageAllReady()" ));
+
+    iStatus = CCaeStillStatesActive::ECaeEventNone;
+
+    // Encode to Jpeg if there is a separate (Exif) header or bitmap to 
+    // Jpeg coversion is needed for client.
+    if ( iImageHeaderData 
+         || ( ( iStillOutputFormat == CCamera::EFormatJpeg ) && !iImageData ) )
+        {
+        iCurrentState = CCaeStillStatesActive::ECaeStateEncodingToJpeg;            
+        DoEncodeStillImageToJpeg();
+        }
+   else
+        {
+        if ( iStillBurst )
+            {
+            iCurrentState = CCaeStillStatesActive::ECaeStateDeliveringStillBurstImage;            
+            DoDeliverStillBurstImage();
+            }
+        else
+            {
+            iCurrentState = CCaeStillStatesActive::ECaeStateDeliveringStillImage;            
+            DoDeliverStillImage();
+            }
+        }
+    }
+    
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleEncodeToJpegReady()
+// Deliver the still image to the client.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleEncodeToJpegReady()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleEncodeToJpegReady()" ));
+
+    iStatus = CCaeStillStatesActive::ECaeEventNone;
+    if ( iStillBurst )
+        {
+        iCurrentState = CCaeStillStatesActive::ECaeStateDeliveringStillBurstImage;            
+        DoDeliverStillBurstImage();
+        }
+    else
+        {
+        iCurrentState = CCaeStillStatesActive::ECaeStateDeliveringStillImage;            
+        DoDeliverStillImage();
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleImageQueueExtPro()
+// Deliver the still image to the client.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleImageQueueExtPro()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleImageQueueExtPro()" ));
+
+    CFbsBitmap* bitmap = NULL;
+    HBufC8*     imagedata = NULL;
+    TBool       lastimage = EFalse;
+    TBool       snapimage = EFalse;
+
+    // Get next snap or main image from image queue
+    if ( iImageQueueExtPro )
+        {
+        TInt result = iImageQueueExtPro->GetNextImage( bitmap, imagedata, lastimage, snapimage );
+
+        // If prepare has not been done then format has default value
+        if ( !iStillPrepared )
+            {
+            iStillOutputFormat = CCamera::EFormatExif; // Only exif/jpeg is supported
+            }
+        if ( result == KErrNone )
+            {
+            iLastImageExtPro = lastimage;
+            if ( bitmap && snapimage ) // Snap image
+                {
+                LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleImageQueueExtPro() Snap bitmap" ));
+                iStatus = CCaeStillStatesActive::ECaeEventNone;
+                iCurrentState = CCaeStillStatesActive::ECaeStateExtensionsProcessingSnapImage;            
+                iSnapBitmap = bitmap;
+                Event( CCaeStillStatesActive::ECaeEventProcessSnapImageStepReady );
+                }
+            else if ( imagedata && !snapimage) // Main captured image (jpeg)
+                {
+                LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleImageQueueExtPro() JPG imagedata" ));
+                iStatus = CCaeStillStatesActive::ECaeEventNone;
+                iCurrentState = CCaeStillStatesActive::ECaeStateExtensionsProcessingStillImage;            
+                iImageData = imagedata;
+                Event( CCaeStillStatesActive::ECaeEventProcessStillImageStepReady );
+                }
+            else if ( bitmap && !snapimage) // Main captured image (bitmap)
+                {
+                LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleImageQueueExtPro() bitmap imagedata" ));
+                iStatus = CCaeStillStatesActive::ECaeEventNone;
+                iCurrentState = CCaeStillStatesActive::ECaeStateDeliveringSnapImage;            
+                iBitmap = bitmap;
+                Event( CCaeStillStatesActive::ECaeEventDeliverSnapImageReady );
+                }
+            else 
+                {
+                LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleImageQueueExtPro() iImageQueueExtPro return empty image" ));
+                }
+            }
+        else
+            {
+            LOGTEXT2( _L( "Cae: CCaeStillStatesActive::HandleImageQueueExtPro() iImageQueueExtPro error %d" ), result);
+            }
+        }
+    else
+        {
+        LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleImageQueueExtPro() iImageQueueExtPro not found" ));
+        }
+
+    }
+
+
+// ---------------------------------------------------------------------------
+// EXTERNAL CALLBACKS
+//
+// Callbacks from external objects are mapped to the internal events.
+// ---------------------------------------------------------------------------
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::ImageReady
+// Store the captured image and send event to the state machine.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::ImageReady( 
+    CFbsBitmap* aBitmap, 
+    HBufC8*     aImageData, 
+    TInt        aError )
+    {
+    LOGTEXT2( _L( "Cae: CCaeStillStatesActive::ImageReady() entering, aError=%d" ), aError );
+    CAE_ASSERT_ALWAYS( ( iBitmap == NULL ) && ( iSnapBitmap == NULL ) );
+    CAE_ASSERT_ALWAYS( ( iImageData == NULL ) && ( iImageHeaderData == NULL ) );
+    
+    #ifdef _DEBUG
+    // Performance debugging
+    iImageReadyTime.HomeTime();
+    TTimeIntervalMicroSeconds convertInterval =
+        iImageReadyTime.MicroSecondsFrom( iCaptureStartTime );
+    LOGTEXT2( _L( "Cae: CCaeStillStatesActive::ImageReady(): Captured image ready %f seconds after capture" ),
+                   I64LOW( convertInterval.Int64() ) * 1.0 / KOneSecond );
+    #endif
+
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaeImageReadyError( aError );
+    #endif    
+
+    // Get ownership and store pointers
+    iBitmap = aBitmap;
+    iImageData = aImageData;
+
+    if ( iStillBurst )
+        {
+        iFirstStillBurstError =  iFirstStillBurstError ? iFirstStillBurstError : aError;
+        Event( CCaeStillStatesActive::ECaeEventBurstImageCaptureReady );
+        }
+
+    // Single image capture
+    else if ( !aError )
+        {
+        Event( CCaeStillStatesActive::ECaeEventImageCaptureReady );
+        }
+    else
+        {
+        // Handle error
+        ErrorRecovery( aError );
+        }
+
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::ImageReady() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::McaesdoCFbsBitmapImageReady
+// Store original and decoded images and send event to the state machine.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::McaesdoCFbsBitmapImageReady( 
+    HBufC8*     aImageData, 
+    CFbsBitmap* aBitmap, 
+    TInt        aError,
+    TInt        /*aImageSize*/ ) // Not yet used
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::McaesdoCFbsBitmapImageReady() entering" ) );
+    CAE_ASSERT_ALWAYS( ( iBitmap == NULL ) && ( iSnapBitmap == NULL ) );
+    CAE_ASSERT_ALWAYS( iImageHeaderData == NULL );
+    CAE_ASSERT_ALWAYS( !iStillCancelled );
+
+   #ifdef _DEBUG
+    // Performance debugging
+    iFinalImageReadyTime.HomeTime();
+    TTimeIntervalMicroSeconds convertInterval =
+        iFinalImageReadyTime.MicroSecondsFrom( iCaptureStartTime );
+    LOGTEXT2( _L( "Cae: CCaeEngineImp::McaesdoCFbsBitmapImageReady(): Final decoded image ready %f seconds after capture" ),
+                   I64LOW( convertInterval.Int64() ) * 1.0 / KOneSecond );
+    #endif
+
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaeMcaesdoCFbsBitmapImageReadyError( aError );
+    #endif
+    
+    // Get ownership and store pointers
+    iBitmap = aBitmap;
+
+    // Delete image data if not the original (extracted thumbnail was used as decoder input).
+    if ( iImageData != NULL )
+        {
+        delete ( aImageData ); // Delete (exif) thumbnail source image
+        }
+    else
+        {
+        iImageData = aImageData; // Store original still image
+        }
+
+    if ( !aError )
+        {
+        Event( CCaeStillStatesActive::ECaeEventDecodeToBitmapReady );
+        }
+    else
+        {
+        // Handle error
+        ErrorRecovery( aError );
+        }
+
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::McaesdoCFbsBitmapImageReady() returning" ) );
+    }
+    
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::McaeseoHBufC8ImageReady
+// Store original and encoded images and send event to the state machine.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::McaeseoHBufC8ImageReady( 
+    CFbsBitmap* aBitmap, 
+    HBufC8*     aImageData, 
+    TInt        aError,
+    TInt        /*aImageSize*/ )
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::McaeseoHBufC8ImageReady() entering" ) );
+    CAE_ASSERT_ALWAYS( ( iBitmap == NULL ) && ( iSnapBitmap == NULL ) );
+    CAE_ASSERT_ALWAYS( ( iImageData == NULL ) && ( iImageHeaderData == NULL ) );
+    CAE_ASSERT_ALWAYS( !iStillCancelled );
+    
+    #ifdef _DEBUG
+    // Performance debugging
+    iFinalImageReadyTime.HomeTime();
+    TTimeIntervalMicroSeconds convertInterval =
+        iFinalImageReadyTime.MicroSecondsFrom( iCaptureStartTime );
+    LOGTEXT2(_L( "Cae: CCaeStillStatesActive::McaeseoHBufC8ImageReady(): Final encoded image ready %f seconds after capture" ), 
+        I64LOW( convertInterval.Int64() ) * 1.0 / KOneSecond);
+    #endif
+
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaeMcaeseoHBufC8ImageReadyError( aError );
+    #endif
+    
+    // Get ownership and store pointers
+    iBitmap = aBitmap;
+    iImageData = aImageData;
+
+    if ( !aError )
+        {
+        Event( CCaeStillStatesActive::ECaeEventEncodeToJpegReady );
+        }
+    else 
+        {
+        // Handle error
+        ErrorRecovery( aError );
+        }
+
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::McaeseoHBufC8ImageReady() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::ViewFinderFrameReady
+// Send event if the state machine is waiting for the view finder. 
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::ViewFinderFrameReady()
+    {
+	iViewFinderFrameReceived = ETrue;
+
+    if ( iCurrentState == CCaeStillStatesActive::ECaeStateBurstWaitingForViewFinder 
+         && !IsActive() ) // To make sure the previous ECaeEventViewFinderForBurstReady has been handled
+        {
+        Event( CCaeStillStatesActive::ECaeEventViewFinderForBurstReady );        
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// ACTION FUNCTIONS FOR STATES
+//
+// To keep it simple, action functions should do only one task each if 
+// possible. If there is a lot of conditions, make several action functions 
+// and call them from event handlers. 
+// ---------------------------------------------------------------------------
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoCaptureStill
+// Start image capturing in Camera API.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoCaptureStill()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCaptureStill() entering" ) );
+
+    #ifdef _DEBUG
+    // Performance debugging
+    iCaptureStartTime.HomeTime();
+    #endif
+
+    iViewFinderFrameReceived = EFalse;
+    iStillCancelled = EFalse;
+
+    iCamera.CaptureImage(); // Start capture
+
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCaptureStill() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoDecodeCapturedImageToBitmap
+//
+// Decode to bitmap. CCaeStillDecoder calls McaesdoCFbsBitmapImageReady 
+// callback when decoding is ready.
+// Decodes Exif thumbnail to bitmap if requested (by iSnapImageSource).
+// Note that the callback can be called synchronously by iStillDecoder, if 
+// an error occurs in the still decoder. In that case also  ErrorRecovery() 
+// has been called in McaesdoCFbsBitmapImageReady() *before* the method 
+// below returns.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoDecodeCapturedImageToBitmap()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoDecodeCapturedImageToBitmap()" ) );
+    HBufC8* tmpImageData = NULL;
+    TSize   tmpSnapImageSize( 0, 0 );
+    TInt    error( KErrNone );
+    
+    // Use thumbnail for snap image basis if requested to use it.
+    if ( iSnapImageSource == CCaeEngine::ESnapImageSourceThumbnail ) 
+        {
+        TRAP( error, GetThumbnailL( tmpImageData, tmpSnapImageSize ) );
+        if ( error )
+            {
+            LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoDecodeCapturedImageToBitmap(): Thumbnail extraction failed" ) );
+            delete( tmpImageData );
+            tmpImageData = iImageData;
+            tmpSnapImageSize = iOptimalSnapImageSize;
+	        iImageData = NULL; 
+            }
+        }
+    else // Use the captured image for snap image basis.
+        {
+        tmpImageData = iImageData;
+        tmpSnapImageSize = iOptimalSnapImageSize;
+	    iImageData = NULL; 
+        }
+
+    // Ownership will be transferred. Null the pointer already before the method
+    // call because it can call McaesdoCFbsBitmapImageReady() callback synchronously 
+    // inside the method.
+    // Always decode and scale to the correct size if free scaling is supported.
+    TDisplayMode displayMode = iRequireFullColorSnapInputImageRefCount ? 
+        EColor16M : iSnapImageColorMode;
+    TRAP( error, iStillDecoder->ConvertHBufC8ToCFbsBitmapL( 
+            tmpImageData, displayMode, tmpSnapImageSize, iSnapImageSize) );
+
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaeCreateAndDeliverSnapImageError( error );
+    #endif
+
+    if ( error )
+        {
+        // Handle error.
+        ErrorRecovery( error );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoExtensionsProcessCapturedImage
+//
+// Call the extensions for processing the captured image. Subsequent synchronous
+// methods are called inside a loop. After an asynchronous method, the extension
+// signals the state machine which calls this function again for the next 
+// extension.  
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoExtensionsProcessCapturedImage()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoExtensionsProcessCapturedImage()" ) );
+    
+    OstTrace0( CAMERASRV_PERFORMANCE, CCAESTILLSTATESACTIVE_DOEXTENSIONSPROCESSCAPTUREDIMAGE, "e_CAM_CAE_OPERATIONS 1" );   //CAE_ENGINE_OPERATIONS_START
+        
+	TBool isAsyncOperation = EFalse;
+
+	// Execute synchronous operations in loop. Exit the loop if there is an 
+	// asynchronous function or a syncronous function has returned error status.  		
+	while ( iStatus == KErrNone  
+            && !iStillCancelled
+		    && !isAsyncOperation 
+		    && ( ++iCurrentExtensionIndex <  iProcessImageImplList.Count() ) )
+		{
+
+        TAny* interfacePtr = iProcessImageImplList[iCurrentExtensionIndex].iImplPtr;
+
+        // Call extensions. Note that references to image pointers are given as
+        // parameters. The engine has shared the ownership with the extensions,
+        // which can also delete and create new images.
+        if ( iProcessImageImplList[iCurrentExtensionIndex].iIsActive )
+            {
+    		isAsyncOperation = STATIC_CAST( MCaeExtProcessImageInterface*, interfacePtr )->ProcessCapturedImage(
+                iStatus, iBitmap, iImageData, iImageHeaderData );
+            }
+        else
+            {
+	        LOGTEXT2(_L("Cae: CCaeStillStatesActive::DoExtensionsProcessCapturedImage().Skipping extension %x"),
+	            iProcessImageImplList[iCurrentExtensionIndex].iImplUid.iUid);
+            }
+	    
+	    #ifdef _DEBUG
+	    if ( ( iStatus != KErrNone ) && ( iStatus != KRequestPending ) )
+	        {
+	        LOGTEXT3(_L("Cae: CCaeStillStatesActive::DoExtensionsProcessCapturedImage().Error: %d in ProcessCapturedImage() for Extension %x"),
+	            iStatus.Int(), iProcessImageImplList[iCurrentExtensionIndex].iImplUid.iUid);
+	        }
+	    #endif
+		}
+
+    if (!iStillCancelled)
+        {
+	    // Note: For an asynchronous operation the status can be KErrNone 
+	    //       if the operation has already finished and this thread has 
+	    //       been signaled. 
+		if ( ( iStatus == KErrNone || iStatus == KRequestPending ) && isAsyncOperation )
+			{
+			// Come back after an asynchronous operation has finished
+			SetActive();
+			}
+		else
+			{
+            iCurrentExtensionIndex = -1;
+            if ( iStatus == KErrNone )
+                {
+                OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAESTILLSTATESACTIVE_DOEXTENSIONSPROCESSCAPTUREDIMAGE, "e_CAM_CAE_OPERATIONS 0" );  //CAE_ENGINE_OPERATIONS_END
+                Event( CCaeStillStatesActive::ECaeEventProcessCapturedImageAllReady );            
+                }
+            else
+                {
+                // Note: negative status values are handled as "external errors"
+                // in RunL(). Check that the received iStatus is negative, extension can return any value
+                
+                if ( iStatus.Int() <= 0 )
+                    {
+                    Event( (CCaeStillStatesActive::TCaeEvent)iStatus.Int() );    
+                    }
+                else
+                    {
+                    Event( (CCaeStillStatesActive::TCaeEvent) KErrGeneral );    
+                    }
+                }
+			}
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoExtensionsProcessSnapImage
+//
+// Call the extensions for processing the snap image. Subsequent synchronous
+// methods are called inside a loop. After an asynchronous method, the extension
+// signals the state machine which calls this function again for the next 
+// extension.  
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoExtensionsProcessSnapImage()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoExtensionsProcessSnapImage()" ) );
+    
+    OstTrace0( CAMERASRV_PERFORMANCE, CCAESTILLSTATESACTIVE_DOEXTENSIONSPROCESSSNAPIMAGE, "e_CAM_CAE_OPERATIONS 1" );   //CAE_ENGINE_OPERATIONS_START
+        
+	TBool isAsyncOperation = EFalse;
+
+	// Execute synchronous operations in loop. Exit the loop if there is an 
+	// asynchronous function or a syncronous function has returned error status.  
+	
+	while ( iStatus == KErrNone  
+            && !iStillCancelled
+		    && !isAsyncOperation 
+		    && ( ++iCurrentExtensionIndex <  iProcessImageImplList.Count() ) )
+		{
+
+        TAny* interfacePtr = iProcessImageImplList[iCurrentExtensionIndex].iImplPtr;
+
+        // Call extensions. Note that references to image pointers are given as
+        // parameters. The engine has shared the ownership with the extensions,
+        // which can also delete and create new images.
+        if ( iProcessImageImplList[iCurrentExtensionIndex].iIsActive )
+            {
+    		isAsyncOperation = STATIC_CAST( MCaeExtProcessImageInterface*, interfacePtr )->ProcessSnapImage(
+                iStatus, iBitmap, iSnapBitmap );
+            }
+        else
+            {
+	        LOGTEXT2(_L("Cae: CCaeStillStatesActive::DoExtensionsProcessSnapImage(). Skipping Extension %x"),
+	            iProcessImageImplList[iCurrentExtensionIndex].iImplUid.iUid );
+            }
+	    
+	    #ifdef _DEBUG
+	    if ( ( iStatus != KErrNone ) && ( iStatus != KRequestPending ) )
+	        {
+	        LOGTEXT3(_L("Cae: CCaeStillStatesActive::DoExtensionsProcessSnapImage(). Error %d in ProcessSnapImage() for Extension %x"),
+	            iStatus.Int(), iProcessImageImplList[iCurrentExtensionIndex].iImplUid.iUid );
+	        }
+	    #endif
+		}
+
+    if (!iStillCancelled)
+        {
+		// Note: For an asynchronous operation the status can be KErrNone 
+		//       if the operation has already finished and this thread has 
+		//       been signaled. 
+		if ( ( iStatus == KErrNone || iStatus == KRequestPending ) && isAsyncOperation )
+			{
+			// Come back after an asynchronous operation has finished
+			SetActive();
+			}
+		else
+			{
+            iCurrentExtensionIndex = -1;
+            if ( iStatus == KErrNone )
+                {
+                OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAESTILLSTATESACTIVE_DOEXTENSIONSPROCESSSNAPIMAGE, "CamAppEngine_Perf:e_CAM_CAE_OPERATIONS 0" );    //CAE_ENGINE_OPERATIONS_END
+                Event( CCaeStillStatesActive::ECaeEventProcessSnapImageAllReady );            
+                }
+            else
+                {
+                // Note: negative status values are handled as "external errors"
+                // in RunL().
+                if ( iStatus.Int() <= 0 )
+                    {
+                    Event( (CCaeStillStatesActive::TCaeEvent)iStatus.Int() );    
+                    }
+                else
+                    {
+                    Event( (CCaeStillStatesActive::TCaeEvent) KErrGeneral );    
+                    }
+                }
+			}
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoDeliverSnapImage
+// Deliver the snap image to the client.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoDeliverSnapImage()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoDeliverSnapImage()" ) );
+    CAE_ASSERT_ALWAYS( !iStillCancelled );
+
+    if ( iSnapBitmap )
+        {
+        iCaeObserver->McaeoSnapImageReady( *iSnapBitmap, KErrNone );  
+        delete( iSnapBitmap );
+        iSnapBitmap = NULL;   
+        }
+    else
+        {
+        iCaeObserver->McaeoSnapImageReady( *iBitmap, KErrNone );  
+        }
+   
+    if ( !iStillCancelled )
+        {
+        if ( ExtModeActive() )
+            {
+            Event( CCaeStillStatesActive::ECaeEventEnd ); // extension mode operation is completed
+            }
+        else
+            {
+            Event( CCaeStillStatesActive::ECaeEventDeliverSnapImageReady );
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoExtensionsProcessStillImage
+//
+// Call the extensions for processing the still image. Subsequent synchronous
+// methods are called inside a loop. After an asynchronous method, the extension
+// signals the state machine which calls this function again for the next 
+// extension.  
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoExtensionsProcessStillImage()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoExtensionsProcessStillImage()" ) );
+    
+    OstTrace0( CAMERASRV_PERFORMANCE, CCAESTILLSTATESACTIVE_DOEXTENSIONSPROCESSSTILLIMAGE, "e_CAM_CAE_OPERATIONS 1" );  //CAE_ENGINE_OPERATIONS_START
+        
+	TBool isAsyncOperation = EFalse;
+
+	// Execute synchronous operations in loop. Exit the loop if there is an 
+	// asynchronous function or a syncronous function has returned error status.  
+	
+	while ( iStatus == KErrNone  
+            && !iStillCancelled
+		    && !isAsyncOperation 
+		    && ( ++iCurrentExtensionIndex <  iProcessImageImplList.Count() ) )
+		{
+
+        TAny* interfacePtr = iProcessImageImplList[iCurrentExtensionIndex].iImplPtr;
+
+        // Call extensions. Note that references to image pointers are given as
+        // parameters. The engine has shared the ownership with the extensions,
+        // which can also delete and create new images.
+        if ( iProcessImageImplList[iCurrentExtensionIndex].iIsActive )
+            {
+    		isAsyncOperation = STATIC_CAST( MCaeExtProcessImageInterface*, interfacePtr )->ProcessStillImage(
+                iStatus, iBitmap, iImageData, iImageHeaderData );
+            }
+        else
+            {
+	        LOGTEXT2(_L("Cae: CCaeStillStatesActive::DoExtensionsProcessStillImage(). Skipping extension %x"),
+	            iProcessImageImplList[iCurrentExtensionIndex].iImplUid.iUid);
+            }
+	    
+	    #ifdef _DEBUG
+	    if ( ( iStatus != KErrNone ) && ( iStatus != KRequestPending ) )
+	        {
+	        LOGTEXT3(_L("Cae: CCaeStillStatesActive::DoExtensionsProcessStillImage(). Error %d in ProcessStillImage() for Extension %x"),
+	            iStatus.Int(), iProcessImageImplList[iCurrentExtensionIndex].iImplUid.iUid);
+	        }
+	    #endif
+		}
+
+    if (!iStillCancelled)
+        {
+		// Note: For an asynchronous operation the status can be KErrNone 
+		//       if the operation has already finished and this thread has 
+		//       been signaled. 
+		if ( ( iStatus == KErrNone || iStatus == KRequestPending ) && isAsyncOperation )
+			{
+			// Come back after an asynchronous operation has finished
+			SetActive();
+			}
+		else
+			{
+            iCurrentExtensionIndex = -1;
+            if ( iStatus == KErrNone )
+                {
+                OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAESTILLSTATESACTIVE_DOEXTENSIONSPROCESSSTILLIMAGE, "e_CAM_CAE_OPERATIONS 0" ); //CAE_ENGINE_OPERATIONS_END
+                Event( CCaeStillStatesActive::ECaeEventProcessStillImageAllReady );            
+                }
+            else
+                {
+                // Note: negative status values are handled as "external errors"
+                // in RunL().
+                if ( iStatus.Int() <= 0 )
+                    {
+                    Event( (CCaeStillStatesActive::TCaeEvent)iStatus.Int() );    
+                    }
+                else
+                    {
+                    Event( (CCaeStillStatesActive::TCaeEvent) KErrGeneral );    
+                    }
+                }
+			}
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoEncodeStillImageToJpeg
+//
+// Encode bitmap to the Jpeg image. CCaeStillEncoder calls 
+// McaeseoHBufC8ImageReady callback when encoding is ready.
+// Note that the callback can be called synchronously by , iStillEncoder
+// if an error occurs in the still encoder. In that case also
+// ErrorRecovery() has been called in McaeseoHBufC8ImageReady() *before* 
+// the method below returns.
+//
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoEncodeStillImageToJpeg()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoEncodeStillImageToJpeg()" ) );
+    // Ownership will be transferred. Null the pointer already before the method
+    // call because it can call McaesdoCFbsBitmapImageReady() callback synchronously 
+    // inside the method.
+    CFbsBitmap* tmpBitmap = iBitmap;   
+	iBitmap = NULL; 
+	iStillEncoder->SetCompressionQuality( iStillCompressionQuality );
+	TRAPD( error, iStillEncoder->ConvertCFbsBitmapToHBufC8L( tmpBitmap ) );
+
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaeCreateAndDeliverStillImageError( error );
+    #endif
+
+    if ( error )
+        {
+        // Handle error
+        ErrorRecovery( error );
+        }
+   }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoDeliverStillImage
+// 
+// Deliver the still image to the client and delete internal images after that.
+// Note: If ownership is transferred, the image pointers should be NULLed before
+// calling the observer method. That is because the observer method can call back
+// CancelStill() which tries to delete images. That is no allowed as images 
+// should be owned by the observer.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoDeliverStillImage()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoDeliverStillImage()" ) );
+    CAE_ASSERT_ALWAYS( !iStillCancelled && ( iSnapBitmap == NULL ) );
+
+    // Deliver the still image to the client.
+    if ( IsBitmapOutput() )
+        {
+        CFbsBitmap* tmpBitmap = iBitmap;
+        iBitmap = NULL; // ownership is transferred      
+        OstTrace0( CAMERASRV_PERFORMANCE, CCAESTILLSTATESACTIVE_DODELIVERSTILLIMAGE, "e_CAM_ENG_SHOT_TO_STILL 0" ); //CAE_ENGINE_SHOT_TO_STILL_END
+        iCaeObserver->McaeoStillImageReady( tmpBitmap, NULL, KErrNone );
+        }
+    else
+        {
+        HBufC8* tmpImageData = iImageData;   
+        iImageData = NULL; // Ownership is tranferred
+        OstTrace0( CAMERASRV_PERFORMANCE, DUP1_CCAESTILLSTATESACTIVE_DODELIVERSTILLIMAGE, "e_CAM_ENG_SHOT_TO_STILL 0" );    //CAE_ENGINE_SHOT_TO_STILL_END
+        iCaeObserver->McaeoStillImageReady( NULL, tmpImageData, KErrNone );
+        }
+ 
+    // Delete all that is not NULL already. 
+    delete iImageData;
+    iImageData = NULL;
+    delete iImageHeaderData;
+    iImageHeaderData = NULL;
+    delete iBitmap;
+    iBitmap = NULL;
+
+    Event( CCaeStillStatesActive::ECaeEventEnd ); // The end. Actuall does no issue any event. 
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::StartQuickCapture()
+// 
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::StartQuickCapture()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::StartQuickCapture()" ) );
+    CAE_ASSERT_DEBUG( iCurrentState == CCaeStillStatesActive::ECaeStateNone );
+    HandleStart();
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::ExtModeActive()
+// 
+// -----------------------------------------------------------------------------
+//
+TBool CCaeStillStatesActive::ExtModeActive()
+    {
+    LOGTEXT2( _L( "Cae: CCaeStillStatesActive::ExtModeActive() %d" ), iExtModeActive );
+    return( iExtModeActive );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetExtModeActiveL()
+// 
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetExtModeActiveL( TBool aExtModeActive )
+    {
+    LOGTEXT2( _L( "Cae: CCaeStillStatesActive::SetExtModeActiveL() %d" ), aExtModeActive );
+    iExtModeActive = aExtModeActive;
+    iStillCancelled = EFalse;           // clear previous cancel request of still capture
+
+    // Create new instance of still image queue object.
+    if ( aExtModeActive && !iImageQueueExtPro )
+        {
+        iImageQueueExtPro = CCaeImageQueueExtPro::NewL();
+        }
+    else if ( !aExtModeActive )
+        {
+        delete iImageQueueExtPro;
+        iImageQueueExtPro = 0;
+        }
+
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::ProcessExtSnapImage
+// Process extension for snap image
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillStatesActive::ProcessExtSnapImage( CFbsBitmap* aSnapImage )
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::ProcessExtSnapImage()" ));
+    
+    TInt result = iImageQueueExtPro->AppendImage( aSnapImage, NULL, EFalse, ETrue );
+    if ( result == KErrNone &&                                      // image was saved ok
+        iCurrentState == CCaeStillStatesActive::ECaeStateNone &&    // state machine is idle
+        iImageQueueExtPro->ImageCount() < 2 )                       // queue was empty
+        {
+        // Send event to start processing, state machine will stop when queue is empty
+        // and return then back to ECaeStateNone state
+        Event( CCaeStillStatesActive::ECaeEventImageQueueExtPro );
+        }
+    return ( result );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::ProcessExtCapturedImage
+// Process extension for captured jpg image
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillStatesActive::ProcessExtCapturedImage( HBufC8* aImageData, TBool aLastImage  )
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::ProcessExtCapturedImage() jpg" ));
+
+    TInt result = KErrNone;
+    result = iImageQueueExtPro->AppendImage( NULL, aImageData, aLastImage, EFalse );
+
+    if ( result == KErrNone &&                                      // image was saved ok
+        iCurrentState == CCaeStillStatesActive::ECaeStateNone &&    // state machine is idle
+        iImageQueueExtPro->ImageCount() < 2 )                       // queue was empty
+        {
+        // Send event to start processing, state machine will stop when queue is empty
+        // and return then back to ECaeStateNone state
+        Event( CCaeStillStatesActive::ECaeEventImageQueueExtPro );
+        }
+
+    return ( result );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::ProcessExtCapturedImage
+// Process extension for captured bitmap image
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillStatesActive::ProcessExtCapturedImage( CFbsBitmap* aImageBitmapData, TBool aLastImage  )
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::ProcessExtCapturedImage() bitmap" ));
+
+    TInt result = KErrNone;
+    result = iImageQueueExtPro->AppendImage( aImageBitmapData, NULL, aLastImage, EFalse );
+
+    if ( result == KErrNone &&                                      // image was saved ok
+        iCurrentState == CCaeStillStatesActive::ECaeStateNone &&    // state machine is idle
+        iImageQueueExtPro->ImageCount() < 2 )                       // queue was empty
+        {
+        // Send event to start processing, state machine will stop when queue is empty
+        // and return then back to ECaeStateNone state
+        Event( CCaeStillStatesActive::ECaeEventImageQueueExtPro );
+        }
+
+    return ( result );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetBurstModeVFOptimization()
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetBurstModeVFOptimization(
+    TBool aBurstModeVFOptimization )
+    {
+    LOGTEXT2( _L( "Cae: CCaeStillStatesActive::SetBurstModeVFOptimization(%d)" ), aBurstModeVFOptimization);
+    iBurstModeVFOptimization = aBurstModeVFOptimization;
+    }
+
+// End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeStillStatesActiveBurst.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,628 @@
+/*
+* Copyright (c) 2005 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine still image burst capturing 
+*                interface implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include "CaeEngineImp.h"                   // Engine implementation header.
+#include "CaeStillBurst.h"                  // Still capturing burst mode class.
+#include "CaeStillStatesActive.h"           // Still capturing burst mode class.
+
+#ifdef CAE_TEST_VERSION
+#include "CaeEngineImpTestErrors.h"         // For TEST_VERSION compilation only
+#endif
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetCaeStillBurstObserver
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetCaeStillBurstObserver( 
+    MCaeStillBurstObserver& aObserver )
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::SetCaeStillBurstObserver()" ) );
+    iCaeStillBurstObserver = &aObserver;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetStillCaptureImageCountL
+// Delete old instance and create a new burst object if required. 
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillStatesActive::SetStillCaptureImageCountL( 
+    TInt aImageCount )
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::SetStillCaptureImageCountL() entering" ) );
+
+    // Leave if still capturing is running.
+    if ( IsRunning() ) 
+        {
+        LOGTEXT( _L( "Cae: CCaeStillStatesActive::SetStillCaptureImageCountL() leaving KErrNotReady (IsRunning)" ) );
+        User::Leave( KErrNotReady );
+        }
+    
+    // Leave if the image count requested is invalid.
+    if ( aImageCount <= 0 ) 
+        {
+        LOGTEXT2( _L( "Cae: invalid input argument aImageCount = %d, leaving KErrArgument" ), aImageCount );
+        User::Leave( KErrArgument );
+        }
+
+    // Delete possible old still burst instance.
+    DeleteStillBurst();
+
+    // Prepare for burst capturing if requested image count more than 1.
+    // Otherwise iStillBurst stays NULL.
+    if ( aImageCount > 1 )
+        {
+        // Create new instance of still image burst object.
+        iStillBurst = CCaeStillBurst::NewL();
+
+        // Set parameter(s).
+        iStillBurst->SetLengthL( aImageCount );
+
+        LOGTEXT2( _L( "Cae: image count set successfully = %d" ), aImageCount );
+        }
+
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::SetStillCaptureImageCountL() returning" ) );    
+
+    return aImageCount;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::StillCaptureImageCount
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillStatesActive::StillCaptureImageCount() const
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::StillCaptureImageCount() entering" ) );
+    
+    // Nonexistence of still burst object implies image count of 1 
+    // (= normal single still capture).
+    TInt imageCount( 1 );
+    if ( iStillBurst ) 
+        {
+        imageCount = iStillBurst->Length();
+        }
+        
+    LOGTEXT2( _L( "Cae: CCaeStillStatesActive::StillCaptureImageCount() returning: %d" ), imageCount );
+    
+    return imageCount;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetStillBurstCaptureIntervalL
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetStillBurstCaptureIntervalL( 
+    TTimeIntervalMicroSeconds aInterval )
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::SetStillBurstCaptureIntervalL()" ) );
+
+    if ( IsRunning() ) 
+        {
+        LOGTEXT( _L( "Cae: CCaeStillStatesActive::SetStillBurstCaptureIntervalL(), leaving KErrNotReady" ) );
+        User::Leave( KErrNotReady );
+        }
+        
+    // Note: KMaxTInt32 in microseconds is about 35 minutes
+    if ( aInterval < TTimeIntervalMicroSeconds( 0 ) || 
+         aInterval > TTimeIntervalMicroSeconds( KMaxTInt32 ) )
+        {
+        LOGTEXT( _L( "Cae: CCaeStillStatesActive::SetStillBurstCaptureIntervalL(), leaving KErrArgument" ) );
+        User::Leave( KErrArgument );
+        }
+
+    iStillBurstCaptureInterval = I64INT( aInterval.Int64() );
+    }
+        
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::StillBurstCaptureInterval
+// -----------------------------------------------------------------------------
+//
+TTimeIntervalMicroSeconds CCaeStillStatesActive::StillBurstCaptureInterval() const 
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::StillBurstCaptureInterval()" ) );
+    
+    TInt64 intInterval = iStillBurstCaptureInterval.Int();
+
+    TTimeIntervalMicroSeconds interval( intInterval );
+
+    return interval;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::StopStillBurstCapture
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::StopStillBurstCapture()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::StopStillBurstCapture()" ) );
+
+    iStillBurstStopped = ETrue;
+    
+    // Complete early any pending delayed event 
+	if ( iDelayedEvent != CCaeStillStatesActive::ECaeEventNone )
+    	{
+        iDelayedCallTimer.Cancel();
+        }
+    }
+
+
+// ==================== PRIVATE MEMBER FUNCTIONS ===============================
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleAppendCapturedBurstImageReady()
+// Fetch the first burst image from the array, or continue burst capturing.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleAppendCapturedBurstImageReady()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleAppendCapturedBurstImageReady()" ));
+
+    iStatus = CCaeStillStatesActive::ECaeEventNone;
+
+    if ( iStillBurst->IsBurstCaptured() || iStillBurstStopped )
+        {
+        // Fetch the first burst image from the array
+
+        iCurrentState = CCaeStillStatesActive::ECaeStateFetchingNextBurstImage;
+        iStillBurstDeliveryStarted = ETrue;            
+        DoFetchNextBurstImage();
+        }
+    else
+        {         
+        // Continue burst capturing.
+        // If view finder is enabled, at least one view finder image 
+        // should be received before the next capture.
+        // Otherwise, start directly the next capture.
+
+         // wait alway next iViewFinderFrameReceived if optimization is not used
+         // with optimization old VF updates are acccepted
+        if ( iIsViewFinderEnabled &&
+             !(iBurstModeVFOptimization && iViewFinderFrameReceived ) )
+            {
+            LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleAppendCapturedBurstImageReady(). Waiting for the view finder." ) );
+            iCurrentState = CCaeStillStatesActive::ECaeStateBurstWaitingForViewFinder;            
+            }
+        else        
+            {
+            iCurrentState = CCaeStillStatesActive::ECaeStateCapturingBurst;            
+            DoCaptureStillBurstImage();
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleBurstImageFetchReady()
+// Decode the captured image, extract Exif metadata, or process the 
+// image by the extensions.  
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleBurstImageFetchReady()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleBurstImageFetchReady()" ));
+
+    iStatus = CCaeStillStatesActive::ECaeEventNone;
+
+    if ( !iBitmap                   // Does not already exist
+         && ( iCreateSnapImage ) )   // Snap bitmap required by UI
+        {
+        // Need to decode first.
+        iCurrentState = CCaeStillStatesActive::ECaeStateDecodingCapturedImageToBitmap;            
+        DoDecodeCapturedImageToBitmap();
+        }
+    else
+        {
+        // No need to decode.
+            {
+            iCurrentState = CCaeStillStatesActive::ECaeStateExtensionsProcessingCapturedImage;            
+            DoExtensionsProcessCapturedImage();    
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleDeliverStillBurstImageReady()
+// Complete still burst or fetch the next image.
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleDeliverStillBurstImageReady()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::HandleDeliverStillBurstImageReady()" ));
+    CAE_ASSERT_ALWAYS( iStillBurst && ( iBitmap == NULL ) && ( iImageData == NULL ) && ( iSnapBitmap == NULL ) );
+
+    iStatus = CCaeStillStatesActive::ECaeEventNone;
+    if ( CheckForStillBurstCompletion() )
+        {
+        iCurrentState = CCaeStillStatesActive::ECaeStateCompletingStillBurst;            
+        DoCompleteStillBurst();
+        }
+    else
+        {
+        iCurrentState = CCaeStillStatesActive::ECaeStateFetchingNextBurstImage;            
+        DoFetchNextBurstImage();
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoCaptureStillBurst
+// Start the burst and capture the first burst image.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoCaptureStillBurst()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCaptureStillBurst() entering" ) );
+    MEM();
+ 
+    iFirstStillBurstError = KErrNone;
+    iStillBurstDeliveryStarted = EFalse;
+        
+    // Do not wait for the view finder for the first capture
+    iViewFinderFrameReceived = ETrue; 
+    iStillCancelled = EFalse;
+
+    // Capture the first image in the burst.
+    DoCaptureStillBurstImage();
+
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCaptureStillBurst() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoCaptureStillBurstImage
+// Capture one image for the burst.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoCaptureStillBurstImage()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCaptureStillBurstImage() entering" ) );
+    MEM();
+    CAE_ASSERT_ALWAYS( !iStillCancelled );
+
+    // Notify client about capturing moment.
+    if ( !iStillBurstStopped )
+        {
+        iCaeStillBurstObserver->McaesboStillBurstCaptureMoment( KErrNone );       
+        }
+
+    // Note: If still burst is cancelled in the callback, the state 
+    // machine has already been reseted. Any member data is not allowed
+    // to be changed any more. Just return from this function. 
+
+    if ( !iStillCancelled && !iStillBurstStopped ) 
+        {
+        LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCaptureStillBurstImage() capture next image" ) );
+        iViewFinderFrameReceived = EFalse;
+        iCamera.CaptureImage();
+        }
+
+    // Separate "if" (instead of "else if") due 
+    // the possibility of stopping or cancelling in callback above.
+    if ( !iStillCancelled ) // Return immediately, if cancelled
+        {
+        if ( iStillBurstStopped )
+            {
+            // Deliver the images to the client if the burst was stopped.
+            // This call delivers the first image in the burst.
+            if ( !iStillBurstDeliveryStarted )
+                {
+                LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCaptureStillBurstImage(): burst stopped, starting delivery" ) );
+                iStillBurstDeliveryStarted = ETrue;
+                Event( CCaeStillStatesActive::ECaeEventBurstCaptureReady );
+                }
+        
+            }
+        }
+
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCaptureStillBurstImage() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoAppendCapturedBurstImageToArray
+// Append the captured image to the still burst array.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoAppendCapturedBurstImageToArray()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoAppendCapturedBurstImageToArray() entering" ) );
+    CAE_ASSERT_ALWAYS( !iStillCancelled );
+    MEM();
+
+    TInt error = iFirstStillBurstError; // We may have had error during previous capture phase
+
+    if ( !error ) 
+        {
+        // Put the image into buffer.
+        // All appended images will have KErrNone code.
+        // AppendImage does not delete the image if unable to append (error is returned).
+        error = iStillBurst->AppendImage( iBitmap, iImageData, KErrNone ); 
+        }
+
+    if ( !error ) 
+        {
+        // Ownership transferred
+        iBitmap = NULL;
+        iImageData = NULL;
+        }
+    else
+        {
+        LOGTEXT2( _L( "Cae: CCaeStillStatesActive::DoAppendCapturedBurstImageToArray(): error detected: %d" ), error );
+    	    
+        // Delete images
+        delete( iBitmap );
+        iBitmap = NULL;
+	    delete( iImageData );
+        iImageData = NULL;
+
+        iFirstStillBurstError =  iFirstStillBurstError ? iFirstStillBurstError : error;
+        iStillBurstStopped = ETrue; // Stop burst if an error was detected.    
+        }
+
+    if ( !iStillBurstStopped && !iStillBurst->IsBurstCaptured() ) 
+        {
+        // Activate (delayed) capturing of new image if burst is not complete yet.
+        Event( CCaeStillStatesActive::ECaeEventAppendCapturedBurstImageReady, iStillBurstCaptureInterval );
+        }
+    else  
+        {
+        // Start delivering immediately
+        Event( CCaeStillStatesActive::ECaeEventAppendCapturedBurstImageReady );
+        }
+
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoAppendCapturedBurstImageToArray() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoFetchNextBurstImage
+// Get the next image from the burst array.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoFetchNextBurstImage()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoFetchNextBurstImage() entering" ) );
+    MEM();
+    CAE_ASSERT_ALWAYS( ( iBitmap == NULL ) && ( iImageData == NULL ) && ( iSnapBitmap == NULL ) );
+    CAE_ASSERT_ALWAYS( !iStillCancelled );
+    CAE_ASSERT_ALWAYS( iStillBurst );
+
+    if ( ExtModeActive() ) // Extension processing mode
+        {
+            Event( CCaeStillStatesActive::ECaeEventEnd ); // extension mode operation is completed when queue is empty
+        }
+    else  // Normal mode
+        {
+        LOGTEXT2( _L( "Cae: CCaeStillStatesActive::DoFetchNextBurstImage(): count of burst images in queue = %d" ), iStillBurst->ImageCount() );
+
+        // Get next image from the array
+
+        CFbsBitmap* bitmap = NULL; 
+        HBufC8* imageData = NULL;
+        TInt imageError( KErrNone );
+
+        TInt error = iStillBurst->GetNextImage( bitmap, imageData, imageError );
+
+        // If there is no items in the array, return the first error
+        if ( (error == KErrUnderflow) && iFirstStillBurstError)
+            {
+            error = iFirstStillBurstError;
+            }
+
+        error = error ? error : imageError;
+        iImageData = imageData;
+        iBitmap = bitmap;
+
+        if ( error )
+            {
+            // Handle error
+            ErrorRecovery( error );                    
+            }
+        else
+            {
+            Event( CCaeStillStatesActive::ECaeEventBurstImageFetchReady );
+            }
+        }
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoFetchNextBurstImage() returning" ) );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::CheckForStillBurstCompletion
+// -----------------------------------------------------------------------------
+//
+TBool CCaeStillStatesActive::CheckForStillBurstCompletion()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::CheckForStillBurstCompletion()" ) );
+    MEM();
+    
+    TBool burstShouldBeCompleted( EFalse );
+
+    if ( iStillBurst )
+        {
+        if ( ExtModeActive() )  // In extension mode client knows when completed
+            {
+            burstShouldBeCompleted = iLastImageExtPro;
+            }
+        else if ( iCountOfProcessedBurstImages >= iStillBurst->CaptureCount() ) // Normal mode
+            {
+            // All captures have now been processed, ready to complete the burst.
+            LOGTEXT2( _L( "Cae: CCaeStillStatesActive::CheckForStillBurstCompletion(): Burst complete, count of images = %d" ), iCountOfProcessedBurstImages );
+            burstShouldBeCompleted = ETrue;
+            }
+        }
+
+    return( burstShouldBeCompleted );
+    }
+    
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::BurstErrorRecovery
+// Recover from burst errors.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::BurstErrorRecovery( TInt aError )
+    {
+    // Handle burst image mode errors   
+    
+    // Store error code
+    iFirstStillBurstError =  iFirstStillBurstError ? iFirstStillBurstError : aError;
+
+    iCountOfProcessedBurstImages++;
+
+    // Delete all images which are not deleted already. 
+    delete iSnapBitmap;
+    iSnapBitmap = NULL;
+    delete iBitmap;
+    iBitmap = NULL;
+    delete iImageData;
+    iImageData = NULL;
+
+    // Ignore error and continue processing
+    Event( CCaeStillStatesActive::ECaeEventDeliverStillBurstImageReady );       
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoCompleteStillBurst
+// Complete still image burst capture. 
+// Calls the observer method McaesboStillBurstComplete if capturing was not 
+// cancelled.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoCompleteStillBurst()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCompleteStillBurst() entering" ) );
+
+    if ( !iStillCancelled && IsRunning() )
+        {
+        // Notify client about completing the burst.
+        iCaeStillBurstObserver->McaesboStillBurstComplete( iCountOfDeliveredBurstImages, iFirstStillBurstError );
+        LOGTEXT2( _L( "Cae: CCaeStillStatesActive::DoCompleteStillBurst(): Count of delivered burst images = %d" ), iCountOfDeliveredBurstImages );
+        }
+    iFirstStillBurstError = KErrNone;
+    CompleteStillBurst();
+    Event( CCaeStillStatesActive::ECaeEventEnd ); // The end. Actuall does not issue any event. 
+
+    MEM();
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoCompleteStillBurst() returning" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoDeliverStillBurstImage
+//
+// Deliver the still burst image to the client and delete internal images after that.
+// Note: If ownership is transferred, the image pointers should be NULLed before
+// calling the observer method. That is because the observer method can call back
+// CancelStill() which tries to delete images. That is no allowed as images 
+// should be owned by the observer.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoDeliverStillBurstImage()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DoDeliverStillBurstImage()" ) );
+    CAE_ASSERT_ALWAYS( !iStillCancelled && ( iSnapBitmap == NULL ) );
+
+    // Deliver the still burst image to the client.
+    if ( IsBitmapOutput() )
+        {
+        // Give original image to the client even if there is decoding error.
+        CFbsBitmap* tmpBitmap = iBitmap;
+        iBitmap = NULL; // ownership is transferred      
+        iCaeObserver->McaeoStillImageReady( tmpBitmap, NULL, KErrNone );
+        }
+    else
+        {
+        // Give original image to the client even if there is encoding error
+        HBufC8* tmpImageData = iImageData;   
+        iImageData = NULL; // Ownership is tranferred
+        iCaeObserver->McaeoStillImageReady( NULL, tmpImageData, KErrNone );
+        }
+
+    iCountOfDeliveredBurstImages++;
+    iCountOfProcessedBurstImages++;
+
+    // Delete all that is not NULL already. 
+    delete iImageData;
+    iImageData = NULL;
+    delete iImageHeaderData;
+    iImageHeaderData = NULL;
+    delete iBitmap;
+    iBitmap = NULL;
+
+    Event( CCaeStillStatesActive::ECaeEventDeliverStillBurstImageReady );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::CompleteStillBurst()
+// Complete still image burst capture but do not delete still burst object. 
+// Calls the observer method McaesboStillBurstComplete if capturing was not 
+// cancelled.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::CompleteStillBurst()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::CompleteStillBurst() entering" ) );
+    MEM();
+    if ( iStillBurst )
+        {
+        iStillBurst->ResetAndDestroyImages();
+        }
+  
+    iCountOfProcessedBurstImages = 0;
+    iCountOfDeliveredBurstImages = 0;
+    iStillBurstStopped = EFalse;
+    MEM();
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::CompleteStillBurst() returning" ) );
+   }
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DeleteStillBurst
+// Delete still burst object and reset burst related variables.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DeleteStillBurst()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DeleteStillBurst() entering" ) );
+
+    delete iStillBurst;
+    iStillBurst = NULL;
+
+    iCountOfProcessedBurstImages = 0;
+    iCountOfDeliveredBurstImages = 0;
+
+    iStillBurstStopped = EFalse;
+
+    MEM();
+    LOGTEXT( _L( "Cae: CCaeStillStatesActive::DeleteStillBurst() returning" ) );    
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeStillStatesActiveNoBurst.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,208 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine still burst 
+*                interface implementation when NOT SUPPORTED
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CaeEngineImp.h"                   // Engine implementation header.
+#include "CaeStillStatesActive.h"                
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetCaeStillBurstObserver
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetCaeStillBurstObserver( 
+    MCaeStillBurstObserver& /*aObserver*/ )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetStillCaptureImageCountL
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillStatesActive::SetStillCaptureImageCountL( 
+    TInt /*aImageCount*/ )
+    {
+    return 1; // Always one without burst support
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::StillCaptureImageCount
+// -----------------------------------------------------------------------------
+//
+TInt CCaeStillStatesActive::StillCaptureImageCount() const
+    {
+    return 1; // Always one without burst support
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::SetStillBurstCaptureIntervalL
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::SetStillBurstCaptureIntervalL( 
+    TTimeIntervalMicroSeconds /*aInterval*/ )
+    {
+    }
+        
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::StillBurstCaptureInterval
+// -----------------------------------------------------------------------------
+//
+TTimeIntervalMicroSeconds CCaeStillStatesActive::StillBurstCaptureInterval() const 
+    {
+    return 0;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::StopStillBurstCapture
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::StopStillBurstCapture()
+    {
+    }
+
+
+// ==================== PRIVATE MEMBER FUNCTIONS ===============================
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleAppendCapturedBurstImageReady()
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleAppendCapturedBurstImageReady()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleBurstImageFetchReady()
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleBurstImageFetchReady()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CCaeStillStatesActive::HandleDeliverStillBurstImageReady()
+// ---------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::HandleDeliverStillBurstImageReady()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoCaptureStillBurst
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoCaptureStillBurst()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoCaptureStillBurstImage
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoCaptureStillBurstImage()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoAppendCapturedBurstImageToArray
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoAppendCapturedBurstImageToArray()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoFetchNextBurstImage
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoFetchNextBurstImage()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::CheckForStillBurstCompletion
+// -----------------------------------------------------------------------------
+//
+TBool CCaeStillStatesActive::CheckForStillBurstCompletion()
+    {
+    return( ETrue );
+    }
+    
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::BurstErrorRecovery
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::BurstErrorRecovery( TInt /*aError*/)
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoCompleteStillBurst
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoCompleteStillBurst()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DoDeliverStillBurstImage
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DoDeliverStillBurstImage()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::CompleteStillBurst()
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::CompleteStillBurst()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeStillStatesActive::DeleteStillBurst
+// -----------------------------------------------------------------------------
+//
+void CCaeStillStatesActive::DeleteStillBurst()
+    {
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeVideoQualityLevels.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,249 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine video quality level and container
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CaeVideoQualityLevels.h"
+
+#include "CaeEngineImp.h"       // For LOGTEXT
+
+// CONSTANTS
+const TInt KQualityLevelArrayGranularity = 3;
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::CCaeVideoQualityLevelsCont
+// Default constructor.
+// -----------------------------------------------------------------------------
+//
+CCaeVideoQualityLevelsCont::CCaeVideoQualityLevelsCont()
+: iQltyLevelCountSdKey( KCaeVideoQltyLevelCount )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::~CCaeVideoQualityLevelsCont
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CCaeVideoQualityLevelsCont::~CCaeVideoQualityLevelsCont()
+    {
+    delete iQualityLevels;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCaeVideoQualityLevelsCont::ConstructL()
+    {
+    LOGTEXT( _L( "Cae: CCaeVideoQualityLevelsCont::ConstructL() entering" ) );
+
+    iQualityLevels = new( ELeave ) CArrayFixFlat<CVideoQualityLevel>( KQualityLevelArrayGranularity );
+
+    LOGTEXT( _L( "Cae: CCaeVideoQualityLevelsCont::ConstructL() returning" ) );
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCaeVideoQualityLevelsCont* CCaeVideoQualityLevelsCont::NewL()
+    {
+    LOGTEXT( _L( "Cae: CCaeVideoQualityLevelsCont::NewL() entering" ) );
+
+    CCaeVideoQualityLevelsCont* self = new( ELeave ) CCaeVideoQualityLevelsCont;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    LOGTEXT( _L( "Cae: CCaeVideoQualityLevelsCont::NewL() returning" ) );
+
+    return self;
+    }
+    
+
+// -----------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::InitDefaultsL
+// Sets hardcoded default parameters for default video quality levels that 
+// are created.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeVideoQualityLevelsCont::InitDefaultsL()
+    {
+    LOGTEXT( _L( "Cae: CCaeVideoQualityLevelsCont::InitL() entering" ) );
+
+    // Delete all elements from the array and 
+    // free the memory allocated to the array buffer.
+    iQualityLevels->Reset();
+
+    // Initialize hardcoded default quality levels.
+
+    TSize size;
+
+    CVideoQualityLevel* videoQualityLevel = new( ELeave ) CVideoQualityLevel;
+    CleanupStack::PushL( videoQualityLevel );
+    
+    // Level 0:
+    size.SetSize( KImgWidthQCIF, KImgHeightQCIF );
+    videoQualityLevel->iFrameSize    = size;
+    videoQualityLevel->iFrameRate    = 15.0;  // Frames per second. Basically HW dependent.
+    videoQualityLevel->iBitRate      = 64000; // Bits per second. Basically HW dependent.
+    videoQualityLevel->iAudioEnabled = EFalse;
+    videoQualityLevel->iAudioBitRate = 12200; // Bits per second. Basically HW dependent.
+    videoQualityLevel->iMimeType.Copy( KVideoMimeType );
+    videoQualityLevel->iPreferredSupplier.Copy( KPreferredSupplier );
+    videoQualityLevel->iVideoType.Copy( KVideoType );
+    videoQualityLevel->iAudioType.Copy( KAudioType );
+    videoQualityLevel->iStorageRate = 78000;  // That many bits per second to store. Estimate only
+    videoQualityLevel->iKey = KCaeVideoQltyLevel0;
+
+    iQualityLevels->AppendL( *videoQualityLevel );
+
+    // Level 1:
+    size.SetSize( KImgWidthSubQCIF, KImgHeightSubQCIF );
+    videoQualityLevel->iFrameSize    = size;
+    videoQualityLevel->iFrameRate    = 15.0;  // Frames per second. Basically HW dependent.
+    videoQualityLevel->iBitRate      = 60000; // Bits per second. Basically HW dependent.
+    videoQualityLevel->iAudioEnabled = EFalse;
+    videoQualityLevel->iAudioBitRate = 6700;  // Bits per second. Basically HW dependent.
+    videoQualityLevel->iMimeType.Copy( KVideoMimeType );
+    videoQualityLevel->iPreferredSupplier.Copy( KPreferredSupplier );
+    videoQualityLevel->iVideoType.Copy( KVideoType );
+    videoQualityLevel->iAudioType.Copy( KAudioType );
+    videoQualityLevel->iStorageRate = 68000;  // That many bits per second to store. Estimate only
+    videoQualityLevel->iKey = KCaeVideoQltyLevel1;
+
+    iQualityLevels->AppendL( *videoQualityLevel );
+
+    // Level 2:
+    size.SetSize( KImgWidthSubQCIF, KImgHeightSubQCIF );
+    videoQualityLevel->iFrameSize    = size;
+    videoQualityLevel->iFrameRate    = 5.0;   // Frames per second. Basically HW dependent.
+    videoQualityLevel->iBitRate      = 40000; // Bits per second. Basically HW dependent.
+    videoQualityLevel->iAudioEnabled = EFalse;
+    videoQualityLevel->iAudioBitRate = 5150;  // Bits per second. Basically HW dependent.
+    videoQualityLevel->iMimeType.Copy( KVideoMimeType );
+    videoQualityLevel->iPreferredSupplier.Copy( KPreferredSupplier );
+    videoQualityLevel->iVideoType.Copy( KVideoType );
+    videoQualityLevel->iAudioType.Copy( KAudioType );
+    videoQualityLevel->iStorageRate = 47000;  // That many bits per second to store. Estimate only
+    videoQualityLevel->iKey = KCaeVideoQltyLevel2;
+
+    iQualityLevels->AppendL( *videoQualityLevel );
+
+    CleanupStack::PopAndDestroy( videoQualityLevel );
+
+    LOGTEXT( _L( "Cae: CCaeVideoQualityLevelsCont::InitL() returning" ) );
+
+    return iQualityLevels->Count();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::Count
+// -----------------------------------------------------------------------------
+//
+TInt CCaeVideoQualityLevelsCont::Count() const
+    {
+    return iQualityLevels->Count();
+    }
+
+        
+// -----------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::At
+// -----------------------------------------------------------------------------
+//
+CVideoQualityLevel& CCaeVideoQualityLevelsCont::At( 
+    TInt aIndex ) const
+    {
+    return iQualityLevels->At( aIndex );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::Key
+// -----------------------------------------------------------------------------
+//
+const TDes& CCaeVideoQualityLevelsCont::Key( 
+    TInt aIndex ) const
+    {
+    return iQualityLevels->At( aIndex ).iKey;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::ResizeL
+// -----------------------------------------------------------------------------
+//
+void CCaeVideoQualityLevelsCont::ResizeL( 
+    TInt aQualityLevelCount )
+    {
+    iQualityLevels->ResizeL( aQualityLevelCount );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::QltyLevelCountSdKey
+// -----------------------------------------------------------------------------
+//
+const TDesC& CCaeVideoQualityLevelsCont::QltyLevelCountSdKey() const
+    {
+    return iQltyLevelCountSdKey;
+    }
+
+
+/////////////////////////////
+// CVideoQualityLevel methods 
+/////////////////////////////
+
+
+// -----------------------------------------------------------------------------
+// CVideoQualityLevel::CVideoQualityLevel
+// Default constructor.
+// -----------------------------------------------------------------------------
+//
+CVideoQualityLevel::CVideoQualityLevel()
+:CQualityLevel()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CVideoQualityLevel::~CVideoQualityLevel
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CVideoQualityLevel::~CVideoQualityLevel()
+    {
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeVideoQualityLevelsNoSd.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine video quality levels container
+*                with Shared Data API support.
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CaeVideoQualityLevels.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// ---------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::CreateQualityLevelString()
+// Create quality level string for SharedData Camera ini file.
+// ---------------------------------------------------------------------------
+//
+void CCaeVideoQualityLevelsCont::CreateQualityLevelString( 
+    TInt  /*aIndex*/,
+    TDes& /*aDefaultQualityLevel*/ )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// CCaeVideoQualityLevelsCont::ParseQualityLevelFromStringL
+// Parse quality level string to quality level object data.
+// ---------------------------------------------------------------------------
+//
+void CCaeVideoQualityLevelsCont::ParseQualityLevelFromStringL( 
+    const TDesC& /*aQualityLevelString*/, 
+    TInt         /*aIndex*/ )
+    {
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/Src/CaeVideoTimes.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine video times provider class 
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include "CaeVideoTimes.h"
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoTimes::CCaeVideoTimes
+// Constructor.
+// -----------------------------------------------------------------------------
+//
+CCaeVideoTimes::CCaeVideoTimes() : 
+    CPeriodic( CActive::EPriorityStandard - 1 )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoTimes::~CCaeVideoTimes
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CCaeVideoTimes::~CCaeVideoTimes()
+    {
+    Cancel();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoTimes::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCaeVideoTimes::ConstructL()
+    {
+    CPeriodic::ConstructL();
+    CActiveScheduler::Add( this );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoTimes::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CCaeVideoTimes* CCaeVideoTimes::NewL()
+    {
+    CCaeVideoTimes* self = new( ELeave ) CCaeVideoTimes;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeVideoTimes::RunError
+// Called if CCaeVideoTimes function RunL() leaves.
+// -----------------------------------------------------------------------------
+//
+TInt CCaeVideoTimes::RunError( 
+    TInt /*aError*/ )
+    {
+    return KErrNone;
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/traces/CamAppEngineTraceDefinitions.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine Trace Definitions
+*
+*/
+
+
+// Created by TraceBuilder.Autogen 0.20.1
+// DO NOT EDIT, CHANGES WILL BE LOST
+
+#ifndef __CAMAPPENGINETRACEDEFINITIONS_H__
+#define __CAMAPPENGINETRACEDEFINITIONS_H__
+
+#include <autogen_symbian_trace_config.h>
+// Empty macro for TraceBuilder data definitions
+#define TB_DATA(x)
+
+#undef CAMAPPENGINE_ERROR
+#define CAMAPPENGINE_ERROR 0xe1
+#undef CAMAPPENGINE_API
+#define CAMAPPENGINE_API 0xe2
+#undef CAMAPPENGINE_FLOW
+#define CAMAPPENGINE_FLOW 0xe3
+#undef CAMAPPENGINE_PERFORMANCE
+#define CAMAPPENGINE_PERFORMANCE 0xe4
+
+RES_BEGIN( RESOURCE_TRC_SYMBIAN, AUTOGEN_NO_RESOURCE_ID, CAMAPPENGINE_TRACE, "CAMAPPENGINE", "", FALSE )
+	
+	TRACE_GROUP_BEGIN( CAMAPPENGINE_ERROR, "CamAppEngine_Error:", ON )
+	
+	TRACE_GROUP_END()
+	
+	TRACE_GROUP_BEGIN( CAMAPPENGINE_API, "CamAppEngine_API:", ON )
+	
+	TRACE_GROUP_END()
+	
+	TRACE_GROUP_BEGIN( CAMAPPENGINE_FLOW, "CamAppEngine_Flow:", ON )
+	
+	TRACE_GROUP_END()
+	
+	TRACE_GROUP_BEGIN( CAMAPPENGINE_PERFORMANCE, "CamAppEngine_Perf:", ON )
+		
+		TRACE_BEGIN( CAE_ENGINE_INIT_START, "e_CAM_ENG_INIT 1" )
+			
+			AUTOGEN_BTRACE_HEADER
+			
+			AUTOGEN_BTRACE_TIMESTAMP
+			
+			AUTOGEN_BTRACE_GROUP_TRACE_ID
+		
+		TRACE_END()
+		
+		TRACE_BEGIN( CAE_ENGINE_INIT_END, "e_CAM_ENG_INIT 0" )
+			
+			AUTOGEN_BTRACE_HEADER
+			
+			AUTOGEN_BTRACE_TIMESTAMP
+			
+			AUTOGEN_BTRACE_GROUP_TRACE_ID
+		
+		TRACE_END()
+		
+		TRACE_BEGIN( CAE_ENGINE_STILL_INIT_START, "e_CAM_ENG_STILL_INIT 1" )
+			
+			AUTOGEN_BTRACE_HEADER
+			
+			AUTOGEN_BTRACE_TIMESTAMP
+			
+			AUTOGEN_BTRACE_GROUP_TRACE_ID
+		
+		TRACE_END()
+		
+		TRACE_BEGIN( CAE_ENGINE_STILL_INIT_END, "e_CAM_ENG_STILL_INIT 0" )
+			
+			AUTOGEN_BTRACE_HEADER
+			
+			AUTOGEN_BTRACE_TIMESTAMP
+			
+			AUTOGEN_BTRACE_GROUP_TRACE_ID
+		
+		TRACE_END()
+		
+		TRACE_BEGIN( CAE_ENGINE_SHOT_TO_STILL_START, "e_CAM_ENG_SHOT_TO_STILL 1" )
+			
+			AUTOGEN_BTRACE_HEADER
+			
+			AUTOGEN_BTRACE_TIMESTAMP
+			
+			AUTOGEN_BTRACE_GROUP_TRACE_ID
+		
+		TRACE_END()
+		
+		TRACE_BEGIN( CAE_ENGINE_SHOT_TO_STILL_END, "e_CAM_ENG_SHOT_TO_STILL 0" )
+			
+			AUTOGEN_BTRACE_HEADER
+			
+			AUTOGEN_BTRACE_TIMESTAMP
+			
+			AUTOGEN_BTRACE_GROUP_TRACE_ID
+		
+		TRACE_END()
+		
+		TRACE_BEGIN( CAE_ENGINE_OPERATIONS_START, "e_CAM_CAE_OPERATIONS 1" )
+			
+			AUTOGEN_BTRACE_HEADER
+			
+			AUTOGEN_BTRACE_TIMESTAMP
+			
+			AUTOGEN_BTRACE_GROUP_TRACE_ID
+		
+		TRACE_END()
+		
+		TRACE_BEGIN( CAE_ENGINE_OPERATIONS_END, "e_CAM_CAE_OPERATIONS 0" )
+			
+			AUTOGEN_BTRACE_HEADER
+			
+			AUTOGEN_BTRACE_TIMESTAMP
+			
+			AUTOGEN_BTRACE_GROUP_TRACE_ID
+		
+		TRACE_END()
+	
+	TRACE_GROUP_END()
+
+RES_END
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/Engine/traces/OstTraceDefinitions.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: OstTraceDefinitions.h
+*
+*/
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <opensystemtrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Bmarm/CAESTILLCONVERTERU.DEF	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,14 @@
+EXPORTS
+	"_._16CCaeStillEncoder" @ 1 NONAME R3UNUSED ; CCaeStillEncoder::~CCaeStillEncoder(void)
+	Cleanup__16CCaeStillEncoder @ 2 NONAME R3UNUSED ; CCaeStillEncoder::Cleanup(void)
+	CompressionQuality__C16CCaeStillEncoder @ 3 NONAME R3UNUSED ; CCaeStillEncoder::CompressionQuality(void) const
+	ConvertCFbsBitmapToHBufC8L__16CCaeStillEncoderP10CFbsBitmapQ216CCaeStillEncoder13TTargetFormat @ 4 NONAME R3UNUSED ; CCaeStillEncoder::ConvertCFbsBitmapToHBufC8L(CFbsBitmap *, CCaeStillEncoder::TTargetFormat)
+	ConvertHBufC8ToCFbsBitmapL__16CCaeStillDecoderP6HBufC812TDisplayModeRC5TSizeT3 @ 5 NONAME ; CCaeStillDecoder::ConvertHBufC8ToCFbsBitmapL(HBufC8 *, TDisplayMode, TSize const &, TSize const &)
+	NewL__16CCaeStillDecoder @ 6 NONAME R3UNUSED ; CCaeStillDecoder::NewL(void)
+	NewL__16CCaeStillEncoder @ 7 NONAME R3UNUSED ; CCaeStillEncoder::NewL(void)
+	SetCompressionQuality__16CCaeStillEncoderi @ 8 NONAME R3UNUSED ; CCaeStillEncoder::SetCompressionQuality(int)
+	SetObserver__16CCaeStillDecoderP24MCaeStillDecoderObserver @ 9 NONAME R3UNUSED ; CCaeStillDecoder::SetObserver(MCaeStillDecoderObserver *)
+	SetObserver__16CCaeStillEncoderP24MCaeStillEncoderObserver @ 10 NONAME R3UNUSED ; CCaeStillEncoder::SetObserver(MCaeStillEncoderObserver *)
+	"_._16CCaeStillDecoder" @ 11 NONAME R3UNUSED ; CCaeStillDecoder::~CCaeStillDecoder(void)
+	Cleanup__16CCaeStillDecoder @ 12 NONAME R3UNUSED ; CCaeStillDecoder::Cleanup(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Bwins/CAESTILLCONVERTERU.DEF	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,14 @@
+EXPORTS
+	??1CCaeStillDecoder@@UAE@XZ @ 1 NONAME ; public: virtual __thiscall CCaeStillDecoder::~CCaeStillDecoder(void)
+	??1CCaeStillEncoder@@UAE@XZ @ 2 NONAME ; public: virtual __thiscall CCaeStillEncoder::~CCaeStillEncoder(void)
+	?Cleanup@CCaeStillDecoder@@QAEXXZ @ 3 NONAME ; public: void __thiscall CCaeStillDecoder::Cleanup(void)
+	?Cleanup@CCaeStillEncoder@@QAEXXZ @ 4 NONAME ; public: void __thiscall CCaeStillEncoder::Cleanup(void)
+	?CompressionQuality@CCaeStillEncoder@@QBEHXZ @ 5 NONAME ; public: int __thiscall CCaeStillEncoder::CompressionQuality(void)const 
+	?ConvertCFbsBitmapToHBufC8L@CCaeStillEncoder@@QAEXPAVCFbsBitmap@@W4TTargetFormat@1@@Z @ 6 NONAME ; public: void __thiscall CCaeStillEncoder::ConvertCFbsBitmapToHBufC8L(class CFbsBitmap *,enum CCaeStillEncoder::TTargetFormat)
+	?ConvertHBufC8ToCFbsBitmapL@CCaeStillDecoder@@QAEXPAVHBufC8@@W4TDisplayMode@@ABVTSize@@2@Z @ 7 NONAME ; public: void __thiscall CCaeStillDecoder::ConvertHBufC8ToCFbsBitmapL(class HBufC8 *,enum TDisplayMode,class TSize const &,class TSize const &)
+	?NewL@CCaeStillDecoder@@SAPAV1@XZ @ 8 NONAME ; public: static class CCaeStillDecoder * __cdecl CCaeStillDecoder::NewL(void)
+	?NewL@CCaeStillEncoder@@SAPAV1@XZ @ 9 NONAME ; public: static class CCaeStillEncoder * __cdecl CCaeStillEncoder::NewL(void)
+	?SetCompressionQuality@CCaeStillEncoder@@QAEXH@Z @ 10 NONAME ; public: void __thiscall CCaeStillEncoder::SetCompressionQuality(int)
+	?SetObserver@CCaeStillDecoder@@QAEXPAVMCaeStillDecoderObserver@@@Z @ 11 NONAME ; public: void __thiscall CCaeStillDecoder::SetObserver(class MCaeStillDecoderObserver *)
+	?SetObserver@CCaeStillEncoder@@QAEXPAVMCaeStillEncoderObserver@@@Z @ 12 NONAME ; public: void __thiscall CCaeStillEncoder::SetObserver(class MCaeStillEncoderObserver *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Bwinscw/CAESTILLCONVERTERU.DEF	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,14 @@
+EXPORTS
+	??1CCaeStillDecoder@@UAE@XZ @ 1 NONAME ; CCaeStillDecoder::~CCaeStillDecoder(void)
+	??1CCaeStillEncoder@@UAE@XZ @ 2 NONAME ; CCaeStillEncoder::~CCaeStillEncoder(void)
+	?Cleanup@CCaeStillDecoder@@QAEXXZ @ 3 NONAME ; void CCaeStillDecoder::Cleanup(void)
+	?Cleanup@CCaeStillEncoder@@QAEXXZ @ 4 NONAME ; void CCaeStillEncoder::Cleanup(void)
+	?CompressionQuality@CCaeStillEncoder@@QBEHXZ @ 5 NONAME ; int CCaeStillEncoder::CompressionQuality(void) const
+	?ConvertCFbsBitmapToHBufC8L@CCaeStillEncoder@@QAEXPAVCFbsBitmap@@W4TTargetFormat@1@@Z @ 6 NONAME ; void CCaeStillEncoder::ConvertCFbsBitmapToHBufC8L(class CFbsBitmap *, enum CCaeStillEncoder::TTargetFormat)
+	?ConvertHBufC8ToCFbsBitmapL@CCaeStillDecoder@@QAEXPAVHBufC8@@W4TDisplayMode@@ABVTSize@@2@Z @ 7 NONAME ; void CCaeStillDecoder::ConvertHBufC8ToCFbsBitmapL(class HBufC8 *, enum TDisplayMode, class TSize const &, class TSize const &)
+	?NewL@CCaeStillDecoder@@SAPAV1@XZ @ 8 NONAME ; class CCaeStillDecoder * CCaeStillDecoder::NewL(void)
+	?NewL@CCaeStillEncoder@@SAPAV1@XZ @ 9 NONAME ; class CCaeStillEncoder * CCaeStillEncoder::NewL(void)
+	?SetCompressionQuality@CCaeStillEncoder@@QAEXH@Z @ 10 NONAME ; void CCaeStillEncoder::SetCompressionQuality(int)
+	?SetObserver@CCaeStillDecoder@@QAEXPAVMCaeStillDecoderObserver@@@Z @ 11 NONAME ; void CCaeStillDecoder::SetObserver(class MCaeStillDecoderObserver *)
+	?SetObserver@CCaeStillEncoder@@QAEXPAVMCaeStillEncoderObserver@@@Z @ 12 NONAME ; void CCaeStillEncoder::SetObserver(class MCaeStillEncoderObserver *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Eabi/CaeStillConverterU.DEF	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,18 @@
+EXPORTS
+	_ZN16CCaeStillDecoder11SetObserverEP24MCaeStillDecoderObserver @ 1 NONAME
+	_ZN16CCaeStillDecoder26ConvertHBufC8ToCFbsBitmapLEP6HBufC812TDisplayModeRK5TSizeS5_ @ 2 NONAME
+	_ZN16CCaeStillDecoder4NewLEv @ 3 NONAME
+	_ZN16CCaeStillDecoder7CleanupEv @ 4 NONAME
+	_ZN16CCaeStillDecoderD0Ev @ 5 NONAME
+	_ZN16CCaeStillDecoderD1Ev @ 6 NONAME
+	_ZN16CCaeStillDecoderD2Ev @ 7 NONAME
+	_ZN16CCaeStillEncoder11SetObserverEP24MCaeStillEncoderObserver @ 8 NONAME
+	_ZN16CCaeStillEncoder21SetCompressionQualityEi @ 9 NONAME
+	_ZN16CCaeStillEncoder26ConvertCFbsBitmapToHBufC8LEP10CFbsBitmapNS_13TTargetFormatE @ 10 NONAME
+	_ZN16CCaeStillEncoder4NewLEv @ 11 NONAME
+	_ZN16CCaeStillEncoder7CleanupEv @ 12 NONAME
+	_ZN16CCaeStillEncoderD0Ev @ 13 NONAME
+	_ZN16CCaeStillEncoderD1Ev @ 14 NONAME
+	_ZN16CCaeStillEncoderD2Ev @ 15 NONAME
+	_ZNK16CCaeStillEncoder18CompressionQualityEv @ 16 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Group/CaeStillConverter.mmp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine Still Image Converter
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          CaeStillConverter.dll
+TARGETTYPE      dll
+
+UID             0x1000008d 0x101F856A
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+// Define directories for the .def-files of WINS and WINSCW builds separately.
+// IMPORTANT NOTICE:  The lines in the example that end with a backslash 
+// must have one space after the backslash.
+#if defined(ARMCC)
+deffile ../Eabi/ 
+#elif defined( WINSCW )
+deffile ../Bwinscw/ 
+#elif defined( WINS )
+deffile ../Bwins/ 
+#else
+deffile ../Bmarm/ 
+#endif
+
+SOURCEPATH      ../Src
+
+SOURCE          CaeStillConverter.cpp
+SOURCE          CaeStillEncoder.cpp
+SOURCE          CaeStillDecoder.cpp
+
+USERINCLUDE     ../Inc
+USERINCLUDE     ../../../inc       // MW level inc dir
+USERINCLUDE     ../../Engine/traces
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         imageconversion.lib
+
+LIBRARY         efsrv.lib
+LIBRARY         fbscli.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Group/CaeStillConverterTestVersion.mmp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine Still Image Converter 
+*                (TEST VERSION! For developers only.)
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET 		CaeStillConverter.dll
+TARGETTYPE      dll
+
+UID           	0x1000008d 0x101F856A
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+// Define directories for the .def-files of WINS and WINSCW builds separately.
+// IMPORTANT NOTICE:  The lines in the example that end with a backslash 
+// must have one space after the backslash.
+#if defined(ARMCC)
+deffile ../Eabi/ 
+#elif defined( WINSCW )
+deffile ../Bwinscw/ 
+#elif defined( WINS )
+deffile ../Bwins/ 
+#else
+deffile ../Bmarm/ 
+#endif
+
+MACRO           CAE_TEST_VERSION
+#define     	CAE_TEST_VERSION
+
+SOURCEPATH    	../Src
+
+SOURCE          CaeStillConverter.cpp
+SOURCE          CaeStillEncoder.cpp
+SOURCE          CaeStillDecoder.cpp
+
+#ifdef CAE_TEST_VERSION
+SOURCE          CaeStillConverterTestErrors.cpp
+#endif
+
+USERINCLUDE   	../Inc
+USERINCLUDE	    ../../../inc      // MW level inc dir
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY        	euser.lib
+LIBRARY         imageconversion.lib
+
+LIBRARY         efsrv.lib
+LIBRARY         fbscli.lib
+
+EXPORTUNFROZEN
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Group/bld.inf	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine Still Image Converter
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+CaeStillConverter.mmp
+
+PRJ_TESTMMPFILES
+CaeStillConverterTestVersion.mmp
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Inc/CaeStillCommon.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Still Image Converter Common
+*
+*/
+
+
+
+#ifndef CAESTILLCOMMON_H
+#define CAESTILLCOMMON_H
+
+// INCLUDES
+
+// CONSTANTS
+
+// Logging support
+// Serial port logging is enabled in _DEBUG builds by default
+// USE_FILE_LOGGER or USE_SERIAL_LOGGER can also be explicitely defined e.g. in MMP file.
+//
+#if defined (_DEBUG) && !defined(USE_FILE_LOGGER)                   
+    #define USE_SERIAL_LOGGER 
+#endif
+                                    
+#if defined (USE_FILE_LOGGER)
+    #include <flogger.h>
+    _LIT(KLogFile,"cae.txt");
+    _LIT(KLogFolder,"cae");
+    #define LOGTEXT(AAA)                RFileLogger::Write(KLogFolder(),KLogFile(),EFileLoggingModeAppend,AAA)
+    #define LOGTEXT2(AAA,BBB)           RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(AAA),BBB)
+    #define LOGTEXT3(AAA,BBB,CC)       RFileLogger::WriteFormat(KLogFolder(),KLogFile(),EFileLoggingModeAppend,TRefByValue<const TDesC>(AAA),BBB,CC)
+    #define LOGHEXDUMP(AAA,BBB,CC,DDD) RFileLogger::HexDump(KLogFolder(),KLogFile(),EFileLoggingModeAppend,AAA,BBB,CC,DDD)    
+#elif defined (USE_SERIAL_LOGGER) 
+    #include <e32svr.h>
+    #define LOGTEXT(AAA)                RDebug::Print(AAA)
+    #define LOGTEXT2(AAA,BBB)           RDebug::Print(AAA,BBB)
+    #define LOGTEXT3(AAA,BBB,CC)       RDebug::Print(AAA,BBB,CC)
+    #define LOGHEXDUMP(AAA,BBB,CC,DDD)
+#else
+    #define LOGTEXT(AAA)                
+    #define LOGTEXT2(AAA,BBB)           
+    #define LOGTEXT3(AAA,BBB,CC)       
+    #define LOGHEXDUMP(AAA,BBB,CC,DDD) 
+#endif                              
+
+
+// CLASS DECLARATION
+
+
+
+#endif // CAESTILLCOMMON_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Inc/CaeStillConverter.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Still Image Converter base class for Camera Application Engine
+*
+*/
+
+
+
+#ifndef CAESTILLCONVERTER_H
+#define CAESTILLCONVERTER_H
+
+// INCLUDES
+#include <imageconversion.h>
+
+// CONSTANTS
+
+const TUid KUidSpecialFreeScalingDecoder = { 0x101FF555 }; // This decoder supports free scaling
+
+// CLASS DECLARATION
+
+/**
+* Still Converter class.
+* Base class for still image conversions by the Camera Application Engine.
+*/
+NONSHARABLE_CLASS( CCaeStillConverter ) : public CActive
+    {
+    
+    public: 
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CCaeStillConverter();
+
+    protected:
+
+        /**
+        * Internal state.
+        */
+        enum 
+            {
+            EIdle,
+            EConvert
+            };
+
+    protected:  // Functions from base classes
+        /**
+        * From CActive, handles an active object’s request completion event.
+        * @return void
+        */
+        void RunL();
+
+        /**
+        * From CActive, called if CCaeStillConverter function RunL() leaves.
+        * @param aError Standard Symbian OS error code
+        * @return Error code KErrNone
+        */
+        TInt RunError( 
+            TInt aError );
+
+    protected:
+        /**
+        * C++ constructor.
+        */
+        CCaeStillConverter();
+
+        /**
+        * Symbian 2nd phase constructor that can leave.
+        * This is intended to be called from derived class ConstructL().
+        */
+        void ConstructL();
+
+    protected:
+        /**
+        * Returns the engine state.
+        * @return Boolean indicating if Still Converter is busy
+        */
+        TBool IsBusy() const;
+
+    protected: // To be implemented in a derived class.
+        /**
+        * Converts (encodes or decodes) the image.
+        * @return void
+        */
+        virtual void ConvertL() = 0;
+   
+        /**
+        * Perfoms necessary cleanup and delivers the result to the client.
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code
+        * @return void
+        */
+        virtual void ConversionComplete( 
+            TInt aError ) = 0;
+
+        /** 
+        * Sets the specific image codec implementation to be used in decoding and encoding.
+        * @since 3.1
+        * @param aCodecUid The UID of the specific image codec to be used.
+        * @return void
+        */
+        virtual void SetImageCodecL( 
+        	TUid aCodecUid ) = 0;
+        	
+    protected:  // Data
+
+        // Class for image data.
+        class CImageItem: public CBase
+            {
+            public:
+                CImageItem() {};
+                virtual ~CImageItem() 
+                    {
+                    delete iBitmap;
+                    delete iImageBuffer;
+                    delete iFrameImageData;
+                    };
+            public:
+                // Bitmap.
+                CFbsBitmap* iBitmap;
+                // Bitmap target size.
+                TSize iBitmapSize;
+                // Bitmap target size for free scaling.
+                TSize iFullyScaledBitmapSize;
+               // Bitmap display mode.
+                TDisplayMode iBitmapDisplayMode;
+                // Image in some common image file format (like Jpeg)
+                HBufC8* iImageBuffer;
+                 // Info for encoder
+                CFrameImageData* iFrameImageData;
+                // UID of conversion target image type.
+                TUid iImageTypeUid;
+            };
+
+        // Specific image codec UID.
+        TUid iImageCodecUid;
+
+        // Pointer to array of CImageItem.
+        RPointerArray<CImageItem>* iImageQueue;
+
+        // Still Converter state.
+        TInt iState;
+        
+    };
+
+
+#endif // CAESTILLCONVERTER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Inc/CaeStillConverterTestErrors.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine Still Converter error simulation 
+*                global functions for testing (CAE_TEST_VERSION only)
+*
+*/
+
+
+#ifdef CAE_TEST_VERSION
+
+#ifndef CAESTILLCONVERTERTESTERRORS_H
+#define CAESTILLCONVERTERTESTERRORS_H
+
+IMPORT_C void CaeSetConvertCFbsBitmapToHBufC8Error( TInt aError );
+
+IMPORT_C void CaeConvertCFbsBitmapToHBufC8ErrorL();
+
+IMPORT_C void CaeSetConvertHBufC8ToCFbsBitmapError( TInt aError );
+
+IMPORT_C void CaeConvertHBufC8ToCFbsBitmapErrorL();
+
+IMPORT_C void CaeSetStillConvertError( TInt aError );
+
+IMPORT_C void CaeStillConvertErrorL();
+
+#endif // CAESTILLCONVERTERTESTERRORS_H
+
+#endif // CAE_TEST_VERSION
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Inc/CaeStillDecoder.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,164 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Still Image Decoder for Camera Application Engine
+*
+*/
+
+
+
+#ifndef CAESTILLDECODER_H
+#define CAESTILLDECODER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <s32file.h>
+#include <imageconversion.h>
+#include <ecam.h>
+
+
+// CLASS DECLARATION
+
+/**
+*  Still decoder observer class.
+*  User of CCaeStillDecoder class must derive from this interface.
+*
+* @lib CAESTILLCONVERTER.LIB
+* @since 2.1
+*/
+class MCaeStillDecoderObserver
+    {
+    public:
+        /**
+        * Called back by CCaeStillDecoder when it completes conversion (decoding) to CFbsBitmap image.
+        * @since 2.1
+        * @param aImageData Source image (as JPEG)
+        * @param aBitmap Converted Symbian OS bitmap image
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code
+        * @param aImageSize Decoded image size
+        * @return void
+        */
+        virtual void McaesdoCFbsBitmapImageReady( 
+            HBufC8* aImageData, 
+            CFbsBitmap* aBitmap, 
+            TInt aError,
+            TInt aImageSize ) = 0;
+    };
+
+
+// CLASS DECLARATION
+
+/**
+* Still Decoder class.
+* Implements still image decoding for Camera Application Engine 
+* using Symbian Image Conversion Library (ICL)
+*
+* @lib CAESTILLCONVERTER.LIB
+* @since 2.1
+*/
+NONSHARABLE_CLASS( CCaeStillDecoder ) : public CCaeStillConverter
+    {
+    public:  // Constructor and destructor    
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CCaeStillDecoder* NewL();
+
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CCaeStillDecoder();
+
+    public: // From CCaeStillConverter:
+
+        void SetImageCodecL( 
+        	TUid aCodecUid );
+        	
+    public: // New functions
+        /**
+        * Sets Still Decoder observer.
+        * @since 2.1
+        * @param aObserver Still Decoder observer
+        * @return void
+        */
+        IMPORT_C void SetObserver( 
+            MCaeStillDecoderObserver* aObserver );
+
+        /** 
+        * Creates the CImageItem object, places it in the internal queue and 
+        * starts the memory image conversion where the memory image (e.g. JPEG) 
+        * is converted to bitmap. 
+        * @param aImageBuffer Memory image to convert. Ownership is given.
+        * @param aTargetBitmapMode Target/destination bitmap color mode
+        * @param aTargetBitmapSize Target/destination bitmap size without free scaling decoder
+        * @param aFullyScaledTargetBitmapSize Target/destination bitmap size with free scaling decoder
+        * @return void
+        */
+        IMPORT_C void ConvertHBufC8ToCFbsBitmapL( 
+            HBufC8* aImageBuffer,
+            TDisplayMode aTargetBitmapMode,
+            const TSize& aTargetBitmapSize,
+            const TSize& aFullyScaledTargetBitmapSize = TSize( 0, 0 ) );
+
+        /**
+        * Destroys all allocations for decoding, as the images from the queue.
+        * @return void
+        */
+        IMPORT_C void Cleanup();
+
+    protected: // Constructors
+        /**
+        * C++ constructor.
+        */
+        CCaeStillDecoder();
+
+        /**
+        * Symbian 2nd phase constructor that can leave.
+        */
+        void ConstructL();
+
+    private: // From CCaeStillConverter:
+        
+        /**
+        * From CActive, implements cancellation of an outstanding request.
+        * @return void
+        */
+        void DoCancel();
+
+    protected: // From CCaeStillConverter
+        
+        void ConvertL();
+   
+        void ConversionComplete( 
+            TInt aError );
+
+    private: // Data
+
+        // Still Decoder observer.
+        MCaeStillDecoderObserver* iObserver;
+
+        // Pointer to ICL decoder object.
+        CImageDecoder* iDecoder;
+
+        // Pointer to decoded image.
+        CFbsBitmap* iDecodedImage;
+
+        // Class wide file server handle for file operations
+        RFs iFs;
+    };
+
+
+#endif // CAESTILLDECODER_H   
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Inc/CaeStillEncoder.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,191 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Still Image Encoder for Camera Application Engine
+*
+*/
+
+
+
+#ifndef CAESTILLENCODER_H
+#define CAESTILLENCODER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <s32file.h>
+#include <imageconversion.h>
+#include "CaeStillConverter.h"
+
+// CONSTANTS
+const TInt KJpegQualityMin = 0;
+const TInt KJpegQualityMax = 100;
+
+const TJpegImageData::TColorSampling KCaeJpegColorSampling = TJpegImageData::EColor420;
+
+
+// CLASS DECLARATION
+
+/**
+*  Still encoder observer class.
+*  User of CCaeStillEncoder class must derive from this interface.
+*
+* @lib CAESTILLCONVERTER.LIB
+* @since 2.1
+*/
+class MCaeStillEncoderObserver
+    {
+    public:
+        /**
+        * Called back by CCaeStillEncoder when it completes conversion (encoding) to HBufC8 image data (as JPEG).
+        * single media item during media items enumeration.
+        * @since 2.1
+        * @param aBitmap Source Symbian OS bitmap image
+        * @param aImageData Converted image (as JPEG)
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code
+        * @param aImageSize Encoded image size
+        * @return void
+        */
+        virtual void McaeseoHBufC8ImageReady(
+            CFbsBitmap* aBitmap,
+            HBufC8* aImageData, 
+            TInt aError,
+            TInt aImageSize ) = 0;
+    };
+
+
+// CLASS DECLARATION
+
+/**
+* Still Encoder class. Derived from CaeStillConverter. 
+* Implements still image encoding for Camera Application Engine 
+* using Symbian Image Conversion Library (ICL).
+*
+* @lib CAESTILLCONVERTER.LIB
+* @since 2.1
+*/
+NONSHARABLE_CLASS( CCaeStillEncoder ) : public CCaeStillConverter
+    {
+    public: // Conversion target image type.
+
+        enum TTargetFormat
+            {
+            ETargetFormatJPEG
+            };
+
+    public: // Constructor and destructor    
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CCaeStillEncoder* NewL();
+
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CCaeStillEncoder();
+
+    public: // From CCaeStillConverter:
+
+        void SetImageCodecL( 
+        	TUid aCodecUid );
+        	
+    public: // New functions
+        /**
+        * Sets Still Encoder observer.
+        * @since 2.1
+        * @param aObserver Still Encoder observer
+        * @return void
+        */
+        IMPORT_C void SetObserver( 
+            MCaeStillEncoderObserver* aObserver );
+
+        /**
+        * Sets compression quality.
+        * @since 2.1
+        * @param aQuality Compression quality
+        * @return void
+        */
+        IMPORT_C void SetCompressionQuality( 
+            TInt aQuality );
+
+        /**
+        * Gets compression quality.
+        * @since 2.1
+        * @return Compression quality
+        */
+        IMPORT_C TInt CompressionQuality() const;
+
+        /** 
+        * Creates the CImageItem object, places it in the internal queue and 
+        * starts the memory image conversion where the memory bitmap is 
+        * converted to another format (e.g. JPEG). 
+        * @since 2.1
+        * @param aBitmap Bitmap to convert
+        * @param aTargetFormat Target/destination image format (JPEG by default)
+        * @return void
+        */
+        IMPORT_C void ConvertCFbsBitmapToHBufC8L( 
+            CFbsBitmap* aBitmap,
+            TTargetFormat aTargetFormat = ETargetFormatJPEG );
+
+        /**
+        * Destroys all allocations for encoding, as the images from the queue.
+        * @return void
+        */
+        IMPORT_C void Cleanup();
+
+    private: // Constructors
+        /**
+        * C++ constructor.
+        */
+        CCaeStillEncoder();
+
+        /**
+        * Symbian 2nd phase constructor that can leave.
+        */
+        void ConstructL();
+    
+    private: // From CCaeStillConverter:
+        
+        /**
+        * From CActive, implements cancellation of an outstanding request.
+        * @return void
+        */
+        void DoCancel();
+
+    private: // From CCaeStillConverter:
+        
+        void ConvertL();
+   
+        void ConversionComplete( 
+            TInt aError );
+
+    private: // Data
+
+        // Still Encoder observer.
+        MCaeStillEncoderObserver* iObserver;
+
+        // Pointer to ICL encoder object.
+        CImageEncoder* iEncoder;
+
+        // Pointer to encoded image.
+        HBufC8* iEncodedImage;
+
+        // Quality factor for JPEG images.
+        TInt iJpegQuality;
+    };
+
+
+#endif // CAESTILLENCODER_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Src/CaeStillConverter.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Still Image Converter base class for Camera Application Engine
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <eikenv.h>
+
+#include "CaeStillConverter.h"
+
+#ifdef CAE_TEST_VERSION
+#include "CaeStillConverterTestErrors.h"
+#endif
+
+// CONSTANTS
+const TInt KImageQueueGranularity = 6;
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+// ---------------------------------------------------------
+// CCaeStillConverter::~CCaeStillConverter
+// Destructor.
+// ---------------------------------------------------------
+//
+CCaeStillConverter::~CCaeStillConverter()
+    {
+    if ( iImageQueue )
+        {
+        iImageQueue->ResetAndDestroy();
+        delete iImageQueue;
+        }
+
+    // For RTRT code coverage analysis.
+    // #pragma attol insert _ATCPQ_DUMP(0);
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillConverter::RunL
+// Handles an active object’s request completion event.
+// ---------------------------------------------------------
+//
+void CCaeStillConverter::RunL()
+    {
+    switch ( iState )
+        {
+        case EIdle:
+            break;
+
+        case EConvert:
+            {
+            ConversionComplete( iStatus.Int() );
+
+            // Start the next image conversion
+            if ( iImageQueue->Count() > 0 )
+                {
+                TRAPD( error, ConvertL() );
+                if ( error != KErrNone )
+                    {
+                    ConversionComplete( error );
+                    }
+                }
+            }
+            break;
+
+        default:
+            break;
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillConverter::RunError
+// From CActive, handles the leaving RunL().
+// ---------------------------------------------------------
+//
+TInt CCaeStillConverter::RunError( TInt aError )
+    {
+    ConversionComplete( aError );
+    return KErrNone;
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillConverter::CCaeStillConverter
+// Default constructor. 
+// This can NOT leave.
+// ---------------------------------------------------------
+//
+CCaeStillConverter::CCaeStillConverter() :
+CActive( EPriorityStandard ),
+iState( EIdle )
+    {
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillConverter::ConstructL
+// Symbian 2nd phase constructor that can leave.
+// ---------------------------------------------------------
+//
+void CCaeStillConverter::ConstructL()
+    {
+    iImageQueue = new( ELeave ) RPointerArray<CImageItem>( KImageQueueGranularity );
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillConverter::IsBusy
+// Returns ETrue if Still Converter is busy.
+// ---------------------------------------------------------
+//
+TBool CCaeStillConverter::IsBusy() const
+    {
+    return ( iState != EIdle );
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Src/CaeStillConverterTestErrors.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine Still Converter error simulations 
+*                (CAE_TEST_VERSION only).
+*
+*/
+
+
+#ifdef CAE_TEST_VERSION
+
+//  INCLUDES
+#include <e32base.h>
+
+
+// Error simulation variables.
+TInt CaeConvertCFbsBitmapToHBufC8ErrorValue( 0 );
+TInt CaeConvertHBufC8ToCFbsBitmapErrorValue( 0 );
+TInt CaeStillConvertErrorValue( 0 );
+
+
+// ============================ GLOBAL FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// CaeSetConvertCFbsBitmapToHBufC8Error
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetConvertCFbsBitmapToHBufC8Error( TInt aError )
+    {
+    CaeConvertCFbsBitmapToHBufC8ErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaeConvertCFbsBitmapToHBufC8ErrorL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeConvertCFbsBitmapToHBufC8ErrorL()
+    {
+    if ( CaeConvertCFbsBitmapToHBufC8ErrorValue != KErrNone )
+        {
+        User::Leave( CaeConvertCFbsBitmapToHBufC8ErrorValue );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CaeSetConvertHBufC8ToCFbsBitmapError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetConvertHBufC8ToCFbsBitmapError( TInt aError )
+    {
+    CaeConvertHBufC8ToCFbsBitmapErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaeConvertHBufC8ToCFbsBitmapErrorL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeConvertHBufC8ToCFbsBitmapErrorL()
+    {
+    if ( CaeConvertHBufC8ToCFbsBitmapErrorValue != KErrNone )
+        {
+        User::Leave( CaeConvertHBufC8ToCFbsBitmapErrorValue );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CaeSetStillConvertError
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeSetStillConvertError( TInt aError )
+    {
+    CaeStillConvertErrorValue = aError;
+    }
+
+// -----------------------------------------------------------------------------
+// CaeStillConvertErrorL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CaeStillConvertErrorL()
+    {
+    if ( CaeStillConvertErrorValue != KErrNone )
+        {
+        User::Leave( CaeStillConvertErrorValue );
+        }
+    }
+
+
+#endif // CAE_TEST_VERSION
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Src/CaeStillDecoder.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,308 @@
+/*
+* Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Still Image Decoder for Camera Application Engine
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <eikenv.h>
+
+#include "CaeStillConverter.h"
+#include "CaeStillDecoder.h"
+#include "CaeStillCommon.h"
+
+#ifdef CAE_TEST_VERSION
+#include "CaeStillConverterTestErrors.h"
+#endif
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+// ---------------------------------------------------------
+// CCaeStillDecoder::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------
+//
+EXPORT_C CCaeStillDecoder* CCaeStillDecoder::NewL()
+    {
+    CCaeStillDecoder* self = new( ELeave ) CCaeStillDecoder;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillDecoder::~CCaeStillDecoder
+// Destructor.
+// ---------------------------------------------------------
+//
+EXPORT_C CCaeStillDecoder::~CCaeStillDecoder()
+    {
+    delete iDecoder;
+    delete iDecodedImage;
+    iFs.Close(); 
+
+    // For RTRT code coverage analysis.
+    // #pragma attol insert _ATCPQ_DUMP(0);
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillDecoder::SetObserver
+// Sets Still Decoder observer.
+// ---------------------------------------------------------
+//
+EXPORT_C void CCaeStillDecoder::SetObserver( 
+    MCaeStillDecoderObserver* aObserver )
+    {
+    iObserver = aObserver;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillDecoder::SetImageCodecL
+// Sets the specific image codec implementation to be used in decoding.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillDecoder::SetImageCodecL( 
+	TUid aCodecUid )
+    {
+    iImageCodecUid = aCodecUid;
+    }
+
+        
+// ---------------------------------------------------------
+// CCaeStillDecoder::ConvertHBufC8ToCFbsBitmapL
+// Creates CImageItem object, places it in the internal 
+// queue and starts memory image to bitmap conversion.
+// ---------------------------------------------------------
+//
+EXPORT_C void CCaeStillDecoder::ConvertHBufC8ToCFbsBitmapL( 
+    HBufC8* aImageBuffer,
+    TDisplayMode aTargetBitmapMode,
+    const TSize& aTargetBitmapSize,
+    const TSize& aFullyScaledTargetBitmapSize )
+    {
+    LOGTEXT( _L( "Cae: CCaeStillDecoder::ConvertHBufC8ToCFbsBitmapL() entering" ) );
+
+    CleanupStack::PushL( aImageBuffer );
+
+    // Create image item and set up image data.
+
+    CImageItem* imageItem = new( ELeave ) CImageItem;
+    imageItem->iBitmapDisplayMode = aTargetBitmapMode;
+    imageItem->iImageBuffer = aImageBuffer;
+    imageItem->iBitmapSize = aTargetBitmapSize;
+    imageItem->iFullyScaledBitmapSize = aFullyScaledTargetBitmapSize;
+    CleanupStack::Pop( aImageBuffer );
+    CleanupStack::PushL( imageItem ); 
+
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaeConvertHBufC8ToCFbsBitmapErrorL();
+    #endif    
+
+    // Add image to the queue.
+    User::LeaveIfError ( iImageQueue->Append( imageItem ) );
+
+    CleanupStack::Pop( imageItem );
+
+    // Start image conversion if not busy. Busy means that e.g. conversion is currently running. 
+    if ( !IsBusy() )
+        {
+        TRAPD( error, ConvertL() );
+        if ( error != KErrNone )
+            {
+            ConversionComplete( error );
+            }
+        }
+
+    LOGTEXT( _L( "Cae: CCaeStillDecoder::ConvertHBufC8ToCFbsBitmapL() returning" ) );
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillDecoder::Cleanup
+// Destroy all allocations.
+// ---------------------------------------------------------
+//
+EXPORT_C void CCaeStillDecoder::Cleanup()
+    {
+    if ( iDecoder )
+        {
+        iDecoder->Cancel();
+        delete iDecoder;
+        iDecoder = NULL;
+        }
+
+    if ( iState != EIdle )
+        {
+        delete iDecodedImage;
+        iDecodedImage = NULL;
+        }
+    
+    if ( iImageQueue )
+        {
+        iImageQueue->ResetAndDestroy();
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillDecoder::CCaeStillDecoder
+// Default constructor. 
+// This can NOT leave.
+// ---------------------------------------------------------
+//
+CCaeStillDecoder::CCaeStillDecoder()
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillDecoder::ConstructL
+// Symbian 2nd phase constructor that can leave.
+// ---------------------------------------------------------
+//
+void CCaeStillDecoder::ConstructL()
+    {
+    CCaeStillConverter::ConstructL();
+    User::LeaveIfError( iFs.Connect() );
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillDecoder::DoCancel
+// From CActive, implements cancellation of an outstanding request.
+// ---------------------------------------------------------
+//
+void CCaeStillDecoder::DoCancel()
+    {
+    Cleanup();
+    iState = EIdle;
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillDecoder::ConvertL
+// Converts bitmap to memory JPEG image.
+// ---------------------------------------------------------
+//
+void CCaeStillDecoder::ConvertL()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillDecoder::ConvertL() entering" ) );
+
+    iState = EConvert;
+    
+    // Use the default codec or the specific codec
+    iDecoder = CImageDecoder::DataNewL( iFs, *(*iImageQueue)[0]->iImageBuffer, 
+    	CImageDecoder::EOptionNone, KNullUid, KNullUid, iImageCodecUid );
+    
+    iDecodedImage = NULL;
+    iDecodedImage = new( ELeave ) CFbsBitmap;
+
+    // Set target bitmap size
+    TSize targetBitmapSize = (*iImageQueue)[0]->iBitmapSize;
+
+    const TFrameInfo& frameInfo = iDecoder->FrameInfo( 0 );
+    TUid impUid = iDecoder->ImplementationUid();
+    LOGTEXT3( _L( "Cae: CCaeStillDecoder::ConvertL() Requested decoder: %x, Found decoder: %x" ), iImageCodecUid.iUid, impUid.iUid );
+    LOGTEXT2( _L( "Cae: CCaeStillDecoder::ConvertL() Free scaling support: %d" ), frameInfo.iFlags & TFrameInfo::EFullyScaleable );
+
+    //
+    // Use free scaling always with special decoder or with any decoder that supports it
+    //
+    if ( (( impUid == KUidSpecialFreeScalingDecoder ) || ( frameInfo.iFlags & TFrameInfo::EFullyScaleable ))  
+         && ( (*iImageQueue)[0]->iFullyScaledBitmapSize != TSize( 0, 0 ) ) )
+        {
+        LOGTEXT( _L( "Cae: CCaeStillDecoder::ConvertL(). Use free scaling in decoding" ) );
+        targetBitmapSize = (*iImageQueue)[0]->iFullyScaledBitmapSize;
+        }
+
+    User::LeaveIfError( iDecodedImage->Create(
+        targetBitmapSize, 
+        (*iImageQueue)[0]->iBitmapDisplayMode ) );
+
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaeStillConvertErrorL();
+    #endif    
+
+    iState = EConvert;
+    iStatus = KRequestPending;
+    iDecoder->Convert( &iStatus, *iDecodedImage );
+    SetActive();
+
+    LOGTEXT( _L( "Cae: CCaeStillDecoder::ConvertL() returning" ) );
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillDecoder::ConversionComplete
+// Perfoms necessary cleanup and delivers result to the client.
+// ---------------------------------------------------------
+//
+void CCaeStillDecoder::ConversionComplete( 
+    TInt aError )
+    {
+    LOGTEXT( _L( "Cae: CCaeStillDecoder::ConversionComplete() entering" ) );
+    #ifdef _DEBUG
+    if ( aError ) 
+        {
+        LOGTEXT( _L( "Cae: CCaeStillDecoder::ConversionComplete(): error detected" ) );
+        }
+    #endif
+
+    // Delete the decoder object and image queue item
+    if ( iDecoder )
+        {
+        iDecoder->Cancel();
+        delete iDecoder;
+        iDecoder = NULL;
+        }
+
+    // To be outputted via call-back.
+    HBufC8* imageBuffer = NULL;
+
+    if ( iImageQueue->Count() > 0 )
+        {
+        imageBuffer = (*iImageQueue)[0]->iImageBuffer;
+
+        (*iImageQueue)[0]->iImageBuffer = NULL; // Prevent deletion of source image.
+        delete ( *iImageQueue )[0];
+
+        // Remove item pointer from the queue and compress the queue.
+        iImageQueue->Remove( 0 ); // Remove item pointer from the queue and compress the queue.
+        }
+
+    iState = EIdle;
+
+    const TInt KZeroImageSize = 0; // Image size argument currently not in use.
+
+    // Call back the client to deliver the result image. Gives away the ownership of the imageBuffer
+    // and iDecodedImage.
+    iObserver->McaesdoCFbsBitmapImageReady( imageBuffer, iDecodedImage, aError, KZeroImageSize );
+    iDecodedImage = NULL; // Ownership has been given away
+
+    LOGTEXT( _L( "Cae: CCaeStillDecoder::ConversionComplete() returning" ) );
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/StillConverter/Src/CaeStillEncoder.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,336 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Still Image Encoder for Camera Application Engine
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <eikenv.h>
+
+#include "CaeStillConverter.h"
+#include "CaeStillEncoder.h"
+#include "CaeStillCommon.h"
+
+#ifdef CAE_TEST_VERSION
+#include "CaeStillConverterTestErrors.h"
+#endif
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+// ---------------------------------------------------------
+// CCaeStillEncoder::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------
+//
+EXPORT_C CCaeStillEncoder* CCaeStillEncoder::NewL()
+    {
+    CCaeStillEncoder* self = new( ELeave ) CCaeStillEncoder;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillEncoder::~CCaeStillEncoder
+// Destructor.
+// ---------------------------------------------------------
+//
+EXPORT_C CCaeStillEncoder::~CCaeStillEncoder()
+    {
+    Cancel();
+    Cleanup();
+    
+    // For RTRT code coverage analysis.
+    // #pragma attol insert _ATCPQ_DUMP(0);
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillEncoder::SetObserver
+// Sets Still encoder observer.
+// ---------------------------------------------------------
+//
+EXPORT_C void CCaeStillEncoder::SetObserver( 
+    MCaeStillEncoderObserver* aObserver )
+    {
+    iObserver = aObserver;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCaeStillEncoder::SetImageCodecL
+// Sets the specific image codec implementation to be used in encoding.
+// -----------------------------------------------------------------------------
+//
+void CCaeStillEncoder::SetImageCodecL( 
+	TUid aCodecUid )
+    {
+    iImageCodecUid = aCodecUid;
+    }
+
+// ---------------------------------------------------------
+// CCaeStillEncoder::SetCompressionQuality
+// Sets compression quality.
+// ---------------------------------------------------------
+//
+EXPORT_C void CCaeStillEncoder::SetCompressionQuality( 
+    TInt aQuality )
+    {
+    iJpegQuality = Min( KJpegQualityMax, Max( KJpegQualityMin, aQuality ) );
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillEncoder::CompressionQuality
+// Gets compression quality.
+// ---------------------------------------------------------
+//
+EXPORT_C TInt CCaeStillEncoder::CompressionQuality() const
+    {
+    return iJpegQuality;
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillEncoder::ConvertCFbsBitmapToHBufC8L
+// Creates CImageItem object, places it in the internal 
+// queue and starts bitmap to memory image conversion.
+// ---------------------------------------------------------
+//
+EXPORT_C void CCaeStillEncoder::ConvertCFbsBitmapToHBufC8L( 
+    CFbsBitmap* aBitmap,  
+    TTargetFormat aTargetFormat )
+    {
+    LOGTEXT( _L( "Cae: CCaeStillEncoder::ConvertCFbsBitmapToHBufC8L() entering" ) );
+
+    CleanupStack::PushL( aBitmap );
+
+    // Create image item and set up image data.
+
+    CImageItem* imageItem = new( ELeave ) CImageItem;
+
+    imageItem->iBitmap = aBitmap;
+
+    CleanupStack::Pop( aBitmap );
+    CleanupStack::PushL( imageItem );
+
+    switch ( aTargetFormat )
+        {
+        case ETargetFormatJPEG:
+        default:
+            {
+            imageItem->iImageTypeUid = KImageTypeJPGUid;
+
+            imageItem->iFrameImageData = CFrameImageData::NewL(); 
+            // ( do not push member variable to cleanup stack )
+
+            TJpegImageData* imagedata = new( ELeave ) TJpegImageData;
+            CleanupStack::PushL( imagedata );
+
+            imagedata->iSampleScheme = KCaeJpegColorSampling;
+            imagedata->iQualityFactor = iJpegQuality;
+
+            User::LeaveIfError ( imageItem->iFrameImageData->AppendImageData( imagedata ) );
+
+            CleanupStack::Pop( imagedata );
+            break;
+            }
+        }
+
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaeConvertCFbsBitmapToHBufC8ErrorL();
+    #endif    
+
+    // Append image to the queue.
+    User::LeaveIfError ( iImageQueue->Append( imageItem ) );
+
+    CleanupStack::Pop( imageItem );
+
+    // Start image conversion if not busy.
+    if ( !IsBusy() )
+        {
+        TRAPD( error, ConvertL() );
+        if ( error != KErrNone )
+            {
+            ConversionComplete( error );
+            }
+        }
+
+    LOGTEXT( _L( "Cae: CCaeStillEncoder::ConvertCFbsBitmapToHBufC8L() returning" ) );
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillEncoder::Cleanup
+// Destroy all allocations.
+// ---------------------------------------------------------
+//
+EXPORT_C void CCaeStillEncoder::Cleanup()
+    {
+    if ( iEncoder )
+        {
+        iEncoder->Cancel();
+        delete iEncoder;
+        iEncoder = NULL;
+        }
+
+    if ( iState != EIdle )
+        {
+        delete iEncodedImage;
+        iEncodedImage = NULL;
+        }
+    
+    if ( iImageQueue )
+        {
+        iImageQueue->ResetAndDestroy();
+        }
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillEncoder::CCaeStillEncoder
+// Default constructor. 
+// This can NOT leave.
+// ---------------------------------------------------------
+//
+CCaeStillEncoder::CCaeStillEncoder() :
+iJpegQuality( KJpegQualityMax )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillEncoder::ConstructL
+// Symbian 2nd phase constructor that can leave.
+// ---------------------------------------------------------
+//
+void CCaeStillEncoder::ConstructL()
+    {
+    CCaeStillConverter::ConstructL();
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillEncoder::DoCancel
+// From CActive, implements cancellation of an outstanding request.
+// ---------------------------------------------------------
+//
+void CCaeStillEncoder::DoCancel()
+    {
+    Cleanup();
+    iState = EIdle;
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillEncoder::ConvertL
+// Converts bitmap to memory JPEG image.
+// Allocates Image Conversion Library (ICL) encoder and 
+// starts conversion.
+// ---------------------------------------------------------
+//
+void CCaeStillEncoder::ConvertL()
+    {
+    LOGTEXT( _L( "Cae: CCaeStillEncoder::ConvertL() entering" ) );
+
+    // Do not delete the encoded image here, just set to NULL.
+    iEncodedImage = NULL;
+
+    // Allocate new ICL encoder.
+    delete iEncoder;
+    iEncoder = NULL;
+    
+    // Use the default codec or the specific codec
+    iEncoder = CImageEncoder::DataNewL( iEncodedImage, 
+    	CImageEncoder::EOptionNone, (*iImageQueue)[0]->iImageTypeUid, 
+    	KNullUid, iImageCodecUid ); 
+
+    LOGTEXT3( _L( "Cae: CCaeStillEncoder::ConvertL(). Requested encoder: %x, Found encoder: %x" ), iImageCodecUid.iUid, iEncoder->ImplementationUid().iUid );
+    
+    #ifdef CAE_TEST_VERSION
+    // For simulating errors when compiled as special "test version".
+    CaeStillConvertErrorL();
+    #endif    
+
+    iState = EConvert;
+    iStatus = KRequestPending;
+    iEncoder->Convert( &iStatus, 
+                       *(*iImageQueue)[0]->iBitmap, 
+                       (*iImageQueue)[0]->iFrameImageData );
+    SetActive();
+
+    LOGTEXT( _L( "Cae: CCaeStillEncoder::ConvertL() returning" ) );
+    }
+
+
+// ---------------------------------------------------------
+// CCaeStillEncoder::ConversionComplete
+// Perfoms necessary cleanup and delivers result 
+// to the client.
+// ---------------------------------------------------------
+//
+void CCaeStillEncoder::ConversionComplete( 
+    TInt aError )
+    {
+    LOGTEXT( _L( "Cae: CCaeStillEncoder::ConversionComplete() entering" ) );
+    #ifdef _DEBUG
+    if ( aError ) 
+        {
+        LOGTEXT2( _L( "Cae: CCaeStillEncoder::ConversionComplete(): error detected: %d" ), aError );
+        }
+    #endif
+
+    if ( iEncoder )
+        {
+        iEncoder->Cancel();
+        delete iEncoder;
+        iEncoder = NULL;
+        }
+
+    // To be outputted via call-back.
+    CFbsBitmap* bitmap = NULL;
+    
+    if ( iImageQueue->Count() > 0 )
+        {
+        bitmap = (*iImageQueue)[0]->iBitmap;
+
+        (*iImageQueue)[0]->iBitmap = NULL; // Prevent deletion of source image.
+        delete ( *iImageQueue )[0];
+
+        // Remove item pointer from the queue and compress the queue.
+        iImageQueue->Remove( 0 );
+        }
+
+    iState = EIdle;
+
+    const TInt KZeroImageSize = 0; // Image size argument currently not in use.
+
+    // Call back the client to deliver the result image. Gives away the ownership of the bitmap 
+    // and iEncodedImage.
+    iObserver->McaeseoHBufC8ImageReady( bitmap, iEncodedImage, aError, KZeroImageSize );
+    iEncodedImage = NULL; // Ownership has been given away
+
+    LOGTEXT( _L( "Cae: CCaeStillEncoder::ConversionComplete() returning" ) );
+    }
+
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/bwinscw/AsynchFSQu.def	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,12 @@
+EXPORTS
+	?ActionsLeft@CAsynchFSQ@@QAEHXZ @ 1 NONAME ; int CAsynchFSQ::ActionsLeft(void)
+	?Delete@CAsynchFSQ@@QAEHABVTDesC16@@@Z @ 2 NONAME ; int CAsynchFSQ::Delete(class TDesC16 const &)
+	?Go@CAsynchFSQ@@QAEHXZ @ 3 NONAME ; int CAsynchFSQ::Go(void)
+	?NewL@CAsynchFSQ@@SAPAV1@XZ @ 4 NONAME ; class CAsynchFSQ * CAsynchFSQ::NewL(void)
+	?Rename@CAsynchFSQ@@QAEHABVTDesC16@@0@Z @ 5 NONAME ; int CAsynchFSQ::Rename(class TDesC16 const &, class TDesC16 const &)
+	?SaveAndDestroy@CAsynchFSQ@@QAEHAAVTDesC8@@ABVTDesC16@@H@Z @ 6 NONAME ; int CAsynchFSQ::SaveAndDestroy(class TDesC8 &, class TDesC16 const &, int)
+	?SetCallback@CAsynchFSQ@@QAEXPAVMAsynchFSQObserver@@@Z @ 7 NONAME ; void CAsynchFSQ::SetCallback(class MAsynchFSQObserver *)
+	?SetManualStart@CAsynchFSQ@@QAEXH@Z @ 8 NONAME ; void CAsynchFSQ::SetManualStart(int)
+	?SetPriority@CAsynchFSQ@@QAEXH@Z @ 9 NONAME ; void CAsynchFSQ::SetPriority(int)
+	?Cancel@CAsynchFSQ@@QAEXXZ @ 10 NONAME ; void CAsynchFSQ::Cancel(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/eabi/AsynchFSQu.def	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,16 @@
+EXPORTS
+	_ZN10CAsynchFSQ11ActionsLeftEv @ 1 NONAME
+	_ZN10CAsynchFSQ11SetCallbackEP18MAsynchFSQObserver @ 2 NONAME
+	_ZN10CAsynchFSQ14SaveAndDestroyER6TDesC8RK7TDesC16i @ 3 NONAME
+	_ZN10CAsynchFSQ11SetPriorityEi @ 4 NONAME
+	_ZN10CAsynchFSQ14SetManualStartEi @ 5 NONAME
+	_ZN10CAsynchFSQ2GoEv @ 6 NONAME
+	_ZN10CAsynchFSQ4NewLEv @ 7 NONAME
+	_ZN10CAsynchFSQ6DeleteERK7TDesC16 @ 8 NONAME
+	_ZN10CAsynchFSQ6RenameERK7TDesC16S2_ @ 9 NONAME
+	_ZTI10CAsynchFSQ @ 10 NONAME ; #<TI>#
+	_ZTI14CAsynchFSQAtom @ 11 NONAME ; #<TI>#
+	_ZTV10CAsynchFSQ @ 12 NONAME ; #<VT>#
+	_ZTV14CAsynchFSQAtom @ 13 NONAME ; #<VT>#
+	_ZN10CAsynchFSQ6CancelEv @ 14 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/group/asynchfsq.mmp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Asynchronous File Saving Queue
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          AsynchFSQ.dll
+TARGETTYPE      dll
+
+UID             0x1000008d 0x2000b00b
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+// Define directories for the .def-files of WINS and WINSCW builds separately.
+// IMPORTANT NOTICE:  The lines in the example that end with a backslash 
+// must have one space after the backslash.
+#if defined(ARMCC)
+deffile ../eabi/ 
+#elif defined( WINSCW )
+deffile ../bwinscw/ 
+#elif defined( WINS )
+deffile ../bwins/ 
+#else
+deffile ../bmarm/ 
+#endif
+
+SOURCEPATH      ../src
+
+SOURCE          asynchfsq.cpp
+SOURCE          asynchatom.cpp
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../Engine/traces
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         sysutil.lib
+LIBRARY         bafl.lib
+LIBRARY         efsrv.lib
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/group/bld.inf	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Asynchronous File Saving Queue
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+asynchfsq.mmp
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/inc/asynchatom.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,210 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Asynchronous FSQ Atom Class
+*
+*/
+
+
+
+#ifndef ASYNCHATOM_H
+#define ASYNCHATOM_H
+
+//  INCLUDES
+#include <f32file.h>
+#include <e32base.h>
+
+
+//   FOR DEBUGGING
+#if defined (_DEBUG)
+    #include <e32svr.h>
+    #define LOGTEXT(AAA)                RDebug::Print(AAA)
+    #define LOGTEXT2(AAA,BBB)           RDebug::Print(AAA,BBB)
+    #define LOGTEXT3(AAA,BBB,CC)        RDebug::Print(AAA,BBB,CC)
+#else
+    #define LOGTEXT(AAA)                
+    #define LOGTEXT2(AAA,BBB)           
+    #define LOGTEXT3(AAA,BBB,CC)       
+#endif           
+
+
+// CONSTANTS
+
+enum TFSQAtomState
+    {
+    EPending,
+    ESaving,
+    ESavePending,
+    EUploading,
+    EUploadPending,
+    EComplete
+    };
+
+// FORWARD DECLARATIONS
+class CAsynchFSQ;
+
+// CLASS DECLARATIONS
+
+/**
+* Asynchronous file manager queue and related operations.
+*
+* @since 3.2
+*/
+class CAsynchFSQAtom : public CActive
+    {
+    
+    public: // Constructor and Descructor
+    
+        /**
+        * Two-phased constructor.
+        */
+        static CAsynchFSQAtom* NewL(  CAsynchFSQ* aOwner, 
+                                      TInt aPriority,
+                                      TFSQActionType aActionType,  
+                                      TDesC8& aData, 
+                                      const TDesC& aPath, 
+                                      const TDesC& aURL, 
+                                      TFSQSchemaType aSchema, 
+                                      const TDesC& aUserName, 
+                                      const TDesC& aPassword  );
+    
+        /**
+        * Two-phased constructor.
+        */
+        virtual ~CAsynchFSQAtom();            
+                
+    public: // Data
+                
+
+        
+    public: // Public member functions
+    
+        /**
+        * C++ default constructor.
+        */
+        CAsynchFSQAtom();
+        
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL(  CAsynchFSQ* aOwner, 
+                          TInt aPriority,
+                          TFSQActionType aActionType,  
+                          TDesC8& aData, 
+                          const TDesC& aPath, 
+                          const TDesC& aURL, 
+                          TFSQSchemaType aSchema, 
+                          const TDesC& aUserName, 
+                          const TDesC& aPassword  );
+        
+        /**
+        * 
+        */
+        TInt Go();
+        
+        /**
+        * 
+        */
+        TInt ActionsLeft();
+        
+        /**
+        *
+        */
+        TFSQAtomState GetState();
+        
+        /**
+        *
+        */
+        TBool DoesLocalSave();
+        
+        /**
+        *
+        */
+        const TDesC& GetPath() const;
+        
+        /**
+        *
+        */
+        TInt DeleteLocal();
+        
+        /**
+        *
+        */
+        TInt RenameLocal( const TDesC& aNew );
+        
+    private: // Private member functions
+    
+        /**
+        * From CActive
+        */
+        void RunL();
+
+        /** 
+        * From CActive
+        */
+        void DoCancel();        
+
+        /** 
+        * From CActive
+        */
+        TInt RunError( TInt aError );
+
+        /**
+        * 
+        */
+        void SaveL();
+        
+        /**
+        * 
+        */
+        void SaveCleanupL();
+        
+        /**
+        * 
+        */
+        void UploadL();
+        
+        /**
+        * 
+        */
+        void UploadCleanupL();
+        
+    private: // Private data members
+    
+        // Activity specific items
+        TFSQActionType iActionType;
+        TDesC8* iData;
+        HBufC* iPath;           // EFileSave only
+        HBufC* iURL;            // EWebUpload only
+        TFSQSchemaType iSchema; // EWebUpload only
+        HBufC* iUserName;       // EWebUpload only
+        HBufC* iPassword;       // EWebUpload only
+        
+        // Variables specifics to owning class
+        CAsynchFSQ* iOwner;
+        TInt iError;
+        TBool iOverwrite;
+        
+        // State machine variable
+        TFSQAtomState iState;
+        
+        // Helper variables
+        RFile iFile;
+        RFs iFs;
+        TBool iDelayedLocalDelete;
+        TBool iDelayedLocalRename;
+        HBufC* iDelayedFileName;
+        
+    };
+
+#endif // CAsynchATOM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/src/asynchatom.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,718 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Asynchronous FSQ Atom
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <asynchfsq.h>
+#include <sysutil.h> // for disk space query
+#include <bautils.h> // for deleting files
+#include "asynchatom.h"
+
+// CONSTANTS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::CAsynchFSQAtom
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CAsynchFSQAtom::CAsynchFSQAtom() : CActive( EPriorityNormal )
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::CAsynchFSQAtom() entering" ) );
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CAsynchFSQAtom::ConstructL( CAsynchFSQ* aOwner, 
+                                 TInt aPriority,
+                                 TFSQActionType aActionType,  
+                                 TDesC8& aData, 
+                                 const TDesC& aPath, 
+                                 const TDesC& aURL, 
+                                 TFSQSchemaType aSchema, 
+                                 const TDesC& aUserName, 
+                                 const TDesC& aPassword )
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::ConstructL() entering" ) );
+    iOwner = aOwner;
+    iState = EPending;
+    iDelayedFileName = NULL;
+    SetPriority(aPriority);
+    iSchema = aSchema;
+    
+    // prep to copy
+    iData = NULL;
+    iPath = NULL;
+    iURL = NULL;
+    iUserName = NULL;
+    iPassword = NULL;
+    
+    // copy
+    iActionType = aActionType;
+    
+    iData = &aData;  
+    if ( aPath != KNullDesC ) 
+        {
+        iPath = HBufC::NewL( aPath.Length() ); 
+        iPath->Des().Append( aPath ); 
+        }
+    if ( aURL != KNullDesC )
+        {
+        iURL = HBufC::NewL( aURL.Length() ); 
+        iURL->Des().Append( aURL ); 
+        }
+    if ( aUserName != KNullDesC )
+        {
+        iUserName = HBufC::NewL( aUserName.Length() ); 
+        iUserName->Des().Append( aUserName ); 
+        }
+    if ( aPassword != KNullDesC )
+        {
+        iPassword = HBufC::NewL( aPassword.Length() ); 
+        iPassword->Des().Append( aPassword ); 
+        }
+    
+    LOGTEXT( _L( "CAsynchFSQAtom::ConstructL() adding AO" ) );
+    CActiveScheduler::Add( this );
+    LOGTEXT( _L( "CAsynchFSQAtom::ConstructL() exiting" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CAsynchFSQAtom* CAsynchFSQAtom::NewL( CAsynchFSQ* aOwner, 
+                                      TInt aPriority,
+                                      TFSQActionType aActionType,  
+                                      TDesC8& aData, 
+                                      const TDesC& aPath, 
+                                      const TDesC& aURL, 
+                                      TFSQSchemaType aSchema, 
+                                      const TDesC& aUserName, 
+                                      const TDesC& aPassword )
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::NewL() entering" ) );
+    CAsynchFSQAtom* self = new( ELeave ) CAsynchFSQAtom();   
+    CleanupStack::PushL( self );
+    self->ConstructL(  aOwner, 
+                       aPriority,
+                       aActionType,  
+                       aData, 
+                       aPath, 
+                       aURL, 
+                       aSchema, 
+                       aUserName, 
+                       aPassword  );
+                       
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::~CAsynchFSQAtom   
+// Destructor for the atom class
+// -----------------------------------------------------------------------------
+//
+CAsynchFSQAtom::~CAsynchFSQAtom()
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::~CAsynchFSQAtom() entering" ) );
+    
+    LOGTEXT( _L( "CAsynchFSQAtom::~CAsynchFSQAtom() canceling" ) );
+    Cancel();
+    LOGTEXT( _L( "CAsynchFSQAtom::~CAsynchFSQAtom() canceled" ) );
+    
+    // Close file
+    iFile.Close(); 
+    
+    // Close file system
+    iFs.Close();
+    
+    // Free leftover data
+    if( iData )
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::~CAsynchFSQAtom() deleting iData" ) );
+        delete iData;
+        iData = NULL;
+        }
+
+    if( iPath )
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::~CAsynchFSQAtom() deleting iPath" ) );
+        delete iPath;
+        iPath = NULL;
+        }
+        
+    if( iURL )
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::~CAsynchFSQAtom() deleting iURL" ) );
+        delete iURL;
+        iURL = NULL;
+        }
+        
+    if( iUserName )
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::~CAsynchFSQAtom() deleting iUserName" ) );
+        delete iUserName;
+        iUserName = NULL;
+        }
+        
+    if( iPassword )
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::~CAsynchFSQAtom() deleting iPassword" ) );
+        delete iPassword;
+        iPassword = NULL;
+        }                
+        
+    if( iDelayedFileName )
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::~CAsynchFSQAtom() deleting iDelayedFileName" ) );
+        delete iDelayedFileName;
+        iPassword = NULL;
+        }      
+        
+    LOGTEXT( _L( "CAsynchFSQAtom::~CAsynchFSQAtom() exiting" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::Go
+// -----------------------------------------------------------------------------
+//
+TInt CAsynchFSQAtom::Go()
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::Go() entering" ) );
+    TInt err = KErrNone;
+    
+    if (( iState != EPending )||( IsActive() ))
+        {
+        err = KErrInUse;
+        }
+    else
+        {
+        // set new state
+        switch ( iActionType )
+	        {
+    	    case EFileSave:
+            case EFileSaveAndWebUpload:
+    	        {
+    	        LOGTEXT( _L( "CAsynchFSQAtom::Go() iState => ESaving" ) );
+    	        iState = ESaving;
+    	        break;	        
+    	        }
+    	    case EWebUpload:
+    	        {
+    	        LOGTEXT( _L( "CAsynchFSQAtom::Go() iState => EUploading" ) );
+    	        iState = EUploading;
+    	        break;	        
+    	        }
+    	    default:
+    	        {
+       	        LOGTEXT( _L( "CAsynchFSQAtom::Go() undefined activity requested" ) );
+                err = KErrNotSupported;
+    	        break;
+    	        }
+	        }	        
+    
+        // initiate AO activity
+        LOGTEXT( _L( "CAsynchFSQAtom::Go() setting active" ) );
+        SetActive();
+        TRequestStatus* statusPtr = &iStatus;
+        User::RequestComplete( statusPtr, KErrNone );
+        LOGTEXT( _L( "CAsynchFSQAtom::Go() request completed" ) );
+        }
+        
+    LOGTEXT( _L( "CAsynchFSQAtom::Go() returning" ) );
+    return err;
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::GetState
+// -----------------------------------------------------------------------------
+//
+TFSQAtomState CAsynchFSQAtom::GetState()
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::GetState() entering & returning" ) );
+    return iState;
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::DoesLocalSave
+// -----------------------------------------------------------------------------
+//
+TBool CAsynchFSQAtom::DoesLocalSave()
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::DoesLocalSave() entering" ) );
+    TBool ret = EFalse;
+    if (( iActionType == EFileSave )||( iActionType == EFileSaveAndWebUpload ))
+        {
+        ret = ETrue;
+        }
+    LOGTEXT2( _L( "CAsynchFSQAtom::DoesLocalSave() returning, ret=%d" ),ret );
+    return ret;
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::GetPath
+// -----------------------------------------------------------------------------
+//
+const TDesC& CAsynchFSQAtom::GetPath() const
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::GetPath() entering & returning" ) );
+    return *iPath;
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::DeleteLocal
+// -----------------------------------------------------------------------------
+//
+TInt CAsynchFSQAtom::DeleteLocal()
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::DeleteLocal() entering" ) );
+    TInt err = KErrNone;
+    
+    // delete or delayed delete
+    if (( iState == EPending ) || ( iState == ESaving )||( iState == ESavePending ))
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::DeleteLocal() delayed delete" ) );
+        // we are currently saving, so we have to delete later
+        iDelayedLocalDelete = ETrue;
+        }
+    else
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::DeleteLocal() deleting now" ) );
+        // delete now
+        err = KErrNotFound;
+        RFs fs;
+        TInt connectError = fs.Connect();
+        BaflUtils ba;
+        if( !connectError && ba.FileExists( fs, *iPath ) )
+            {
+            err = KErrNone;
+            ba.DeleteFile( fs, *iPath );
+            }
+        fs.Close();
+        }
+    
+    LOGTEXT2( _L( "CAsynchFSQAtom::DeleteLocal() returning, err=%d" ),err );
+    return err;
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::RenameLocal
+// -----------------------------------------------------------------------------
+//
+TInt CAsynchFSQAtom::RenameLocal( const TDesC& aNew )
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::RenameLocal() entering" ) );
+    TInt err = KErrNone;
+    
+    // delete or delayed delete
+    if (( iState == EPending ) || ( iState == ESaving )||( iState == ESavePending ))
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::RenameLocal() delayed rename" ) );
+        // we are currently saving, so we have to delete later
+        iDelayedLocalRename = ETrue;
+        TRAP( err,
+            iDelayedFileName = HBufC::NewL( aNew.Length() );
+            iDelayedFileName->Des().Append( aNew );
+            );
+        }
+    else
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::RenameLocal() renaming now" ) );
+        err = KErrNotFound;
+        RFs fs;
+        TInt connectError = fs.Connect();
+        BaflUtils ba;
+        if( !connectError && ba.FileExists( fs, *iPath ) )
+            {
+            err = KErrNone;
+            ba.RenameFile( fs, *iPath, aNew );
+            }
+        fs.Close();
+        }
+    
+    LOGTEXT2( _L( "CAsynchFSQAtom::RenameLocal() returning, err=%d" ),err );
+    return err;
+    }    
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::SaveL
+// -----------------------------------------------------------------------------
+//
+void CAsynchFSQAtom::SaveL()
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::SaveL() entering" ) );
+    iError = KErrNone;
+    
+    if ( iState != ESaving )
+        {
+        // the state machine is lost
+        LOGTEXT( _L( "CAsynchFSQAtom::SaveL() bad state, leaving..." ) );
+        User::Leave( KErrGeneral );
+        }
+
+    // Init
+    iError = iFs.Connect();
+    LOGTEXT2( _L( "CAsynchFSQAtom::SaveL() fsSession.Connect iError=%d" ),iError );
+    
+    // Get drive number
+    TInt drive = 0;
+    if( !iError )
+        {
+        iError = RFs::CharToDrive( iPath->Des()[0], drive );
+        LOGTEXT2( _L( "CAsynchFSQAtom::SaveL() CharToDrive iError=%d" ),iError );
+        }
+
+    // Check disk space
+    if ( !iError )
+        {
+        TBool fullDisk = EFalse;
+        TRAPD( utilErr,
+               fullDisk = SysUtil::DiskSpaceBelowCriticalLevelL( 
+                          &iFs, iData->Length(), drive ) );
+        if( utilErr )
+            {
+            LOGTEXT2( _L( "CAsynchFSQAtom::SaveL() SysUtil iError=%d" ),iError );
+            iError = utilErr;
+            }
+        else if( fullDisk )
+            {
+            iError = KErrDiskFull;
+            }
+        }
+   
+    // Attempt to create the file
+    if( !iError )
+        {    
+        if ( iOverwrite )
+            {
+            iError = iFile.Replace( iFs, iPath->Des(), EFileWrite );
+            LOGTEXT2( _L( "CAsynchFSQAtom::SaveL() file.Replace iError=%d" ),iError );
+            }
+        else
+            {
+            iError = iFile.Create( iFs, iPath->Des(), EFileWrite );
+            LOGTEXT2( _L( "CAsynchFSQAtom::SaveL() file.Open iError=%d" ),iError );
+            }
+        }
+        
+    // Write the file
+    if( !iError )
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::SaveL() about to write" ) );
+        SetActive();
+        iFile.Write( *iData, iStatus );
+        LOGTEXT( _L( "CAsynchFSQAtom::SaveL() write requested" ) );
+        }
+    
+    // Update state
+    LOGTEXT( _L( "CAsynchFSQAtom::SaveL() iState => ESavePending" ) );
+    iState = ESavePending;
+    
+    // leave if error
+    if ( iError )
+        {
+        LOGTEXT2( _L( "CAsynchFSQAtom::SaveL() Leaving with iError=%d" ),iError );
+        User::Leave( iError );
+        }
+    
+    LOGTEXT2( _L( "CAsynchFSQAtom::SaveL() exiting, iError=%d" ), iError );
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::SaveCleanupL
+// -----------------------------------------------------------------------------
+//
+void CAsynchFSQAtom::SaveCleanupL()
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::SaveCleanupL() entering" ) );
+        
+    if ( iState != ESavePending )
+        {
+        // the state machine is lost
+        LOGTEXT( _L( "CAsynchFSQAtom::SaveCleanupL() bad state, leaving..." ) );
+        User::Leave( KErrGeneral );
+        }
+        
+    // Flush file.
+    if( !iError )
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::SaveCleanupL() flushing" ) );
+        iError = iFile.Flush();
+        LOGTEXT( _L( "CAsynchFSQAtom::SaveCleanupL() flushed" ) );
+        }
+        
+    // Close file
+    iFile.Close(); 
+        
+    // Delayed rename, if needed
+    if (( !iError ) && ( iDelayedLocalRename ))
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::SaveCleanupL() doing delayed rename" ) );
+        BaflUtils ba;
+        if( ba.FileExists( iFs, *iPath ) )
+            {
+            iError = KErrNone;
+            TPtrC newPath = *iDelayedFileName;
+            ba.RenameFile( iFs, *iPath, newPath );
+            }
+        iDelayedLocalRename = EFalse;
+        }
+        
+    // Delayed delete, if needed
+    if (( !iError ) && ( iDelayedLocalDelete ))
+        {
+        LOGTEXT( _L( "CAsynchFSQAtom::SaveCleanupL() doing delayed delete" ) );
+        iError = KErrNotFound;
+        BaflUtils ba;
+        if( ba.FileExists( iFs, *iPath ) )
+            {
+            iError = KErrNone;
+            ba.DeleteFile( iFs, *iPath );
+            }
+        iDelayedLocalDelete = EFalse;
+        LOGTEXT2( _L( "CAsynchFSQAtom::SaveCleanupL() delete done, iError=%d" ), iError );
+        }
+        
+    // Close file system
+    iFs.Close();
+        
+    // Update state
+    switch ( iActionType )
+	    {
+	    case EFileSave:
+	        {
+            LOGTEXT( _L( "CAsynchFSQAtom::SaveCleanupL() iState => EComplete" ) );
+            iState = EComplete;            
+	        break;	        
+	        }
+	    case EFileSaveAndWebUpload:
+	        {
+            LOGTEXT( _L( "CAsynchFSQAtom::SaveCleanupL() iState => EUploading" ) );
+            iState = EUploading;            
+            
+            // re-initiate AO activity
+            LOGTEXT( _L( "CAsynchFSQAtom::SaveCleanupL() setting active" ) );
+            SetActive();
+            TRequestStatus* statusPtr = &iStatus;
+            User::RequestComplete( statusPtr, KErrNone );
+            LOGTEXT( _L( "CAsynchFSQAtom::SaveCleanupL() request completed" ) );
+	        break;	        
+	        }     	        
+	    default:
+	        {
+	        // the state machine is lost
+	        LOGTEXT( _L( "CAsynchFSQAtom::SaveCleanupL() bad action, leaving" ) );
+	        User::Leave( KErrGeneral );
+	        break;        
+	        }	        
+	    }	
+    
+    // report completion
+    LOGTEXT2( _L( "CAsynchFSQAtom::SaveCleanupL() notifying, iError=%d" ), iError );
+    iOwner->Notify( iError );
+        
+    LOGTEXT( _L( "CAsynchFSQAtom::SaveCleanupL() exiting" ));
+    }    
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::UploadL
+// -----------------------------------------------------------------------------
+//
+void CAsynchFSQAtom::UploadL()
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::UploadL() entering" ) );
+    iError = KErrNone;
+        
+    if ( iState != EUploading )
+        {
+        // the state machine is lost
+        LOGTEXT( _L( "CAsynchFSQAtom::UploadL() bad state, leaving..." ) );
+        User::Leave( KErrGeneral );
+        }
+    
+    // This activity is not yet supported, so just feign completion
+    LOGTEXT( _L( "CAsynchFSQAtom::UploadL() iState => EComplete" ) );
+    iState = EUploadPending;
+    
+    // re-initiate AO activity
+    LOGTEXT( _L( "CAsynchFSQAtom::UploadL() setting active" ) );
+    SetActive();
+    TRequestStatus* statusPtr = &iStatus;
+    User::RequestComplete( statusPtr, KErrNone );
+    LOGTEXT( _L( "CAsynchFSQAtom::UploadL() request completed" ) );
+    
+    LOGTEXT( _L( "CAsynchFSQAtom::UploadL() exiting" ) );
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::UploadCleanup
+// -----------------------------------------------------------------------------
+//
+void CAsynchFSQAtom::UploadCleanupL()
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::UploadCleanupL() entering" ) );
+    
+    if ( iState != ESaving )
+        {
+        // the state machine is lost
+        LOGTEXT( _L( "CAsynchFSQAtom::UploadCleanupL() bad state, leaving..." ) );
+        User::Leave( KErrGeneral );
+        }
+    
+    // This activity is not yet supported, so just feign completion
+    LOGTEXT( _L( "CAsynchFSQAtom::UploadCleanupL() iState => EComplete" ) );
+    iState = EComplete;
+    
+    // report completion
+    LOGTEXT2( _L( "CAsynchFSQAtom::UploadCleanupL() notifying, iError=%d" ), iError );
+    iOwner->Notify( iError );
+    
+    LOGTEXT( _L( "CAsynchFSQAtom::UploadCleanupL() exiting" ) );
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::ActionsLeft
+// -----------------------------------------------------------------------------
+//
+TInt CAsynchFSQAtom::ActionsLeft()
+    {
+    TInt actionsLeft = 0;
+    
+    // logically, this section is liable to change if more
+    // action types are added to the class
+    switch ( iState )
+	    {
+	    case EPending:
+	        {
+	        if ( iActionType == EFileSaveAndWebUpload )
+	            {
+	            actionsLeft = 2;
+	            }
+	        else
+	            {
+	            actionsLeft = 1;
+	            }
+	        break;
+	        }
+	    case ESaving:
+	    case ESavePending:
+	        {
+	        if ( iActionType == EFileSave )
+	            {
+	            actionsLeft = 1;
+	            }
+	        else
+	            {
+	            actionsLeft = 2;
+	            }
+	        break;	        
+	        }
+	    case EUploading:
+	    case EUploadPending:
+	        {
+	        actionsLeft = 1;
+	        break;
+	        }	        	        
+	    case EComplete:
+	        {
+	        actionsLeft = 0;
+	        break;
+	        }	        	        
+	    }	
+    
+    LOGTEXT2( _L( "CAsynchFSQAtom::ActionsLeft() returning, actionsLeft=%d" ), actionsLeft );
+    return actionsLeft;
+    }
+
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::RunL
+// -----------------------------------------------------------------------------
+//
+void CAsynchFSQAtom::RunL()
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::RunL() entering" ) );
+
+    switch ( iState )
+	    {
+	    case ESaving:
+	        {
+	        SaveL();
+	        break;	        
+	        }
+	    case ESavePending:
+	        {
+	        SaveCleanupL();
+	        break;	        
+	        }
+	    case EUploading:
+	        {
+	        UploadL();
+	        break;	        
+	        }	        	        
+	    case EUploadPending:
+	        {
+	        UploadCleanupL();
+	        break;
+	        }	        	        
+	    default:
+	        {
+	        // the state machine is lost
+	        LOGTEXT( _L( "CAsynchFSQAtom::RunL() bad state, leaving..." ) );
+	        User::Leave( KErrGeneral );
+	        break;        
+	        }	        
+	    }	
+
+    LOGTEXT( _L( "CAsynchFSQAtom::RunL() exiting" ) );
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::RunError
+// -----------------------------------------------------------------------------
+//
+TInt CAsynchFSQAtom::RunError( TInt aError )
+    {
+    LOGTEXT2( _L( "CAsynchFSQAtom::RunError() entering, aError=%d" ), aError );
+    // notify and wait for teardown
+    iState = EComplete;
+    iOwner->Notify( aError );
+    LOGTEXT( _L( "CAsynchFSQAtom::RunError() returning" ) );
+    return KErrNone;
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQAtom::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CAsynchFSQAtom::DoCancel()
+    {
+    LOGTEXT( _L( "CAsynchFSQAtom::DoCancel() entering" ) );
+
+    LOGTEXT( _L( "CAsynchFSQAtom::DoCancel() exit" ) );
+    }
+    
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/src/asynchfsq.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,369 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Asynchronous File Saving Queue
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <asynchfsq.h>
+#include <bautils.h> // for deleting files
+#include "asynchatom.h"
+
+// CONSTANTS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::CAsynchFSQ
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CAsynchFSQ::CAsynchFSQ()
+    {
+    LOGTEXT( _L( "CAsynchFSQ::CAsynchFSQ() entering" ) );
+    }
+
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CAsynchFSQ::ConstructL()
+    {
+    LOGTEXT( _L( "CAsynchFSQ::ConstructL() entering" ) );
+    iPriority = EPriorityNormal;
+    iManualStart = EFalse;
+    LOGTEXT( _L( "CAsynchFSQ::ConstructL() exiting" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CAsynchFSQ* CAsynchFSQ::NewL()
+    {
+    LOGTEXT( _L( "CAsynchFSQ::NewL() entering" ) );
+    CAsynchFSQ* self = new( ELeave ) CAsynchFSQ();   
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::~CAsynchFSQ   
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CAsynchFSQ::~CAsynchFSQ()
+    {
+    LOGTEXT( _L( "CAsynchFSQ::~CAsynchFSQ() entering" ) );
+
+    // clean up queues
+    iQueue.ResetAndDestroy();
+    
+    LOGTEXT( _L( "CAsynchFSQ::~CAsynchFSQ() exiting" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::SaveAndDestroy
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CAsynchFSQ::SaveAndDestroy( TDesC8& aData, const TDesC& aPath, TBool aOverwrite )
+    {
+    LOGTEXT( _L( "CAsynchFSQ::SaveAndDestroy() entering" ) );
+    
+    TInt err = KErrNone;
+    
+    // return if NULL descriptor.
+    if( !&aData )
+        {
+        return KErrArgument;
+        }
+    
+    iOverwrite = aOverwrite;
+    
+    LOGTEXT2( _L( "CAsynchFSQ::SaveAndDestroy() iQueue.Count()=%d" ), iQueue.Count() );
+    LOGTEXT2( _L( "CAsynchFSQ::SaveAndDestroy() ActionsLeft()=%d" ), ActionsLeft() );
+    
+    // add data to our queue
+    err = Enqueue( EFileSave, aData, aPath, KNullDesC, ENullSchemaType, KNullDesC, KNullDesC );
+    
+    LOGTEXT2( _L( "CAsynchFSQ::SaveAndDestroy() iManualStart=%d" ), iManualStart );
+
+    if ( !err && !iManualStart )
+        {
+        err = Go();	
+        }
+        
+    LOGTEXT2( _L( "CAsynchFSQ::SaveAndDestroy() returning err=%d" ), err );
+    return err;
+    }
+        
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::Go
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CAsynchFSQ::Go()
+    {
+    LOGTEXT( _L( "CAsynchFSQ::Go() entering" ) );
+    TInt err = KErrNone;
+    
+    // make sure the queue has at least one object
+    if( iQueue.Count() == 0 )
+        {
+        err = KErrNotReady;	
+        }
+    
+    // activate AO's
+    
+    for( TInt i = 0; i < iQueue.Count(); i++ )
+        {
+        if(( !err )&&( iQueue[i]->GetState() == EPending ))
+            {
+            err = iQueue[i]->Go();
+            }
+        }
+    
+    LOGTEXT2( _L( "CAsynchFSQ::Go() returning err=%d" ), err );
+    return err;
+    }
+        
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::SetManualStart
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CAsynchFSQ::SetManualStart( TBool aManualStart )
+    {
+    LOGTEXT( _L( "CAsynchFSQ::ManualStart() entering" ) );
+    iManualStart = aManualStart;
+    LOGTEXT( _L( "CAsynchFSQ::ManualStart() returning" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::Delete
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CAsynchFSQ::Delete( const TDesC& aPath )
+    {
+    LOGTEXT( _L( "CAsynchFSQ::Delete() entering" ) );
+	TInt err = KErrNotFound;
+
+    // search for path name and delete if found
+    for( TInt i = 0; i < iQueue.Count(); i++ )
+        {
+        if ( iQueue[i]->DoesLocalSave() )
+            {
+            if ( (iQueue[i]->GetPath()).Compare( aPath ) == 0 )
+                {
+                LOGTEXT( _L( "CAsynchFSQ::Delete() file found, deleting" ) );
+                err = iQueue[i]->DeleteLocal();
+                }
+            }
+        }
+        
+    // if still not found,
+    // attempt to delete from file system
+    if ( err == KErrNotFound )
+        {
+        LOGTEXT( _L( "CAsynchFSQ::Delete() not in queues, trying file system" ) );
+        RFs fs;
+        TInt connectError = fs.Connect();
+        BaflUtils ba;
+        if( !connectError && ba.FileExists( fs, aPath ) )
+            {
+            LOGTEXT( _L( "CAsynchFSQ::Delete() exists, deleting from file system" ) );
+            err = KErrNone;
+            ba.DeleteFile( fs, aPath );
+            }
+        fs.Close();
+        }
+       
+    LOGTEXT2( _L( "CAsynchFSQ::Delete() returning err=%d" ), err );
+    return err;
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::Rename
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CAsynchFSQ::Rename( const TDesC& aOld, const TDesC& aNew )
+    {
+    LOGTEXT( _L( "CAsynchFSQ::Rename() entering" ) );
+  
+	TInt err = KErrNotFound;
+
+    // search for path name and delete if found
+    for( TInt i = 0; i < iQueue.Count(); i++ )
+        {
+        if ( iQueue[i]->DoesLocalSave() )
+            {
+            if ( (iQueue[i]->GetPath()).Compare( aOld ) == 0 )
+                {
+                LOGTEXT( _L( "CAsynchFSQ::Delete() file found, renaming" ) );
+                err = iQueue[i]->RenameLocal( aNew );
+                }
+            }
+        }       
+    
+    // if still not found,
+    // attempt to rename from file system
+    if ( err == KErrNotFound )
+        {
+        LOGTEXT( _L( "CAsynchFSQ::Rename() not in queues, trying file system" ) );
+        RFs fs;
+        TInt connectError = fs.Connect();
+        BaflUtils ba;
+        if( !connectError && ba.FileExists( fs, aOld ) )
+            {
+            LOGTEXT( _L( "CAsynchFSQ::Rename() exists, renaming in file system" ) );
+            err = KErrNone;
+            ba.RenameFile( fs, aOld, aNew );
+            }
+        fs.Close();
+        }
+
+    LOGTEXT2( _L( "CAsynchFSQ::Rename() returning err=%d" ), err );
+    return err;
+    }
+
+
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::SetThreadPriority
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CAsynchFSQ::SetPriority( TInt aPriority ) 
+    {
+    LOGTEXT2( _L( "CAsynchFSQ::SetThreadPriority() entering aPriority=%d" ), aPriority );
+    iPriority = aPriority;
+    LOGTEXT( _L( "CAsynchFSQ::SetThreadPriority() exiting" ) );
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::SetCallback
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CAsynchFSQ::SetCallback( MAsynchFSQObserver* aCallback )
+    {
+    LOGTEXT( _L( "CAsynchFSQ::SetCallback() entering" ) );
+    iCallback = aCallback;
+    LOGTEXT( _L( "CAsynchFSQ::SetCallback() exiting" ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::ActionsLeft
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CAsynchFSQ::ActionsLeft()
+    {
+    TInt actionsLeft = 0;
+    
+    for( TInt i = 0; i < iQueue.Count(); i++ )
+        {
+        actionsLeft += iQueue[i]->ActionsLeft();
+        }
+        
+    LOGTEXT2( _L( "CAsynchFSQ::ActionsLeft() actionsLeft=%d" ), actionsLeft );
+    return actionsLeft;
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::Cancel
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CAsynchFSQ::Cancel()
+    {
+    LOGTEXT( _L( "CAsynchFSQ::Cancel() entering" ) );
+    
+    while( iQueue.Count() )
+        {
+        delete iQueue[0];
+        iQueue[0] = NULL;
+        iQueue.Remove( 0 ); // Data MUST be deleted first
+        }
+        
+    LOGTEXT( _L( "CAsynchFSQ::Cancel() exiting" ) );
+    }
+    
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::Notify
+// -----------------------------------------------------------------------------
+//
+void CAsynchFSQ::Notify( TInt aError )
+    {
+    LOGTEXT( _L( "CAsynchFSQ::Notify() entering" ) );
+    iCallback->MAsynchFSQEvent( aError );
+    
+    // Scan and delete completed atoms
+    for( TInt i = 0; i < iQueue.Count(); i++ )
+        {
+        if( iQueue[i]->ActionsLeft() == 0 )
+            {
+            delete iQueue[i];
+            iQueue[i] = NULL;
+            iQueue.Remove( i ); // Data MUST be deleted first
+            i--;
+            }
+        }
+        
+    LOGTEXT( _L( "CAsynchFSQ::Notify() exiting" ) );
+    }
+        
+// -----------------------------------------------------------------------------
+// CAsynchFSQ::Enqueue
+// -----------------------------------------------------------------------------
+//
+TInt CAsynchFSQ::Enqueue( TFSQActionType aActionType, TDesC8& aData, 
+                          const TDesC& aPath, const TDesC& aURL, 
+                          TFSQSchemaType aSchema, const TDesC& aUserName, 
+                          const TDesC& aPassword )
+    {
+    LOGTEXT( _L( "CAsynchFSQ::Enqueue() entering" ) );
+    
+    TInt err = KErrNone;
+    
+    TInt queueError = KErrNone; 
+    TRAP( err,
+        // create atom
+        CAsynchFSQAtom* atom = 
+            CAsynchFSQAtom::NewL( this, 
+                                  iPriority,
+                                  aActionType,
+                                  aData,
+                                  aPath,
+                                  aURL,
+                                  aSchema,
+                                  aUserName,
+                                  aPassword );
+        
+        //append to queue
+        iQueue.Append( atom );
+        );
+
+    if ( !err && queueError )
+        {
+        err = queueError;
+        }
+
+    LOGTEXT2( _L( "CAsynchFSQ::Enqueue() returning err=%d" ), err );
+    return err;
+    }
+    
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/Bwinscw/STIFAFSQTestu.def	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,4 @@
+EXPORTS
+	?LibEntryL@@YAPAVCTestModule@@XZ @ 1 NONAME ; class CTestModule * LibEntryL(void)
+	?SetRequirements@@YAHAAPAVCTestModuleParam@@AAK@Z @ 2 NONAME ; int SetRequirements(class CTestModuleParam * &, unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/Eabi/STIFAFSQTestu.def	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,14 @@
+EXPORTS
+	_Z9LibEntryLv @ 1 NONAME
+	_Z15SetRequirementsRP16CTestModuleParamRm @ 2 NONAME
+	_ZTI10CTestSuite @ 3 NONAME ; #<TI>#
+	_ZTI11CTestCallerI19CAFSQTestAsynchSaveE @ 4 NONAME ; #<TI>#
+	_ZTI14CAssertFailure @ 5 NONAME ; #<TI>#
+	_ZTI19CAFSQTestAsynchSave @ 6 NONAME ; #<TI>#
+	_ZTI9CTestCase @ 7 NONAME ; #<TI>#
+	_ZTV10CTestSuite @ 8 NONAME ; #<VT>#
+	_ZTV11CTestCallerI19CAFSQTestAsynchSaveE @ 9 NONAME ; #<VT>#
+	_ZTV14CAssertFailure @ 10 NONAME ; #<VT>#
+	_ZTV19CAFSQTestAsynchSave @ 11 NONAME ; #<VT>#
+	_ZTV9CTestCase @ 12 NONAME ; #<VT>#
+
Binary file camappengine/asynchfilesavequeue/tsrc/public/basic/data/StifAFSQTest/Nibbles.jpg has changed
Binary file camappengine/asynchfilesavequeue/tsrc/public/basic/data/StifAFSQTest/Nibbles2.jpg has changed
Binary file camappengine/asynchfilesavequeue/tsrc/public/basic/data/StifAFSQTest/Nibbles3.jpg has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/group/StifAFSQTest.mmp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Asynchronous File Saving Queue interface/integration tests
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET        STIFAFSQTest.dll
+TARGETTYPE    dll
+
+// First UID is DLL UID, Second UID is STIF Test Framework UID
+UID             0x1000008D 0x101FB3E7
+
+CAPABILITY    CAP_GENERAL_DLL
+VENDORID      VID_DEFAULT
+
+// Define directories for the .def-files of WINS and WINSCW builds separately.
+// IMPORTANT NOTICE:  The lines in the example that end with a backslash 
+// must have one space after the backslash.
+#if defined(ARMCC)
+deffile ../Eabi/ 
+#elif defined( WINSCW )
+deffile ../Bwinscw/ 
+#elif defined( WINS )
+deffile ../Bwins/ 
+#else
+deffile ../Bmarm/ 
+#endif
+
+SOURCEPATH      ../src
+
+SOURCE          StifFSQTestTop.cpp
+SOURCE          AFSQTestAsynchSave.cpp
+SOURCE          AFSQTestAdd.cpp
+SOURCE          AFSQTestDelete.cpp
+SOURCE          AFSQTestRename.cpp
+
+// STIF TFW files
+SOURCEPATH    ../src/TestFramework
+SOURCE        testcase.cpp
+SOURCE        assertFailure.cpp
+SOURCE        testSuite.cpp
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../inc/TestFramework
+USERINCLUDE     ../../../../Inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         sysutil.lib
+LIBRARY         fbscli.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         AsynchFSQ.lib
+
+EXPORTUNFROZEN
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/group/bld.inf	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Asynchronous File Saving Queue interface/integration tests
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+// ROM build files
+
+PRJ_MMPFILES
+STIFAFSQTest.mmp     
+
+// Makefile for ATS manual runs
+//GNUMAKEFILE FSQTests_CreateATSTestDrop.make
+
+// Makefile for ATS automated scripts
+gnumakefile testcollector.mk
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/group/testcollector.mk	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,45 @@
+#
+# Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  GNU Makefile that updates the ATS3 drop for a test set.
+#
+TESTTYPE=STIF
+DLLS=STIFAFSQTest.dll
+DLLDIR=..\$(TESTTYPE)_temp
+
+
+BUILD_DIR=\epoc32\RELEASE\$(PLATFORM)\$(CFG)
+
+UPDATE_BINARIES := $(foreach DLL, $(DLLS), \
+                   & xcopy /Q /Y /F "$(BUILD_DIR)\$(DLL)" "$(DLLDIR)")
+UPDATE_BINARIES := $(wordlist 2, 1000, $(UPDATE_BINARIES))
+
+
+
+# For these targets we shall not do anything.
+MAKMAKE FREEZE LIB CLEANLIB RESOURCE RELEASABLES FINAL SAVESPACE:
+
+# BLD target of this Makefile is executed after Symbian BLD target
+# so the binaries are ready.
+BLD: 
+	echo Preparing Test collection...
+	-mkdir "$(DLLDIR)" 2> NUL
+	$(UPDATE_BINARIES)
+
+# Clean the copied binaries from the ATS drop.
+CLEAN:
+	echo Cleaning Test collection...
+	-rd /s /q "$(DLLDIR)" 2> NUL
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/inc/AFSQTestAsynchSave.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,201 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  AsynchFSQTest test module.
+*
+*/
+
+
+#ifndef AFSQ_TEST_ASYNCH_SAVE_H
+#define AFSQ_TEST_ASYNCH_SAVE_H
+
+
+// INCLUDES
+
+#include <e32base.h>
+#include "ASynchFSQ.h"
+#include "TestFramework/test.h"
+#include "TestFramework/TestCase.h"
+#include "TestFramework/TestCaller.h"
+#include "TestFramework/TestSuite.h"
+
+// CONSTANTS
+
+enum TTestCaseNumber
+    {
+    ECONSTRUCT001p1,
+    EDESTRUCT001p1,
+    EPRIORITY001p1,
+    EADD001p1,
+    EADD002p1,
+    EADD003p1,
+    EADD004p1,
+    EADD005p1,
+    EADD006p1,
+    EADD007p1,
+    EDEL001p1,
+    EDEL002p1,
+    EDEL003p1,
+    EDEL004p1,
+    EDEL005p1,
+    EDEL006p1,
+    EREN001p1,
+    EREN002p1,
+    EREN003p1,
+    EREN004p1,
+    EREN005p1,
+    EREN006p1,
+    ECANCEL001p1
+    };
+
+
+// MACROS
+
+#define KNibbles TFileName(_L("E:\\testing\\data\\StifAFSQTest\\Nibbles.jpg"));
+#define KNibbles2 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\Nibbles2.jpg"));
+#define KNibbles3 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\Nibbles3.jpg"));
+
+#define KNibblesCANCEL001 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesADD001.jpg"));
+
+#define KNibblesADD001 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesADD001.jpg"));
+#define KNibblesADD002 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesADD002.jpg"));
+#define KNibblesADD003 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesADD003.jpg"));
+#define KNibblesADD004A TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesADD004A.jpg"));
+#define KNibblesADD004B TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesADD004B.jpg"));
+#define KNibblesADD005A TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesADD005A.jpg"));
+#define KNibblesADD005B TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesADD005B.jpg"));
+#define KNibblesADD006 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesADD006.jpg"));
+#define KNibblesADD007 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesADD007.jpg"));
+
+#define KNibblesDEL001 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL001.jpg"));
+#define KNibblesDEL002 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL002.jpg"));
+#define KNibblesDEL003A TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL003A.jpg"));
+#define KNibblesDEL003B TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL003B.jpg"));
+#define KNibblesDEL003C TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL003C.jpg"));
+#define KNibblesDEL004A TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL004A.jpg"));
+#define KNibblesDEL004B TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL004B.jpg"));
+#define KNibblesDEL004C TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL004C.jpg"));
+#define KNibblesDEL005A TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL005A.jpg"));
+#define KNibblesDEL005B TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL005B.jpg"));
+#define KNibblesDEL005C TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL005C.jpg"));
+#define KNibblesDEL006A TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL006A.jpg"));
+#define KNibblesDEL006B TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL006B.jpg"));
+#define KNibblesDEL006C TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesDEL006C.jpg"));
+
+#define KNibblesREN001A TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN001A.jpg"));
+#define KNibblesREN001B TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN001B.jpg"));
+#define KNibblesREN002A TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN002A.jpg"));
+#define KNibblesREN002B TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN002B.jpg"));
+#define KNibblesREN003A TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN003A.jpg"));
+#define KNibblesREN003B TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN003B.jpg"));
+#define KNibblesREN003C TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN003C.jpg"));
+#define KNibblesREN003A2 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN003A2.jpg"));
+#define KNibblesREN004A TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN004A.jpg"));
+#define KNibblesREN004B TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN004B.jpg"));
+#define KNibblesREN004C TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN004C.jpg"));
+#define KNibblesREN004A2 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN004A2.jpg"));
+#define KNibblesREN005A TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN005A.jpg"));
+#define KNibblesREN005B TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN005B.jpg"));
+#define KNibblesREN005C TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN005C.jpg"));
+#define KNibblesREN005A2 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN005A2.jpg"));
+#define KNibblesREN006A TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN006A.jpg"));
+#define KNibblesREN006B TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN006B.jpg"));
+#define KNibblesREN006C TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN006C.jpg"));
+#define KNibblesREN006B2 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN006B2.jpg"));
+#define KNibblesREN006C2 TFileName(_L("E:\\testing\\data\\StifAFSQTest\\NibblesREN006C2.jpg"));
+
+
+// CLASS DECLARATION
+
+class CAFSQTestAsynchSave : public CTestCase,
+                            public MAsynchFSQObserver
+    {
+    public:
+
+        CAFSQTestAsynchSave ();
+        ~CAFSQTestAsynchSave ();
+
+        // Allocate the resources for one test function
+        void setUpL ();
+
+        // Free the resources reserved in setUpL()
+        void tearDown ();
+
+        // A function to collect and return a suite of tests
+        static MTest* suiteL ();
+
+    protected:
+    
+        // stalling function
+        void WaitForAsynchCompleteL();
+
+        // Own test functions that use assertions and may leave:
+        
+        //constructor
+        void TestFileManNewLReturnsNotNullL();   
+    
+        //add
+        void TestAddEmptyObjectToQueueL();
+        void TestAddObjectToEmptyQueueL();
+        void TestAddObjectToEmptyQueueWillSaveL();
+        void TestAddObjectToNonEmptyQueueL();
+        void TestAddObjectToNonEmptyQueueWillSaveL();
+        void TestAddObjectThatExistsAlreadyL();
+        void TestAddObjectToEmptyQueueLManualStart();
+    
+        //delete
+        void TestDeleteFromEmptyNotExistL();
+        void TestDeleteFromEmptyExistsL();
+        void TestDeleteNonEmptyExistsButNotInQueueL();
+        void TestDeleteNonEmptyNotExistAndNotInQueueL();
+        void TestDeleteInQueueNotActiveL();
+        void TestDeleteInQueueActiveL();
+    
+        //destructor
+        void TestDestructorL();
+        
+        //priority
+        void TestSetPriorityL();
+        
+        //cancel
+        void TestCancelL();
+        
+        //rename
+        void TestRenameFromEmptyNotExistL();
+        void TestRenameFromEmptyExistsL();
+        void TestRenameNonEmptyExistsButNotInQueueL();
+        void TestRenameNonEmptyNotExistAndNotInQueueL();
+        void TestRenameInQueueNotActiveL();
+        void TestRenameInQueueActiveL();
+    
+    protected:  // from MAsynchFSQObserver
+    
+        void MAsynchFSQEvent( TInt aError );
+    
+    private:
+    
+        CAsynchFSQ* iFSQ;
+        CActiveScheduler* iScheduler;
+        TTestCaseNumber currentTest;
+        TBool delayedBool;
+        TBool wait;
+        // Needed for synchronization
+        RMutex iMutex;
+        TInt assertion;
+        TInt numSaved;
+        TInt numToSave;
+        
+    };
+
+#endif // AFSQ_TEST_ASYNCH_SAVE_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/inc/AFSQTestTop.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#ifndef AFSQ_TEST_TOP_H
+#define AFSQ_TEST_TOP_H
+
+#include <e32base.h>
+#include "TestFramework/test.h"
+#include "TestFramework/TestCase.h"
+#include "TestFramework/TestCaller.h"
+#include "TestFramework/TestSuite.h"
+
+EXPORT_C  MTest* CreateTopFct();
+
+class CAFSQTestTop : public CTestSuite
+    {
+    public:
+	    CAFSQTestTop();
+        ~CAFSQTestTop();
+
+	    // A function to collect and return a suite of tests
+	    static MTest* suiteL();
+
+    protected:
+
+    private:
+
+    };
+
+#endif // AFSQ_TEST_TOP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/inc/STIFAFSQTest.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef STIFAFSQTEST_H
+#define STIFAFSQTEST_H
+
+//  INCLUDES
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+
+// CONSTANTS
+
+// MACROS
+
+// Logging path
+_LIT( KSTIFAFSQTestLogPath, "\\logs\\testframework\\STIFAFSQTest\\" ); 
+// Log file
+_LIT( KSTIFAFSQTestLogFile, "STIFAFSQTest.txt" ); 
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CSTIFAFSQTest;
+
+// DATA TYPES
+
+// CLASS DECLARATION
+
+/**
+*  CSTIFAFSQTest test class for STIF Test Framework TestScripter.
+*  This STIF test module provides basic FSQ tests 
+*
+*  @lib STIFAFSQTest.dll
+*  @since Series60_31
+*/
+NONSHARABLE_CLASS(CSTIFAFSQTest) : public CScriptBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static STIFAFSQTest* NewL( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * Destructor.
+        */
+        virtual ~STIFAFSQTest();
+
+    public: // New functions
+
+    public: // Functions from base classes
+
+        /**
+        * From CScriptBase Runs a script line 
+        * @since Series60_31
+        * @param aItem Script line containing method name and parameters
+        * @return Symbian OS error code
+        */
+        virtual TInt RunMethodL( CStifItemParser& aItem );
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CWLANTests( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        // Prohibit copy constructor if not deriving from CBase.
+        // ?classname( const ?classname& );
+        // Prohibit assigment operator if not deriving from CBase.
+        // ?classname& operator=( const ?classname& );
+
+        /**
+        * Frees all resources allocated from test methods.
+        * @since Series60_31
+        */
+        void Delete();
+
+        /**
+        * Test methods are listed below. 
+        */
+        virtual TInt SearchNetworkL( CStifItemParser& aItem );
+        
+
+    public:     // Data
+
+    protected:  // Data
+
+    private:    // Data
+       
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+    public:     // Friend classes
+       
+    protected:  // Friend classes
+       
+    private:    // Friend classes
+       
+    };
+
+#endif      // STIFAFSQTEST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/inc/StifFSQTestTop.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#ifndef DEMOMODULE_H
+#define DEMOMODULE_H
+
+// INCLUDES
+#if defined (_MSC_VER) && (_MSC_VER >= 1000)
+#pragma once
+#endif
+
+#include <StifTestModule.h>
+#include "TestFramework/testsuite.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CTestModule;
+class TCaseInfo;
+
+// CLASS DECLARATION
+ 
+
+// DESCRIPTION
+// Demo testmodule class definition.
+NONSHARABLE_CLASS( CTestModule ) 
+        :public CTestModuleBase
+    {
+    public: // Enumerations
+    	// None
+
+    private: // Enumerations
+    	// None
+
+    public: // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CTestModule* NewL();
+        
+        /**
+        * Destructor.
+        */
+        ~CTestModule();
+
+    public: // New functions
+        // None
+        
+    public: // Functions from base classes
+
+        /**
+        * Test cases are inquired from the Test Module by calling GetTestCases. 
+        * Test cases are appended to RPointerArray<TTestCaseInfo>& aTestCases
+        * that is a list consisting of several TTestCaseInfo objects.
+        */
+        TInt GetTestCasesL( const TFileName& aConfigFile, 
+            RPointerArray<TTestCaseInfo>& aTestCases );
+        /**
+        * RunTestCase is used to run an individual test case.
+        */
+        TInt RunTestCaseL( const TInt aCaseNumber, 
+                          const TFileName& aConfig,
+                          TTestResult& aResult );
+        
+    protected: // New functions
+    	// None
+    	
+    protected: // Functions from base classes
+        // None
+    	
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CTestModule();
+
+        /**
+        * Symbian OS constructor.
+        */
+        void ConstructL();        
+
+        /**
+        * Function returning test case name and pointer to test case function
+        */
+        const TCaseInfo Case ( const TInt aCaseNumber ) const;
+
+        void SetAllocFailureSimulation( RHeap::TAllocFail aAllocFailureType, TInt aAllocFailureRate );
+        void AllocFailureSimulation ( TBool aSwitchedOn );
+
+        void RunTestCaseInOOMLoopL( const TInt aCaseNumber, TTestResult& aResult );
+            
+    private: // Data
+
+       CTestSuite *iTestSuite ;
+       CActiveScheduler* iScheduler;
+       RHeap::TAllocFail iAllocFailureType;
+       TInt iAllocFailureRate;    	    	  	
+       TInt iCurrentAllocFailureRate;    	    	  	
+    };
+
+
+
+
+#endif // DEMOMODULE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/inc/TestFramework/AssertFailure.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef __CPPUNIT_ASSERT_FAILURE_H
+#define __CPPUNIT_ASSERT_FAILURE_H
+
+#include <e32base.h>
+
+_LIT8(KCppUnitUnknownFilename, "-unknown-");
+const TInt KCppUnitUnknownLineNumber=(-1);
+
+
+class CAssertFailure : public CBase
+	{
+public:
+
+	static CAssertFailure* NewL (const TDesC8& aMessage,
+	                             TInt aLineNumber=KCppUnitUnknownLineNumber,
+	                             const TDesC8& aFileName=KCppUnitUnknownFilename);
+
+	static CAssertFailure* NewLC (const TDesC8& aMessage,
+	                              TInt aLineNumber=KCppUnitUnknownLineNumber,
+	                              const TDesC8& aFileName=KCppUnitUnknownFilename);
+
+	static CAssertFailure* NewL (CAssertFailure& aAssertFailure);
+
+	static CAssertFailure* NewLC (CAssertFailure& aAssertFailure);
+
+    ~CAssertFailure ();
+
+    const TDesC8& What() const;
+    TInt LineNumber() const;
+    const TDesC8& FileName() const;
+
+	void SetMyHeapCellCount (TInt aHeapCellCount);
+	TInt MyHeapCellCount ();
+
+private:
+
+    CAssertFailure ();
+    CAssertFailure (TInt aLineNumber);
+    void ConstructL (const TDesC8& aMessage, const TDesC8& aFileName);
+    void ConstructL (CAssertFailure& aAssertFailure);
+
+    HBufC8* iMessage;
+    TInt  iLineNumber;
+    HBufC8* iFileName;
+	TInt iMyHeapCellCount;
+	};
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/inc/TestFramework/TestResult.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef __CPPUNIT_TESTRESULT_H
+#define __CPPUNIT_TESTRESULT_H
+
+#include <e32base.h>
+
+class MTest;
+class CAssertFailure;
+class CTestFailure;
+
+
+/*
+ * A CTestResult collects the results of executing a test case. It is an 
+ * instance of the Collecting Parameter pattern.
+ *
+ * The test framework distinguishes between failures and errors.
+ * A failure is anticipated and checked for with assertions. Errors are
+ * unanticipated problems that are caused by "leaves" that are not generated
+ * by the framework.
+ *
+ * see MTest
+ */
+
+class CTestResult : public CBase
+	{
+public:
+
+	IMPORT_C static CTestResult* NewLC();
+	IMPORT_C static CTestResult* NewL();
+
+    IMPORT_C ~CTestResult ();
+
+    IMPORT_C TInt TestCount ();
+    IMPORT_C RPointerArray<CTestFailure>& Errors ();
+    IMPORT_C RPointerArray<CTestFailure>& Failures ();
+    IMPORT_C TBool WasSuccessful ();
+
+	void IncrementTestCount ();
+    void AddErrorL (MTest& aTest, TInt aError);
+    void AddFailureL (MTest& aTest, CAssertFailure* aAssertFailure);
+
+private:
+
+	void ConstructL ();
+	CTestResult ();
+
+    RPointerArray<CTestFailure> iErrors;
+    RPointerArray<CTestFailure> iFailures;
+	TInt iTestCount; 
+	};
+
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/inc/TestFramework/test.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef __CPPUNIT_MTEST_H
+#define __CPPUNIT_MTEST_H
+
+#include <e32base.h>
+#include <StifTestModule.h>
+class CCppUnitLog;
+
+
+// A MTest can be run and collect its results. See CTestResult.
+//
+class MTest
+	{
+public:
+
+	virtual ~MTest() { }
+
+    virtual void ExecuteL (TTestResult& aResult) = 0;
+    
+	virtual TInt CountTestCases () = 0;
+    
+	virtual const TDesC8& Name () = 0;
+
+    // Same functions with an Index.
+    virtual void ExecuteTestL(TTestResult& aResult,
+                      TInt aIndex) = 0;
+
+    virtual const TDesC8& TestCaseName (TInt aIndex) = 0;
+	};
+
+// All the polymorphic DLLs containing tests should use the following UID:
+//
+const TInt KCppUnitTestDllUidValue=0x101F5380;
+const TUid KCppUnitTestDllUid={KCppUnitTestDllUidValue};
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/inc/TestFramework/testCaller.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef CPPUNIT_TESTCALLER_H
+#define CPPUNIT_TESTCALLER_H
+
+#include "TestFrameWork/testCase.h"
+
+
+/* 
+ * A test caller provides access to a test case method 
+ * on a test case class.  Test callers are useful when 
+ * you want to run an individual test or add it to a suite.
+ * 
+ * Here is an example:
+ * 
+ * class CMathTest : public CTestCase 
+ * {
+ *     public:
+ *         void         setUpL ();
+ *         void         tearDown ();
+ *
+ *     protected:
+ *         void         testAddL ();
+ *         void         testSubtractL ();
+ * };
+ *
+ * CTest* CMathTest::suiteL () 
+ * {
+ *     CTestSuite *suite = CTestSuite::NewL();
+ *     suite->addTestL(CTestCaller<MathTest>::NewL(_L("testAddL") testAddL));
+ *     suite->addTestL(CTestCaller<MathTest>::NewL(_L("testSubtractL") testSubtractL));
+ *     return suite;
+ * }
+ *
+ * You can use a CTestCaller to bind any test method on a CTestCase
+ * class, as long as it does not have parameters and returns void.
+ * 
+ * See CTestCase
+ */
+
+
+template <class Fixture> class CTestCaller : public CTestCase
+	{
+public:
+
+    typedef void (Fixture::*TestMethod)();
+
+    static CTestCaller* NewLC (const TDesC8& aName, TestMethod aTest);
+    static CTestCaller* NewL (const TDesC8& aName, TestMethod aTest);
+	~CTestCaller();
+
+protected:
+ 
+    // From CTestCase:
+    void setUpL ()       { iFixture->setUpL (); }
+    void executeTestL () { (iFixture->*iTest)(); } 
+    void tearDown ()     { iFixture->tearDown (); }
+
+private:
+
+    CTestCaller (TestMethod aTest) : iTest(aTest) { }
+    void ConstructL (const TDesC8& aName);
+
+    TestMethod iTest;
+    Fixture    *iFixture;
+	};
+
+
+template <class Fixture>
+CTestCaller<Fixture>* CTestCaller<Fixture>::NewLC (const TDesC8& aName,
+                                                   TestMethod aTest)
+	{
+	CTestCaller* self = new(ELeave) CTestCaller(aTest);
+	CleanupStack::PushL(self);
+	self->ConstructL(aName);
+	return self;
+	}
+
+template <class Fixture> 
+CTestCaller<Fixture>* CTestCaller<Fixture>::NewL (const TDesC8& aName,
+                                                  TestMethod aTest)
+	{
+	CTestCaller* self = NewLC(aName, aTest);
+	CleanupStack::Pop();
+	return self;
+	}
+
+
+template <class Fixture>
+void CTestCaller<Fixture>::ConstructL (const TDesC8& aName)
+	{
+	CTestCase::ConstructL(aName);
+	iFixture = new(ELeave)Fixture;
+	}
+
+
+template <class Fixture>
+CTestCaller<Fixture>::~CTestCaller () 
+	{
+	delete iFixture;
+	}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/inc/TestFramework/testCase.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,200 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef __CPPUNIT_CTESTCASE_H
+#define __CPPUNIT_CTESTCASE_H
+
+#include <e32base.h>
+#include "TestFrameWork/test.h"
+#include <StifTestModule.h>
+class CAssertFailure;
+class CTestResult;
+class CppUnitLog;
+
+/*
+ * A test case defines the fixture to run multiple tests. To define a test case
+ * 1) implement a subclass of CTestCase
+ * 2) define instance variables that store the state of the fixture
+ * 3) initialize the fixture state by overriding setUp
+ * 4) clean-up after a test by overriding tearDown.
+ *
+ * Each test runs in its own fixture so there can be no side effects 
+ * among test runs. Here is an example:
+ * 
+ * class CMathTest : public CTestCase 
+ * {
+ *     public:
+ *
+ *     void setUpL () 
+ *     {
+ *         iValue1 = 2;
+ *         iValue2 = 3;
+ *     }
+ *     
+ *     private:
+ *
+ *     TInt iValue1, iValue2;
+ * }
+ * 
+ * For each test implement a method which interacts with the fixture.
+ * Verify the expected results with assertions specified
+ * by calling assert on the expression you want to test:
+ * 
+ *    protected: 
+ *    void testAddL ()
+ *    {
+ *        TInt result = value1 + value2;
+ *        assertL (result == 5);
+ *    }
+ * 
+ * The tests to be run can be collected into a CTestSuite:
+ * 
+ * public: 
+ * static CMathTest::suiteL ()
+ * {
+ *      CTestSuite *suiteOfTests = CTestSuite::NewL(_L8("aSuite"));
+ *      suiteOfTests->addTestL(CTestCaller<MathTest>::NewL(_L8("testAddL"), testAddL));
+ *      return suiteOfTests;
+ * }
+ *
+ * see CTestSuite and CTestCaller
+ *
+ */
+
+
+class CTestCase : public MTest, public CBase 
+	{
+public:
+
+     ~CTestCase ();
+
+    // From MTest:
+     void ExecuteL (TTestResult& aResult);
+
+	// From MTest:
+     TInt CountTestCases ();
+	
+	// From MTest:
+     const TDesC8& Name ();
+
+    // From MTest:
+     void ExecuteTestL(TTestResult& aResult,
+                      TInt aIndex);
+
+    // From MTest:
+     const TDesC8& TestCaseName (TInt aIndex);
+
+protected:
+
+     virtual void ConstructL (const TDesC8& aName);
+
+     void AssertL (TBool aCondition, 
+                           const TDesC8& aConditionExpression,
+                           TInt  aLineNumber,
+                           const TDesC8& aFileName);
+
+     void AssertEqualsL (TInt  aExpected, 
+                                 TInt  aActual,
+                                 TInt  aLineNumber,
+                                 const TDesC8& aFileName);
+
+     void AssertEqualsL (TReal aExpected,
+                                 TReal aActual, 
+                                 TReal aDelta, 
+                                 TInt  aLineNumber,
+                                 const TDesC8& aFileName);
+
+     void AssertEqualsL (const TDesC8&  aExpected, 
+                                 const TDesC8&  aActual,
+                                 TInt           aLineNumber,
+                                 const          TDesC8& aFileName);
+
+     void AssertEqualsL (const TDesC16& aExpected, 
+                                 const TDesC16& aActual,
+                                 TInt           aLineNumber,
+                                 const          TDesC8& aFileName);
+
+	 void AllocFailureSimulation (TBool aSwitchedOn);
+
+    virtual void setUpL () = 0;
+    virtual void executeTestL () { }
+    virtual void tearDown () = 0;
+
+	 CTestCase ();
+
+private:
+
+	TInt ExecuteImplL ();
+
+    HBufC8* NotEqualsMessageLC (const TDesC8& aExpected,
+                                const TDesC8& aActual);
+
+    HBufC8* NotEqualsMessageLC (const TDesC16& aExpected,
+                                const TDesC16& aActual);
+
+	void AssertFailureToTlsL (const TDesC8& aMessage,
+	                          TInt  aLineNumber,
+	                          const TDesC8& aFileName);
+
+	CAssertFailure* AssertFailureFromTlsL ();
+
+	TInt HeapCellsReservedByAssertFailure ();
+
+    // data
+    HBufC8* iName;
+	RHeap::TAllocFail iAllocFailureType;
+	TUint iAllocFailureRate;
+	};
+
+
+// A set of macros which allow us to get the line number
+// and file name at the point of an assertion failure:
+
+#undef assertL
+#define assertL(condition)\
+        (this->AssertL ((condition), TPtrC8((TText8*)(#condition)),\
+                        __LINE__, TPtrC8((TText8*)__FILE__)))
+
+// Macros for primitive value comparisons
+#define assertTIntsEqualL(expected,actual)\
+        (this->AssertEqualsL ((expected), (actual),\
+                              __LINE__, TPtrC8((TText8*)__FILE__)))
+
+#define assertTRealsEqualL(expected,actual,delta)\
+        (this->AssertEqualsL ((expected), (actual), (delta),\
+                              __LINE__,TPtrC8((TText8*)__FILE__)))
+
+
+// Macros for descriptor comparisons
+#define assertTDesC8sEqualL(expected,actual)\
+        (this->AssertEqualsL ((expected), (actual),\
+                              __LINE__, TPtrC8((TText8*)__FILE__)))
+
+#define assertTDesC16sEqualL(expected,actual)\
+        (this->AssertEqualsL ((expected), (actual),\
+                              __LINE__, TPtrC8((TText8*)__FILE__)))
+
+#if defined(_UNICODE)
+#define assertTDesCsEqualL(expected,actual) assertTDesC16sEqualL(expected,actual)
+#else
+#define assertTDesCsEqualL(expected,actual) assertTDesC8sEqualL(expected,actual)
+#endif
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/inc/TestFramework/testSuite.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef __CPPUNIT_CTESTSUITE_H
+#define __CPPUNIT_CTESTSUITE_H
+
+#include <e32base.h>
+#include "TestFrameWork/test.h"
+
+class TestResult;
+class CppUnitLog;
+
+/*
+* A CTestSuite is a Composite of MTests.
+* It runs a collection of test cases.
+*
+* see MTest and CTestCaller
+*/
+
+
+class CTestSuite : public MTest, public CBase
+    {
+    public:
+        
+        static CTestSuite* NewLC(const TDesC8& aName);
+        static CTestSuite* NewL(const TDesC8& aName);
+        ~CTestSuite ();
+        
+        void addTestL (MTest *aTest);
+        
+        // From MTest:
+        void ExecuteL (TTestResult& aResult);
+        
+        // From MTest:
+        TInt CountTestCases ();
+        
+        // From MTest:
+        const TDesC8& Name ();
+        
+        
+        // From MTest:
+        void ExecuteTestL(TTestResult& aResult,
+            TInt aIndex);
+        
+        // From MTest:
+        const TDesC8& TestCaseName (TInt aIndex);
+        
+    private:
+        
+        void ConstructL (const TDesC8& aName);
+        CTestSuite () { }
+        
+        RPointerArray<MTest> iTests;
+        HBufC8 *iName;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/sis/STIFAFSQTest.pkg	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,66 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: STIFAFSQTest.pkg
+;
+;
+;
+
+; Languages
+&EN
+
+; Package header
+#{"STIFAFSQTEST"},(0x101F8818),0,0,0,TYPE=SA
+
+; Localised Vendor name
+%{"Nokia EN"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Logo
+; None
+
+; Package signature - Optional
+; None
+
+; Start of Package body
+
+; Condition blocks
+; None
+
+; Options list
+; None
+
+; Install files
+
+"\epoc32\release\armv5\udeb\STIFAFSQTest.dll"   -   "!:\Sys\Bin\STIFAFSQTest.dll"
+  
+"\epoc32\winscw\c\TestFramework\TestFramework.ini"-"C:\TestFramework\TestFramework_FSQ.ini"
+
+"\s60\mw\cameraengines\CamAppEngine\asynchfilesavequeue\tsrc\public\basic\data\STIFAFSQTest\Nibbles.jpg"-"E:\testing\data\STIFAFSQTest\Nibbles.jpg"
+
+"\s60\mw\cameraengines\CamAppEngine\asynchfilesavequeue\tsrc\public\basic\data\STIFAFSQTest\Nibbles2.jpg"-"E:\testing\data\STIFAFSQTest\Nibbles2.jpg"
+
+"\s60\mw\cameraengines\CamAppEngine\asynchfilesavequeue\tsrc\public\basic\data\STIFAFSQTest\Nibbles3.jpg"-"E:\testing\data\STIFAFSQTest\Nibbles3.jpg"
+
+; Embedded SIS 
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/src/AFSQTestAdd.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,530 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include "../inc/AFSQTestAsynchSave.h"
+#include <f32file.h> // for opening / creating files
+#include <bautils.h> // for deleting files
+
+void CAFSQTestAsynchSave::TestAddEmptyObjectToQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.001
+    // 
+    // Action : Test that adding an null object to the queue will return an error.
+    //      
+    // Output : An error code.   
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddEmptyObjectToQueueL in") );
+
+    TInt error = KErrNone;
+    currentTest = EADD001p1;
+    numSaved = 0;
+    wait = ETrue;
+    
+    HBufC8 * myData = HBufC8::NewL(1000);
+    delete myData;
+    myData = NULL;
+    
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        TFileName add001 = KNibblesADD001;
+        error = iFSQ->SaveAndDestroy( *myData, add001);
+        );
+    TRAPD( err2,
+        delete iFSQ;
+        iFSQ = NULL;
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddEmptyObjectToQueueL isKErrArgument=%d notErr=%d notErr2=%d"), (error == KErrArgument), !err, !err2 );
+    
+    //do not delay assert because queue should not be active
+    assertL( (error == KErrArgument) && !err && !err2);
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddEmptyObjectToQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.002
+    // 
+    // Action : Test that adding an object to an empty queue will at least start OK.
+    //      
+    // Output : An error code.  
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL in") );
+
+    TInt error = KErrNone;
+    currentTest = EADD002p1;
+    numSaved = 0;
+    wait = ETrue;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+    
+    // Delete the file if it exists
+    TFileName add002 = KNibblesADD002;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, add002, EFileRead);
+    deleter.Close();
+
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add002);
+        }
+    aFs.Close();
+    
+    // Save    
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();        
+        //add this as a callback
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf, add002 );
+        buf = NULL; // transfer ownership 
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL isKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+   
+    delayedBool = ( (error == KErrNone) && !err );
+    //wait for callback to assert
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestAddObjectToEmptyQueueWillSaveL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.003
+    // 
+    // Action : Test that adding an object to an empty queue will finish OK.
+    //      
+    // Output : Asynchronous report.    
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueWillSaveL in") );
+
+    currentTest = EADD003p1;
+    numSaved = 0;
+    wait = ETrue;
+    
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+    
+    // Delete the file if it exists
+    TFileName add003 = KNibblesADD003;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, add003, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add003);
+        }
+    aFs.Close();
+    
+    TRAP_IGNORE(  
+        iFSQ = CAsynchFSQ::NewL();
+        //add this as a callback
+        iFSQ->SetCallback( this );
+        iFSQ->SaveAndDestroy( *buf, add003 );
+        buf = NULL; // transfer ownership
+        );
+    
+    //wait for callback to assert
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueWillSaveL out") );
+    }
+
+void CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.004
+    // 
+    // Action : Test that adding an object to a non empty queue will at least start OK.
+    //      
+    // Output : An error code.
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueL in") );
+
+    TInt error = KErrNone;
+    TInt error2 = KErrNone;
+    currentTest = EADD004p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+   
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+
+    // Delete the file if it exists
+    TFileName add004A = KNibblesADD004A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, add004A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add004A);
+        }
+
+    // Delete the file if it exists
+    TFileName add004B = KNibblesADD004B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, add004B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add004B);
+        }
+    aFs.Close();
+
+    // Save    
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf, add004A );
+        buf = NULL; // transfer ownership
+        error2 = iFSQ->SaveAndDestroy( *buf2, add004B );
+        buf2 = NULL; // transfer ownership
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueL isKErrNone=%d is2KErrNone=%d notErr=%d"), (error == KErrNone), (error2 == KErrNone), !err );
+    
+    delayedBool = ( (error == KErrNone) && (error2 == KErrNone) && (!err) );
+    //wait for callback to assert
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueWillSaveL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.005
+    // 
+    // Action : Test that adding an object to a non empty queue will finish OK.
+    //      
+    // Output : Asynchronous report.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueWillSaveL in") );
+
+    //TInt error = KErrNone;
+    currentTest = EADD005p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+    
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+
+    // Delete the file if it exists
+    TFileName add005A = KNibblesADD005A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, add005A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueWillSaveL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add005A);
+        }
+
+    // Delete the file if it exists
+    TFileName add005B = KNibblesADD005B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, add005B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueWillSaveL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add005B);
+        }
+    aFs.Close();
+
+    // Save    
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        iFSQ->SaveAndDestroy( *buf, add005A );
+        buf = NULL; // transfer ownership
+        iFSQ->SaveAndDestroy( *buf2, add005B );
+        buf2 = NULL; // transfer ownership
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueWillSaveL notErr=%d"), !err );
+    
+    //wait for callback to assert
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueWillSaveL out") );
+    }
+
+void CAFSQTestAsynchSave::TestAddObjectThatExistsAlreadyL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.006
+    // 
+    // Action : Test that adding an object to an empty queue which exists int the file
+    //          system will report KErrAlreadyExists.
+    //      
+    // Output : An error code.  
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectThatExistsAlready in") );
+
+    TInt error = KErrNone;
+    currentTest = EADD006p1;
+    numSaved = 0;
+    wait = ETrue;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Delete the file if it exists
+    TFileName add006 = KNibblesADD006;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, add006, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectThatExistsAlreadyL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add006);
+        }
+    aFs.Close();
+
+    // Write the file to be used in testing
+    TInt err2 = KErrNone;
+    RFs fsSession;
+    err2 = fsSession.Connect();
+    RFile myFile;
+    if ( !err2 )
+        {
+        err2 = myFile.Create( fsSession, add006, 
+                             EFileStream | EFileShareExclusive | EFileWrite );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Write( myData );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Flush();
+        }
+	myFile.Close();
+	fsSession.Close();
+	
+    // Reuse the file name, to write where it exists.
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        //add this as a callback
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf, add006, EFalse );
+        buf = NULL; // transfer ownership 
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectThatExistsAlreadyL isKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+   
+    delayedBool = ( (error == KErrNone) && !err );
+    //wait for callback to assert
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectThatExistsAlreadyL out") );
+    }
+
+
+void CAFSQTestAsynchSave::TestAddObjectToEmptyQueueLManualStart()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.007
+    // 
+    // Action : Test that adding an object to an empty manual queue will be OK.
+    //      
+    // Output : An error code.  
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueLManualStart in") );
+
+    TInt error = KErrNone;
+    TInt error2 = KErrNone;
+    currentTest = EADD007p1;
+    numSaved = 0;
+    wait = ETrue;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+    
+    // Delete the file if it exists
+    TFileName add007 = KNibblesADD007;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, add007, EFileRead);
+    deleter.Close();
+
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+        RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueLManualStart exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add007);
+        }
+    aFs.Close();
+    
+    // Save    
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();        
+        //add this as a callback
+        iFSQ->SetCallback( this );
+        iFSQ->SetManualStart( ETrue );
+        error = iFSQ->SaveAndDestroy( *buf, add007 );
+        buf = NULL; // transfer ownership 
+        error2 = iFSQ->Go();
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueLManualStart isKErrNone=%d notErr=%d"), ((error == KErrNone) && (error2 == KErrNone)), !err );
+   
+    delayedBool = ( (error == KErrNone) && (error2 == KErrNone) && !err );
+    //wait for callback to assert
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueLManualStart out") );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/src/AFSQTestAsynchSave.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,636 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include "../inc/AFSQTestAsynchSave.h"
+#include <f32file.h> // for opening / creating files
+#include <bautils.h> // for deleting files
+
+CAFSQTestAsynchSave::CAFSQTestAsynchSave()
+    {
+    RDebug::Print( _L("CAFSQTestAsynchSave::CAFSQTestAsynchSave in") );
+    
+    // Create a mutex for synchronization purpose
+    iMutex.CreateLocal();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::CAFSQTestAsynchSave out") );
+    }
+
+CAFSQTestAsynchSave::~CAFSQTestAsynchSave()
+    {
+    // Nothing to do
+    }
+
+void CAFSQTestAsynchSave::setUpL()
+    {
+    RDebug::Print( _L("CAFSQTestAsynchSave::setUpL in") );
+    }
+
+void CAFSQTestAsynchSave::tearDown()
+    {
+    RDebug::Print( _L("CAFSQTestAsynchSave::tearDown in") );
+    }
+
+void CAFSQTestAsynchSave::TestFileManNewLReturnsNotNullL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTFILEMANNEWLRETURNSNOTNULL.001
+    // 
+    // Action : Test that cfileman::newl returns a value.
+    //      
+    // Output : A handle to the requested object.   
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestFileManNewLReturnsNotNullL in") );
+
+    currentTest = ECONSTRUCT001p1;
+    wait = ETrue;
+
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestFileManNewLReturnsNotNullL isNotNull=%d notErr=%d"), (iFSQ!=NULL), !err);
+    assertL( (iFSQ != NULL) && !err );
+    delete iFSQ;
+    iFSQ = NULL;
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestFileManNewLReturnsNotNullL out") );
+    }
+
+void CAFSQTestAsynchSave::TestDestructorL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDESTRUCTOR.001
+    // 
+    // Action : Test that delete works
+    //      
+    // Output : KErrNone on all fronts.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDestructorL in") );
+
+    currentTest = EDESTRUCT001p1;
+    wait = ETrue;
+
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        delete iFSQ;
+        iFSQ = NULL;
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDestructorL notErr=%d"), !err );
+    
+    assertL( !err );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDestructorL out") );
+    }
+    
+void CAFSQTestAsynchSave::TestSetPriorityL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTSETPRIORITY.001
+    // 
+    // Action : Test that setting the priority doesn't fail
+    //      
+    // Output : KErrNone on all fronts.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestSetPriorityL in") );
+
+    currentTest = EPRIORITY001p1;
+    wait = ETrue;
+
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetPriority( EPriorityMore );
+        delete iFSQ;
+        iFSQ = NULL;
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestSetPriorityL notErr=%d"), !err );
+    
+    assertL( !err );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestSetPriorityL out") );
+    }   
+    
+void CAFSQTestAsynchSave::TestCancelL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTCANCEL.001
+    // 
+    // Action : Test that canceling will....
+    //      
+    // Output : An error code.   
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestCancelL in") );
+
+    TInt error = KErrNone;
+    currentTest = ECANCEL001p1;
+    numSaved = 0;
+    wait = ETrue;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+    
+    // Delete the file if it exists
+    TFileName cancel001 = KNibblesCANCEL001;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, cancel001, EFileRead);
+    deleter.Close();
+
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+        RDebug::Print( _L("CAFSQTestAsynchSave::TestCancelL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, cancel001);
+        }
+    aFs.Close();
+    
+    // Save    
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();        
+        //add this as a callback
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf, cancel001 );
+        buf = NULL; // transfer ownership 
+        iFSQ->Cancel();
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestCancelL isKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+   
+    // do not wait for callback to assert, since we have canceled
+    delayedBool = ( (error == KErrNone) && !err );
+    assertL( delayedBool );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestCancelL out") );
+    }
+    
+void CAFSQTestAsynchSave::WaitForAsynchCompleteL()
+    {
+    RDebug::Print( _L("CAFSQTestAsynchSave::WaitForAsynchCompleteL in") );
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::WaitForAsynchCompleteL starting AS now") );
+    CActiveScheduler::Start();
+        
+    RDebug::Print( _L("CAFSQTestAsynchSave::WaitForAsynchCompleteL closing") );
+    //close up and assert
+    User::After( TTimeIntervalMicroSeconds32(1000000) );
+    if( iFSQ )
+        {
+        delete iFSQ;
+        iFSQ = NULL; 
+        }
+        
+    RDebug::Print( _L("CAFSQTestAsynchSave::WaitForAsynchCompleteL we are asserting the following: %d"), assertion );
+        
+    assertL( assertion );
+       
+    RDebug::Print( _L("CAFSQTestAsynchSave::WaitForAsynchCompleteL out") );
+    }
+
+void CAFSQTestAsynchSave::MAsynchFSQEvent( TInt aError )
+    {
+    RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent in, waiting"));
+    User::After( TTimeIntervalMicroSeconds32(2000000) );
+    RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent in, done waiting"));
+
+    numSaved++;
+    RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent in, numToSave=%d"),numToSave);
+
+    switch( currentTest )
+        {
+        case EADD002p1:
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(2) delayedBool=%d !aError=%d"), delayedBool, !aError );
+            CActiveScheduler::Stop();
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(2)"));
+    
+            assertion = ( delayedBool && !aError );
+            break;
+            
+        case EADD003p1:
+            {
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(3)"));
+            CActiveScheduler::Stop();
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(3)"));
+            
+            //check that the file exists
+            RFs fsSession;
+            TInt connectErr = fsSession.Connect();
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(3) connectErr=%d"), connectErr );
+            RFile file;
+            TFileName add003 = KNibblesADD003;
+            TInt fileErr = file.Open(fsSession, add003, EFileRead);
+            file.Close();
+            fsSession.Close();
+
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(3) aErrorIsKErrNone=%d !fileErr=%d"), (aError == KErrNone), !fileErr );
+            assertion = ( (aError == KErrNone) && !fileErr);
+            break;        
+            }           
+        case EADD004p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(4)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(4)"));
+                
+                //check that the file exists
+                RFs fsSession;
+                TInt connectErr = fsSession.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(4) connectErr=%d"), connectErr );
+                RFile file1;
+                RFile file2;
+                TFileName add004A = KNibblesADD004A;
+                TFileName add004B = KNibblesADD004B;
+                TInt fileErr1 = file1.Open(fsSession, add004A, EFileRead);
+                TInt fileErr2 = file2.Open(fsSession, add004B, EFileRead);
+                file1.Close();
+                file2.Close();
+                fsSession.Close();
+
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(4) delayedBool=%d !aError=%d !fileErr1=%d !fileErr2=%d"), delayedBool, !aError, !fileErr1, !fileErr2 );
+                assertion = ( delayedBool && !aError && !fileErr1 && !fileErr2);
+                }
+            break;
+            }
+        case EADD005p1:
+            {        
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(5)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(5)"));
+                
+                //check that the file exists
+                RFs fsSession;
+                TInt connectErr = fsSession.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(5) connectErr=%d"), connectErr );
+                RFile file1;
+                RFile file2;
+                TFileName add005A = KNibblesADD005A;
+                TFileName add005B = KNibblesADD005B;
+                TInt fileErr1 = file1.Open(fsSession, add005A, EFileRead);
+                TInt fileErr2 = file2.Open(fsSession, add005B, EFileRead);
+                file1.Close();
+                file2.Close();
+                fsSession.Close();
+                    
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(5) isaErrorKErrNone=%d"), (aError==KErrNone) );
+                assertion = ( aError == KErrNone );
+                }
+            break;
+            }        
+        case EADD007p1:
+            {        
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(EADD007p1) delayedBool=%d !aError=%d"), delayedBool, !aError );
+            CActiveScheduler::Stop();
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(EADD007p1)"));
+    
+            assertion = ( delayedBool && !aError );
+            break;
+            }                
+        case EDEL003p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(8)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(8)"));
+                
+                //check that file was deleted
+                RFs fsSession2;
+                TInt connectErr = fsSession2.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(8) connectErr=%d"), connectErr );
+                RFile file3;
+                TFileName del003A = KNibblesDEL003A;
+                TInt fileError = file3.Open(fsSession2, del003A, EFileRead);
+                file3.Close();
+                fsSession2.Close();
+    
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(8) delayedBool=%d !aError=%d fileError=%d"), delayedBool, !aError, !(!fileError) );
+                assertion = ( delayedBool && !aError && !(!fileError) );
+                }
+            break;
+            }    
+        case EDEL004p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(9)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(9)"));
+                
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(9) delayedBool=%d !aError=%d"), delayedBool, !aError );
+                assertion = ( delayedBool && !aError );
+                }
+            break;
+            }    
+        case EDEL005p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(10)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(10)"));
+                
+                //check that file was deleted
+                RFs fsSession2;
+                TInt connectErr = fsSession2.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(10) connectErr=%d"), connectErr );
+                RFile file3;
+                TFileName del005A = KNibblesDEL005A;
+                TInt fileError = file3.Open(fsSession2, del005A, EFileRead);
+                file3.Close();
+            
+                //check that file was saved
+                RFile file4;
+                TFileName del005B = KNibblesDEL005B;
+                TInt fileError2 = file4.Open(fsSession2, del005B, EFileRead);
+                file4.Close();
+                
+                //check that file was saved
+                RFile file5;
+                TFileName del005C = KNibblesDEL005C;
+                TInt fileError3 = file5.Open(fsSession2, del005C, EFileRead);
+                file5.Close();
+                fsSession2.Close();
+            
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(10) delayedBool=%d !aError=%d fileError=%d !fileError2=%d !fileError3=%d"), delayedBool, !aError, !(!fileError), !fileError2, !fileError3 );
+                assertion = ( delayedBool && !aError && !(!fileError) && !fileError2 && !fileError3 );
+                }
+            break;
+            }    
+        case EDEL006p1:
+            {
+            //check that file was saved
+            RFs fsSession2;
+            TInt connectErr = fsSession2.Connect();
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(11) connectErr=%d"), connectErr );
+            RFile file5;
+            TFileName del006A = KNibblesDEL006A;
+            TInt fileError3 = file5.Open(fsSession2, del006A, EFileRead);
+            file5.Close();
+            
+            if( iFSQ->ActionsLeft() == 0 )
+                {
+                //we should be done with the rest...
+                
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(11)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(11)"));
+                
+                //check that file was deleted
+                RFile file3;
+                TFileName del006C = KNibblesDEL006C;
+                TInt fileError = file3.Open(fsSession2, del006C, EFileRead);
+                file3.Close();
+                
+                //check that file was saved
+                RFile file4;
+                TFileName del006B = KNibblesDEL006B;
+                TInt fileError2 = file4.Open(fsSession2, del006B, EFileRead);
+                file4.Close();
+                
+            
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(11) delayedBool=%d !aError=%d fileError=%d fileError2=%d !fileError3=%d"), delayedBool, !aError, !(!fileError), !(!fileError2), !fileError3 );
+                assertion = ( delayedBool && !aError && !(!fileError) && !(!fileError2) && !fileError3 );
+                }
+                
+            fsSession2.Close();
+            break;
+            }    
+        case EREN003p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(15)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(15)"));
+                
+                //check that file was renamed
+                RFs fsSession2;
+                TInt connectErr = fsSession2.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(15) connectErr=%d"), connectErr );
+                RFile file3;
+                TFileName ren003A2 = KNibblesREN003A2;
+                TInt fileError = file3.Open(fsSession2, ren003A2, EFileRead);
+                file3.Close();
+                
+                //check that file was saved
+                RFile file4;
+                TFileName ren003B = KNibblesREN003B;
+                TInt fileError2 = file4.Open(fsSession2, ren003B, EFileRead);
+                file4.Close();
+                
+                //check that file was renamed (so this one wont exist anymore)
+                RFile file5;
+                TFileName ren003A = KNibblesREN003A;
+                TInt fileError3 = file5.Open(fsSession2, ren003A, EFileRead);
+                file5.Close();
+                fsSession2.Close();
+            
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(15) delayedBool=%d !aError=%d !fileError=%d !fileError2=%d !!fileError3=%d"), delayedBool, !aError, !fileError, !fileError2, !(!fileError3) );
+                assertion = ( delayedBool && !aError && !fileError && !fileError2 && !(!fileError3) );
+                }
+            break;
+            }    
+        case EREN004p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(16)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(16)"));
+                
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(16) delayedBool=%d !aError=%d"), delayedBool, !aError );
+                assertion = ( delayedBool && !aError );
+                }
+            break;
+            }    
+        case EREN005p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(17)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(17)"));
+                
+                //check that file was renamed
+                RFs fsSession2;
+                TInt connectErr = fsSession2.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(17) connectErr=%d"), connectErr );
+                RFile file3;
+                TFileName ren005A2 = KNibblesREN005A2;
+                TInt fileError = file3.Open(fsSession2, ren005A2, EFileRead);
+                file3.Close();
+                
+                //check that file was saved
+                RFile file4;
+                TFileName ren005B = KNibblesREN005B;
+                TInt fileError2 = file4.Open(fsSession2, ren005B, EFileRead);
+                file4.Close();
+                
+                //check that file was renamed (so this one wont exist anymore)
+                RFile file5;
+                TFileName ren005A = KNibblesREN005A;
+                TInt fileError3 = file5.Open(fsSession2, ren005A, EFileRead);
+                file5.Close();
+                
+                //check that file was saved
+                RFile file6;
+                TFileName ren005C = KNibblesREN005C;
+                TInt fileError4 = file6.Open(fsSession2, ren005C, EFileRead);
+                file6.Close();
+                fsSession2.Close();
+            
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(17) delayedBool=%d !aError=%d !fileError=%d !fileError2=%d !!fileError3=%d !fileError4=%d"), delayedBool, !aError, !fileError, !fileError2, !(!fileError3), !fileError4 );
+                assertion = ( delayedBool && !aError && !fileError && !fileError2 && !(!fileError3) && !fileError4 );
+                }
+            break;
+            }    
+        case EREN006p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(18)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(18)"));
+                
+                //check that file was renamed
+                RFs fsSession2;
+                TInt connectErr = fsSession2.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(18) connectErr=%d"), connectErr );
+                RFile file3;
+                TFileName ren006C2 = KNibblesREN006C2;
+                TInt fileError = file3.Open(fsSession2, ren006C2, EFileRead);
+                file3.Close();
+                
+                //check that file was saved
+                RFile file4;
+                TFileName ren006B2 = KNibblesREN006B2;
+                TInt fileError2 = file4.Open(fsSession2, ren006B2, EFileRead);
+                file4.Close();
+                
+                //check that file was renamed (so this one wont exist anymore)
+                RFile file5;
+                TFileName ren006B = KNibblesREN006B;
+                TInt fileError3 = file5.Open(fsSession2, ren006B, EFileRead);
+                file5.Close();
+                
+                //check that file was saved
+                RFile file6;
+                TFileName ren006A = KNibblesREN006A;
+                TInt fileError4 = file6.Open(fsSession2, ren006A, EFileRead);
+                file6.Close();
+                
+                //check that file was renamed (so this one wont exist anymore)
+                RFile file7;
+                TFileName ren006C = KNibblesREN006C;
+                TInt fileError5 = file7.Open(fsSession2, ren006C, EFileRead);
+                file7.Close();
+                
+                fsSession2.Close();
+            
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(17) delayedBool=%d !aError=%d !fileError=%d !fileError2=%d !!fileError3=%d !fileError4=%d !!fileError5=%d"), delayedBool, !aError, !fileError, !fileError2, !(!fileError3), !fileError4, !(!fileError5) );
+                assertion = ( delayedBool && !aError && !fileError && !fileError2 && !(!fileError3) && !fileError4 && !(!fileError5) );
+                }
+            break;
+            }
+        case EADD006p1:
+            {
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(19)"));
+            CActiveScheduler::Stop();
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(19)"));
+            assertion = ( delayedBool && ( aError == KErrAlreadyExists ));
+            break;
+            }
+        case ECANCEL001p1:
+            {
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(ECANCEL001p1) delayedBool=%d !aError=%d"), delayedBool, !aError );
+            // do nothing, we are waiting for cancel
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(ECANCEL001p1)"));
+            break;
+            }
+        default:
+            break;
+        }
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent out") );
+    }
+
+MTest* CAFSQTestAsynchSave::suiteL ()
+    {
+    // An own static function to collect the test functions into one 
+    // suite of tests. The framework will run the tests and free the
+    // memory allocated for the test suite.
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::suiteL in") );
+    
+    // Always use NewL (Do not use NewLC here)
+    CTestSuite *suite = CTestSuite::NewL( _L8("CAFSQTestAsynchSave") );
+
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTFILEMANNEWLRETURNSNOTNULL.001"), &TestFileManNewLReturnsNotNullL ) );
+    
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDESTRUCTOR.001"), &TestDestructorL ) );
+    
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTSETPRIORITY.001"), &TestSetPriorityL ) );
+    
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTCANCEL.001"), &TestCancelL ) );
+    
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.001"), &TestAddEmptyObjectToQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.002"), &TestAddObjectToEmptyQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.003"), &TestAddObjectToEmptyQueueWillSaveL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.004"), &TestAddObjectToNonEmptyQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.005"), &TestAddObjectToNonEmptyQueueWillSaveL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.006"), &TestAddObjectThatExistsAlreadyL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.007"), &TestAddObjectToEmptyQueueLManualStart ) );
+    
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDELETEOBJECT.001"), &TestDeleteFromEmptyNotExistL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDELETEOBJECT.002"), &TestDeleteFromEmptyExistsL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDELETEOBJECT.003"), &TestDeleteNonEmptyExistsButNotInQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDELETEOBJECT.004"), &TestDeleteNonEmptyNotExistAndNotInQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDELETEOBJECT.005"), &TestDeleteInQueueNotActiveL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDELETEOBJECT.006"), &TestDeleteInQueueActiveL ) );
+    
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTRENAMEOBJECT.001"), &TestRenameFromEmptyNotExistL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTRENAMEOBJECT.002"), &TestRenameFromEmptyExistsL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTRENAMEOBJECT.003"), &TestRenameNonEmptyExistsButNotInQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTRENAMEOBJECT.004"), &TestRenameNonEmptyNotExistAndNotInQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTRENAMEOBJECT.005"), &TestRenameInQueueNotActiveL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTRENAMEOBJECT.006"), &TestRenameInQueueActiveL ) );
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::suiteL returning") );
+    return suite;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/src/AFSQTestDelete.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,692 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include "../inc/AFSQTestAsynchSave.h"
+#include <f32file.h> // for opening / creating files
+#include <bautils.h> // for deleting files
+
+void CAFSQTestAsynchSave::TestDeleteFromEmptyNotExistL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDELETEOBJECT.001
+    // 
+    // Action : Test that cfileman::delete returns error if no such file.
+    //      
+    // Output : A KErrNotFound.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyNotExistL in") );
+	
+    currentTest = EDEL001p1;
+    numSaved = 0;
+    wait = ETrue;
+    TInt error = KErrNone;
+    
+    // Delete the file if it exists
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    TFileName del001 = KNibblesDEL001;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, del001, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyNotExistL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del001);
+        }
+    aFs.Close();
+    
+    // Try delete
+    CAsynchFSQ* aFSQ = NULL;
+    TRAPD( err, 
+        aFSQ = CAsynchFSQ::NewL();
+        error = aFSQ->Delete( del001 );
+        );
+    TRAP_IGNORE(
+        delete aFSQ;
+        aFSQ = NULL;
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyNotExistL errorIsKErrNotFound=%d notErr=%d"), (error == KErrNotFound), !err );
+    
+    assertL( (error == KErrNotFound) && !err );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyNotExistL out") );
+    }
+
+void CAFSQTestAsynchSave::TestDeleteFromEmptyExistsL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDELETEOBJECT.002
+    // 
+    // Action : Test that delete works if file exists and queue empty
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyExistsL in") );
+
+    currentTest = EDEL002p1;
+    numSaved = 0;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Delete the file if it exists
+    TFileName del002 = KNibblesDEL002;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, del002, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyExistsL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del002);
+        }
+    aFs.Close();
+
+    // Write the file to be used in testing
+    TInt err2 = KErrNone;
+    RFs fsSession;
+    err2 = fsSession.Connect();
+    RFile myFile;
+    if ( !err2 )
+        {
+        err2 = myFile.Create( fsSession, del002, 
+                             EFileStream | EFileShareExclusive | EFileWrite );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Write( myData );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Flush();
+        }
+    myFile.Close();
+    fsSession.Close();
+    delete buf;
+    buf = NULL;
+
+    //delete
+    CAsynchFSQ* aFSQ = NULL;
+    TRAPD( err, 
+        aFSQ = CAsynchFSQ::NewL();
+        error = aFSQ->Delete( del002 );
+        );
+    TRAP_IGNORE(
+        delete aFSQ;
+        aFSQ = NULL;
+        );
+    
+    //check that file was deleted
+    RFs fsSession2;
+    TInt fsConnectErr = fsSession2.Connect();
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyExistsL fsConnectErr=%d"), fsConnectErr );
+    RFile file2;
+    TInt fileError = file2.Open(fsSession2, del002, EFileRead);
+    file2.Close();
+    fsSession2.Close();
+    
+    //assert
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyExistsL errorIsKErrNone=%d notErr=%d isFileError=%d"), (error == KErrNone), !err, !(!(fileError )) );
+    
+    assertL( (error == KErrNone) && !err && (fileError!=KErrNone) );
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyExistsL out") );
+    }
+
+void CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDELETEOBJECT.003
+    // 
+    // Action : Test that delete will work if the queue is not empty but
+    //          the requested file is not in the queue (but it also exists)
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL in") );
+	
+    currentTest = EDEL003p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2, EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+    
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3, EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName del003A = KNibblesDEL003A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, del003A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del003A);
+        }
+
+    // Delete the file if it exists
+    TFileName del003B = KNibblesDEL003B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, del003B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del003B);
+        }
+        
+    // Delete the file if it exists
+    TFileName del003C = KNibblesDEL003C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, del003C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del003C);
+        }
+
+    // Write the file to be used in testing
+    TInt err2 = KErrNone;
+    RFs fsSession;
+    err2 = fsSession.Connect();
+    RFile myFile;
+    if ( !err2 )
+        {
+        err2 = myFile.Create( fsSession, del003A, 
+                             EFileStream | EFileShareExclusive | EFileWrite );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Write( myData );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Flush();
+        }
+	myFile.Close();
+	fsSession.Close();
+	aFs.Close();
+	delete buf;
+	buf = NULL;
+
+    //delete
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, del003B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, del003C );
+        buf3 = NULL;
+        error = iFSQ->Delete( del003A );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL errorIsKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+    
+    delayedBool = ( (error == KErrNone) && !err );
+    WaitForAsynchCompleteL();
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDELETEOBJECT.004
+    // 
+    // Action : Test that delete will return error if the queue is not empty but
+    //          the requested file is not in the queue (but it doesnt exist)
+    //      
+    // Output : A KErrNotFound.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL in") );
+
+    currentTest = EDEL004p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+    
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName del004A = KNibblesDEL004A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, del004A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del004A);
+        }
+
+    // Delete the file if it exists
+    TFileName del004B = KNibblesDEL004B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, del004B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del004B);
+        }
+        
+    // Delete the file if it exists
+    TFileName del004C = KNibblesDEL004C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, del004C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del004C);
+        }
+
+    aFs.Close();
+    delete buf;
+    buf = NULL;
+
+    //delete
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, del004B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, del004C );
+        buf3 = NULL;
+        error = iFSQ->Delete( del004A );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL errorIsKErrNotFound=%d notErr=%d"), (error == KErrNotFound), !err );
+    
+    delayedBool = ( (error == KErrNotFound) && !err );
+    WaitForAsynchCompleteL();
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDELETEOBJECT.005
+    // 
+    // Action : Test that delete will work ok if the queue is not empty and
+    //          the file is in the queue.  Should also check filesystem for existence.
+    //          This case checks that the file NOT ACTIVELY being saved gets deleted.
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL in") );
+	
+    currentTest = EDEL005p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+    
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName del005A = KNibblesDEL005A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, del005A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del005A);
+        }
+
+    // Delete the file if it exists
+    TFileName del005B = KNibblesDEL005B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, del005B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del005B);
+        }
+        
+    // Delete the file if it exists
+    TFileName del005C = KNibblesDEL005C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, del005C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del005C);
+        }
+
+    aFs.Close();
+
+    //delete
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, del005B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, del005C );
+        buf3 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf, del005A );
+        buf = NULL;
+        error = iFSQ->Delete( del005A );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL errorIsKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+    
+    delayedBool = ( (error == KErrNone) && !err );
+    WaitForAsynchCompleteL();
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL out") );
+    }
+
+void CAFSQTestAsynchSave::TestDeleteInQueueActiveL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDELETEOBJECT.006
+    // 
+    // Action : Test that delete will work ok if the queue is not empty and
+    //          the file is in the queue.  Should also check filesystem for existence.
+    //          This case checks that the file ACTIVELY being saved gets deleted.
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueActiveL in") );
+	
+    currentTest = EDEL006p1;
+    numSaved = 0;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+    
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName del006A = KNibblesDEL006A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, del006A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del006A);
+        }
+
+    // Delete the file if it exists
+    TFileName del006B = KNibblesDEL006B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, del006B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del006B);
+        }
+        
+    // Delete the file if it exists
+    TFileName del006C = KNibblesDEL006C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, del006C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del006C);
+        }
+
+    aFs.Close();
+	    
+    //delete
+    TInt errorA = 0;
+    TInt errorB = 0;
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, del006B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, del006C );
+        buf3 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf, del006A );
+        buf = NULL;
+        errorA = iFSQ->Delete( del006B );
+        errorB = iFSQ->Delete( del006C );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueActiveL errorIsKErrNone=%d notErr=%d !errorA=%d !errorB=%d"), (error == KErrNone), !err, !errorA, !errorB );
+    
+    delayedBool = ( (error == KErrNone) && !err && !errorA && !errorB );
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueActiveL out") );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/src/AFSQTestRename.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,746 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include "../inc/AFSQTestAsynchSave.h"
+#include <f32file.h> // for opening / creating files
+#include <bautils.h> // for deleting files
+
+void CAFSQTestAsynchSave::TestRenameFromEmptyNotExistL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTRENAMEOBJECT.001
+    // 
+    // Action : Test that cfileman::rename returns error if no such file.
+    //      
+    // Output : A KErrNotFound.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyNotExistL in") );
+	
+    currentTest = EREN001p1;
+    numSaved = 0;
+    wait = ETrue;
+    TInt error = KErrNone;
+    
+    // Delete the file if it exists
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    TFileName ren001A = KNibblesREN001A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, ren001A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyNotExistL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren001A);
+        }
+    aFs.Close();
+    
+    // Try delete
+    CAsynchFSQ* aFSQ = NULL;
+    TFileName ren001B = KNibblesREN001B;
+    TRAPD( err, 
+        aFSQ = CAsynchFSQ::NewL();
+        error = aFSQ->Rename( ren001A, ren001B );
+        );
+    TRAP_IGNORE(
+        delete aFSQ;
+        aFSQ = NULL;
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyNotExistL errorIsKErrNotFound=%d notErr=%d"), (error == KErrNotFound), !err );
+    
+    assertL( (error == KErrNotFound) && !err );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyNotExistL out") );
+    }
+
+void CAFSQTestAsynchSave::TestRenameFromEmptyExistsL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTRENAMEOBJECT.002
+    // 
+    // Action : Test that rename works if file exists and queue empty
+    //      
+    // Output : A KErrNone.  
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyExistsL in") );
+	 
+    currentTest = EREN002p1;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Delete the file if it exists
+    TFileName ren002A = KNibblesREN002A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, ren002A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyExistsL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren002A);
+        }
+    aFs.Close();
+
+    // Write the file to be used in testing
+    TInt err2 = KErrNone;
+    RFs fsSession;
+    err2 = fsSession.Connect();
+    RFile myFile;
+    if ( !err2 )
+        {
+        err2 = myFile.Create( fsSession, ren002A, 
+                             EFileStream | EFileShareExclusive | EFileWrite );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Write( myData );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Flush();
+        }
+    myFile.Close();
+    fsSession.Close();
+    delete buf;
+    buf = NULL;
+
+    //delete file
+    CAsynchFSQ* aFSQ = NULL;
+    TFileName ren002B = KNibblesREN002B;
+    TRAPD( err, 
+        aFSQ = CAsynchFSQ::NewL();
+        error = aFSQ->Rename( ren002A, ren002B );
+        );
+    TRAP_IGNORE(
+        delete aFSQ;
+        aFSQ = NULL;
+        );
+
+    //check that file was deleted
+    RFs fsSession2;
+    TInt fsConnectErr = fsSession2.Connect();
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyExistsL connectErr=%d"), fsConnectErr );
+    RFile file2;
+    TInt fileError = file2.Open(fsSession2, ren002B, EFileRead);
+    file2.Close();
+    fsSession2.Close();
+
+    //assert
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyExistsL errorIsKErrNone=%d notErr=%d !fileError=%d"), (error == KErrNone), !err, !(fileError ) );
+    
+    assertL( (error == KErrNone) && !err && (fileError==KErrNone) );
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyExistsL out") );   
+    }
+
+void CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTRENAMEOBJECT.003
+    // 
+    // Action : Test that rename will work if the queue is not empty but
+    //          the requested file is not in the queue (but it also exists)
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL in") );
+	
+    currentTest = EREN003p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName ren003A = KNibblesREN003A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, ren003A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren003A);
+        }
+
+    // Delete the file if it exists
+    TFileName ren003B = KNibblesREN003B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, ren003B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren003B);
+        }
+
+    // Delete the file if it exists
+    TFileName ren003C = KNibblesREN003C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, ren003C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren003C);
+        }
+        
+    // Delete the file if it exists
+    TFileName ren003A2 = KNibblesREN003A2;
+    RFile deleter4;
+    TInt isDeleted4 = deleter4.Open(aFs, ren003A2, EFileRead);
+    deleter4.Close();
+    if ( isDeleted4 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL 4th exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren003A2);
+        }    
+
+    // Write the file to be used in testing
+    TInt err2 = KErrNone;
+    RFs fsSession;
+    err2 = fsSession.Connect();
+    RFile myFile;
+    if ( !err2 )
+        {
+        err2 = myFile.Create( fsSession, ren003A, 
+                             EFileStream | EFileShareExclusive | EFileWrite );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Write( myData );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Flush();
+        }
+    myFile.Close();
+    fsSession.Close();
+    aFs.Close();
+    delete buf;
+    buf = NULL;
+	    
+    //delete
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, ren003B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, ren003C );
+        buf3 = NULL;
+        error = iFSQ->Rename( ren003A, ren003A2);
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL errorIsKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+    
+    delayedBool = ( (error == KErrNone) && !err );
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTRENAMEOBJECT.004
+    // 
+    // Action : Test that rename will return error if the queue is not empty but
+    //          the requested file is not in the queue (but it doesnt exist)
+    //      
+    // Output : A KErrNotFound.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL in") );
+	
+    currentTest = EREN004p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    TInt connectError = User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName ren004A = KNibblesREN004A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, ren004A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren004A);
+        }
+
+    // Delete the file if it exists
+    TFileName ren004B = KNibblesREN004B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, ren004B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren004B);
+        }
+
+    // Delete the file if it exists
+    TFileName ren004C = KNibblesREN004C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, ren004C,EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren004C);
+        }
+    aFs.Close();
+    delete buf;
+    buf = NULL;
+
+    //delete
+    TFileName ren004A2 = KNibblesREN004A2;
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, ren004B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, ren004C );
+        buf3 = NULL;
+        error = iFSQ->Rename( ren004A, ren004A2 );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL errorIsKErrNotFound=%d notErr=%d"), (error == KErrNotFound), !err );
+    
+    delayedBool = ( (error == KErrNotFound) && !err );
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestRenameInQueueNotActiveL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTRENAMEOBJECT.005
+    // 
+    // Action : Test that rename will work ok if the queue is not empty and
+    //          the file is in the queue.  Should also check filesystem for existence.
+    //          This case checks that the file NOT ACTIVELY being saved gets renamed.
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueNotActiveL in") );
+	
+    currentTest = EREN005p1;
+    numSaved = 0;
+    numToSave = 3;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName ren005A = KNibblesREN005A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, ren005A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueNotActiveL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren005A);
+        }
+
+    // Delete the file if it exists
+    TFileName ren005B = KNibblesREN005B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, ren005B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueNotActiveL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren005B);
+        }
+
+    // Delete the file if it exists
+    TFileName ren005C = KNibblesREN005C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, ren005C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueNotActiveL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren005C);
+        }
+
+    // Delete the file if it exists
+    TFileName ren005A2 = KNibblesREN005A2;
+    RFile deleter4;
+    TInt isDeleted4 = deleter4.Open(aFs, ren005A2, EFileRead);
+    deleter4.Close();
+    if ( isDeleted4 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL 4th exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren005A2);
+        }    
+
+    aFs.Close();
+	    
+    //delete
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, ren005B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, ren005C );
+        buf3 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf, ren005A );
+        buf = NULL;
+        error = iFSQ->Rename( ren005A, ren005A2 );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueNotActiveL errorIsKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+    
+    delayedBool = ( (error == KErrNone) && !err );
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueNotActiveL out") );
+    }
+
+void CAFSQTestAsynchSave::TestRenameInQueueActiveL()
+{
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTRENAMEOBJECT.006
+    // 
+    // Action : Test that rename will work ok if the queue is not empty and
+    //          the file is in the queue.  Should also check filesystem for existence?
+    //          This case checks that the file ACTIVELY being saved gets renamed.
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL in") );
+	
+    currentTest = EREN006p1;
+    numSaved = 0;
+    numToSave = 3;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+    
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName ren006A = KNibblesREN006A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, ren006A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren006A);
+        }
+
+    // Delete the file if it exists
+    TFileName ren006B = KNibblesREN006B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, ren006B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren006B);
+        }
+        
+    // Delete the file if it exists
+    TFileName ren006C = KNibblesREN006C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, ren006C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren006C);
+        }
+        
+    // Delete the file if it exists
+    TFileName ren006B2 = KNibblesREN006B2;
+    RFile deleter4;
+    TInt isDeleted4 = deleter4.Open(aFs, ren006B2, EFileRead);
+    deleter4.Close();
+    if ( isDeleted4 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL 4th exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren006B2);
+        }
+        
+    // Delete the file if it exists
+    TFileName ren006C2 = KNibblesREN006C2;
+    RFile deleter5;
+    TInt isDeleted5 = deleter5.Open(aFs, ren006C2, EFileRead);
+    deleter5.Close();
+    if ( isDeleted5 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL 5th exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren006C2);
+        }                
+
+    aFs.Close();
+
+    //delete
+    TInt errorA = 0;
+    TInt errorB = 0;
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, ren006B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, ren006C );
+        buf3 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf, ren006A );
+        buf = NULL;
+        errorA = iFSQ->Rename( ren006B, ren006B2 );
+        errorB = iFSQ->Rename( ren006C, ren006C2 );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL errorIsKErrNone=%d notErr=%d !errorA=%d !errorB=%d"), (error == KErrNone), !err, !errorA, !errorB );
+    
+    delayedBool = ( (error == KErrNone) && !err && !errorA && !errorB );
+    WaitForAsynchCompleteL();
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL out") );
+    }
+    
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/src/STIFAFSQTestBlocks.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,17 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: STIFAFSQTestBlocks.cpp
+*
+*/
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/src/StifFSQTestTop.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,354 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include "../inc/StifFSQTestTop.h"
+#include "../inc/TestFramework/testsuite.h"
+#include "../inc/AFSQTestTop.h"
+#include "../inc/AFSQTestAsynchSave.h"
+
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+           
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+    
+    This file (DemoModule.cpp) contains all STIF test framework related parts of
+    this test module.
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt SetRequirements( CTestModuleParam*& aTestModuleParam, TUint32& aParameterValid )
+    {
+    aParameterValid = KStifTestModuleParameterChanged;
+    
+    TRAP_IGNORE(
+        CTestModuleParamVer01* param = CTestModuleParamVer01::NewL();
+        
+    	// Stack size
+    	param->iTestThreadStackSize= 2*16384; // 2*16K stack
+
+    	// Heap sizes
+    	param->iTestThreadMinHeap = 4096;   // 4K heap min
+    	param->iTestThreadMaxHeap = 8*1048576;// 8M heap max
+
+    	aTestModuleParam = param;
+	);
+	
+    return KErrNone;
+    }
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+CTestModule::CTestModule()
+    {
+    }
+
+
+void CTestModule::ConstructL()
+    {  
+    iTestSuite = CTestSuite::NewL(_L8("Test Suite Container"));
+
+    iTestSuite->addTestL( CAFSQTestAsynchSave::suiteL() );    
+    
+
+    
+    // SetAllocFailureSimulation( RHeap::EDeterministic, 0 ); // Enable OOM test loop
+    SetAllocFailureSimulation( RHeap::ENone, 0 ); // Disable OOM test loop
+
+    /* Install an active scheduler */
+    iScheduler = new(ELeave)CActiveScheduler;
+    CActiveScheduler::Install(iScheduler);
+
+    }
+
+
+CTestModule* CTestModule::NewL()
+    {
+
+    // Construct new CTestModule instance.
+    CTestModule* self = new ( ELeave ) CTestModule();    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+  
+    }
+
+
+CTestModule::~CTestModule()
+    {
+    delete iTestSuite;
+    delete iScheduler;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: GetTestCases
+
+    Description: GetTestCases is used to inquire test cases 
+    from the test module. Because this test module have hard coded test cases
+    (i.e cases are not read from file), paramter aConfigFile is not used.
+
+    This function loops through all cases defined in Cases() function and 
+    adds corresponding items to aTestCases array.
+
+    Parameters: const TFileName&  : in: Configuration file name. Not used                                                       
+                RPointerArray<TTestCaseInfo>& aTestCases: out: 
+                      Array of TestCases.
+    
+    Return Values: KErrNone: No error
+
+    Errors/Exceptions: Function leaves if any memory allocation operation fails
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/      
+TInt CTestModule::GetTestCasesL( const TFileName& /*aConfigFile*/, 
+                                     RPointerArray<TTestCaseInfo>& aTestCases )
+    {
+
+    // Loop through all test cases and create new
+    // TTestCaseInfo items and append items to aTestCase array    
+    for( TInt i = 0; i< iTestSuite->CountTestCases(); i++ )
+        {
+ 
+	    // Allocate new TTestCaseInfo from heap for a testcase definition.
+        TTestCaseInfo* newCase = new( ELeave ) TTestCaseInfo();
+    
+	    // PushL TTestCaseInfo to CleanupStack.    
+        CleanupStack::PushL( newCase );
+
+	    // Set number for the testcase.
+	    // When the testcase is run, this comes as a parameter to RunTestCaseL.
+        newCase->iCaseNumber = i;
+
+	    // Set title for the test case. This is shown in UI to user.
+        newCase->iTitle.Copy( iTestSuite->TestCaseName(i) );
+
+	    // Append TTestCaseInfo to the testcase array. After appended 
+	    // successfully the TTestCaseInfo object is owned (and freed) 
+	    // by the TestServer. 
+        User::LeaveIfError(aTestCases.Append ( newCase ) );
+        
+	    // Pop TTestCaseInfo from the CleanupStack.
+        CleanupStack::Pop( newCase );
+
+        }
+    
+    return KErrNone;
+  
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: RunTestCase
+
+    Description: Run a specified testcase.
+
+    Function runs a test case specified by test case number. Test case file
+    parameter is not used.
+
+    If case number is valid, this function runs a test case returned by
+    function Cases(). 
+  
+    Parameters: const TInt aCaseNumber: in: Testcase number 
+                const TFileName& : in: Configuration file name. Not used
+                TTestResult& aResult: out: Testcase result
+    
+    Return Values: KErrNone: Testcase ran.
+                   KErrNotFound: Unknown testcase
+
+    Errors/Exceptions: None
+    
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestModule::RunTestCaseL( const TInt aCaseNumber, 
+                                    const TFileName& /*aConfig*/,
+                                    TTestResult& aResult )
+    {
+    // Next is a temporary solution for Stif memory leak error
+    //TestModuleIf().SetBehavior(CTestModuleIf::ETestLeaksMem);
+    // TestModuleIf().SetBehavior(CTestModuleIf::ETestLeaksRequests);
+    // TestModuleIf().SetBehavior(CTestModuleIf::ETestLeaksHandles);
+
+    if ( iAllocFailureType != RHeap::ENone )
+        {
+        RunTestCaseInOOMLoopL( aCaseNumber, aResult );
+        }
+    else
+        {
+        iTestSuite->ExecuteTestL( aResult, aCaseNumber );
+        }
+
+    // Return case execution status (not the result of the case execution)
+    return KErrNone; 
+    }
+
+
+/*
+*/    
+
+void CTestModule::RunTestCaseInOOMLoopL( const TInt aCaseNumber,
+                                        TTestResult& aResult )
+    {
+
+    // 
+    TInt error = KErrNone; 
+    aResult.SetResult( KErrNoMemory, _L("") ); // Initial value
+
+    for (; ( aResult.iResult == KErrNoMemory ) && !error;)
+        {      
+        // Switches on alloc failure simulation if the parameters are set for it
+        AllocFailureSimulation( ETrue ); 
+        RDebug::Print(_L("*** OOM loop : %d ***\n"), iCurrentAllocFailureRate );
+        TRAP( error, iTestSuite->ExecuteTestL( aResult, aCaseNumber ) );
+        if ( error == KErrNoMemory )
+            {
+            error = KErrNone;
+            }
+        }
+    
+    //
+    AllocFailureSimulation( EFalse );
+    User::LeaveIfError( error ); 
+    }
+
+
+/*
+*/    
+
+void CTestModule::AllocFailureSimulation (TBool aSwitchedOn)
+	{
+	if (aSwitchedOn)
+		{
+		__UHEAP_SETFAIL ( iAllocFailureType, iCurrentAllocFailureRate );
+        iCurrentAllocFailureRate++;
+		}
+	else
+		{
+		__UHEAP_RESET;
+        iCurrentAllocFailureRate = iAllocFailureRate;
+		}
+	}
+
+
+/*
+*/    
+
+void CTestModule::SetAllocFailureSimulation( RHeap::TAllocFail aAllocFailureType, TInt aAllocFailureRate )
+    {
+    iAllocFailureType = aAllocFailureType;
+    iAllocFailureRate = aAllocFailureRate;
+    iCurrentAllocFailureRate = aAllocFailureRate;
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+/*
+-------------------------------------------------------------------------------
+   
+    Function: LibEntryL
+
+    Description: Polymorphic Dll Entry Point
+    
+    Test framework calls this function to obtain new instance of test module
+    class. 
+
+    Parameters:    None
+    
+    Return Values: CTestModule*    Pointer to CTestModule instance
+    
+    Errors/Exceptions: Leaves if CTestModule::NewL leaves
+    
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CTestModule* LibEntryL()
+    {
+    return CTestModule::NewL();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+   
+    Function: E32Dll
+
+    Description: DLL entry point function
+    
+    Parameters:    TDllReason: Not used
+    
+    Return Values: KErrNone: always
+    
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+#ifndef EKA2
+GLDEF_C TInt E32Dll(TDllReason /*aReason*/)
+    {
+    return( KErrNone );
+
+    }
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/src/TestFramework/AssertFailure.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include "TestFramework/AssertFailure.h"
+
+CAssertFailure* CAssertFailure::NewL (const TDesC8& aMessage,
+                                      TInt aLineNumber,
+                                      const TDesC8& aFileName)
+    {
+    CAssertFailure* self=NewLC(aMessage, aLineNumber, aFileName);
+    CleanupStack::Pop();
+    return self;
+    }
+
+CAssertFailure* CAssertFailure::NewLC (const TDesC8& aMessage,
+                                       TInt aLineNumber,
+                                       const TDesC8& aFileName)
+
+    {
+    CAssertFailure* self = new (ELeave) CAssertFailure(aLineNumber);
+    CleanupStack::PushL(self);
+    self->ConstructL(aMessage, aFileName);
+    return self;
+    }
+
+CAssertFailure* CAssertFailure::NewL (CAssertFailure& aAssertFailure)
+    {
+    CAssertFailure* self=NewLC(aAssertFailure);
+    CleanupStack::Pop();
+    return self;
+    }
+
+CAssertFailure* CAssertFailure::NewLC (CAssertFailure& aAssertFailure)
+    {
+    CAssertFailure* self = new(ELeave)CAssertFailure;
+    CleanupStack::PushL(self);
+    self->ConstructL(aAssertFailure);
+    return self;
+    }
+
+void CAssertFailure::ConstructL (const TDesC8& aMessage,
+                                 const TDesC8& aFileName)
+    {
+    iMessage = aMessage.AllocL();
+    iFileName = aFileName.AllocL();
+    }
+
+void CAssertFailure::ConstructL (CAssertFailure& aAssertFailure)
+    {
+    iLineNumber = aAssertFailure.iLineNumber;
+    iMessage = aAssertFailure.iMessage->AllocL();
+    iFileName = aAssertFailure.iFileName->AllocL();
+    }
+
+CAssertFailure::CAssertFailure ()
+    {
+    }
+
+CAssertFailure::CAssertFailure (TInt aLineNumber)
+ : iLineNumber (aLineNumber)
+    {
+    }
+
+CAssertFailure::~CAssertFailure () 
+    {
+    delete iFileName;
+    delete iMessage;
+    }
+
+const TDesC8& CAssertFailure::What() const
+    {
+    return *iMessage;
+    }
+
+TInt CAssertFailure::LineNumber()  const
+    {
+    return iLineNumber;
+    }
+
+const TDesC8& CAssertFailure::FileName()  const
+    {
+    return *iFileName;
+    }
+
+void CAssertFailure::SetMyHeapCellCount (TInt aHeapCellCount)
+    {
+    iMyHeapCellCount = aHeapCellCount;
+    }
+
+TInt CAssertFailure::MyHeapCellCount ()
+    {
+    return iMyHeapCellCount;
+    }
+    
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/src/TestFramework/TestSuite.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include "../inc/TestFramework/TestSuite.h"
+#include <StifTestModule.h>
+
+CTestSuite* CTestSuite::NewLC (const TDesC8& aName)
+    {
+    CTestSuite* self=new(ELeave) CTestSuite();
+    CleanupStack::PushL(self);
+    self->ConstructL(aName);
+    return self;
+    }
+
+CTestSuite* CTestSuite::NewL (const TDesC8& aName)
+    {
+    CTestSuite* self=NewLC(aName);
+    CleanupStack::Pop();
+    return self;
+    }
+
+void CTestSuite::ConstructL (const TDesC8& aName)
+    {
+    iName = aName.AllocL();
+    }
+
+CTestSuite::~CTestSuite () 
+    {
+    iTests.ResetAndDestroy();
+    delete iName;
+    }
+
+void CTestSuite::addTestL (MTest* aTest)
+    {
+    User::LeaveIfError (iTests.Append(aTest));
+    }
+
+// Runs the tests and collects their result in a TestResult.
+// Deprecated.
+// Version with index should be used instead.
+void CTestSuite::ExecuteL (TTestResult& aResult)
+    {
+    for (TInt i=0; i < iTests.Count(); i++)
+        {
+        iTests[i]->ExecuteL(aResult);
+        }
+    }
+
+// Counts the number of test cases that will be run by this test.
+TInt CTestSuite::CountTestCases ()
+    {
+    TInt count = 0;
+    for (TInt i=0; i < iTests.Count(); i++)
+        {
+        count += iTests[i]->CountTestCases ();
+        }
+    return count;
+    }
+
+const TDesC8& CTestSuite::Name ()
+    {
+    return *iName;
+    }
+
+#if 1
+void CTestSuite::ExecuteTestL(TTestResult& aResult,
+                              TInt aIndex)
+    { 
+    for (TInt i=0; i< iTests.Count(); i++)
+        {
+        TInt count = iTests[i]->CountTestCases();
+        if ( aIndex > ( count - 1 ) )
+            {
+            aIndex -= count;
+            }
+        else
+            {
+            iTests[i]->ExecuteTestL(aResult, aIndex);
+            return ;
+            }
+        }
+    }
+
+const TDesC8& CTestSuite::TestCaseName (TInt aIndex)
+    {
+    for (TInt i=0; i< iTests.Count(); i++)
+        {
+        TInt count = iTests[i]->CountTestCases();
+        if ( aIndex > ( count - 1 ) )
+            {
+            aIndex -= count;
+            }
+        else
+            {
+            return ( iTests[i]->TestCaseName(aIndex) ) ;
+            }
+        }
+    // It's an error if we reached that point.
+    return(KNullDesC8);
+    }
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/asynchfilesavequeue/tsrc/public/basic/src/TestFramework/testCase.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,289 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include <utf.h>
+
+#include "../inc/TestFramework/testCase.h"
+#include "../inc/TestFramework/AssertFailure.h"
+#include <StifTestModule.h>
+
+#if 0
+#include "../inc/TestFramework/TestCase.h"
+#include "../inc/TestFramework/TestResult.h"
+#include "../inc/TestFramework/AssertFailure.h"
+#include "../inc/TestFramework/CppUnitLog.h"
+#endif
+
+// Assertion failure message formats:
+_LIT8(KIntsNotEqualFormat,"expected: %d but was: %d");
+_LIT8(KRealsNotEqualFormat,"expected: %g but was: %g");                                                    
+_LIT8(KDesCsNotEqualFormat,"expected: '%S' but was: '%S'");
+
+// A unique error code:
+const TInt KErrCppUnitAssertionFailed=(-99999999);
+
+void CTestCase::ConstructL (const TDesC8& aName)
+    {
+    iName = aName.AllocL();
+    User::LeaveIfError(Dll::SetTls(0));
+    }
+
+CTestCase::CTestCase ()
+: iAllocFailureType(RHeap::ENone),
+iAllocFailureRate(0)
+    {
+    }
+
+CTestCase::~CTestCase () 
+    { 
+    delete iName;
+    }
+
+// From MTest:
+void CTestCase::ExecuteL (TTestResult& aResult)
+    {
+    TInt error = ExecuteImplL();
+    aResult.iResult = error;
+    // add the possible failure or error to the result
+    
+    if (error == KErrCppUnitAssertionFailed)
+        {
+        CAssertFailure* assertFailure = AssertFailureFromTlsL ();
+        CleanupStack::PushL(assertFailure);
+        TBuf16 <0x80> convertBuf;
+        TBuf16 <256> temporaryBuf;
+        convertBuf.Copy(assertFailure->What());
+        temporaryBuf.Append(convertBuf);
+        temporaryBuf.AppendFormat(_L(" at Line %i of "), assertFailure->LineNumber()); 
+        convertBuf.Copy(assertFailure->FileName());
+        if (convertBuf.Length() + temporaryBuf.Length() >= 0x80)
+            {
+            TBuf <0x80> printBuf;
+            printBuf = convertBuf.Right(0x80 - temporaryBuf.Length() - 1 -3 );
+            convertBuf = _L("...");
+            convertBuf.Append(printBuf);
+            }
+        temporaryBuf.Append(convertBuf);
+        aResult.iResultDes = temporaryBuf;
+        CleanupStack::PopAndDestroy(assertFailure); 
+        }
+    }
+
+// From MTest:
+TInt CTestCase::CountTestCases ()
+    {
+    return 1;
+    }
+
+// From MTest:
+const TDesC8& CTestCase::Name ()
+    {
+    return *iName;
+    }
+
+#if 1
+// From MTest:
+void CTestCase::ExecuteTestL(TTestResult& aResult,
+                             TInt /*aIndex */)
+    { 
+    ExecuteL(aResult);
+    }
+
+const TDesC8& CTestCase::TestCaseName (TInt /*aIndex*/) 
+    {
+    return Name();
+    }
+#endif
+
+// Check for a failed general assertion 
+void CTestCase::AssertL (TBool aCondition,
+                         const TDesC8& aConditionExpression,
+                         TInt aLineNumber,
+                         const TDesC8& aFileName)
+    {
+    if (!aCondition)
+        {
+        AllocFailureSimulation(EFalse);
+        AssertFailureToTlsL (aConditionExpression,aLineNumber,aFileName);
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+// Check for a failed equality assertion
+void CTestCase::AssertEqualsL (TInt anExpected, 
+                               TInt anActual, 
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (anExpected != anActual)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = HBufC8::NewLC (KIntsNotEqualFormat().Size()+100);
+        msg->Des().Format(KIntsNotEqualFormat, anExpected, anActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+// Check for a failed equality assertion
+void CTestCase::AssertEqualsL (TReal anExpected, 
+                               TReal anActual, 
+                               TReal aDelta,
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (Abs(anExpected-anActual) > aDelta)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = HBufC8::NewLC (KRealsNotEqualFormat().Size()+100);
+        msg->Des().Format(KRealsNotEqualFormat, anExpected, anActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+// Check equality of the contents of two 8-bit descriptors 
+void CTestCase::AssertEqualsL (const TDesC8& anExpected,
+                               const TDesC8& anActual,
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (anExpected.Compare(anActual) != 0)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = NotEqualsMessageLC (anExpected, anActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+// Check equality of the contents of two 16-bit descriptors 
+void CTestCase::AssertEqualsL (const TDesC16& aExpected,
+                               const TDesC16& aActual,
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (aExpected.Compare(aActual) != 0)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = NotEqualsMessageLC (aExpected, aActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+void CTestCase::AllocFailureSimulation (TBool aSwitchedOn)
+    {
+    if (aSwitchedOn)
+        {
+        __UHEAP_SETFAIL (iAllocFailureType, iAllocFailureRate);
+        }
+    else
+        {
+        __UHEAP_RESET;
+        }
+    }
+
+TInt CTestCase::ExecuteImplL ()
+    {
+    
+    __UHEAP_MARK;
+    TRAPD (setupError, setUpL());
+    if (setupError != KErrNone)
+        {
+        tearDown();
+        __UHEAP_MARKEND;
+        User::Leave(setupError);
+        }
+    
+    TRAPD (executionError, executeTestL());
+    
+    tearDown();
+    __UHEAP_MARKENDC(HeapCellsReservedByAssertFailure());
+
+    return executionError;
+    }
+
+// Construct the message and put it in the cleanup stack
+HBufC8* CTestCase::NotEqualsMessageLC (const TDesC8& aExpected,
+                                       const TDesC8& aActual)
+    {
+    TInt size = KDesCsNotEqualFormat().Size()+aExpected.Size()+aActual.Size();
+    HBufC8 *msg = HBufC8::NewLC(size);
+    msg->Des().Format(KDesCsNotEqualFormat, &aExpected, &aActual);
+    return msg;
+    }
+
+// Construct the message and put it in the cleanup stack
+HBufC8* CTestCase::NotEqualsMessageLC (const TDesC16& aExpected,
+                                       const TDesC16& aActual)
+    {
+    TInt length = KDesCsNotEqualFormat().Length() + 
+        aExpected.Length() + aActual.Length();
+    
+    HBufC8* msg = HBufC8::NewLC(length);
+    
+    // Convert 16-bit to 8-bit to ensure readability
+    // of the output possibly directed to a file.
+    HBufC8* expected = HBufC8::NewLC(aExpected.Length());
+    expected->Des().Copy(aExpected);
+    
+    HBufC8* actual = HBufC8::NewLC(aActual.Length());
+    actual->Des().Copy(aActual);
+    
+    msg->Des().Format(KDesCsNotEqualFormat,expected,actual);
+    
+    // pop and destroy actual and expected
+    CleanupStack::PopAndDestroy(2);
+    return msg;
+    }
+
+void CTestCase::AssertFailureToTlsL (const TDesC8& aMessage,
+                                     TInt  aLineNumber,
+                                     const TDesC8& aFileName)
+    {
+    TInt cellsBefore = User::CountAllocCells();
+    CAssertFailure* assertFailure = 
+        CAssertFailure::NewLC(aMessage,aLineNumber,aFileName);
+    User::LeaveIfError(Dll::SetTls(assertFailure));
+    CleanupStack::Pop(); // assertFailure
+    TInt cellsAfter = User::CountAllocCells();
+    assertFailure->SetMyHeapCellCount(cellsAfter-cellsBefore);
+    }
+
+CAssertFailure* CTestCase::AssertFailureFromTlsL ()
+    {
+    CAssertFailure* assertFailure = static_cast<CAssertFailure*>(Dll::Tls());
+    CAssertFailure* copy = CAssertFailure::NewL(*assertFailure);
+    delete assertFailure;
+    Dll::SetTls(0);
+    return copy;
+    }
+
+TInt CTestCase::HeapCellsReservedByAssertFailure ()
+    {
+    if (Dll::Tls() == 0) return 0;
+    CAssertFailure* assertFailure = static_cast<CAssertFailure*>(Dll::Tls());
+    return assertFailure->MyHeapCellCount();
+    }
+    
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/rom/CamAppEngine.iby	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  IBY for Camera Application Engine. 
+*
+*/
+
+
+#ifndef __CAMAPPENGINE_IBY__
+#define __CAMAPPENGINE_IBY__
+
+file=ABI_DIR\BUILD_DIR\CAEENGINE.DLL            SHARED_LIB_DIR\CAEENGINE.DLL
+file=ABI_DIR\BUILD_DIR\ASYNCHFSQ.DLL            SHARED_LIB_DIR\ASYNCHFSQ.DLL
+file=ABI_DIR\BUILD_DIR\CAESTILLCONVERTER.DLL    SHARED_LIB_DIR\CAESTILLCONVERTER.DLL
+
+//data=ZSYSTEM\install\camappenginestub.sis       system\install\camappenginestub.sis
+
+#endif
Binary file camappengine/rom/CamAppEngineStub.SIS has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camappengine/rom/CamAppEngineStub.pkg	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,36 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: CamAppEngineStub.pkg
+;
+; Languages
+&EN
+
+; Header
+#{"CamAppEngine"}, (0x101F8569), 1, 0, 0
+
+;Supports Series 60 v 3.0
+;[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+;Files
+""-"z:\sys\bin\CaeEngine.dll"
+""-"z:\sys\bin\AsynchFSQ.dll"
+""-"z:\sys\bin\CaeStillConverter.dll"
+
+
--- a/camcordermmfplugin/mediarecorder/Src/CCMRAudioInput.cpp	Tue Aug 31 15:25:20 2010 +0300
+++ b/camcordermmfplugin/mediarecorder/Src/CCMRAudioInput.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -45,10 +45,6 @@
 #define PRINT(x)
 #endif
 
-// Unused parameter macro
-#define UNUSED(x) (void)x;
-
-
 #include "OstTraceDefinitions.h"
 #ifdef OST_TRACE_COMPILER_IN_USE
 #include "CCMRAudioInputTraces.h"
@@ -974,7 +970,6 @@
 //
 void CCMRAudioInput::ToneFinished(TInt aError)
     {
-    UNUSED(aError);
     PRINT((_L("CCMRAudioInput::ToneFinished(), error:%d"), aError));
     }
 
@@ -995,7 +990,6 @@
 //
 void CCMRAudioInput::PlayError(TInt aError)
     {
-    UNUSED(aError);
     PRINT((_L("CCMRAudioInput::PlayError(), error:%d"), aError));
     }
 
@@ -1035,7 +1029,6 @@
 //
 void CCMRAudioInput::ConvertError(TInt aError)
     {
-    UNUSED(aError);
     PRINT((_L("CCMRAudioInput::ConvertError(), error:%d"), aError));
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/asynchronous_file_saving_queue_api.metaxml	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<api id="f9651a3f92b94af2f2bb11754579a115" dataversion="2.0">
+<name>Asynchronous File Saving Queue API</name>
+<description>API for saving image files asynchronously</description>
+<type>c++</type>
+<collection>CamAppEngine</collection>
+<libs><lib name="asynchfsq.lib"/>
+</libs>
+<release category="platform" sinceversion="0"/>
+<attributes>
+<htmldocprovided>no</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/group/bld.inf	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File that exports the files belonging to 
+:                Asynchronous File Saving Queue API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/asynchfsq.h     MW_LAYER_PLATFORM_EXPORT_PATH(asynchfsq.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/inc/asynchfsq.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,197 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Asynchronous File Saving Queue
+*
+*/
+
+
+
+#ifndef ASYNCHFSQ_H
+#define ASYNCHFSQ_H
+
+//  INCLUDES
+#include <f32file.h>
+#include <e32base.h>
+
+
+//   FOR DEBUGGING
+#if defined (_DEBUG)
+    #include <e32svr.h>
+    #define LOGTEXT(AAA)                RDebug::Print(AAA)
+    #define LOGTEXT2(AAA,BBB)           RDebug::Print(AAA,BBB)
+    #define LOGTEXT3(AAA,BBB,CC)        RDebug::Print(AAA,BBB,CC)
+#else
+    #define LOGTEXT(AAA)                
+    #define LOGTEXT2(AAA,BBB)           
+    #define LOGTEXT3(AAA,BBB,CC)       
+#endif           
+
+
+// CONSTANTS
+
+// Type of action the FSQ will perform
+enum TFSQActionType
+    {
+    EFileSave,
+    EWebUpload,
+    EFileSaveAndWebUpload
+    };
+    
+// Web service schema definition
+enum TFSQSchemaType
+    {
+    ENullSchemaType,
+    ENokiaPictureUploadSchema1v0
+    };    
+
+
+// FORWARD DECLARATIONS
+class MAsynchFSQObserver;
+class CAsynchFSQAtom;
+
+
+// CLASS DECLARATIONS
+
+/**
+* CAsynchFSQ observer class.
+* Mixin base class for the clients of the asynchronous file manager.
+*
+* @since 3.2
+*/
+class MAsynchFSQObserver
+    {
+    public:
+
+        /**
+        * Callback function which gets called after each thread event.
+        * @return void
+        */
+        virtual void MAsynchFSQEvent( TInt aError ) = 0;
+        
+    };
+    
+/**
+* Asynchronous file manager queue and related operations.
+*
+* @since 3.2
+*/
+class CAsynchFSQ : CBase 
+    {
+
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CAsynchFSQ* NewL();
+                 
+        /**
+        * Destructor.
+        */
+        virtual ~CAsynchFSQ();
+
+    public: // New functions
+        
+        /**
+        * Starts async copy operation
+        */
+        IMPORT_C TInt SaveAndDestroy( TDesC8& aData, const TDesC& aPath,
+                                      TBool aOverwrite = ETrue );
+
+        /**
+        * Notifies the queue that the client wishes to start the thread manually
+        */ 
+        IMPORT_C void SetManualStart( TBool aManualStart );
+
+        /**
+        * Starts the saving thread
+        *   If iManualStart is not activated, this is essentially a NO-OP
+        */ 
+        IMPORT_C TInt Go();
+                            
+        /**
+        * Deletes a file from the file system
+        */ 
+        IMPORT_C TInt Delete( const TDesC& aPath );
+        
+        /**
+        * Renames a file in the file system
+        */
+        IMPORT_C TInt Rename( const TDesC& aOld, const TDesC& aNew );
+
+        /**
+        * Sets the thread priority
+        */
+        IMPORT_C void SetPriority( TInt aPriority );
+        
+        /**
+        * Sets the callback
+        */
+        IMPORT_C void SetCallback( MAsynchFSQObserver* aCallback );
+        
+        /**
+        * Returns the number of actions left for the queue to perform
+        */
+        IMPORT_C TInt ActionsLeft();
+        
+        /**
+        * Cancels any ongoing activity and clears the threads.
+        */
+        IMPORT_C void Cancel();
+        
+        /**
+        * Used to indicate a state change from a data atom
+        */
+        void Notify( TInt aError );
+        
+   private: 
+   
+        /**
+        * C++ default constructor.
+        */
+        CAsynchFSQ();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * Adds one index to the end of each queue.
+        */
+        TInt Enqueue( TFSQActionType aActionType, TDesC8& aData, 
+                      const TDesC& aPath, const TDesC& aURL, 
+                      TFSQSchemaType aSchema, const TDesC& aUserName, 
+                      const TDesC& aPassword );
+        
+    private:    // Data
+    
+        // Data queues
+        RPointerArray<CAsynchFSQAtom> iQueue;
+        
+        // Is overwriting allowed?
+        TBool iOverwrite;
+        
+        // Does the client start the activity?
+        TBool iManualStart;
+        
+        // Most recent callback
+        MAsynchFSQObserver* iCallback;
+        
+        // Performance modifiers
+        TInt iPriority;
+        
+    };
+
+#endif // CAsynchFSQ_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/Bwinscw/STIFAFSQTestu.def	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,4 @@
+EXPORTS
+	?LibEntryL@@YAPAVCTestModule@@XZ @ 1 NONAME ; class CTestModule * LibEntryL(void)
+	?SetRequirements@@YAHAAPAVCTestModuleParam@@AAK@Z @ 2 NONAME ; int SetRequirements(class CTestModuleParam * &, unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/Eabi/STIFAFSQTestu.def	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,14 @@
+EXPORTS
+	_Z9LibEntryLv @ 1 NONAME
+	_Z15SetRequirementsRP16CTestModuleParamRm @ 2 NONAME
+	_ZTI10CTestSuite @ 3 NONAME ; #<TI>#
+	_ZTI11CTestCallerI19CAFSQTestAsynchSaveE @ 4 NONAME ; #<TI>#
+	_ZTI14CAssertFailure @ 5 NONAME ; #<TI>#
+	_ZTI19CAFSQTestAsynchSave @ 6 NONAME ; #<TI>#
+	_ZTI9CTestCase @ 7 NONAME ; #<TI>#
+	_ZTV10CTestSuite @ 8 NONAME ; #<VT>#
+	_ZTV11CTestCallerI19CAFSQTestAsynchSaveE @ 9 NONAME ; #<VT>#
+	_ZTV14CAssertFailure @ 10 NONAME ; #<VT>#
+	_ZTV19CAFSQTestAsynchSave @ 11 NONAME ; #<VT>#
+	_ZTV9CTestCase @ 12 NONAME ; #<VT>#
+
Binary file camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/data/mmc/StifAFSQTest/Nibbles.jpg has changed
Binary file camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/data/mmc/StifAFSQTest/Nibbles2.jpg has changed
Binary file camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/data/mmc/StifAFSQTest/Nibbles3.jpg has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/group/StifAFSQTest.mmp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Asynchronous File Saving Queue interface/integration tests
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET        STIFAFSQTest.dll
+TARGETTYPE    dll
+
+// First UID is DLL UID, Second UID is STIF Test Framework UID
+UID             0x1000008D 0x101FB3E7
+
+CAPABILITY    CAP_GENERAL_DLL
+VENDORID      VID_DEFAULT
+
+// Define directories for the .def-files of WINS and WINSCW builds separately.
+// IMPORTANT NOTICE:  The lines in the example that end with a backslash 
+// must have one space after the backslash.
+#if defined(ARMCC)
+deffile ../Eabi/ 
+#elif defined( WINSCW )
+deffile ../Bwinscw/ 
+#elif defined( WINS )
+deffile ../Bwins/ 
+#else
+deffile ../Bmarm/ 
+#endif
+
+SOURCEPATH      ../src
+
+SOURCE          StifFSQTestTop.cpp
+SOURCE          AFSQTestAsynchSave.cpp
+SOURCE          AFSQTestAdd.cpp
+SOURCE          AFSQTestDelete.cpp
+SOURCE          AFSQTestRename.cpp
+
+// STIF TFW files
+SOURCEPATH    ../src/TestFramework
+SOURCE        testCase.cpp
+SOURCE        AssertFailure.cpp
+SOURCE        TestSuite.cpp
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../inc/TestFramework
+USERINCLUDE     ../../../../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         sysutil.lib
+LIBRARY         fbscli.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         AsynchFSQ.lib
+
+EXPORTUNFROZEN
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/group/StifAFSQTest.pkg	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,38 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: Asynchronous File Saving Queue interface/integration tests
+;
+; Languages
+; =========
+&EN
+
+; Name, UID for installation, Maj.Ver., Min.Ver., Variant, FLAG TO SPECIFY UNICODE, System component
+; ==================================================================================================
+#{"STIFAFSQTEST"},(0x101FB3E7),1,0,1,TYPE=SA
+
+
+; Localised Vendor name
+%{"Nokia-EN"}
+
+; Unique Vendor name
+:"Nokia"
+
+"\epoc32\release\armv5\urel\STIFAFSQTest.dll"      -"$:\sys\bin\STIFAFSQTest.dll"
+
+"..\data\mmc\StifAFSQTest\Nibbles.jpg"      -"F:\testing\data\StifAFSQTest\Nibbles.jpg"
+"..\data\mmc\StifAFSQTest\Nibbles2.jpg"     -"F:\testing\data\StifAFSQTest\Nibbles2.jpg"
+"..\data\mmc\StifAFSQTest\Nibbles3.jpg"     -"F:\testing\data\StifAFSQTest\Nibbles3.jpg"
+
+; eof
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/group/bld.inf	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Asynchronous File Saving Queue interface/integration tests
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTEXPORTS
+
+PRJ_EXPORTS
+
+PRJ_TESTMMPFILES
+StifAFSQTest.mmp 
+
+PRJ_MMPFILES
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/AFSQTestAsynchSave.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,201 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  AsynchFSQTest test module.
+*
+*/
+
+
+#ifndef AFSQ_TEST_ASYNCH_SAVE_H
+#define AFSQ_TEST_ASYNCH_SAVE_H
+
+
+// INCLUDES
+
+#include <e32base.h>
+#include "asynchfsq.h"
+#include "TestFramework/test.h"
+#include "TestFramework/testCase.h"
+#include "TestFramework/testCaller.h"
+#include "TestFramework/testSuite.h"
+
+// CONSTANTS
+
+enum TTestCaseNumber
+    {
+    ECONSTRUCT001p1,
+    EDESTRUCT001p1,
+    EPRIORITY001p1,
+    EADD001p1,
+    EADD002p1,
+    EADD003p1,
+    EADD004p1,
+    EADD005p1,
+    EADD006p1,
+    EADD007p1,
+    EDEL001p1,
+    EDEL002p1,
+    EDEL003p1,
+    EDEL004p1,
+    EDEL005p1,
+    EDEL006p1,
+    EREN001p1,
+    EREN002p1,
+    EREN003p1,
+    EREN004p1,
+    EREN005p1,
+    EREN006p1,
+    ECANCEL001p1
+    };
+
+
+// MACROS
+
+#define KNibbles TFileName(_L("F:\\testing\\data\\StifAFSQTest\\Nibbles.jpg"));
+#define KNibbles2 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\Nibbles2.jpg"));
+#define KNibbles3 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\Nibbles3.jpg"));
+
+#define KNibblesCANCEL001 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesADD001.jpg"));
+
+#define KNibblesADD001 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesADD001.jpg"));
+#define KNibblesADD002 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesADD002.jpg"));
+#define KNibblesADD003 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesADD003.jpg"));
+#define KNibblesADD004A TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesADD004A.jpg"));
+#define KNibblesADD004B TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesADD004B.jpg"));
+#define KNibblesADD005A TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesADD005A.jpg"));
+#define KNibblesADD005B TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesADD005B.jpg"));
+#define KNibblesADD006 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesADD006.jpg"));
+#define KNibblesADD007 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesADD007.jpg"));
+
+#define KNibblesDEL001 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL001.jpg"));
+#define KNibblesDEL002 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL002.jpg"));
+#define KNibblesDEL003A TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL003A.jpg"));
+#define KNibblesDEL003B TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL003B.jpg"));
+#define KNibblesDEL003C TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL003C.jpg"));
+#define KNibblesDEL004A TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL004A.jpg"));
+#define KNibblesDEL004B TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL004B.jpg"));
+#define KNibblesDEL004C TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL004C.jpg"));
+#define KNibblesDEL005A TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL005A.jpg"));
+#define KNibblesDEL005B TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL005B.jpg"));
+#define KNibblesDEL005C TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL005C.jpg"));
+#define KNibblesDEL006A TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL006A.jpg"));
+#define KNibblesDEL006B TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL006B.jpg"));
+#define KNibblesDEL006C TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesDEL006C.jpg"));
+
+#define KNibblesREN001A TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN001A.jpg"));
+#define KNibblesREN001B TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN001B.jpg"));
+#define KNibblesREN002A TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN002A.jpg"));
+#define KNibblesREN002B TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN002B.jpg"));
+#define KNibblesREN003A TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN003A.jpg"));
+#define KNibblesREN003B TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN003B.jpg"));
+#define KNibblesREN003C TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN003C.jpg"));
+#define KNibblesREN003A2 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN003A2.jpg"));
+#define KNibblesREN004A TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN004A.jpg"));
+#define KNibblesREN004B TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN004B.jpg"));
+#define KNibblesREN004C TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN004C.jpg"));
+#define KNibblesREN004A2 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN004A2.jpg"));
+#define KNibblesREN005A TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN005A.jpg"));
+#define KNibblesREN005B TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN005B.jpg"));
+#define KNibblesREN005C TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN005C.jpg"));
+#define KNibblesREN005A2 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN005A2.jpg"));
+#define KNibblesREN006A TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN006A.jpg"));
+#define KNibblesREN006B TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN006B.jpg"));
+#define KNibblesREN006C TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN006C.jpg"));
+#define KNibblesREN006B2 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN006B2.jpg"));
+#define KNibblesREN006C2 TFileName(_L("F:\\testing\\data\\StifAFSQTest\\NibblesREN006C2.jpg"));
+
+
+// CLASS DECLARATION
+
+class CAFSQTestAsynchSave : public CTestCase,
+                            public MAsynchFSQObserver
+    {
+    public:
+
+        CAFSQTestAsynchSave ();
+        ~CAFSQTestAsynchSave ();
+
+        // Allocate the resources for one test function
+        void setUpL ();
+
+        // Free the resources reserved in setUpL()
+        void tearDown ();
+
+        // A function to collect and return a suite of tests
+        static MTest* suiteL ();
+
+    protected:
+    
+        // stalling function
+        void WaitForAsynchCompleteL();
+
+        // Own test functions that use assertions and may leave:
+        
+        //constructor
+        void TestFileManNewLReturnsNotNullL();   
+    
+        //add
+        void TestAddEmptyObjectToQueueL();
+        void TestAddObjectToEmptyQueueL();
+        void TestAddObjectToEmptyQueueWillSaveL();
+        void TestAddObjectToNonEmptyQueueL();
+        void TestAddObjectToNonEmptyQueueWillSaveL();
+        void TestAddObjectThatExistsAlreadyL();
+        void TestAddObjectToEmptyQueueLManualStart();
+    
+        //delete
+        void TestDeleteFromEmptyNotExistL();
+        void TestDeleteFromEmptyExistsL();
+        void TestDeleteNonEmptyExistsButNotInQueueL();
+        void TestDeleteNonEmptyNotExistAndNotInQueueL();
+        void TestDeleteInQueueNotActiveL();
+        void TestDeleteInQueueActiveL();
+    
+        //destructor
+        void TestDestructorL();
+        
+        //priority
+        void TestSetPriorityL();
+        
+        //cancel
+        void TestCancelL();
+        
+        //rename
+        void TestRenameFromEmptyNotExistL();
+        void TestRenameFromEmptyExistsL();
+        void TestRenameNonEmptyExistsButNotInQueueL();
+        void TestRenameNonEmptyNotExistAndNotInQueueL();
+        void TestRenameInQueueNotActiveL();
+        void TestRenameInQueueActiveL();
+    
+    protected:  // from MAsynchFSQObserver
+    
+        void MAsynchFSQEvent( TInt aError );
+    
+    private:
+    
+        CAsynchFSQ* iFSQ;
+        CActiveScheduler* iScheduler;
+        TTestCaseNumber currentTest;
+        TBool delayedBool;
+        TBool wait;
+        // Needed for synchronization
+        RMutex iMutex;
+        TInt assertion;
+        TInt numSaved;
+        TInt numToSave;
+        
+    };
+
+#endif // AFSQ_TEST_ASYNCH_SAVE_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/AFSQTestTop.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#ifndef AFSQ_TEST_TOP_H
+#define AFSQ_TEST_TOP_H
+
+#include <e32base.h>
+#include "TestFramework/test.h"
+#include "TestFramework/testCase.h"
+#include "TestFramework/testCaller.h"
+#include "TestFramework/testSuite.h"
+
+EXPORT_C  MTest* CreateTopFct();
+
+class CAFSQTestTop : public CTestSuite
+    {
+    public:
+	    CAFSQTestTop();
+        ~CAFSQTestTop();
+
+	    // A function to collect and return a suite of tests
+	    static MTest* suiteL();
+
+    protected:
+
+    private:
+
+    };
+
+#endif // AFSQ_TEST_TOP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/STIFAFSQTest.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef STIFAFSQTEST_H
+#define STIFAFSQTEST_H
+
+//  INCLUDES
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+
+// CONSTANTS
+
+// MACROS
+
+// Logging path
+_LIT( KSTIFAFSQTestLogPath, "\\logs\\testframework\\STIFAFSQTest\\" ); 
+// Log file
+_LIT( KSTIFAFSQTestLogFile, "STIFAFSQTest.txt" ); 
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class CSTIFAFSQTest;
+
+// DATA TYPES
+
+// CLASS DECLARATION
+
+/**
+*  CSTIFAFSQTest test class for STIF Test Framework TestScripter.
+*  This STIF test module provides basic FSQ tests 
+*
+*  @lib STIFAFSQTest.dll
+*  @since Series60_31
+*/
+NONSHARABLE_CLASS(CSTIFAFSQTest) : public CScriptBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static STIFAFSQTest* NewL( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * Destructor.
+        */
+        virtual ~STIFAFSQTest();
+
+    public: // New functions
+
+    public: // Functions from base classes
+
+        /**
+        * From CScriptBase Runs a script line 
+        * @since Series60_31
+        * @param aItem Script line containing method name and parameters
+        * @return Symbian OS error code
+        */
+        virtual TInt RunMethodL( CStifItemParser& aItem );
+
+    protected:  // New functions
+
+    protected:  // Functions from base classes
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CWLANTests( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        // Prohibit copy constructor if not deriving from CBase.
+        // ?classname( const ?classname& );
+        // Prohibit assigment operator if not deriving from CBase.
+        // ?classname& operator=( const ?classname& );
+
+        /**
+        * Frees all resources allocated from test methods.
+        * @since Series60_31
+        */
+        void Delete();
+
+        /**
+        * Test methods are listed below. 
+        */
+        virtual TInt SearchNetworkL( CStifItemParser& aItem );
+        
+
+    public:     // Data
+
+    protected:  // Data
+
+    private:    // Data
+       
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+    public:     // Friend classes
+       
+    protected:  // Friend classes
+       
+    private:    // Friend classes
+       
+    };
+
+#endif      // STIFAFSQTEST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/StifFSQTestTop.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#ifndef DEMOMODULE_H
+#define DEMOMODULE_H
+
+// INCLUDES
+#if defined (_MSC_VER) && (_MSC_VER >= 1000)
+#pragma once
+#endif
+
+#include <StifTestModule.h>
+#include "TestFramework/testSuite.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CTestModule;
+class TCaseInfo;
+
+// CLASS DECLARATION
+ 
+
+// DESCRIPTION
+// Demo testmodule class definition.
+NONSHARABLE_CLASS( CTestModule ) 
+        :public CTestModuleBase
+    {
+    public: // Enumerations
+    	// None
+
+    private: // Enumerations
+    	// None
+
+    public: // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CTestModule* NewL();
+        
+        /**
+        * Destructor.
+        */
+        ~CTestModule();
+
+    public: // New functions
+        // None
+        
+    public: // Functions from base classes
+
+        /**
+        * Test cases are inquired from the Test Module by calling GetTestCases. 
+        * Test cases are appended to RPointerArray<TTestCaseInfo>& aTestCases
+        * that is a list consisting of several TTestCaseInfo objects.
+        */
+        TInt GetTestCasesL( const TFileName& aConfigFile, 
+            RPointerArray<TTestCaseInfo>& aTestCases );
+        /**
+        * RunTestCase is used to run an individual test case.
+        */
+        TInt RunTestCaseL( const TInt aCaseNumber, 
+                          const TFileName& aConfig,
+                          TTestResult& aResult );
+        
+    protected: // New functions
+    	// None
+    	
+    protected: // Functions from base classes
+        // None
+    	
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CTestModule();
+
+        /**
+        * Symbian OS constructor.
+        */
+        void ConstructL();        
+
+        /**
+        * Function returning test case name and pointer to test case function
+        */
+        const TCaseInfo Case ( const TInt aCaseNumber ) const;
+
+        void SetAllocFailureSimulation( RHeap::TAllocFail aAllocFailureType, TInt aAllocFailureRate );
+        void AllocFailureSimulation ( TBool aSwitchedOn );
+
+        void RunTestCaseInOOMLoopL( const TInt aCaseNumber, TTestResult& aResult );
+            
+    private: // Data
+
+       CTestSuite *iTestSuite ;
+       CActiveScheduler* iScheduler;
+       RHeap::TAllocFail iAllocFailureType;
+       TInt iAllocFailureRate;    	    	  	
+       TInt iCurrentAllocFailureRate;    	    	  	
+    };
+
+
+
+
+#endif // DEMOMODULE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/TestFramework/AssertFailure.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef __CPPUNIT_ASSERT_FAILURE_H
+#define __CPPUNIT_ASSERT_FAILURE_H
+
+#include <e32base.h>
+
+_LIT8(KCppUnitUnknownFilename, "-unknown-");
+const TInt KCppUnitUnknownLineNumber=(-1);
+
+
+class CAssertFailure : public CBase
+	{
+public:
+
+	static CAssertFailure* NewL (const TDesC8& aMessage,
+	                             TInt aLineNumber=KCppUnitUnknownLineNumber,
+	                             const TDesC8& aFileName=KCppUnitUnknownFilename);
+
+	static CAssertFailure* NewLC (const TDesC8& aMessage,
+	                              TInt aLineNumber=KCppUnitUnknownLineNumber,
+	                              const TDesC8& aFileName=KCppUnitUnknownFilename);
+
+	static CAssertFailure* NewL (CAssertFailure& aAssertFailure);
+
+	static CAssertFailure* NewLC (CAssertFailure& aAssertFailure);
+
+    ~CAssertFailure ();
+
+    const TDesC8& What() const;
+    TInt LineNumber() const;
+    const TDesC8& FileName() const;
+
+	void SetMyHeapCellCount (TInt aHeapCellCount);
+	TInt MyHeapCellCount ();
+
+private:
+
+    CAssertFailure ();
+    CAssertFailure (TInt aLineNumber);
+    void ConstructL (const TDesC8& aMessage, const TDesC8& aFileName);
+    void ConstructL (CAssertFailure& aAssertFailure);
+
+    HBufC8* iMessage;
+    TInt  iLineNumber;
+    HBufC8* iFileName;
+	TInt iMyHeapCellCount;
+	};
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/TestFramework/TestResult.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef __CPPUNIT_TESTRESULT_H
+#define __CPPUNIT_TESTRESULT_H
+
+#include <e32base.h>
+
+class MTest;
+class CAssertFailure;
+class CTestFailure;
+
+
+/*
+ * A CTestResult collects the results of executing a test case. It is an 
+ * instance of the Collecting Parameter pattern.
+ *
+ * The test framework distinguishes between failures and errors.
+ * A failure is anticipated and checked for with assertions. Errors are
+ * unanticipated problems that are caused by "leaves" that are not generated
+ * by the framework.
+ *
+ * see MTest
+ */
+
+class CTestResult : public CBase
+	{
+public:
+
+	IMPORT_C static CTestResult* NewLC();
+	IMPORT_C static CTestResult* NewL();
+
+    IMPORT_C ~CTestResult ();
+
+    IMPORT_C TInt TestCount ();
+    IMPORT_C RPointerArray<CTestFailure>& Errors ();
+    IMPORT_C RPointerArray<CTestFailure>& Failures ();
+    IMPORT_C TBool WasSuccessful ();
+
+	void IncrementTestCount ();
+    void AddErrorL (MTest& aTest, TInt aError);
+    void AddFailureL (MTest& aTest, CAssertFailure* aAssertFailure);
+
+private:
+
+	void ConstructL ();
+	CTestResult ();
+
+    RPointerArray<CTestFailure> iErrors;
+    RPointerArray<CTestFailure> iFailures;
+	TInt iTestCount; 
+	};
+
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/TestFramework/test.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef __CPPUNIT_MTEST_H
+#define __CPPUNIT_MTEST_H
+
+#include <e32base.h>
+#include <StifTestModule.h>
+class CCppUnitLog;
+
+
+// A MTest can be run and collect its results. See CTestResult.
+//
+class MTest
+	{
+public:
+
+	virtual ~MTest() { }
+
+    virtual void ExecuteL (TTestResult& aResult) = 0;
+    
+	virtual TInt CountTestCases () = 0;
+    
+	virtual const TDesC8& Name () = 0;
+
+    // Same functions with an Index.
+    virtual void ExecuteTestL(TTestResult& aResult,
+                      TInt aIndex) = 0;
+
+    virtual const TDesC8& TestCaseName (TInt aIndex) = 0;
+	};
+
+// All the polymorphic DLLs containing tests should use the following UID:
+//
+const TInt KCppUnitTestDllUidValue=0x101F5380;
+const TUid KCppUnitTestDllUid={KCppUnitTestDllUidValue};
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/TestFramework/testCaller.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef CPPUNIT_TESTCALLER_H
+#define CPPUNIT_TESTCALLER_H
+
+#include "TestFramework/testCase.h"
+
+
+/* 
+ * A test caller provides access to a test case method 
+ * on a test case class.  Test callers are useful when 
+ * you want to run an individual test or add it to a suite.
+ * 
+ * Here is an example:
+ * 
+ * class CMathTest : public CTestCase 
+ * {
+ *     public:
+ *         void         setUpL ();
+ *         void         tearDown ();
+ *
+ *     protected:
+ *         void         testAddL ();
+ *         void         testSubtractL ();
+ * };
+ *
+ * CTest* CMathTest::suiteL () 
+ * {
+ *     CTestSuite *suite = CTestSuite::NewL();
+ *     suite->addTestL(CTestCaller<MathTest>::NewL(_L("testAddL") testAddL));
+ *     suite->addTestL(CTestCaller<MathTest>::NewL(_L("testSubtractL") testSubtractL));
+ *     return suite;
+ * }
+ *
+ * You can use a CTestCaller to bind any test method on a CTestCase
+ * class, as long as it does not have parameters and returns void.
+ * 
+ * See CTestCase
+ */
+
+
+template <class Fixture> class CTestCaller : public CTestCase
+	{
+public:
+
+    typedef void (Fixture::*TestMethod)();
+
+    static CTestCaller* NewLC (const TDesC8& aName, TestMethod aTest);
+    static CTestCaller* NewL (const TDesC8& aName, TestMethod aTest);
+	~CTestCaller();
+
+protected:
+ 
+    // From CTestCase:
+    void setUpL ()       { iFixture->setUpL (); }
+    void executeTestL () { (iFixture->*iTest)(); } 
+    void tearDown ()     { iFixture->tearDown (); }
+
+private:
+
+    CTestCaller (TestMethod aTest) : iTest(aTest) { }
+    void ConstructL (const TDesC8& aName);
+
+    TestMethod iTest;
+    Fixture    *iFixture;
+	};
+
+
+template <class Fixture>
+CTestCaller<Fixture>* CTestCaller<Fixture>::NewLC (const TDesC8& aName,
+                                                   TestMethod aTest)
+	{
+	CTestCaller* self = new(ELeave) CTestCaller(aTest);
+	CleanupStack::PushL(self);
+	self->ConstructL(aName);
+	return self;
+	}
+
+template <class Fixture> 
+CTestCaller<Fixture>* CTestCaller<Fixture>::NewL (const TDesC8& aName,
+                                                  TestMethod aTest)
+	{
+	CTestCaller* self = NewLC(aName, aTest);
+	CleanupStack::Pop();
+	return self;
+	}
+
+
+template <class Fixture>
+void CTestCaller<Fixture>::ConstructL (const TDesC8& aName)
+	{
+	CTestCase::ConstructL(aName);
+	iFixture = new(ELeave)Fixture;
+	}
+
+
+template <class Fixture>
+CTestCaller<Fixture>::~CTestCaller () 
+	{
+	delete iFixture;
+	}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/TestFramework/testCase.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,200 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef __CPPUNIT_CTESTCASE_H
+#define __CPPUNIT_CTESTCASE_H
+
+#include <e32base.h>
+#include "TestFramework/test.h"
+#include <StifTestModule.h>
+class CAssertFailure;
+class CTestResult;
+class CppUnitLog;
+
+/*
+ * A test case defines the fixture to run multiple tests. To define a test case
+ * 1) implement a subclass of CTestCase
+ * 2) define instance variables that store the state of the fixture
+ * 3) initialize the fixture state by overriding setUp
+ * 4) clean-up after a test by overriding tearDown.
+ *
+ * Each test runs in its own fixture so there can be no side effects 
+ * among test runs. Here is an example:
+ * 
+ * class CMathTest : public CTestCase 
+ * {
+ *     public:
+ *
+ *     void setUpL () 
+ *     {
+ *         iValue1 = 2;
+ *         iValue2 = 3;
+ *     }
+ *     
+ *     private:
+ *
+ *     TInt iValue1, iValue2;
+ * }
+ * 
+ * For each test implement a method which interacts with the fixture.
+ * Verify the expected results with assertions specified
+ * by calling assert on the expression you want to test:
+ * 
+ *    protected: 
+ *    void testAddL ()
+ *    {
+ *        TInt result = value1 + value2;
+ *        assertL (result == 5);
+ *    }
+ * 
+ * The tests to be run can be collected into a CTestSuite:
+ * 
+ * public: 
+ * static CMathTest::suiteL ()
+ * {
+ *      CTestSuite *suiteOfTests = CTestSuite::NewL(_L8("aSuite"));
+ *      suiteOfTests->addTestL(CTestCaller<MathTest>::NewL(_L8("testAddL"), testAddL));
+ *      return suiteOfTests;
+ * }
+ *
+ * see CTestSuite and CTestCaller
+ *
+ */
+
+
+class CTestCase : public MTest, public CBase 
+	{
+public:
+
+     ~CTestCase ();
+
+    // From MTest:
+     void ExecuteL (TTestResult& aResult);
+
+	// From MTest:
+     TInt CountTestCases ();
+	
+	// From MTest:
+     const TDesC8& Name ();
+
+    // From MTest:
+     void ExecuteTestL(TTestResult& aResult,
+                      TInt aIndex);
+
+    // From MTest:
+     const TDesC8& TestCaseName (TInt aIndex);
+
+protected:
+
+     virtual void ConstructL (const TDesC8& aName);
+
+     void AssertL (TBool aCondition, 
+                           const TDesC8& aConditionExpression,
+                           TInt  aLineNumber,
+                           const TDesC8& aFileName);
+
+     void AssertEqualsL (TInt  aExpected, 
+                                 TInt  aActual,
+                                 TInt  aLineNumber,
+                                 const TDesC8& aFileName);
+
+     void AssertEqualsL (TReal aExpected,
+                                 TReal aActual, 
+                                 TReal aDelta, 
+                                 TInt  aLineNumber,
+                                 const TDesC8& aFileName);
+
+     void AssertEqualsL (const TDesC8&  aExpected, 
+                                 const TDesC8&  aActual,
+                                 TInt           aLineNumber,
+                                 const          TDesC8& aFileName);
+
+     void AssertEqualsL (const TDesC16& aExpected, 
+                                 const TDesC16& aActual,
+                                 TInt           aLineNumber,
+                                 const          TDesC8& aFileName);
+
+	 void AllocFailureSimulation (TBool aSwitchedOn);
+
+    virtual void setUpL () = 0;
+    virtual void executeTestL () { }
+    virtual void tearDown () = 0;
+
+	 CTestCase ();
+
+private:
+
+	TInt ExecuteImplL ();
+
+    HBufC8* NotEqualsMessageLC (const TDesC8& aExpected,
+                                const TDesC8& aActual);
+
+    HBufC8* NotEqualsMessageLC (const TDesC16& aExpected,
+                                const TDesC16& aActual);
+
+	void AssertFailureToTlsL (const TDesC8& aMessage,
+	                          TInt  aLineNumber,
+	                          const TDesC8& aFileName);
+
+	CAssertFailure* AssertFailureFromTlsL ();
+
+	TInt HeapCellsReservedByAssertFailure ();
+
+    // data
+    HBufC8* iName;
+	RHeap::TAllocFail iAllocFailureType;
+	TUint iAllocFailureRate;
+	};
+
+
+// A set of macros which allow us to get the line number
+// and file name at the point of an assertion failure:
+
+#undef assertL
+#define assertL(condition)\
+        (this->AssertL ((condition), TPtrC8((TText8*)(#condition)),\
+                        __LINE__, TPtrC8((TText8*)__FILE__)))
+
+// Macros for primitive value comparisons
+#define assertTIntsEqualL(expected,actual)\
+        (this->AssertEqualsL ((expected), (actual),\
+                              __LINE__, TPtrC8((TText8*)__FILE__)))
+
+#define assertTRealsEqualL(expected,actual,delta)\
+        (this->AssertEqualsL ((expected), (actual), (delta),\
+                              __LINE__,TPtrC8((TText8*)__FILE__)))
+
+
+// Macros for descriptor comparisons
+#define assertTDesC8sEqualL(expected,actual)\
+        (this->AssertEqualsL ((expected), (actual),\
+                              __LINE__, TPtrC8((TText8*)__FILE__)))
+
+#define assertTDesC16sEqualL(expected,actual)\
+        (this->AssertEqualsL ((expected), (actual),\
+                              __LINE__, TPtrC8((TText8*)__FILE__)))
+
+#if defined(_UNICODE)
+#define assertTDesCsEqualL(expected,actual) assertTDesC16sEqualL(expected,actual)
+#else
+#define assertTDesCsEqualL(expected,actual) assertTDesC8sEqualL(expected,actual)
+#endif
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/inc/TestFramework/testSuite.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+
+#ifndef __CPPUNIT_CTESTSUITE_H
+#define __CPPUNIT_CTESTSUITE_H
+
+#include <e32base.h>
+#include "TestFramework/test.h"
+
+class TestResult;
+class CppUnitLog;
+
+/*
+* A CTestSuite is a Composite of MTests.
+* It runs a collection of test cases.
+*
+* see MTest and CTestCaller
+*/
+
+
+class CTestSuite : public MTest, public CBase
+    {
+    public:
+        
+        static CTestSuite* NewLC(const TDesC8& aName);
+        static CTestSuite* NewL(const TDesC8& aName);
+        ~CTestSuite ();
+        
+        void addTestL (MTest *aTest);
+        
+        // From MTest:
+        void ExecuteL (TTestResult& aResult);
+        
+        // From MTest:
+        TInt CountTestCases ();
+        
+        // From MTest:
+        const TDesC8& Name ();
+        
+        
+        // From MTest:
+        void ExecuteTestL(TTestResult& aResult,
+            TInt aIndex);
+        
+        // From MTest:
+        const TDesC8& TestCaseName (TInt aIndex);
+        
+    private:
+        
+        void ConstructL (const TDesC8& aName);
+        CTestSuite () { }
+        
+        RPointerArray<MTest> iTests;
+        HBufC8 *iName;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/AFSQTestAdd.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,530 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include "../inc/AFSQTestAsynchSave.h"
+#include <f32file.h> // for opening / creating files
+#include <bautils.h> // for deleting files
+
+void CAFSQTestAsynchSave::TestAddEmptyObjectToQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.001
+    // 
+    // Action : Test that adding an null object to the queue will return an error.
+    //      
+    // Output : An error code.   
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddEmptyObjectToQueueL in") );
+
+    TInt error = KErrNone;
+    currentTest = EADD001p1;
+    numSaved = 0;
+    wait = ETrue;
+    
+    HBufC8 * myData = HBufC8::NewL(1000);
+    delete myData;
+    myData = NULL;
+    
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        TFileName add001 = KNibblesADD001;
+        error = iFSQ->SaveAndDestroy( *myData, add001);
+        );
+    TRAPD( err2,
+        delete iFSQ;
+        iFSQ = NULL;
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddEmptyObjectToQueueL isKErrArgument=%d notErr=%d notErr2=%d"), (error == KErrArgument), !err, !err2 );
+    
+    //do not delay assert because queue should not be active
+    assertL( (error == KErrArgument) && !err && !err2);
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddEmptyObjectToQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.002
+    // 
+    // Action : Test that adding an object to an empty queue will at least start OK.
+    //      
+    // Output : An error code.  
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL in") );
+
+    TInt error = KErrNone;
+    currentTest = EADD002p1;
+    numSaved = 0;
+    wait = ETrue;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+    
+    // Delete the file if it exists
+    TFileName add002 = KNibblesADD002;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, add002, EFileRead);
+    deleter.Close();
+
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add002);
+        }
+    aFs.Close();
+    
+    // Save    
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();        
+        //add this as a callback
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf, add002 );
+        buf = NULL; // transfer ownership 
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL isKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+   
+    delayedBool = ( (error == KErrNone) && !err );
+    //wait for callback to assert
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestAddObjectToEmptyQueueWillSaveL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.003
+    // 
+    // Action : Test that adding an object to an empty queue will finish OK.
+    //      
+    // Output : Asynchronous report.    
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueWillSaveL in") );
+
+    currentTest = EADD003p1;
+    numSaved = 0;
+    wait = ETrue;
+    
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+    
+    // Delete the file if it exists
+    TFileName add003 = KNibblesADD003;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, add003, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add003);
+        }
+    aFs.Close();
+    
+    TRAP_IGNORE(  
+        iFSQ = CAsynchFSQ::NewL();
+        //add this as a callback
+        iFSQ->SetCallback( this );
+        iFSQ->SaveAndDestroy( *buf, add003 );
+        buf = NULL; // transfer ownership
+        );
+    
+    //wait for callback to assert
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueWillSaveL out") );
+    }
+
+void CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.004
+    // 
+    // Action : Test that adding an object to a non empty queue will at least start OK.
+    //      
+    // Output : An error code.
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueL in") );
+
+    TInt error = KErrNone;
+    TInt error2 = KErrNone;
+    currentTest = EADD004p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+   
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+
+    // Delete the file if it exists
+    TFileName add004A = KNibblesADD004A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, add004A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add004A);
+        }
+
+    // Delete the file if it exists
+    TFileName add004B = KNibblesADD004B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, add004B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add004B);
+        }
+    aFs.Close();
+
+    // Save    
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf, add004A );
+        buf = NULL; // transfer ownership
+        error2 = iFSQ->SaveAndDestroy( *buf2, add004B );
+        buf2 = NULL; // transfer ownership
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueL isKErrNone=%d is2KErrNone=%d notErr=%d"), (error == KErrNone), (error2 == KErrNone), !err );
+    
+    delayedBool = ( (error == KErrNone) && (error2 == KErrNone) && (!err) );
+    //wait for callback to assert
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueWillSaveL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.005
+    // 
+    // Action : Test that adding an object to a non empty queue will finish OK.
+    //      
+    // Output : Asynchronous report.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueWillSaveL in") );
+
+    //TInt error = KErrNone;
+    currentTest = EADD005p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+    
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+
+    // Delete the file if it exists
+    TFileName add005A = KNibblesADD005A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, add005A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueWillSaveL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add005A);
+        }
+
+    // Delete the file if it exists
+    TFileName add005B = KNibblesADD005B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, add005B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueWillSaveL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add005B);
+        }
+    aFs.Close();
+
+    // Save    
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        iFSQ->SaveAndDestroy( *buf, add005A );
+        buf = NULL; // transfer ownership
+        iFSQ->SaveAndDestroy( *buf2, add005B );
+        buf2 = NULL; // transfer ownership
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueWillSaveL notErr=%d"), !err );
+    
+    //wait for callback to assert
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToNonEmptyQueueWillSaveL out") );
+    }
+
+void CAFSQTestAsynchSave::TestAddObjectThatExistsAlreadyL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.006
+    // 
+    // Action : Test that adding an object to an empty queue which exists int the file
+    //          system will report KErrAlreadyExists.
+    //      
+    // Output : An error code.  
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectThatExistsAlready in") );
+
+    TInt error = KErrNone;
+    currentTest = EADD006p1;
+    numSaved = 0;
+    wait = ETrue;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Delete the file if it exists
+    TFileName add006 = KNibblesADD006;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, add006, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectThatExistsAlreadyL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add006);
+        }
+    aFs.Close();
+
+    // Write the file to be used in testing
+    TInt err2 = KErrNone;
+    RFs fsSession;
+    err2 = fsSession.Connect();
+    RFile myFile;
+    if ( !err2 )
+        {
+        err2 = myFile.Create( fsSession, add006, 
+                             EFileStream | EFileShareExclusive | EFileWrite );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Write( myData );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Flush();
+        }
+	myFile.Close();
+	fsSession.Close();
+	
+    // Reuse the file name, to write where it exists.
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        //add this as a callback
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf, add006, EFalse );
+        buf = NULL; // transfer ownership 
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectThatExistsAlreadyL isKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+   
+    delayedBool = ( (error == KErrNone) && !err );
+    //wait for callback to assert
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectThatExistsAlreadyL out") );
+    }
+
+
+void CAFSQTestAsynchSave::TestAddObjectToEmptyQueueLManualStart()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTADDOBJECT.007
+    // 
+    // Action : Test that adding an object to an empty manual queue will be OK.
+    //      
+    // Output : An error code.  
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueLManualStart in") );
+
+    TInt error = KErrNone;
+    TInt error2 = KErrNone;
+    currentTest = EADD007p1;
+    numSaved = 0;
+    wait = ETrue;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+    
+    // Delete the file if it exists
+    TFileName add007 = KNibblesADD007;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, add007, EFileRead);
+    deleter.Close();
+
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+        RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueLManualStart exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, add007);
+        }
+    aFs.Close();
+    
+    // Save    
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();        
+        //add this as a callback
+        iFSQ->SetCallback( this );
+        iFSQ->SetManualStart( ETrue );
+        error = iFSQ->SaveAndDestroy( *buf, add007 );
+        buf = NULL; // transfer ownership 
+        error2 = iFSQ->Go();
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueLManualStart isKErrNone=%d notErr=%d"), ((error == KErrNone) && (error2 == KErrNone)), !err );
+   
+    delayedBool = ( (error == KErrNone) && (error2 == KErrNone) && !err );
+    //wait for callback to assert
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestAddObjectToEmptyQueueLManualStart out") );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/AFSQTestAsynchSave.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,636 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include "../inc/AFSQTestAsynchSave.h"
+#include <f32file.h> // for opening / creating files
+#include <bautils.h> // for deleting files
+
+CAFSQTestAsynchSave::CAFSQTestAsynchSave()
+    {
+    RDebug::Print( _L("CAFSQTestAsynchSave::CAFSQTestAsynchSave in") );
+    
+    // Create a mutex for synchronization purpose
+    iMutex.CreateLocal();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::CAFSQTestAsynchSave out") );
+    }
+
+CAFSQTestAsynchSave::~CAFSQTestAsynchSave()
+    {
+    // Nothing to do
+    }
+
+void CAFSQTestAsynchSave::setUpL()
+    {
+    RDebug::Print( _L("CAFSQTestAsynchSave::setUpL in") );
+    }
+
+void CAFSQTestAsynchSave::tearDown()
+    {
+    RDebug::Print( _L("CAFSQTestAsynchSave::tearDown in") );
+    }
+
+void CAFSQTestAsynchSave::TestFileManNewLReturnsNotNullL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTFILEMANNEWLRETURNSNOTNULL.001
+    // 
+    // Action : Test that cfileman::newl returns a value.
+    //      
+    // Output : A handle to the requested object.   
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestFileManNewLReturnsNotNullL in") );
+
+    currentTest = ECONSTRUCT001p1;
+    wait = ETrue;
+
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestFileManNewLReturnsNotNullL isNotNull=%d notErr=%d"), (iFSQ!=NULL), !err);
+    assertL( (iFSQ != NULL) && !err );
+    delete iFSQ;
+    iFSQ = NULL;
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestFileManNewLReturnsNotNullL out") );
+    }
+
+void CAFSQTestAsynchSave::TestDestructorL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDESTRUCTOR.001
+    // 
+    // Action : Test that delete works
+    //      
+    // Output : KErrNone on all fronts.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDestructorL in") );
+
+    currentTest = EDESTRUCT001p1;
+    wait = ETrue;
+
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        delete iFSQ;
+        iFSQ = NULL;
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDestructorL notErr=%d"), !err );
+    
+    assertL( !err );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDestructorL out") );
+    }
+    
+void CAFSQTestAsynchSave::TestSetPriorityL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTSETPRIORITY.001
+    // 
+    // Action : Test that setting the priority doesn't fail
+    //      
+    // Output : KErrNone on all fronts.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestSetPriorityL in") );
+
+    currentTest = EPRIORITY001p1;
+    wait = ETrue;
+
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetPriority( EPriorityMore );
+        delete iFSQ;
+        iFSQ = NULL;
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestSetPriorityL notErr=%d"), !err );
+    
+    assertL( !err );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestSetPriorityL out") );
+    }   
+    
+void CAFSQTestAsynchSave::TestCancelL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTCANCEL.001
+    // 
+    // Action : Test that canceling will....
+    //      
+    // Output : An error code.   
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestCancelL in") );
+
+    TInt error = KErrNone;
+    currentTest = ECANCEL001p1;
+    numSaved = 0;
+    wait = ETrue;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+    
+    // Delete the file if it exists
+    TFileName cancel001 = KNibblesCANCEL001;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, cancel001, EFileRead);
+    deleter.Close();
+
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+        RDebug::Print( _L("CAFSQTestAsynchSave::TestCancelL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, cancel001);
+        }
+    aFs.Close();
+    
+    // Save    
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();        
+        //add this as a callback
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf, cancel001 );
+        buf = NULL; // transfer ownership 
+        iFSQ->Cancel();
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestCancelL isKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+   
+    // do not wait for callback to assert, since we have canceled
+    delayedBool = ( (error == KErrNone) && !err );
+    assertL( delayedBool );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestCancelL out") );
+    }
+    
+void CAFSQTestAsynchSave::WaitForAsynchCompleteL()
+    {
+    RDebug::Print( _L("CAFSQTestAsynchSave::WaitForAsynchCompleteL in") );
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::WaitForAsynchCompleteL starting AS now") );
+    CActiveScheduler::Start();
+        
+    RDebug::Print( _L("CAFSQTestAsynchSave::WaitForAsynchCompleteL closing") );
+    //close up and assert
+    User::After( TTimeIntervalMicroSeconds32(1000000) );
+    if( iFSQ )
+        {
+        delete iFSQ;
+        iFSQ = NULL; 
+        }
+        
+    RDebug::Print( _L("CAFSQTestAsynchSave::WaitForAsynchCompleteL we are asserting the following: %d"), assertion );
+        
+    assertL( assertion );
+       
+    RDebug::Print( _L("CAFSQTestAsynchSave::WaitForAsynchCompleteL out") );
+    }
+
+void CAFSQTestAsynchSave::MAsynchFSQEvent( TInt aError )
+    {
+    RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent in, waiting"));
+    User::After( TTimeIntervalMicroSeconds32(2000000) );
+    RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent in, done waiting"));
+
+    numSaved++;
+    RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent in, numToSave=%d"),numToSave);
+
+    switch( currentTest )
+        {
+        case EADD002p1:
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(2) delayedBool=%d !aError=%d"), delayedBool, !aError );
+            CActiveScheduler::Stop();
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(2)"));
+    
+            assertion = ( delayedBool && !aError );
+            break;
+            
+        case EADD003p1:
+            {
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(3)"));
+            CActiveScheduler::Stop();
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(3)"));
+            
+            //check that the file exists
+            RFs fsSession;
+            TInt connectErr = fsSession.Connect();
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(3) connectErr=%d"), connectErr );
+            RFile file;
+            TFileName add003 = KNibblesADD003;
+            TInt fileErr = file.Open(fsSession, add003, EFileRead);
+            file.Close();
+            fsSession.Close();
+
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(3) aErrorIsKErrNone=%d !fileErr=%d"), (aError == KErrNone), !fileErr );
+            assertion = ( (aError == KErrNone) && !fileErr);
+            break;        
+            }           
+        case EADD004p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(4)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(4)"));
+                
+                //check that the file exists
+                RFs fsSession;
+                TInt connectErr = fsSession.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(4) connectErr=%d"), connectErr );
+                RFile file1;
+                RFile file2;
+                TFileName add004A = KNibblesADD004A;
+                TFileName add004B = KNibblesADD004B;
+                TInt fileErr1 = file1.Open(fsSession, add004A, EFileRead);
+                TInt fileErr2 = file2.Open(fsSession, add004B, EFileRead);
+                file1.Close();
+                file2.Close();
+                fsSession.Close();
+
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(4) delayedBool=%d !aError=%d !fileErr1=%d !fileErr2=%d"), delayedBool, !aError, !fileErr1, !fileErr2 );
+                assertion = ( delayedBool && !aError && !fileErr1 && !fileErr2);
+                }
+            break;
+            }
+        case EADD005p1:
+            {        
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(5)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(5)"));
+                
+                //check that the file exists
+                RFs fsSession;
+                TInt connectErr = fsSession.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(5) connectErr=%d"), connectErr );
+                RFile file1;
+                RFile file2;
+                TFileName add005A = KNibblesADD005A;
+                TFileName add005B = KNibblesADD005B;
+                TInt fileErr1 = file1.Open(fsSession, add005A, EFileRead);
+                TInt fileErr2 = file2.Open(fsSession, add005B, EFileRead);
+                file1.Close();
+                file2.Close();
+                fsSession.Close();
+                    
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(5) isaErrorKErrNone=%d"), (aError==KErrNone) );
+                assertion = ( aError == KErrNone );
+                }
+            break;
+            }        
+        case EADD007p1:
+            {        
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(EADD007p1) delayedBool=%d !aError=%d"), delayedBool, !aError );
+            CActiveScheduler::Stop();
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(EADD007p1)"));
+    
+            assertion = ( delayedBool && !aError );
+            break;
+            }                
+        case EDEL003p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(8)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(8)"));
+                
+                //check that file was deleted
+                RFs fsSession2;
+                TInt connectErr = fsSession2.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(8) connectErr=%d"), connectErr );
+                RFile file3;
+                TFileName del003A = KNibblesDEL003A;
+                TInt fileError = file3.Open(fsSession2, del003A, EFileRead);
+                file3.Close();
+                fsSession2.Close();
+    
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(8) delayedBool=%d !aError=%d fileError=%d"), delayedBool, !aError, !(!fileError) );
+                assertion = ( delayedBool && !aError && !(!fileError) );
+                }
+            break;
+            }    
+        case EDEL004p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(9)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(9)"));
+                
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(9) delayedBool=%d !aError=%d"), delayedBool, !aError );
+                assertion = ( delayedBool && !aError );
+                }
+            break;
+            }    
+        case EDEL005p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(10)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(10)"));
+                
+                //check that file was deleted
+                RFs fsSession2;
+                TInt connectErr = fsSession2.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(10) connectErr=%d"), connectErr );
+                RFile file3;
+                TFileName del005A = KNibblesDEL005A;
+                TInt fileError = file3.Open(fsSession2, del005A, EFileRead);
+                file3.Close();
+            
+                //check that file was saved
+                RFile file4;
+                TFileName del005B = KNibblesDEL005B;
+                TInt fileError2 = file4.Open(fsSession2, del005B, EFileRead);
+                file4.Close();
+                
+                //check that file was saved
+                RFile file5;
+                TFileName del005C = KNibblesDEL005C;
+                TInt fileError3 = file5.Open(fsSession2, del005C, EFileRead);
+                file5.Close();
+                fsSession2.Close();
+            
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(10) delayedBool=%d !aError=%d fileError=%d !fileError2=%d !fileError3=%d"), delayedBool, !aError, !(!fileError), !fileError2, !fileError3 );
+                assertion = ( delayedBool && !aError && !(!fileError) && !fileError2 && !fileError3 );
+                }
+            break;
+            }    
+        case EDEL006p1:
+            {
+            //check that file was saved
+            RFs fsSession2;
+            TInt connectErr = fsSession2.Connect();
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(11) connectErr=%d"), connectErr );
+            RFile file5;
+            TFileName del006A = KNibblesDEL006A;
+            TInt fileError3 = file5.Open(fsSession2, del006A, EFileRead);
+            file5.Close();
+            
+            if( iFSQ->ActionsLeft() == 0 )
+                {
+                //we should be done with the rest...
+                
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(11)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(11)"));
+                
+                //check that file was deleted
+                RFile file3;
+                TFileName del006C = KNibblesDEL006C;
+                TInt fileError = file3.Open(fsSession2, del006C, EFileRead);
+                file3.Close();
+                
+                //check that file was saved
+                RFile file4;
+                TFileName del006B = KNibblesDEL006B;
+                TInt fileError2 = file4.Open(fsSession2, del006B, EFileRead);
+                file4.Close();
+                
+            
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(11) delayedBool=%d !aError=%d fileError=%d fileError2=%d !fileError3=%d"), delayedBool, !aError, !(!fileError), !(!fileError2), !fileError3 );
+                assertion = ( delayedBool && !aError && !(!fileError) && !(!fileError2) && !fileError3 );
+                }
+                
+            fsSession2.Close();
+            break;
+            }    
+        case EREN003p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(15)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(15)"));
+                
+                //check that file was renamed
+                RFs fsSession2;
+                TInt connectErr = fsSession2.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(15) connectErr=%d"), connectErr );
+                RFile file3;
+                TFileName ren003A2 = KNibblesREN003A2;
+                TInt fileError = file3.Open(fsSession2, ren003A2, EFileRead);
+                file3.Close();
+                
+                //check that file was saved
+                RFile file4;
+                TFileName ren003B = KNibblesREN003B;
+                TInt fileError2 = file4.Open(fsSession2, ren003B, EFileRead);
+                file4.Close();
+                
+                //check that file was renamed (so this one wont exist anymore)
+                RFile file5;
+                TFileName ren003A = KNibblesREN003A;
+                TInt fileError3 = file5.Open(fsSession2, ren003A, EFileRead);
+                file5.Close();
+                fsSession2.Close();
+            
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(15) delayedBool=%d !aError=%d !fileError=%d !fileError2=%d !!fileError3=%d"), delayedBool, !aError, !fileError, !fileError2, !(!fileError3) );
+                assertion = ( delayedBool && !aError && !fileError && !fileError2 && !(!fileError3) );
+                }
+            break;
+            }    
+        case EREN004p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(16)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(16)"));
+                
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(16) delayedBool=%d !aError=%d"), delayedBool, !aError );
+                assertion = ( delayedBool && !aError );
+                }
+            break;
+            }    
+        case EREN005p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(17)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(17)"));
+                
+                //check that file was renamed
+                RFs fsSession2;
+                TInt connectErr = fsSession2.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(17) connectErr=%d"), connectErr );
+                RFile file3;
+                TFileName ren005A2 = KNibblesREN005A2;
+                TInt fileError = file3.Open(fsSession2, ren005A2, EFileRead);
+                file3.Close();
+                
+                //check that file was saved
+                RFile file4;
+                TFileName ren005B = KNibblesREN005B;
+                TInt fileError2 = file4.Open(fsSession2, ren005B, EFileRead);
+                file4.Close();
+                
+                //check that file was renamed (so this one wont exist anymore)
+                RFile file5;
+                TFileName ren005A = KNibblesREN005A;
+                TInt fileError3 = file5.Open(fsSession2, ren005A, EFileRead);
+                file5.Close();
+                
+                //check that file was saved
+                RFile file6;
+                TFileName ren005C = KNibblesREN005C;
+                TInt fileError4 = file6.Open(fsSession2, ren005C, EFileRead);
+                file6.Close();
+                fsSession2.Close();
+            
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(17) delayedBool=%d !aError=%d !fileError=%d !fileError2=%d !!fileError3=%d !fileError4=%d"), delayedBool, !aError, !fileError, !fileError2, !(!fileError3), !fileError4 );
+                assertion = ( delayedBool && !aError && !fileError && !fileError2 && !(!fileError3) && !fileError4 );
+                }
+            break;
+            }    
+        case EREN006p1:
+            {
+            if( numToSave == numSaved )
+                {
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(18)"));
+                CActiveScheduler::Stop();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(18)"));
+                
+                //check that file was renamed
+                RFs fsSession2;
+                TInt connectErr = fsSession2.Connect();
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(18) connectErr=%d"), connectErr );
+                RFile file3;
+                TFileName ren006C2 = KNibblesREN006C2;
+                TInt fileError = file3.Open(fsSession2, ren006C2, EFileRead);
+                file3.Close();
+                
+                //check that file was saved
+                RFile file4;
+                TFileName ren006B2 = KNibblesREN006B2;
+                TInt fileError2 = file4.Open(fsSession2, ren006B2, EFileRead);
+                file4.Close();
+                
+                //check that file was renamed (so this one wont exist anymore)
+                RFile file5;
+                TFileName ren006B = KNibblesREN006B;
+                TInt fileError3 = file5.Open(fsSession2, ren006B, EFileRead);
+                file5.Close();
+                
+                //check that file was saved
+                RFile file6;
+                TFileName ren006A = KNibblesREN006A;
+                TInt fileError4 = file6.Open(fsSession2, ren006A, EFileRead);
+                file6.Close();
+                
+                //check that file was renamed (so this one wont exist anymore)
+                RFile file7;
+                TFileName ren006C = KNibblesREN006C;
+                TInt fileError5 = file7.Open(fsSession2, ren006C, EFileRead);
+                file7.Close();
+                
+                fsSession2.Close();
+            
+                RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(17) delayedBool=%d !aError=%d !fileError=%d !fileError2=%d !!fileError3=%d !fileError4=%d !!fileError5=%d"), delayedBool, !aError, !fileError, !fileError2, !(!fileError3), !fileError4, !(!fileError5) );
+                assertion = ( delayedBool && !aError && !fileError && !fileError2 && !(!fileError3) && !fileError4 && !(!fileError5) );
+                }
+            break;
+            }
+        case EADD006p1:
+            {
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(19)"));
+            CActiveScheduler::Stop();
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(19)"));
+            assertion = ( delayedBool && ( aError == KErrAlreadyExists ));
+            break;
+            }
+        case ECANCEL001p1:
+            {
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(ECANCEL001p1) delayedBool=%d !aError=%d"), delayedBool, !aError );
+            // do nothing, we are waiting for cancel
+            RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent(ECANCEL001p1)"));
+            break;
+            }
+        default:
+            break;
+        }
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::MAFSQEvent out") );
+    }
+
+MTest* CAFSQTestAsynchSave::suiteL ()
+    {
+    // An own static function to collect the test functions into one 
+    // suite of tests. The framework will run the tests and free the
+    // memory allocated for the test suite.
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::suiteL in") );
+    
+    // Always use NewL (Do not use NewLC here)
+    CTestSuite *suite = CTestSuite::NewL( _L8("CAFSQTestAsynchSave") );
+
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTFILEMANNEWLRETURNSNOTNULL.001"), &TestFileManNewLReturnsNotNullL ) );
+    
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDESTRUCTOR.001"), &TestDestructorL ) );
+    
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTSETPRIORITY.001"), &TestSetPriorityL ) );
+    
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTCANCEL.001"), &TestCancelL ) );
+    
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.001"), &TestAddEmptyObjectToQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.002"), &TestAddObjectToEmptyQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.003"), &TestAddObjectToEmptyQueueWillSaveL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.004"), &TestAddObjectToNonEmptyQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.005"), &TestAddObjectToNonEmptyQueueWillSaveL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.006"), &TestAddObjectThatExistsAlreadyL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTADDOBJECT.007"), &TestAddObjectToEmptyQueueLManualStart ) );
+    
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDELETEOBJECT.001"), &TestDeleteFromEmptyNotExistL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDELETEOBJECT.002"), &TestDeleteFromEmptyExistsL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDELETEOBJECT.003"), &TestDeleteNonEmptyExistsButNotInQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDELETEOBJECT.004"), &TestDeleteNonEmptyNotExistAndNotInQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDELETEOBJECT.005"), &TestDeleteInQueueNotActiveL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTDELETEOBJECT.006"), &TestDeleteInQueueActiveL ) );
+    
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTRENAMEOBJECT.001"), &TestRenameFromEmptyNotExistL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTRENAMEOBJECT.002"), &TestRenameFromEmptyExistsL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTRENAMEOBJECT.003"), &TestRenameNonEmptyExistsButNotInQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTRENAMEOBJECT.004"), &TestRenameNonEmptyNotExistAndNotInQueueL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTRENAMEOBJECT.005"), &TestRenameInQueueNotActiveL ) );
+    suite->addTestL( CTestCaller<CAFSQTestAsynchSave>::NewL( _L8("CAE.FM.TESTRENAMEOBJECT.006"), &TestRenameInQueueActiveL ) );
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::suiteL returning") );
+    return suite;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/AFSQTestDelete.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,692 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include "../inc/AFSQTestAsynchSave.h"
+#include <f32file.h> // for opening / creating files
+#include <bautils.h> // for deleting files
+
+void CAFSQTestAsynchSave::TestDeleteFromEmptyNotExistL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDELETEOBJECT.001
+    // 
+    // Action : Test that cfileman::delete returns error if no such file.
+    //      
+    // Output : A KErrNotFound.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyNotExistL in") );
+	
+    currentTest = EDEL001p1;
+    numSaved = 0;
+    wait = ETrue;
+    TInt error = KErrNone;
+    
+    // Delete the file if it exists
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    TFileName del001 = KNibblesDEL001;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, del001, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyNotExistL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del001);
+        }
+    aFs.Close();
+    
+    // Try delete
+    CAsynchFSQ* aFSQ = NULL;
+    TRAPD( err, 
+        aFSQ = CAsynchFSQ::NewL();
+        error = aFSQ->Delete( del001 );
+        );
+    TRAP_IGNORE(
+        delete aFSQ;
+        aFSQ = NULL;
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyNotExistL errorIsKErrNotFound=%d notErr=%d"), (error == KErrNotFound), !err );
+    
+    assertL( (error == KErrNotFound) && !err );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyNotExistL out") );
+    }
+
+void CAFSQTestAsynchSave::TestDeleteFromEmptyExistsL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDELETEOBJECT.002
+    // 
+    // Action : Test that delete works if file exists and queue empty
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyExistsL in") );
+
+    currentTest = EDEL002p1;
+    numSaved = 0;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Delete the file if it exists
+    TFileName del002 = KNibblesDEL002;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, del002, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyExistsL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del002);
+        }
+    aFs.Close();
+
+    // Write the file to be used in testing
+    TInt err2 = KErrNone;
+    RFs fsSession;
+    err2 = fsSession.Connect();
+    RFile myFile;
+    if ( !err2 )
+        {
+        err2 = myFile.Create( fsSession, del002, 
+                             EFileStream | EFileShareExclusive | EFileWrite );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Write( myData );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Flush();
+        }
+    myFile.Close();
+    fsSession.Close();
+    delete buf;
+    buf = NULL;
+
+    //delete
+    CAsynchFSQ* aFSQ = NULL;
+    TRAPD( err, 
+        aFSQ = CAsynchFSQ::NewL();
+        error = aFSQ->Delete( del002 );
+        );
+    TRAP_IGNORE(
+        delete aFSQ;
+        aFSQ = NULL;
+        );
+    
+    //check that file was deleted
+    RFs fsSession2;
+    TInt fsConnectErr = fsSession2.Connect();
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyExistsL fsConnectErr=%d"), fsConnectErr );
+    RFile file2;
+    TInt fileError = file2.Open(fsSession2, del002, EFileRead);
+    file2.Close();
+    fsSession2.Close();
+    
+    //assert
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyExistsL errorIsKErrNone=%d notErr=%d isFileError=%d"), (error == KErrNone), !err, !(!(fileError )) );
+    
+    assertL( (error == KErrNone) && !err && (fileError!=KErrNone) );
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteFromEmptyExistsL out") );
+    }
+
+void CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDELETEOBJECT.003
+    // 
+    // Action : Test that delete will work if the queue is not empty but
+    //          the requested file is not in the queue (but it also exists)
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL in") );
+	
+    currentTest = EDEL003p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2, EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+    
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3, EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName del003A = KNibblesDEL003A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, del003A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del003A);
+        }
+
+    // Delete the file if it exists
+    TFileName del003B = KNibblesDEL003B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, del003B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del003B);
+        }
+        
+    // Delete the file if it exists
+    TFileName del003C = KNibblesDEL003C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, del003C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del003C);
+        }
+
+    // Write the file to be used in testing
+    TInt err2 = KErrNone;
+    RFs fsSession;
+    err2 = fsSession.Connect();
+    RFile myFile;
+    if ( !err2 )
+        {
+        err2 = myFile.Create( fsSession, del003A, 
+                             EFileStream | EFileShareExclusive | EFileWrite );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Write( myData );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Flush();
+        }
+	myFile.Close();
+	fsSession.Close();
+	aFs.Close();
+	delete buf;
+	buf = NULL;
+
+    //delete
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, del003B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, del003C );
+        buf3 = NULL;
+        error = iFSQ->Delete( del003A );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL errorIsKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+    
+    delayedBool = ( (error == KErrNone) && !err );
+    WaitForAsynchCompleteL();
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyExistsButNotInQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDELETEOBJECT.004
+    // 
+    // Action : Test that delete will return error if the queue is not empty but
+    //          the requested file is not in the queue (but it doesnt exist)
+    //      
+    // Output : A KErrNotFound.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL in") );
+
+    currentTest = EDEL004p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+    
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName del004A = KNibblesDEL004A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, del004A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del004A);
+        }
+
+    // Delete the file if it exists
+    TFileName del004B = KNibblesDEL004B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, del004B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del004B);
+        }
+        
+    // Delete the file if it exists
+    TFileName del004C = KNibblesDEL004C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, del004C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del004C);
+        }
+
+    aFs.Close();
+    delete buf;
+    buf = NULL;
+
+    //delete
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, del004B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, del004C );
+        buf3 = NULL;
+        error = iFSQ->Delete( del004A );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL errorIsKErrNotFound=%d notErr=%d"), (error == KErrNotFound), !err );
+    
+    delayedBool = ( (error == KErrNotFound) && !err );
+    WaitForAsynchCompleteL();
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDELETEOBJECT.005
+    // 
+    // Action : Test that delete will work ok if the queue is not empty and
+    //          the file is in the queue.  Should also check filesystem for existence.
+    //          This case checks that the file NOT ACTIVELY being saved gets deleted.
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL in") );
+	
+    currentTest = EDEL005p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+    
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName del005A = KNibblesDEL005A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, del005A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del005A);
+        }
+
+    // Delete the file if it exists
+    TFileName del005B = KNibblesDEL005B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, del005B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del005B);
+        }
+        
+    // Delete the file if it exists
+    TFileName del005C = KNibblesDEL005C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, del005C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del005C);
+        }
+
+    aFs.Close();
+
+    //delete
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, del005B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, del005C );
+        buf3 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf, del005A );
+        buf = NULL;
+        error = iFSQ->Delete( del005A );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL errorIsKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+    
+    delayedBool = ( (error == KErrNone) && !err );
+    WaitForAsynchCompleteL();
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL out") );
+    }
+
+void CAFSQTestAsynchSave::TestDeleteInQueueActiveL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTDELETEOBJECT.006
+    // 
+    // Action : Test that delete will work ok if the queue is not empty and
+    //          the file is in the queue.  Should also check filesystem for existence.
+    //          This case checks that the file ACTIVELY being saved gets deleted.
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueActiveL in") );
+	
+    currentTest = EDEL006p1;
+    numSaved = 0;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+    
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName del006A = KNibblesDEL006A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, del006A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del006A);
+        }
+
+    // Delete the file if it exists
+    TFileName del006B = KNibblesDEL006B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, del006B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteNonEmptyNotExistAndNotInQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del006B);
+        }
+        
+    // Delete the file if it exists
+    TFileName del006C = KNibblesDEL006C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, del006C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueNotActiveL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, del006C);
+        }
+
+    aFs.Close();
+	    
+    //delete
+    TInt errorA = 0;
+    TInt errorB = 0;
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, del006B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, del006C );
+        buf3 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf, del006A );
+        buf = NULL;
+        errorA = iFSQ->Delete( del006B );
+        errorB = iFSQ->Delete( del006C );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueActiveL errorIsKErrNone=%d notErr=%d !errorA=%d !errorB=%d"), (error == KErrNone), !err, !errorA, !errorB );
+    
+    delayedBool = ( (error == KErrNone) && !err && !errorA && !errorB );
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestDeleteInQueueActiveL out") );
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/AFSQTestRename.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,746 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include "../inc/AFSQTestAsynchSave.h"
+#include <f32file.h> // for opening / creating files
+#include <bautils.h> // for deleting files
+
+void CAFSQTestAsynchSave::TestRenameFromEmptyNotExistL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTRENAMEOBJECT.001
+    // 
+    // Action : Test that cfileman::rename returns error if no such file.
+    //      
+    // Output : A KErrNotFound.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyNotExistL in") );
+	
+    currentTest = EREN001p1;
+    numSaved = 0;
+    wait = ETrue;
+    TInt error = KErrNone;
+    
+    // Delete the file if it exists
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    TFileName ren001A = KNibblesREN001A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, ren001A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyNotExistL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren001A);
+        }
+    aFs.Close();
+    
+    // Try delete
+    CAsynchFSQ* aFSQ = NULL;
+    TFileName ren001B = KNibblesREN001B;
+    TRAPD( err, 
+        aFSQ = CAsynchFSQ::NewL();
+        error = aFSQ->Rename( ren001A, ren001B );
+        );
+    TRAP_IGNORE(
+        delete aFSQ;
+        aFSQ = NULL;
+        );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyNotExistL errorIsKErrNotFound=%d notErr=%d"), (error == KErrNotFound), !err );
+    
+    assertL( (error == KErrNotFound) && !err );
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyNotExistL out") );
+    }
+
+void CAFSQTestAsynchSave::TestRenameFromEmptyExistsL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTRENAMEOBJECT.002
+    // 
+    // Action : Test that rename works if file exists and queue empty
+    //      
+    // Output : A KErrNone.  
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyExistsL in") );
+	 
+    currentTest = EREN002p1;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Delete the file if it exists
+    TFileName ren002A = KNibblesREN002A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, ren002A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyExistsL exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren002A);
+        }
+    aFs.Close();
+
+    // Write the file to be used in testing
+    TInt err2 = KErrNone;
+    RFs fsSession;
+    err2 = fsSession.Connect();
+    RFile myFile;
+    if ( !err2 )
+        {
+        err2 = myFile.Create( fsSession, ren002A, 
+                             EFileStream | EFileShareExclusive | EFileWrite );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Write( myData );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Flush();
+        }
+    myFile.Close();
+    fsSession.Close();
+    delete buf;
+    buf = NULL;
+
+    //delete file
+    CAsynchFSQ* aFSQ = NULL;
+    TFileName ren002B = KNibblesREN002B;
+    TRAPD( err, 
+        aFSQ = CAsynchFSQ::NewL();
+        error = aFSQ->Rename( ren002A, ren002B );
+        );
+    TRAP_IGNORE(
+        delete aFSQ;
+        aFSQ = NULL;
+        );
+
+    //check that file was deleted
+    RFs fsSession2;
+    TInt fsConnectErr = fsSession2.Connect();
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyExistsL connectErr=%d"), fsConnectErr );
+    RFile file2;
+    TInt fileError = file2.Open(fsSession2, ren002B, EFileRead);
+    file2.Close();
+    fsSession2.Close();
+
+    //assert
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyExistsL errorIsKErrNone=%d notErr=%d !fileError=%d"), (error == KErrNone), !err, !(fileError ) );
+    
+    assertL( (error == KErrNone) && !err && (fileError==KErrNone) );
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameFromEmptyExistsL out") );   
+    }
+
+void CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTRENAMEOBJECT.003
+    // 
+    // Action : Test that rename will work if the queue is not empty but
+    //          the requested file is not in the queue (but it also exists)
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL in") );
+	
+    currentTest = EREN003p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName ren003A = KNibblesREN003A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, ren003A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren003A);
+        }
+
+    // Delete the file if it exists
+    TFileName ren003B = KNibblesREN003B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, ren003B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren003B);
+        }
+
+    // Delete the file if it exists
+    TFileName ren003C = KNibblesREN003C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, ren003C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren003C);
+        }
+        
+    // Delete the file if it exists
+    TFileName ren003A2 = KNibblesREN003A2;
+    RFile deleter4;
+    TInt isDeleted4 = deleter4.Open(aFs, ren003A2, EFileRead);
+    deleter4.Close();
+    if ( isDeleted4 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL 4th exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren003A2);
+        }    
+
+    // Write the file to be used in testing
+    TInt err2 = KErrNone;
+    RFs fsSession;
+    err2 = fsSession.Connect();
+    RFile myFile;
+    if ( !err2 )
+        {
+        err2 = myFile.Create( fsSession, ren003A, 
+                             EFileStream | EFileShareExclusive | EFileWrite );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Write( myData );
+        }
+    if( !err2 )
+        {
+        err2 = myFile.Flush();
+        }
+    myFile.Close();
+    fsSession.Close();
+    aFs.Close();
+    delete buf;
+    buf = NULL;
+	    
+    //delete
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, ren003B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, ren003C );
+        buf3 = NULL;
+        error = iFSQ->Rename( ren003A, ren003A2);
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL errorIsKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+    
+    delayedBool = ( (error == KErrNone) && !err );
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTRENAMEOBJECT.004
+    // 
+    // Action : Test that rename will return error if the queue is not empty but
+    //          the requested file is not in the queue (but it doesnt exist)
+    //      
+    // Output : A KErrNotFound.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL in") );
+	
+    currentTest = EREN004p1;
+    numSaved = 0;
+    numToSave = 2;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    TInt connectError = User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename, EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName ren004A = KNibblesREN004A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, ren004A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren004A);
+        }
+
+    // Delete the file if it exists
+    TFileName ren004B = KNibblesREN004B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, ren004B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren004B);
+        }
+
+    // Delete the file if it exists
+    TFileName ren004C = KNibblesREN004C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, ren004C,EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren004C);
+        }
+    aFs.Close();
+    delete buf;
+    buf = NULL;
+
+    //delete
+    TFileName ren004A2 = KNibblesREN004A2;
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, ren004B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, ren004C );
+        buf3 = NULL;
+        error = iFSQ->Rename( ren004A, ren004A2 );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL errorIsKErrNotFound=%d notErr=%d"), (error == KErrNotFound), !err );
+    
+    delayedBool = ( (error == KErrNotFound) && !err );
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyNotExistAndNotInQueueL out") );
+    }
+
+void CAFSQTestAsynchSave::TestRenameInQueueNotActiveL()
+    {
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTRENAMEOBJECT.005
+    // 
+    // Action : Test that rename will work ok if the queue is not empty and
+    //          the file is in the queue.  Should also check filesystem for existence.
+    //          This case checks that the file NOT ACTIVELY being saved gets renamed.
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueNotActiveL in") );
+	
+    currentTest = EREN005p1;
+    numSaved = 0;
+    numToSave = 3;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName ren005A = KNibblesREN005A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, ren005A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueNotActiveL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren005A);
+        }
+
+    // Delete the file if it exists
+    TFileName ren005B = KNibblesREN005B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, ren005B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueNotActiveL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren005B);
+        }
+
+    // Delete the file if it exists
+    TFileName ren005C = KNibblesREN005C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, ren005C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueNotActiveL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren005C);
+        }
+
+    // Delete the file if it exists
+    TFileName ren005A2 = KNibblesREN005A2;
+    RFile deleter4;
+    TInt isDeleted4 = deleter4.Open(aFs, ren005A2, EFileRead);
+    deleter4.Close();
+    if ( isDeleted4 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameNonEmptyExistsButNotInQueueL 4th exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren005A2);
+        }    
+
+    aFs.Close();
+	    
+    //delete
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, ren005B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, ren005C );
+        buf3 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf, ren005A );
+        buf = NULL;
+        error = iFSQ->Rename( ren005A, ren005A2 );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueNotActiveL errorIsKErrNone=%d notErr=%d"), (error == KErrNone), !err );
+    
+    delayedBool = ( (error == KErrNone) && !err );
+    WaitForAsynchCompleteL();
+    
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueNotActiveL out") );
+    }
+
+void CAFSQTestAsynchSave::TestRenameInQueueActiveL()
+{
+    // Group:   Asynch Save
+    // 
+    // ID:      CAE.FM.TESTRENAMEOBJECT.006
+    // 
+    // Action : Test that rename will work ok if the queue is not empty and
+    //          the file is in the queue.  Should also check filesystem for existence?
+    //          This case checks that the file ACTIVELY being saved gets renamed.
+    //      
+    // Output : A KErrNone.   
+	
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL in") );
+	
+    currentTest = EREN006p1;
+    numSaved = 0;
+    numToSave = 3;
+    wait = ETrue;
+    TInt error = KErrNone;
+
+    // Read the file to be used in testing.
+    TFileName aFilename = KNibbles;
+    RFs aFs;
+    User::LeaveIfError(aFs.Connect());
+    RFile file;
+    TInt connectErr = file.Open(aFs, aFilename,EFileRead);
+    TInt iSize;   
+    file.Size(iSize);
+    HBufC8* buf = HBufC8::NewL(iSize);
+    TPtr8  myData = buf->Des();
+    if ( !connectErr )
+        {
+        file.Read( myData );
+        }
+    file.Close();
+
+    // Read the file to be used in testing.
+    TFileName aFilename2 = KNibbles2;
+    RFile file2;
+    TInt connectErr2 = file2.Open(aFs, aFilename2,EFileRead);
+    file2.Size(iSize);
+    HBufC8* buf2 = HBufC8::NewL(iSize);
+    TPtr8  myData2 = buf2->Des();
+    if ( !connectErr2 )
+        {
+        file2.Read( myData2 );
+        }
+    file2.Close();
+    
+    // Read the file to be used in testing.
+    TFileName aFilename3 = KNibbles3;
+    RFile file3;
+    TInt connectErr3 = file3.Open(aFs, aFilename3,EFileRead);
+    file3.Size(iSize);
+    HBufC8* buf3 = HBufC8::NewL(iSize);
+    TPtr8  myData3 = buf3->Des();
+    if ( !connectErr3 )
+        {
+        file3.Read( myData3 );
+        }
+    file3.Close();
+
+    // Delete the file if it exists
+    TFileName ren006A = KNibblesREN006A;
+    RFile deleter;
+    TInt isDeleted = deleter.Open(aFs, ren006A, EFileRead);
+    deleter.Close();
+    if ( isDeleted == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL 1st exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren006A);
+        }
+
+    // Delete the file if it exists
+    TFileName ren006B = KNibblesREN006B;
+    RFile deleter2;
+    TInt isDeleted2 = deleter2.Open(aFs, ren006B, EFileRead);
+    deleter2.Close();
+    if ( isDeleted2 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL 2nd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren006B);
+        }
+        
+    // Delete the file if it exists
+    TFileName ren006C = KNibblesREN006C;
+    RFile deleter3;
+    TInt isDeleted3 = deleter3.Open(aFs, ren006C, EFileRead);
+    deleter3.Close();
+    if ( isDeleted3 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL 3rd exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren006C);
+        }
+        
+    // Delete the file if it exists
+    TFileName ren006B2 = KNibblesREN006B2;
+    RFile deleter4;
+    TInt isDeleted4 = deleter4.Open(aFs, ren006B2, EFileRead);
+    deleter4.Close();
+    if ( isDeleted4 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL 4th exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren006B2);
+        }
+        
+    // Delete the file if it exists
+    TFileName ren006C2 = KNibblesREN006C2;
+    RFile deleter5;
+    TInt isDeleted5 = deleter5.Open(aFs, ren006C2, EFileRead);
+    deleter5.Close();
+    if ( isDeleted5 == KErrNone )
+        {
+        // if no error, assume the file exists, so delete it
+    	RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL 5th exists, deleting") );
+        BaflUtils ba;
+        ba.DeleteFile(aFs, ren006C2);
+        }                
+
+    aFs.Close();
+
+    //delete
+    TInt errorA = 0;
+    TInt errorB = 0;
+    TRAPD( err, 
+        iFSQ = CAsynchFSQ::NewL();
+        iFSQ->SetCallback( this );
+        error = iFSQ->SaveAndDestroy( *buf2, ren006B );
+        buf2 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf3, ren006C );
+        buf3 = NULL;
+        error = iFSQ->SaveAndDestroy( *buf, ren006A );
+        buf = NULL;
+        errorA = iFSQ->Rename( ren006B, ren006B2 );
+        errorB = iFSQ->Rename( ren006C, ren006C2 );
+        );
+
+    //delayed assert on callback
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL errorIsKErrNone=%d notErr=%d !errorA=%d !errorB=%d"), (error == KErrNone), !err, !errorA, !errorB );
+    
+    delayedBool = ( (error == KErrNone) && !err && !errorA && !errorB );
+    WaitForAsynchCompleteL();
+
+    RDebug::Print( _L("CAFSQTestAsynchSave::TestRenameInQueueActiveL out") );
+    }
+    
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/STIFAFSQTestBlocks.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,17 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: STIFAFSQTestBlocks.cpp
+*
+*/
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/StifFSQTestTop.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,354 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include "../inc/StifFSQTestTop.h"
+#include "../inc/TestFramework/testSuite.h"
+#include "../inc/AFSQTestTop.h"
+#include "../inc/AFSQTestAsynchSave.h"
+
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+           
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+    
+    This file (DemoModule.cpp) contains all STIF test framework related parts of
+    this test module.
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt SetRequirements( CTestModuleParam*& aTestModuleParam, TUint32& aParameterValid )
+    {
+    aParameterValid = KStifTestModuleParameterChanged;
+    
+    TRAP_IGNORE(
+        CTestModuleParamVer01* param = CTestModuleParamVer01::NewL();
+        
+    	// Stack size
+    	param->iTestThreadStackSize= 2*16384; // 2*16K stack
+
+    	// Heap sizes
+    	param->iTestThreadMinHeap = 4096;   // 4K heap min
+    	param->iTestThreadMaxHeap = 8*1048576;// 8M heap max
+
+    	aTestModuleParam = param;
+	);
+	
+    return KErrNone;
+    }
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+CTestModule::CTestModule()
+    {
+    }
+
+
+void CTestModule::ConstructL()
+    {  
+    iTestSuite = CTestSuite::NewL(_L8("Test Suite Container"));
+
+    iTestSuite->addTestL( CAFSQTestAsynchSave::suiteL() );    
+    
+
+    
+    // SetAllocFailureSimulation( RHeap::EDeterministic, 0 ); // Enable OOM test loop
+    SetAllocFailureSimulation( RHeap::ENone, 0 ); // Disable OOM test loop
+
+    /* Install an active scheduler */
+    iScheduler = new(ELeave)CActiveScheduler;
+    CActiveScheduler::Install(iScheduler);
+
+    }
+
+
+CTestModule* CTestModule::NewL()
+    {
+
+    // Construct new CTestModule instance.
+    CTestModule* self = new ( ELeave ) CTestModule();    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+  
+    }
+
+
+CTestModule::~CTestModule()
+    {
+    delete iTestSuite;
+    delete iScheduler;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: GetTestCases
+
+    Description: GetTestCases is used to inquire test cases 
+    from the test module. Because this test module have hard coded test cases
+    (i.e cases are not read from file), paramter aConfigFile is not used.
+
+    This function loops through all cases defined in Cases() function and 
+    adds corresponding items to aTestCases array.
+
+    Parameters: const TFileName&  : in: Configuration file name. Not used                                                       
+                RPointerArray<TTestCaseInfo>& aTestCases: out: 
+                      Array of TestCases.
+    
+    Return Values: KErrNone: No error
+
+    Errors/Exceptions: Function leaves if any memory allocation operation fails
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/      
+TInt CTestModule::GetTestCasesL( const TFileName& /*aConfigFile*/, 
+                                     RPointerArray<TTestCaseInfo>& aTestCases )
+    {
+
+    // Loop through all test cases and create new
+    // TTestCaseInfo items and append items to aTestCase array    
+    for( TInt i = 0; i< iTestSuite->CountTestCases(); i++ )
+        {
+ 
+	    // Allocate new TTestCaseInfo from heap for a testcase definition.
+        TTestCaseInfo* newCase = new( ELeave ) TTestCaseInfo();
+    
+	    // PushL TTestCaseInfo to CleanupStack.    
+        CleanupStack::PushL( newCase );
+
+	    // Set number for the testcase.
+	    // When the testcase is run, this comes as a parameter to RunTestCaseL.
+        newCase->iCaseNumber = i;
+
+	    // Set title for the test case. This is shown in UI to user.
+        newCase->iTitle.Copy( iTestSuite->TestCaseName(i) );
+
+	    // Append TTestCaseInfo to the testcase array. After appended 
+	    // successfully the TTestCaseInfo object is owned (and freed) 
+	    // by the TestServer. 
+        User::LeaveIfError(aTestCases.Append ( newCase ) );
+        
+	    // Pop TTestCaseInfo from the CleanupStack.
+        CleanupStack::Pop( newCase );
+
+        }
+    
+    return KErrNone;
+  
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: RunTestCase
+
+    Description: Run a specified testcase.
+
+    Function runs a test case specified by test case number. Test case file
+    parameter is not used.
+
+    If case number is valid, this function runs a test case returned by
+    function Cases(). 
+  
+    Parameters: const TInt aCaseNumber: in: Testcase number 
+                const TFileName& : in: Configuration file name. Not used
+                TTestResult& aResult: out: Testcase result
+    
+    Return Values: KErrNone: Testcase ran.
+                   KErrNotFound: Unknown testcase
+
+    Errors/Exceptions: None
+    
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestModule::RunTestCaseL( const TInt aCaseNumber, 
+                                    const TFileName& /*aConfig*/,
+                                    TTestResult& aResult )
+    {
+    // Next is a temporary solution for Stif memory leak error
+    //TestModuleIf().SetBehavior(CTestModuleIf::ETestLeaksMem);
+    // TestModuleIf().SetBehavior(CTestModuleIf::ETestLeaksRequests);
+    // TestModuleIf().SetBehavior(CTestModuleIf::ETestLeaksHandles);
+
+    if ( iAllocFailureType != RHeap::ENone )
+        {
+        RunTestCaseInOOMLoopL( aCaseNumber, aResult );
+        }
+    else
+        {
+        iTestSuite->ExecuteTestL( aResult, aCaseNumber );
+        }
+
+    // Return case execution status (not the result of the case execution)
+    return KErrNone; 
+    }
+
+
+/*
+*/    
+
+void CTestModule::RunTestCaseInOOMLoopL( const TInt aCaseNumber,
+                                        TTestResult& aResult )
+    {
+
+    // 
+    TInt error = KErrNone; 
+    aResult.SetResult( KErrNoMemory, _L("") ); // Initial value
+
+    for (; ( aResult.iResult == KErrNoMemory ) && !error;)
+        {      
+        // Switches on alloc failure simulation if the parameters are set for it
+        AllocFailureSimulation( ETrue ); 
+        RDebug::Print(_L("*** OOM loop : %d ***\n"), iCurrentAllocFailureRate );
+        TRAP( error, iTestSuite->ExecuteTestL( aResult, aCaseNumber ) );
+        if ( error == KErrNoMemory )
+            {
+            error = KErrNone;
+            }
+        }
+    
+    //
+    AllocFailureSimulation( EFalse );
+    User::LeaveIfError( error ); 
+    }
+
+
+/*
+*/    
+
+void CTestModule::AllocFailureSimulation (TBool aSwitchedOn)
+	{
+	if (aSwitchedOn)
+		{
+		__UHEAP_SETFAIL ( iAllocFailureType, iCurrentAllocFailureRate );
+        iCurrentAllocFailureRate++;
+		}
+	else
+		{
+		__UHEAP_RESET;
+        iCurrentAllocFailureRate = iAllocFailureRate;
+		}
+	}
+
+
+/*
+*/    
+
+void CTestModule::SetAllocFailureSimulation( RHeap::TAllocFail aAllocFailureType, TInt aAllocFailureRate )
+    {
+    iAllocFailureType = aAllocFailureType;
+    iAllocFailureRate = aAllocFailureRate;
+    iCurrentAllocFailureRate = aAllocFailureRate;
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+/*
+-------------------------------------------------------------------------------
+   
+    Function: LibEntryL
+
+    Description: Polymorphic Dll Entry Point
+    
+    Test framework calls this function to obtain new instance of test module
+    class. 
+
+    Parameters:    None
+    
+    Return Values: CTestModule*    Pointer to CTestModule instance
+    
+    Errors/Exceptions: Leaves if CTestModule::NewL leaves
+    
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CTestModule* LibEntryL()
+    {
+    return CTestModule::NewL();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+   
+    Function: E32Dll
+
+    Description: DLL entry point function
+    
+    Parameters:    TDllReason: Not used
+    
+    Return Values: KErrNone: always
+    
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+#ifndef EKA2
+GLDEF_C TInt E32Dll(TDllReason /*aReason*/)
+    {
+    return( KErrNone );
+
+    }
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/TestFramework/AssertFailure.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include "TestFramework/AssertFailure.h"
+
+CAssertFailure* CAssertFailure::NewL (const TDesC8& aMessage,
+                                      TInt aLineNumber,
+                                      const TDesC8& aFileName)
+    {
+    CAssertFailure* self=NewLC(aMessage, aLineNumber, aFileName);
+    CleanupStack::Pop();
+    return self;
+    }
+
+CAssertFailure* CAssertFailure::NewLC (const TDesC8& aMessage,
+                                       TInt aLineNumber,
+                                       const TDesC8& aFileName)
+
+    {
+    CAssertFailure* self = new (ELeave) CAssertFailure(aLineNumber);
+    CleanupStack::PushL(self);
+    self->ConstructL(aMessage, aFileName);
+    return self;
+    }
+
+CAssertFailure* CAssertFailure::NewL (CAssertFailure& aAssertFailure)
+    {
+    CAssertFailure* self=NewLC(aAssertFailure);
+    CleanupStack::Pop();
+    return self;
+    }
+
+CAssertFailure* CAssertFailure::NewLC (CAssertFailure& aAssertFailure)
+    {
+    CAssertFailure* self = new(ELeave)CAssertFailure;
+    CleanupStack::PushL(self);
+    self->ConstructL(aAssertFailure);
+    return self;
+    }
+
+void CAssertFailure::ConstructL (const TDesC8& aMessage,
+                                 const TDesC8& aFileName)
+    {
+    iMessage = aMessage.AllocL();
+    iFileName = aFileName.AllocL();
+    }
+
+void CAssertFailure::ConstructL (CAssertFailure& aAssertFailure)
+    {
+    iLineNumber = aAssertFailure.iLineNumber;
+    iMessage = aAssertFailure.iMessage->AllocL();
+    iFileName = aAssertFailure.iFileName->AllocL();
+    }
+
+CAssertFailure::CAssertFailure ()
+    {
+    }
+
+CAssertFailure::CAssertFailure (TInt aLineNumber)
+ : iLineNumber (aLineNumber)
+    {
+    }
+
+CAssertFailure::~CAssertFailure () 
+    {
+    delete iFileName;
+    delete iMessage;
+    }
+
+const TDesC8& CAssertFailure::What() const
+    {
+    return *iMessage;
+    }
+
+TInt CAssertFailure::LineNumber()  const
+    {
+    return iLineNumber;
+    }
+
+const TDesC8& CAssertFailure::FileName()  const
+    {
+    return *iFileName;
+    }
+
+void CAssertFailure::SetMyHeapCellCount (TInt aHeapCellCount)
+    {
+    iMyHeapCellCount = aHeapCellCount;
+    }
+
+TInt CAssertFailure::MyHeapCellCount ()
+    {
+    return iMyHeapCellCount;
+    }
+    
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/TestFramework/TestSuite.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include "../inc/TestFramework/testSuite.h"
+#include <StifTestModule.h>
+
+CTestSuite* CTestSuite::NewLC (const TDesC8& aName)
+    {
+    CTestSuite* self=new(ELeave) CTestSuite();
+    CleanupStack::PushL(self);
+    self->ConstructL(aName);
+    return self;
+    }
+
+CTestSuite* CTestSuite::NewL (const TDesC8& aName)
+    {
+    CTestSuite* self=NewLC(aName);
+    CleanupStack::Pop();
+    return self;
+    }
+
+void CTestSuite::ConstructL (const TDesC8& aName)
+    {
+    iName = aName.AllocL();
+    }
+
+CTestSuite::~CTestSuite () 
+    {
+    iTests.ResetAndDestroy();
+    delete iName;
+    }
+
+void CTestSuite::addTestL (MTest* aTest)
+    {
+    User::LeaveIfError (iTests.Append(aTest));
+    }
+
+// Runs the tests and collects their result in a TestResult.
+// Deprecated.
+// Version with index should be used instead.
+void CTestSuite::ExecuteL (TTestResult& aResult)
+    {
+    for (TInt i=0; i < iTests.Count(); i++)
+        {
+        iTests[i]->ExecuteL(aResult);
+        }
+    }
+
+// Counts the number of test cases that will be run by this test.
+TInt CTestSuite::CountTestCases ()
+    {
+    TInt count = 0;
+    for (TInt i=0; i < iTests.Count(); i++)
+        {
+        count += iTests[i]->CountTestCases ();
+        }
+    return count;
+    }
+
+const TDesC8& CTestSuite::Name ()
+    {
+    return *iName;
+    }
+
+#if 1
+void CTestSuite::ExecuteTestL(TTestResult& aResult,
+                              TInt aIndex)
+    { 
+    for (TInt i=0; i< iTests.Count(); i++)
+        {
+        TInt count = iTests[i]->CountTestCases();
+        if ( aIndex > ( count - 1 ) )
+            {
+            aIndex -= count;
+            }
+        else
+            {
+            iTests[i]->ExecuteTestL(aResult, aIndex);
+            return ;
+            }
+        }
+    }
+
+const TDesC8& CTestSuite::TestCaseName (TInt aIndex)
+    {
+    for (TInt i=0; i< iTests.Count(); i++)
+        {
+        TInt count = iTests[i]->CountTestCases();
+        if ( aIndex > ( count - 1 ) )
+            {
+            aIndex -= count;
+            }
+        else
+            {
+            return ( iTests[i]->TestCaseName(aIndex) ) ;
+            }
+        }
+    // It's an error if we reached that point.
+    return(KNullDesC8);
+    }
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/src/TestFramework/testCase.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,289 @@
+/*
+* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FSQ Test DLL
+*
+*/
+
+
+#include <utf.h>
+
+#include "../inc/TestFramework/testCase.h"
+#include "../inc/TestFramework/AssertFailure.h"
+#include <StifTestModule.h>
+
+#if 0
+#include "../inc/TestFramework/TestCase.h"
+#include "../inc/TestFramework/TestResult.h"
+#include "../inc/TestFramework/AssertFailure.h"
+#include "../inc/TestFramework/CppUnitLog.h"
+#endif
+
+// Assertion failure message formats:
+_LIT8(KIntsNotEqualFormat,"expected: %d but was: %d");
+_LIT8(KRealsNotEqualFormat,"expected: %g but was: %g");                                                    
+_LIT8(KDesCsNotEqualFormat,"expected: '%S' but was: '%S'");
+
+// A unique error code:
+const TInt KErrCppUnitAssertionFailed=(-99999999);
+
+void CTestCase::ConstructL (const TDesC8& aName)
+    {
+    iName = aName.AllocL();
+    User::LeaveIfError(Dll::SetTls(0));
+    }
+
+CTestCase::CTestCase ()
+: iAllocFailureType(RHeap::ENone),
+iAllocFailureRate(0)
+    {
+    }
+
+CTestCase::~CTestCase () 
+    { 
+    delete iName;
+    }
+
+// From MTest:
+void CTestCase::ExecuteL (TTestResult& aResult)
+    {
+    TInt error = ExecuteImplL();
+    aResult.iResult = error;
+    // add the possible failure or error to the result
+    
+    if (error == KErrCppUnitAssertionFailed)
+        {
+        CAssertFailure* assertFailure = AssertFailureFromTlsL ();
+        CleanupStack::PushL(assertFailure);
+        TBuf16 <0x80> convertBuf;
+        TBuf16 <256> temporaryBuf;
+        convertBuf.Copy(assertFailure->What());
+        temporaryBuf.Append(convertBuf);
+        temporaryBuf.AppendFormat(_L(" at Line %i of "), assertFailure->LineNumber()); 
+        convertBuf.Copy(assertFailure->FileName());
+        if (convertBuf.Length() + temporaryBuf.Length() >= 0x80)
+            {
+            TBuf <0x80> printBuf;
+            printBuf = convertBuf.Right(0x80 - temporaryBuf.Length() - 1 -3 );
+            convertBuf = _L("...");
+            convertBuf.Append(printBuf);
+            }
+        temporaryBuf.Append(convertBuf);
+        aResult.iResultDes = temporaryBuf;
+        CleanupStack::PopAndDestroy(assertFailure); 
+        }
+    }
+
+// From MTest:
+TInt CTestCase::CountTestCases ()
+    {
+    return 1;
+    }
+
+// From MTest:
+const TDesC8& CTestCase::Name ()
+    {
+    return *iName;
+    }
+
+#if 1
+// From MTest:
+void CTestCase::ExecuteTestL(TTestResult& aResult,
+                             TInt /*aIndex */)
+    { 
+    ExecuteL(aResult);
+    }
+
+const TDesC8& CTestCase::TestCaseName (TInt /*aIndex*/) 
+    {
+    return Name();
+    }
+#endif
+
+// Check for a failed general assertion 
+void CTestCase::AssertL (TBool aCondition,
+                         const TDesC8& aConditionExpression,
+                         TInt aLineNumber,
+                         const TDesC8& aFileName)
+    {
+    if (!aCondition)
+        {
+        AllocFailureSimulation(EFalse);
+        AssertFailureToTlsL (aConditionExpression,aLineNumber,aFileName);
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+// Check for a failed equality assertion
+void CTestCase::AssertEqualsL (TInt anExpected, 
+                               TInt anActual, 
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (anExpected != anActual)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = HBufC8::NewLC (KIntsNotEqualFormat().Size()+100);
+        msg->Des().Format(KIntsNotEqualFormat, anExpected, anActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+// Check for a failed equality assertion
+void CTestCase::AssertEqualsL (TReal anExpected, 
+                               TReal anActual, 
+                               TReal aDelta,
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (Abs(anExpected-anActual) > aDelta)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = HBufC8::NewLC (KRealsNotEqualFormat().Size()+100);
+        msg->Des().Format(KRealsNotEqualFormat, anExpected, anActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+// Check equality of the contents of two 8-bit descriptors 
+void CTestCase::AssertEqualsL (const TDesC8& anExpected,
+                               const TDesC8& anActual,
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (anExpected.Compare(anActual) != 0)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = NotEqualsMessageLC (anExpected, anActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+// Check equality of the contents of two 16-bit descriptors 
+void CTestCase::AssertEqualsL (const TDesC16& aExpected,
+                               const TDesC16& aActual,
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (aExpected.Compare(aActual) != 0)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = NotEqualsMessageLC (aExpected, aActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+void CTestCase::AllocFailureSimulation (TBool aSwitchedOn)
+    {
+    if (aSwitchedOn)
+        {
+        __UHEAP_SETFAIL (iAllocFailureType, iAllocFailureRate);
+        }
+    else
+        {
+        __UHEAP_RESET;
+        }
+    }
+
+TInt CTestCase::ExecuteImplL ()
+    {
+    
+    __UHEAP_MARK;
+    TRAPD (setupError, setUpL());
+    if (setupError != KErrNone)
+        {
+        tearDown();
+        __UHEAP_MARKEND;
+        User::Leave(setupError);
+        }
+    
+    TRAPD (executionError, executeTestL());
+    
+    tearDown();
+    __UHEAP_MARKENDC(HeapCellsReservedByAssertFailure());
+
+    return executionError;
+    }
+
+// Construct the message and put it in the cleanup stack
+HBufC8* CTestCase::NotEqualsMessageLC (const TDesC8& aExpected,
+                                       const TDesC8& aActual)
+    {
+    TInt size = KDesCsNotEqualFormat().Size()+aExpected.Size()+aActual.Size();
+    HBufC8 *msg = HBufC8::NewLC(size);
+    msg->Des().Format(KDesCsNotEqualFormat, &aExpected, &aActual);
+    return msg;
+    }
+
+// Construct the message and put it in the cleanup stack
+HBufC8* CTestCase::NotEqualsMessageLC (const TDesC16& aExpected,
+                                       const TDesC16& aActual)
+    {
+    TInt length = KDesCsNotEqualFormat().Length() + 
+        aExpected.Length() + aActual.Length();
+    
+    HBufC8* msg = HBufC8::NewLC(length);
+    
+    // Convert 16-bit to 8-bit to ensure readability
+    // of the output possibly directed to a file.
+    HBufC8* expected = HBufC8::NewLC(aExpected.Length());
+    expected->Des().Copy(aExpected);
+    
+    HBufC8* actual = HBufC8::NewLC(aActual.Length());
+    actual->Des().Copy(aActual);
+    
+    msg->Des().Format(KDesCsNotEqualFormat,expected,actual);
+    
+    // pop and destroy actual and expected
+    CleanupStack::PopAndDestroy(2);
+    return msg;
+    }
+
+void CTestCase::AssertFailureToTlsL (const TDesC8& aMessage,
+                                     TInt  aLineNumber,
+                                     const TDesC8& aFileName)
+    {
+    TInt cellsBefore = User::CountAllocCells();
+    CAssertFailure* assertFailure = 
+        CAssertFailure::NewLC(aMessage,aLineNumber,aFileName);
+    User::LeaveIfError(Dll::SetTls(assertFailure));
+    CleanupStack::Pop(); // assertFailure
+    TInt cellsAfter = User::CountAllocCells();
+    assertFailure->SetMyHeapCellCount(cellsAfter-cellsBefore);
+    }
+
+CAssertFailure* CTestCase::AssertFailureFromTlsL ()
+    {
+    CAssertFailure* assertFailure = static_cast<CAssertFailure*>(Dll::Tls());
+    CAssertFailure* copy = CAssertFailure::NewL(*assertFailure);
+    delete assertFailure;
+    Dll::SetTls(0);
+    return copy;
+    }
+
+TInt CTestCase::HeapCellsReservedByAssertFailure ()
+    {
+    if (Dll::Tls() == 0) return 0;
+    CAssertFailure* assertFailure = static_cast<CAssertFailure*>(Dll::Tls());
+    return assertFailure->MyHeapCellCount();
+    }
+    
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/cae_extentension_api/cae_extentension_api.metaxml	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<api id="acf6a16935ae7142aec592119a60f037" dataversion="2.0">
+<name>CAE Extentension API</name>
+<description>Interface that every ECom Plug-in extension of the Camera Application Engine should implement. It is used by the Camera Application Engine to create/initialize and to destroy the extension.  At creation phase the ECom Plug-in extension using a callback can find out what the Camera Application Engine supports or in other terms is it compatible with it and register its custom and extension interfaces to the Camera Application Engine. The callback is used for registering custom extensions, registering services and querying supported callbacks, services and properties of the Camera Application Engine. Services that Camera Application Engine's ECom Plug-in extensions can provide to the Camera Application Engine are mainly related to some events happened in the Camera Application Engine like changing the settings of Camera Application Engine, aquiring a new still image etc. When a certain event happens in Camera Application Engine all the related services  registered by the ECom Plug-in extensions are called by the Camera Application Engine.</description>
+<type>c++</type>
+<collection>CamAppEngine</collection>
+<libs><lib name="CaeEngine.lib"/>
+</libs>
+<release category="platform" sinceversion="0"/>
+<attributes>
+<htmldocprovided>no</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/cae_extentension_api/group/bld.inf	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File that exports the files belonging to 
+:                CAE Extentension API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/CaeEngineExtInterface.hrh     MW_LAYER_PLATFORM_EXPORT_PATH(CaeEngineExtInterface.hrh)
+../inc/CaeEngineExtInterface.h     MW_LAYER_PLATFORM_EXPORT_PATH(CaeEngineExtInterface.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/cae_extentension_api/inc/CaeEngineExtInterface.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,313 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine interface for extensions
+*
+*/
+
+
+
+#ifndef CAEENGINEEXTINTERFACE_H
+#define CAEENGINEEXTINTERFACE_H
+
+//  INCLUDES
+
+#include <e32std.h>
+#include <fbs.h>
+#include <ecom/ecom.h>
+
+#include "CaeEngineExtInterface.hrh"
+
+// CONSTANTS
+
+// Common UID that identifies all Cae extensions
+const TUid KExtensionInterfaceUid = {KExtensionInterfaceUidValue};
+
+// Common string that identifies all Cae extensions
+_LIT8( KExtensionTypeStringDesc, KExtensionTypeString);
+
+// Global flags for extension handling. Affect how the engine handles extensions. 
+enum TCaeExtFlags
+        {
+        ECaeExtFlagRequireFullColorSnapInputImage =        0x00000001
+        /* \todo Not yet implemented
+        ECaeExtFlagRequireStillImageAsBitmap =             0x00000002,
+        ECaeExtFlagRequireImageFormatHeader =              0x00000004
+        */
+        };
+
+
+// FORWARD DECLARATIONS
+
+class MExtensionCallbackInterface;
+class MExtension;
+
+
+// CLASS DECLARATIONS
+
+/**
+* Main extension interface class.	
+*/
+
+class MExtension
+	{
+	public:
+        /**
+        * Create the extension. Create the object, get pointers to callback interfaces
+		* and possibly add extension interfaces to the engine.
+        * @since 2.8
+        * @param aImplementationUid The uid for ECom to find the correct dll that implements this extension
+        * @param aEngine Pointer to the callback interface in the engine. Delivered to the extension.
+        * @return MExtension Pointer to the extension. Returned to the engine.
+        */
+ 		static MExtension* NewExtensionL( TUid aImplementationUid, MExtensionCallbackInterface* aEngine );
+
+        /**
+        * Virtual destructor. 
+        * @since 2.8
+        */
+		virtual ~MExtension() { REComSession::DestroyedImplementation (iDtor_ID_Key); };
+
+	private:
+
+		// The ID used by ECom for destroying this dll
+		TUid	iDtor_ID_Key;
+	};
+
+
+/**
+* Main callback interface implemented in the engine. The extension uses this
+* interface to add to and remove own interface implementations from the engine 
+* lists. Also, pointers to the callback interfaces implemented in the engine, 
+* can be fetched.  The extension usually calls this interface during creation. 
+*/
+
+class MExtensionCallbackInterface
+	{
+	public:
+        /**
+        * Check that the interface is supported by the engine. 
+        * @since 2.8
+        * @param aInterfaceUid Uid for the interface.
+        * @return TBool Whether the interface is supported.
+        */
+		virtual TBool IsInterfaceSupported( TUid aInterfaceUid ) = 0;
+
+        /**
+        * Add an extension implemented interface to the list in engine. 
+		* The engine starts to call this interface.
+        * @since 2.8
+        * @param aInterfaceUid Uid for the interface.
+        * @param aExtensionUid Uid for the extension that implements the interface.
+        * @param aInterfacePtr Pointer to the interface implementation.
+        * @param aPriority Priority of the interface. Interfaces with bigger priority value are called first.
+        * @return TInt Error code.
+        */
+		virtual TInt AddExtensionInterface( TUid aInterfaceUid, TUid aExtensionUid, TAny* aImplementationPtr, TInt aInitialPriority = 0 ) = 0;
+
+        /**
+        * Remove an extension implemented interface from the list in engine. 
+		* The engine stops calling this interface.
+        * @since 2.8
+        * @param aInterfaceUid Uid for the interface.
+        * @param aInterfacePtr Pointer to the interface implementation.
+        * @return TInt Error code.
+        */
+		virtual TInt RemoveExtensionInterface( TUid aInterfaceUid, TAny* aImplementationPtr ) = 0;
+
+        /**
+        * Add an extension implemented custom interface to the list in engine. 
+		* The custom interface is not called by the engine. It is called by the application.
+		* The engine gives the pointer to the application when requested.
+		* Note that there is no remove method for a custom interface because there is not 
+		* specified a way to tell to the application when the interface had been removed.
+        * @since 2.8
+        * @param aInterfaceUid Specific uid for the interface.
+        * @param aInterfacePtr Pointer to the interface implementation.
+        * @return TInt Error code.
+        */
+		virtual TInt AddCustomInterface( TUid aInterfaceUid, TAny* aImplementationPtr ) = 0;
+
+        /**
+        * Get an engine implemented callback interface. An extension can call this interface. 
+        * @since 2.8
+        * @param aInterfaceUid Specific uid for the interface.
+        * @return TAny* Pointer to the callback interface.
+        */
+		virtual TAny* GetCallbackInterface( TUid aInterfaceUid ) = 0;
+
+        /**
+        * Register flags which affect general extension handling in the engine. 
+        * Flags must be deregisterd when no longer needed as they can affect
+        * to the engine performance. Each registered flag must be deregistered, 
+        * and only once. All the flags that are in registered state when 
+        * the class is deleted, must be deregistered in the class destructor
+        * method. 
+        * @since 2.8
+        * @param aFlags Flags to register.
+        * @return void.
+        */
+		virtual void RegisterFlags( TUint32 aFlags ) = 0;
+
+        /**
+        * Deregister flags which have been registered before. It is not allowed
+        * to deregister flags that have not been registered earlier.  
+        * @since 2.8
+        * @param aFlags Flags to deregister.
+        * @return void.
+        */
+		virtual void DeregisterFlags( TUint32 aFlags ) = 0;
+	};
+
+
+/**
+* Image processing interface. The engine calls this interface when it gets 
+* a new view finder or captured image from the camera. The extension that 
+* implements this can manipulate the image before it is given to the 
+* application. 
+*/
+
+const TInt KCaeExtProcessImageInterfaceUidValue = 0x101F856A;
+const TUid KCaeExtProcessImageInterfaceUid = { KCaeExtProcessImageInterfaceUidValue };
+
+class MCaeExtProcessImageInterface
+	{
+	public:
+        /**
+        * Process the view finder bitmap. 
+        * @since 2.8
+        * @param aFrame The VF frame bitmap.
+        * @param aError Error code
+        */
+		virtual void ProcessViewFinderFrame( CFbsBitmap& aFrame, TInt& aError ) = 0;
+
+        /**
+        * Process the captured image from the camera. The function can be synchronous or 
+		* asynchronous.
+        * @since 2.8
+        * @param aCaeStatus The status of the finished operation.
+        * @param aBitmap The captured image, if it is a bitmap.
+        * @param aImageData The captured image, if it is a formatted image.
+        * @param aImageHeader The header of the captured image (e.g. Exif header).
+        * @return TBool Whether the operation is asynchronous.
+        */
+		virtual TBool ProcessCapturedImage( TRequestStatus& aCaeStatus, CFbsBitmap*& aBitmap, HBufC8*& aImageData, HBufC8*& aImageHeader ) = 0;
+		
+        /**
+        * Process the snap image. The function can be synchronous or asynchronous.
+        * Modifications should be done on aSnapBitmap. If it is null the extension 
+        * can create it using aStillBitmap as a source.
+        * @since 2.8
+        * @param aCaeStatus The status of the finished operation.
+        * @param aBitmap The still image as a bitmap. Image can be NULL.
+        * @param aSnapBitmap Returned snap bitmap. Image can be NULL.
+        * @return TBool Whether the operation is asynchronous.
+        */
+		virtual TBool ProcessSnapImage( TRequestStatus& aCaeStatus, CFbsBitmap*& aStillBitmap, CFbsBitmap*& aSnapBitmap ) = 0;
+		
+        /**
+        * Process the still image. The function can be synchronous or asynchronous.
+        * @since 2.8
+        * @param aCaeStatus The status of the finished operation.
+        * @param aBitmap The still image, if it is a bitmap.
+        * @param aImageData The still image, if it is a formatted image.
+        * @param aImageHeader The header of the captured image (e.g. Exif header).
+        * @return TBool Whether the operation is asynchronous.
+        */
+		virtual TBool ProcessStillImage( TRequestStatus& aCaeStatus, CFbsBitmap*& aBitmap, HBufC8*& aImageData, HBufC8*& aImageHeader ) = 0;
+		
+        /**
+        * Cancel the asynchronous operation. 
+        * @since 2.8
+        */
+		virtual void CaeExtensionCancel() = 0;
+	};
+
+
+/**
+* Settings interface. The engine calls this when settings should be saved or 
+* restored. Note that not all settings type of exttensions need to implement this
+* interface.
+*/
+
+const TInt KCaeExtSettingsInterfaceUidValue = 0x101F8569;
+const TUid KCaeExtSettingsInterfaceUid = { KCaeExtSettingsInterfaceUidValue };
+
+class MCaeExtSettingsInterface
+	{
+	public:
+
+        /**
+        * Restore previously saved settings.
+        * @since 2.8
+        */
+		virtual void ResetToPreviousSettingsL() = 0;				
+
+        /**
+        * Restore default settings.
+        * @since 2.8
+        */
+		virtual void ResetToDefaultsL() = 0;
+	};
+
+
+/**
+* Engine info interface. Implemented by the engine. The extension can get info 
+* about the current engine state.
+*/
+
+const TInt KCaeExtEngineInfoCallbackInterfaceUidValue = 0x101F856B;
+const TUid KCaeExtEngineInfoCallbackInterfaceUid = { KCaeExtEngineInfoCallbackInterfaceUidValue };
+
+class MCaeExtEngineInfoCallbackInterface
+    {
+    public: 
+        /**
+        * Get current still image size. 
+        * @since 2.8
+        * @return TSize Still image size in pixels.
+        */
+		virtual TSize McaeExtStillImageSize() = 0;
+
+        /**
+        * Get current snap image size. 
+        * @since 2.8
+        * @return TSize Snap image size in pixels.
+        */
+		virtual TSize McaeExtSnapImageSize() = 0;
+
+        /**
+        * Get current view finder size. 
+        * @since 2.8
+        * @return TSize View finder size in pixels.
+        */
+		virtual TSize McaeExtViewFinderSize() = 0;
+
+        /**
+        * Checks that the camera power is on. If it is not, the function leaves with 
+		* KErrNotReady.
+        * @since 2.8
+        * return void.
+        */
+		virtual void McaeExtCheckPowerL() = 0;
+
+        /**
+        * Get display index. 
+        * @since 2.8
+        * @return TInt Display index.
+        */
+		virtual TInt McaeExtDisplayIndex() = 0;
+    };
+
+
+#endif // CAEENGINEEXTINTERFACE_H
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/cae_extentension_api/inc/CaeEngineExtInterface.hrh	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine interface for extensions
+*
+*/
+
+
+
+#ifndef CAEENGINEEXTINTERFACE_HRH
+#define CAEENGINEEXTINTERFACE_HRH
+
+// CONSTANTS
+
+// Common constants for all extensions
+#define KExtensionInterfaceUidValue		0x101F856B
+#define KExtensionTypeString			"CAE_EXTENSION"
+
+#endif // CAEENGINEEXTINTERFACE_HRH
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/camera_application_engine_api.metaxml	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<api id="aed9a2d75c3f9d5ba94afea582303289" dataversion="2.0">
+<name>Camera Application Engine API</name>
+<description>Interface for using camera application engine.</description>
+<type>c++</type>
+<collection>CamAppEngine</collection>
+<libs><lib name="CaeEngine.lib"/>
+</libs>
+<release category="platform" sinceversion="0"/>
+<attributes>
+<htmldocprovided>no</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/group/bld.inf	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File that exports the files belonging to Camera Application Engine API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/CaeEngine.h     MW_LAYER_PLATFORM_EXPORT_PATH(CaeEngine.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/inc/CaeEngine.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,1383 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine
+*
+*/
+
+
+
+#ifndef CAEENGINE_H
+#define CAEENGINE_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <gdi.h>
+#include <ecam.h>
+
+// FORWARD DECLARATIONS
+class RWsSession;
+class CWsScreenDevice;
+class RWindowBase;
+class CFbsBitmap;
+
+// CONSTANTS
+
+// Service UIDs. Services are usually implemented in plug-in extension modules.
+
+const TUid KCaeProcessImageServiceUid = { 0x101F856A };
+const TUid KCaeSettingsServiceUid = { 0x101F8569 };
+
+
+// CLASS DECLARATIONS
+
+/**
+* The feature list item. The features that implement each service are sorted according 
+* to the calling order in the engine.
+*
+* @lib CAEENGINE.LIB
+* @since 2.8
+*/
+
+struct TCaeOrderedFeatureListItem
+    {
+    /** The UID of the service interface */
+    TUid iServiceUid; 
+
+    /** The UID of the feature. It identifies the extension that implements this service. */
+    TUid iFeatureUid;
+    };
+
+typedef RArray<TCaeOrderedFeatureListItem> RCaeOrderedFeatureList;
+
+/**
+* Information about camera and the engine.
+*
+* @lib CAEENGINE.LIB
+* @since 2.1
+*/
+class TCamAppEngineInfo
+    {
+    
+    public:
+        // Camera Application Engine options.
+        enum TOptions
+            {
+            /** No options supported */
+            ENoCaeOptionsSupported      = 0x0000, 
+            /** Still capturing burst mode flag */
+            EStillBurstSupported        = 0x0001,
+            /** Ev compensation flag */
+            EEvCompensationSupported    = 0x0002
+            };
+
+    public:
+
+        // Camera hardware version present.
+        TVersion iHardwareVersion;
+        // Camera driver software version present.
+        TVersion iSoftwareVersion;
+        // Actual orientation of the camera.
+        TCameraInfo::TCameraOrientation iOrientation;
+
+        // Bitfield of CCamera::TOptions available. 
+        TUint32 iOptionsSupported;
+        // Bitfield of CCamera::TFlash modes available.
+        TUint32 iFlashModesSupported;
+        // Bitfield of CCamera::TExposure modes available.
+        TUint32 iExposureModesSupported;
+        // Bitfield of CCamera::TWhiteBalance modes available.
+        TUint32 iWhiteBalanceModesSupported;
+
+        // Minimum zoom value allowed. Must be negative or 
+        // zero (for not supported).
+        TInt iMinZoom;
+        // Maximum zoom value allowed. Must be positive or 
+        // zero (for not supported).
+        TInt iMaxZoom;
+        // Maximum digital zoom value allowed. Must be positive or 
+        // zero (for not supported).
+        TInt iMaxDigitalZoom;
+
+        // Image size multiplier corresponding to minimum zoom value. 
+        // Must be between 0 and 1 inclusive.
+        TReal32 iMinZoomFactor;
+        // Image size multiplier corresponding to maximum zoom value. 
+        // Must be greater than or equal to 1.
+        TReal32 iMaxZoomFactor;
+        // Image size multiplier corresponding to maximum digital zoom value. 
+        // Must be greater than or equal to 1.
+        TReal32 iMaxDigitalZoomFactor;
+
+        // Count of still image capturing sizes allowed.
+        TInt iNumImageSizesSupported;
+        // Bitfield of still image CCamera::TFormat values supported.
+        TUint32 iImageFormatsSupported;
+    
+        // Count of still image capturing quality levels initialized.
+        TInt iNumStillQualityLevelsSupported;
+        // Count of video recording quality levels initialized.
+        TInt iNumVideoQualityLevelsSupported;
+
+        // Bitfield of CCaeEngine::TOptions available. 
+        TUint32 iCaeOptionsSupported;
+
+        // Integer (e.g. -9) that corresponds to minimum EV compensation value.
+        TInt iMinEvCompensation;
+        // Integer (e.g. 9) that corresponds to maximum EV compensation value.
+        TInt iMaxEvCompensation;
+        // Minimum camera EV compensation value (e.g. -3.0).
+        TReal32 iMinEvCompensationValue;
+        // Maximum camera EV compensation value (e.g. 3.0).
+        TReal32 iMaxEvCompensationValue;
+    };
+
+
+/**
+* Camera Application Engine observer class.
+* Mixin base class for the clients of the engine.
+*
+* @lib CAEENGINE.LIB
+* @since 2.1
+*/
+class MCamAppEngineObserver
+    {
+
+    public:
+
+        /**
+        * Called asynchronously when CCaeEngine::Init(), CCaeEngine::PowerOn(), 
+        * or CCaeEngine::Reserve() completes.
+        * Indicates if Camera Application Engine is ready for operation, 
+        * the camera is reserved and its power is switched on.
+        * @since 2.1
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void McaeoInitComplete( TInt aError ) = 0;
+
+        /**
+        * Called (possibly asynchronously) when preparing of still image 
+        * capturing completes after 
+        * PrepareStillCaptureL() has been called.
+        * @since 2.1
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void McaeoStillPrepareComplete( TInt aError ) = 0;
+
+        /**
+        * Called asynchronously when preparing of video recording completes 
+        * after PrepareVideoRecordingL() has been called.
+        * May be called second time with an error code after a successful preparation 
+        * if video recording loses its prepared state for some reason (e.g. audio HW 
+        * is reserved for some other application).
+        * @since 2.1
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void McaeoVideoPrepareComplete( TInt aError ) = 0;
+
+        /**
+        * Called asynchronously when a view finder bitmap is ready for display 
+        * CCaeEngine::StartViewFinderBitmapsL(...) has been called. 
+        * Called repeatedly until CCaeEngine::StopViewFinder() is called.  
+        * The bitmap should be drawn synchronously as it will be re-used as soon as this function returns.
+        * @since 2.1
+        * @param aFrame Reference to a bitmap containing view finder data. Does not transfer ownership.
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void McaeoViewFinderFrameReady( CFbsBitmap& aFrame, 
+            TInt aError ) = 0;
+
+        /**
+        * Called asynchronously when CCaeEngine::CaptureStill() is called and 
+        * snap-image for displaying is ready.
+        * @since 2.1
+        * @param aBitmap Constant reference to a bitmap set on success for Symbian OS bitmap formats. 
+        * Does not transfer ownership. Bitmap contents can not be changed.
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void McaeoSnapImageReady( const CFbsBitmap& aBitmap, 
+            TInt aError ) = 0;
+
+        /**
+        * Called asynchronously when CCaeEngine::CaptureStill() is called and 
+        * image for storaging is ready.
+        * Depending on the prepared image data format, delivers either 
+        * Symbian OS bitmap image or an image in another format, not both. 
+        * The bitmap/the other format image must be used and deleted before 
+        * returning.
+        * @since 2.1
+        * @param aBitmap Pointer to a bitmap transferring ownership and set on success 
+        * for Symbian OS bitmap formats.
+        * @param aData Pointer to image data transferring ownership and set on success 
+        * for non-Symbian OS bitmap or other image data formats.
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void McaeoStillImageReady( CFbsBitmap* aBitmap, 
+            HBufC8* aData, 
+            TInt aError ) = 0;
+
+        /**
+        * Called (possibly asynchronously) when video recording is running 
+        * after CCaeEngine::StartVideoRecording() or 
+        * CCaeEngine::ResumeVideoRecording() has been called.
+        * @since 2.1
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void McaeoVideoRecordingOn( TInt aError ) = 0;
+
+        /**
+        * Called (possibly asynchronously) when video recording is paused after 
+        * CCaeEngine::PauseVideoRecording() has been called.
+        * @since 2.1
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void McaeoVideoRecordingPaused( TInt aError ) = 0;
+
+        /**
+        * Called (possibly asynchronously) when video recording is completed 
+        * after CCaeEngine::StopVideoRecording() has been called or 
+        * recording has been completed for some other reason.
+        * @since 2.1
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * if aError == KErrDiskFull, then disk storage is full.
+        * if aError == KErrCompletion, then clip max size was reached.
+        * @return void
+        */
+        virtual void McaeoVideoRecordingComplete( TInt aError ) = 0;
+
+        /**
+        * Called asynchronously and repeatedly with timed intervals 
+        * when video clip recording is running after 
+        * CCaeEngine::StartVideoRecording() or 
+        * CCaeEngine::ResumeVideoRecording() has been called.
+        * Also, called once by video recording pause operation 
+        * by CCaeEngine::PauseVideoRecording() and stop operation 
+        * by CCaeEngine::StopVideoRecording().
+        * @since 2.1
+        * @param aTimeElapsed Returns recording time elapsed from video recording start.
+        * @param aTimeRemaining Returns estimated video recording time left 
+        * limited by storage capacity or max clip size.
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void McaeoVideoRecordingTimes( 
+            TTimeIntervalMicroSeconds aTimeElapsed, 
+            TTimeIntervalMicroSeconds aTimeRemaining, 
+            TInt aError ) = 0;
+
+        /**
+        * Called asynchronously when video recording is stopped and the CCaeEngine::SetAsyncVideoStopMode()
+        * has been enabled. After this client may play sounds etc. while waiting the
+        * McaeoVideoRecordingComplete call.
+        * @since 5.0
+        * @return void
+        */
+        virtual void McaeoVideoRecordingStopped() 
+            {
+            
+            };
+    };
+
+
+/**
+* Camera Application Engine still burst observer class.
+* Mixin base class for the clients of Camera Application Engine.
+*
+* @lib CAEENGINE.LIB
+* @since 2.1
+*/
+class MCaeStillBurstObserver
+    {
+
+    public:
+
+        /**
+        * Called asynchronously (multiple times) when still image burst 
+        * capturing is running and an image is captured after 
+        * CCaeEngine::CaptureStill() has been called. 
+        * Called once for every still image capture during the burst (just before the capture).
+        * @since 2.1
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void McaesboStillBurstCaptureMoment( TInt aError ) = 0;
+
+        /**
+        * Called asynchronously when still image burst capturing is completed 
+        * after CCaeEngine::CaptureStill() has been called.
+        * Before completion the engine has delivered all the captured images 
+        * using McaeoSnapImageReady() and McaeoStillImageReady() methods of 
+        * MCamAppEngineObserver.
+        * @since 2.1
+        * @param aImageCountDelivered Count of delivered burst images.
+        * @param aError Error code KErrNone to indicate success or a standard Symbian OS error code.
+        * @return void
+        */
+        virtual void McaesboStillBurstComplete( 
+            TInt aImageCountDelivered, 
+            TInt aError ) = 0;
+    };
+    
+    
+/**
+* The Camera Application Engine interface (abstract base class).
+*
+* @lib CAEENGINE.LIB
+* @since 2.1
+*/
+class CCaeEngine : public CBase
+    {
+    
+    public: // Enumerations
+
+        // Possible operation modes.
+        enum TOperationMode
+            {
+            EOperationModeStill     = 0x00, // Still capturing mode (default).
+            EOperationModeVideo     = 0x01  // Video recording mode.
+            };
+
+        // Possible viewfinder types.
+        enum TViewFinder
+            {
+            EViewFinderBitmaps      = 0x00, // Bitmap-based (default).
+            EViewFinderDirect       = 0x01  // Direct Screen Access.
+            };
+
+        // Possible zooming modes.
+        enum TZoomMode
+            {
+            EZoomModeDigital        = 0x00, // Digital zoom (default).
+            EZoomModeOptical        = 0x01, // Optical zoom.
+            EZoomModeOpticalDigital = 0x02  // Optical+digital zoom.
+            };
+
+        // Possible snap image generating modes.
+        enum TSnapImageSource
+            {
+            ESnapImageSourceOriginal, // Create snap image from the captured (JPEG/Exif) image.
+            ESnapImageSourceThumbnail // Create snap image from the thumbnail of the captured (Exif) image.
+            };
+
+    public: // Creation
+
+        /**
+        * A static (factory) function to create the class instance.
+        * @since 2.1
+        * @return Pointer to a fully constructed CCaeEngine object. 
+        * Ownership is passed to the caller.
+        */
+        IMPORT_C static CCaeEngine* NewL();
+
+        /**
+        * Sets the Camera Application Engine observer.
+        * @since 2.1
+        * @param aObserver Reference to Camera Application Engine observer.
+        * @return void
+        */
+        virtual void SetCamAppEngineObserver( 
+            MCamAppEngineObserver& aObserver ) = 0;
+
+    public: // General methods
+
+        /**
+        * Gets information about the supported Camera Application Engine and 
+        * Camera features.
+        * @since 2.1
+        * @param aInfo Info about supported features.
+        * @return void
+        */
+        virtual void GetInfo( TCamAppEngineInfo& aInfo ) const = 0;
+
+        /**
+        * Initializes Camera Application Engine for still image capturing. 
+        * Reserves the camera and switches the camera power on. 
+        * Intialization must be done before all other operations, except 
+        * SetCamAppEngineObserver and GetInfo. 
+        * Calls observer method McaeoInitComplete().
+        * @since 2.1
+        * @param aCreateSnapImage Boolean indicating if "snap-images" 
+        * should be created, leading to calls of McaeoSnapImageReady.
+        * @return void
+        */
+        virtual void InitL( TBool aCreateSnapImage = ETrue ) = 0;
+
+        /**
+        * Initialize the engine for still image capturing. 
+        * Switches also camera power on. 
+        * Intialization must be done before all other operations, except 
+        * SetCamAppEngineObserver and GetInfo. 
+        * Calls observer method McaeoInitComplete().
+        * @since 2.1
+        * @param aSdUidStillQltyLevels Still capturing quality levels Shared Data initialization file UID.
+        * @param aCreateSnapImage Boolean indicating if "snap-images" should be created 
+        * leading to calls of McaeoSnapImageReady.
+        * @return void
+        */
+        virtual void InitL( TUid aSdUidStillQltyLevels, 
+                            TBool aCreateSnapImage = ETrue ) = 0;
+
+        /**
+        * Initializes video recording. 
+        * The initialization must be done before video recording operations.
+        * @since 2.1
+        * @return void
+        */
+        virtual void InitVideoRecorderL() = 0;
+
+        /**
+        * Initializes video recording. 
+        * The initialization must be done before video recording operations.
+        * @since 2.1
+        * @param aSdUidVideoQltyLevels Video recording quality levels Shared Data initialization file UID.
+        * @return void
+        */
+        virtual void InitVideoRecorderL( TUid aSdUidVideoQltyLevels ) = 0;
+
+        /**
+        * Reserves the camera into use and switches the camera power on. 
+        * Calls observer method McaeoInitComplete().
+        * @since 2.1
+        * @return void
+        */
+        virtual void Reserve() = 0;
+        
+        /**
+        * Switches the camera power off and releases the camera.
+        * @since 2.1
+        * @return void
+        */
+        virtual void Release() = 0;
+
+        /**
+        * Switches the camera power on. 
+        * Calls observer method McaeoInitComplete().
+        * @since 2.1
+        * @return void
+        */
+        virtual void PowerOn() = 0;
+        
+        /**
+        * Switches the camera power off.
+        * @since 2.1
+        * @return void
+        */
+        virtual void PowerOff() = 0;
+
+    public: // Camera settings
+
+        /**
+        * Sets the zoom mode.
+        * @since 2.1
+        * @param aZoomMode Zoom mode to set.
+        * @return void
+        */
+        virtual void SetZoomModeL( TZoomMode aZoomMode = EZoomModeDigital ) = 0;
+
+        /**
+        * Gets the current zoom mode.
+        * @since 2.1
+        * @return The current zoom mode.
+        */
+        virtual TZoomMode ZoomMode() const = 0;
+
+        /**
+        * Sets the zoom value.
+        * @since 2.1
+        * @param aZoomValue Index of the zoom factor to set.
+        * @return void
+        */
+        virtual void SetZoomValueL( TInt aZoomValue = 0 ) = 0;
+
+        /**
+        * Gets the current zoom value.
+        * @since 2.1
+        * @return Index of the current zoom factor.
+        */
+        virtual TInt ZoomValue() const = 0;
+
+        /**
+        * Sets the brightness.
+        * @since 2.1
+        * @param aBrightness Brightness value in the range ECam.h SetBrightnessL allows.
+        * @return void
+        */
+        virtual void SetBrightnessL( TInt aBrightness = 0 ) = 0; 
+
+        /**
+        * Gets the current brightness setting.
+        * @since 2.1
+        * @return Brightness value.
+        */
+        virtual TInt Brightness() const = 0;
+
+        /**
+        * Sets the contrast.
+        * @since 2.1
+        * @param aContrast Contrast value in the range ECam.h SetContrastL allows.
+        * @return void
+        */
+        virtual void SetContrastL( TInt aContrast = 0 ) = 0; 
+        
+        /**
+        * Gets the current contrast setting.
+        * @since 2.1
+        * @return Contrast value.
+        */
+        virtual TInt Contrast() const = 0;
+
+        /**
+        * Sets the exposure mode.
+        * @since 2.1
+        * @param aExposureMode Exposure mode in the range ECam.h SetExposureL allows.
+        * @return void
+        */
+        virtual void SetExposureModeL( 
+            CCamera::TExposure aExposureMode = CCamera::EExposureAuto ) = 0;
+
+        /**
+        * Gets the current exposure mode.
+        * @since 2.1
+        * @return Exposure mode.
+        */
+        virtual CCamera::TExposure ExposureMode() const = 0;
+
+        /**
+        * Sets the white balance mode.
+        * @since 2.1
+        * @param aWhiteBalanceMode White balance mode in the range ECam.h SetWhiteBalanceL allows.
+        * @return void
+        */
+        virtual void SetWhiteBalanceModeL( 
+            CCamera::TWhiteBalance aWhiteBalanceMode = CCamera::EWBAuto ) = 0;
+
+        /**
+        * Gets the current white balance mode.
+        * @since 2.1
+        * @return White balance mode.
+        */
+        virtual CCamera::TWhiteBalance WhiteBalanceMode() const = 0;
+
+        /**
+        * Sets the flash mode.
+        * @since 2.1
+        * @param aFlashMode Flash mode in the range ECam.h SetFlashL allows.
+        * @return void
+        */
+        virtual void SetFlashModeL( 
+            CCamera::TFlash aFlashMode = CCamera::EFlashNone ) = 0;
+
+        /**
+        * Gets the current flash mode.
+        * @since 2.1
+        * @return Flash mode.
+        */
+        virtual CCamera::TFlash FlashMode() const = 0;
+
+        /**
+        * Resets to the default setting values.
+        * Resets the following settings: exposure mode, white balance mode, 
+        * zoom mode, zoom value, flash mode, brightness, and contrast. 
+        * @since 2.1
+        * @return void
+        */
+        virtual void ResetToDefaultsL() = 0;
+    
+    public: // View finder
+
+        /**
+        * Sets/resets view finder image mirroring.
+        * @since 2.1
+        * @param aMirror Boolean indicating whether view finder image should be mirrored or not.
+        * @return void
+        */
+        virtual void SetViewFinderMirrorL( TBool aMirror = EFalse ) = 0;
+
+        /**
+        * Queries if view finder image mirroring is on.
+        * @since 2.1
+        * @return Boolean indicating whether view finder image is currently mirrored or not.
+        */
+        virtual TBool ViewFinderMirror() const = 0;
+
+        /**
+        * Starts the bitmap-based view finder.
+        * The engine starts to call observer method McaeoViewFinderFrameReady() repeatedly.
+        * @since 2.1
+        * @param aSize Desired view finder size.
+        * @return void
+        */
+        virtual void StartViewFinderBitmapsL( TSize& aSize ) = 0;
+
+        /**
+        * Starts the bitmap-based view finder.
+        * The engine starts to call observer method McaeoViewFinderFrameReady() repeatedly.
+        * @since 2.1
+        * @param aSize Desired view finder size.
+        * @param aCropRect Desired cropping/clipping rectangle.
+        * @return void
+        */
+        virtual void StartViewFinderBitmapsL(
+            TSize& aSize, 
+            TRect& aCropRect ) = 0;
+
+        /**
+        * Starts the direct screen access view finder.
+        * @since 2.1
+        * @param aWs Window server session.
+        * @param aScreenDevice Software device screen.
+        * @param aWindow Client-side handle to a server-side window.
+        * @param aScreenRect Portion of screen in screen co-ordinates.
+        * @return void
+        */
+        virtual void StartViewFinderDirectL( 
+            RWsSession& aWs, 
+            CWsScreenDevice& aScreenDevice, 
+            RWindowBase& aWindow, 
+            TRect& aScreenRect ) = 0;
+        
+        /**
+        * Starts the direct screen access view finder.
+        * @since 2.1
+        * @param aWs Window server session.
+        * @param aScreenDevice Software device screen.
+        * @param aWindow Client-side handle to a server-side window.
+        * @param aScreenRect Portion of screen in screen co-ordinates.
+        * @param aCropRect Desired cropping/clipping rectangle.
+        * @return void
+        */
+        virtual void StartViewFinderDirectL(
+            RWsSession& aWs, 
+            CWsScreenDevice& aScreenDevice, 
+            RWindowBase& aWindow, 
+            TRect& aScreenRect, 
+            TRect& aCropRect ) = 0;
+
+        /**
+        * Stops the view finder.
+        * @since 2.1
+        * @return void
+        */
+        virtual void StopViewFinder() = 0;
+
+        /**
+        * Queries if view finder is running.
+        * @since 2.1
+        * @return Boolean indicating whether view finder is running or not.
+        */
+        virtual TBool IsViewFinding() const = 0;
+
+        /**
+        * Gets the current view finder size.
+        * @since 2.1
+        * @param aSize View finder size.
+        * @return void
+        */
+        virtual void GetViewFinderSize( TSize& aSize ) = 0;
+
+    public: // Still image capturing
+
+        /**
+        * Prepares Camera Application Engine for still image capture on 
+        * specified quality level.
+        * Calls observer method McaeoStillPrepareComplete().
+        * @since 2.1
+        * @param aStillQualityIndex Still image quality level index.
+        * Imaging parameters linked to quality levels are defined by Shared Data ini-file. 
+        * @return void
+        */
+        virtual void PrepareStillCaptureL( TInt aStillQualityIndex ) = 0;
+
+        /**
+        * Prepares Camera Application Engine for still image capture on 
+        * specified quality level.
+        * Calls observer method McaeoStillPrepareComplete().
+        * @since 2.1
+        * @param aStillQualityIndex Still image quality level index. 
+        * Can have values 0 ... TCamAppEngineInfo::iNumStillQualityLevelsSupported - 1
+        * @param aCropRect Desired cropping/clipping rectangle.
+        * @return void
+        */
+        virtual void PrepareStillCaptureL( 
+            TInt aStillQualityIndex, 
+            const TRect& aCropRect ) = 0;
+
+        /**
+        * Prepares Camera Application Engine for still image capture with 
+        * specified image size and format.
+        * Calls observer method McaeoStillPrepareComplete().
+        * @since 2.1
+        * @param aSize Still image size.
+        * @param aFormat Still image format.
+        * @param aCompressionQuality Still image compression quality [0...100].
+        * @return void
+        */
+        virtual void PrepareStillCaptureL(
+            const TSize& aSize, 
+            CCamera::TFormat aFormat,  
+            TInt aCompressionQuality ) = 0;
+
+        /**
+        * Prepares Camera Application Engine for still image capture with specified image size and format.
+        * Calls observer method McaeoStillPrepareComplete().
+        * @since 2.1
+        * @param aSize Still image size.
+        * @param aFormat Still image format.
+        * @param aCompressionQuality Still image compression quality [0...100].
+        * @param aCropRect Desired cropping/clipping rectangle.
+        * @return void
+        */
+        virtual void PrepareStillCaptureL(
+            const TSize& aSize, 
+            CCamera::TFormat aFormat,  
+            TInt aCompressionQuality, 
+            const TRect& aCropRect ) = 0;
+
+        /**
+        * Gets the current prepared still quality level index.
+        * @since 2.1
+        * @return Still quality level index.
+        */
+        virtual TInt StillQualityIndex() const = 0;
+
+        /**
+        * Gets the still image frame size for the specified quality level.
+        * @since 2.1
+        * @param aStillQualityIndex Still capture quality index.
+        * @param aSize Still image frame size.
+        * @return void
+        */
+        virtual void GetStillFrameSize(
+            TInt aStillQualityIndex, 
+            TSize& aSize ) const = 0;
+
+        /**
+        * Gets the estimated still image size in bytes for the 
+        * specified quality level.
+        * @since 2.1
+        * @param aStillQualityIndex Still capture quality index.
+        * @return Estimated still capturing image size in bytes.
+        */
+        virtual TInt EstimatedStillSizeInBytes( 
+            TInt aStillQualityIndex ) const = 0;
+
+        /**
+        * Captures a still image or a still image burst.
+        * Calls first observer method McaeoSnapImageReady() and then 
+        * McaeoStillImageReady().
+        * McaeoSnapImageReady() is not called if engine initialization 
+        * has been done 
+        * with parameter aCreateSnapImage == EFalse.
+        * @since 2.1
+        * @return void
+        */
+        virtual void CaptureStill() = 0;
+
+        /**
+        * Cancels the on-going still image (single/burst) capture request.
+        * @since 2.1
+        * @return void
+        */
+        virtual void CancelCaptureStill() = 0;
+
+    public: // Video recording
+
+        /**
+        * Sets the file name for the video clip to be recorded.
+        * @since 2.1
+        * @param aVideoClipFileName File name.
+        * @return void
+        */
+        virtual void SetVideoRecordingFileNameL( 
+            const TDesC& aVideoClipFileName ) = 0;
+
+        /**
+        * Prepares Camera Application Engine for video recording on 
+        * specified quality level.
+        * Calls observer method McaeoVideoPrepareComplete().
+        * @since 2.1
+        * @param aVideoQualityIndex Video quality level index. 
+        * Can have values 0 ... TCamAppEngineInfo::iNumVideoQualityLevelsSupported - 1
+        * @return void
+        */
+        virtual void PrepareVideoRecordingL( TInt aVideoQualityIndex ) = 0;
+
+        /**
+        * Prepares Camera Application Engine for video recording with 
+        * specified recording parameters.
+        * Calls observer method McaeoVideoPrepareComplete().
+        * @since 2.1
+        * @param aFrameSize Frame size.
+        * @param aFrameRate Frame rate.
+        * @param aBitRate Bit rate.
+        * @param aAudioEnabled Boolean indicating whether audio should be enabled or not.
+        * @param aMimeType MIME type.
+        * @param aPreferredSupplier Preferred supplier of video encoder.
+        * @param aVideoType Video type.
+        * @param aAudioType Audio type.
+        * @return void
+        */
+        virtual void PrepareVideoRecordingL( 
+            const TSize& aFrameSize, 
+            TReal32 aFrameRate, 
+            TInt aBitRate, 
+            TBool aAudioEnabled,
+            const TDesC8& aMimeType, 
+            const TDesC& aPreferredSupplier, 
+            const TDesC8& aVideoType = KNullDesC8, 
+            const TDesC8& aAudioType = KNullDesC8 ) = 0;
+        /**
+        * Closes (prepared) video recording to free resources.
+        * @since 2.1
+        * @return void
+        */
+        virtual void CloseVideoRecording() = 0;
+
+        /**
+        * Gets the current prepared video quality level index.
+        * @since 2.1
+        * @return Video quality level index.
+        */
+        virtual TInt VideoQualityIndex() const = 0;
+        
+        /**
+        * Gets the video frame size for the specified video quality level.
+        * @since 2.1
+        * @param aVideoQualityIndex Video quality level index.
+        * @return Video frame size.
+        */
+        virtual void GetVideoFrameSize(
+            TInt aVideoQualityIndex, 
+            TSize& aSize ) const = 0;
+
+        /**
+        * Gets the video frame rate for the specified video quality level.
+        * @since 2.1
+        * @param aVideoQualityIndex Video quality level index.
+        * @return Video frame rate.
+        */
+        virtual TReal32 VideoFrameRate( TInt aVideoQualityIndex ) const = 0;
+
+        /**
+        * Gets the estimated video recording bit rate including audio bit rate 
+        * for the specified video quality level.
+        * @since 2.1
+        * @param aVideoQualityIndex Video quality level index.
+        * @return Video recording bit rate rate including audio bit rate.
+        */
+        virtual TInt EstimatedVideoRecordingBitRateL( 
+            TInt aVideoQualityIndex ) const = 0;
+
+        /**
+        * Sets the maximum size in bytes for a video clip.
+        * @since 2.1
+        * @param aMaxClipSizeInBytes Maximum video clip size measured in bytes.
+        * If set to 0, then no limit but the available storage space.
+        * @return void
+        */
+        virtual void SetVideoClipMaxSizeL( TInt aMaxClipSizeInBytes = 0 ) = 0;
+        
+        /**
+        * Gets the current maximum size in bytes for a video clip.
+        * @since 2.1
+        * @return Video clip maximum size.
+        */
+        virtual TInt VideoClipMaxSize() const = 0;
+
+        /**
+        * Sets audio enabled or disabled for video recording.
+        * @since 2.1
+        * @param aAudioEnabled Boolean indicating whether audio should be enabled or not for video recording.
+        * @return void
+        */
+        virtual void SetVideoAudioL( TBool aAudioEnabled ) = 0;
+        
+        /**
+        * Queries if audio is enabled or disabled for video recording.
+        * @since 2.1
+        * @return Boolean indicating whether audio is enabled or disabled for video recording.
+        */
+        virtual TBool VideoAudio() const = 0;
+
+        /**
+        * Sets the time interval for video recording time info.
+        * @since 2.1
+        * @param aInterval Time interval in microseconds for video recording time info.
+        * If zero is given as interval, then video recording time is not generated.
+        * @return void
+        */
+        virtual void SetVideoTimesIntervalL( 
+            TTimeIntervalMicroSeconds aInterval ) = 0;
+
+        /**
+        * Gets the current time interval for video recording time info.
+        * @since 2.1
+        * @return Time interval in microseconds for video recording time info.
+        */
+        virtual TTimeIntervalMicroSeconds VideoTimesInterval() const = 0;
+
+        /**
+        * Starts video recording.
+        * Calls observer method McaeoVideoRecordingOn().
+        * @since 2.1
+        * @return void
+        */
+        virtual void StartVideoRecording() = 0;
+
+        /**
+        * Stops video recording.
+        * Calls observer method McaeoVideoRecordingComplete().
+        * @since 2.1
+        * @return void
+        */
+        virtual void StopVideoRecording() = 0;
+
+        /**
+        * Pauses video recording.
+        * Calls observer method McaeoVideoRecordingPaused().
+        * @since 2.1
+        * @return void
+        */
+        virtual void PauseVideoRecording() = 0;
+
+        /**
+        * Resumes video recording after pause.
+        * Calls observer method McaeoVideoRecordingOn().
+        * @since 2.1
+        * @return void
+        */
+        virtual void ResumeVideoRecording() = 0;
+
+        /**
+        * Gets the remaining video recording time before recording has started.
+        * @since 2.1
+        * @return Remaining video recording time.
+        */
+        virtual TTimeIntervalMicroSeconds RemainingVideoRecordingTime() 
+            const = 0;
+
+        /**
+        * Queries if video recording is running.
+        * @since 2.1
+        * @return Boolean indicating whether video recording is running or not.
+        */
+        virtual TBool IsVideoRecording() const = 0;
+
+    public: // New overloading method for preparing video recording
+
+        /**
+        * Prepares Camera Application Engine for video recording with specified recording parameters.
+        * Calls observer method McaeoVideoPrepareComplete().
+        * @since 2.1
+        * @param aFrameSize Frame size.
+        * @param aFrameRate Frame rate.
+        * @param aBitRate Bit rate.
+        * @param aAudioEnabled Boolean indicating whether audio should be enabled or not.
+        * @param aAudioBitRate Audio bit rate.
+        * @param aMimeType MIME type.
+        * @param aPreferredSupplier Preferred supplier of video encoder.
+        * @param aVideoType Video type.
+        * @param aAudioType Audio type.
+        * @return void
+        */
+        virtual void PrepareVideoRecordingL(
+            const TSize&  aFrameSize, 
+            TReal32       aFrameRate, 
+            TInt          aBitRate, 
+            TBool         aAudioEnabled,
+            TInt          aAudioBitRate, 
+            const TDesC8& aMimeType, 
+            const TDesC&  aPreferredSupplier, 
+            const TDesC8& aVideoType, 
+            const TDesC8& aAudioType ) = 0;
+
+    public: // Still image burst capturing
+
+        /**
+        * Sets the Camera Application Engine still image burst capturing 
+        * observer.
+        * @since 2.1
+        * @param aObserver Camera Application Engine still burst observer.
+        * @return void
+        */
+        virtual void SetCaeStillBurstObserver( 
+            MCaeStillBurstObserver& aObserver ) = 0;
+
+        /**
+        * Sets the image count for still image (burst) capturing.
+        * Note: Inputting value 1 switches back to normal still capturing.
+        * @since 2.1
+        * @param aImageCount The desired count of images to capture (in a burst). 
+        * @return The count of images to be captured (in a burst).
+        */
+        virtual TInt SetStillCaptureImageCountL( TInt aImageCount ) = 0;
+
+        /**
+        * Gets the image count for still image (burst) capturing.
+        * @since 2.1
+        * @return Count of images to capture (in a burst).
+        */
+        virtual TInt StillCaptureImageCount() const = 0;
+
+        /**
+        * Sets the time interval between single captures in still burst.
+        * @since 2.1
+        * @param aInterval Time interval in microseconds.
+        * @return void
+        */
+        virtual void SetStillBurstCaptureIntervalL( 
+            TTimeIntervalMicroSeconds aInterval ) = 0;
+
+        /**
+        * Gets the time interval between single captures in still burst.
+        * @since 2.1
+        * @return Time interval in microseconds.
+        */
+        virtual TTimeIntervalMicroSeconds StillBurstCaptureInterval() const = 0;
+
+        /**
+        * Stops still image burst capturing. 
+        * Delivers the burst images captured before call. 
+        * This is different from CancelCaptureStill that cancels the operation and 
+        * prevents delivering the captured image.
+        * @since 2.1
+        * @return void
+        */
+        virtual void StopStillBurstCapture() = 0;
+
+    public: 
+
+        /**
+        * Prepare Camera Application Engine for still image capture on 
+        * specified quality level with desired snap image size. 
+        * The returned snap image size is always equal or bigger in both 
+        * dimensions than the given size. The returned size is stepwise 
+        * downscaled from the captured image size. The parameter aSnapSize 
+        * is ignored if the image format does not support it in the engine.
+        * Calls observer method McaeoStillPrepareComplete().
+        * @since 2.1
+        * @param aStillQualityIndex Still image quality level index. 
+        * Can have values 0 ... TCamAppEngineInfo::iNumStillQualityLevelsSupported - 1
+        * @param aSnapSize Desired snap image size. Returns the real snap image size.
+        * @return void
+        */
+        virtual void PrepareStillCaptureL(
+            TInt aStillQualityIndex, 
+            TSize& aSnapSize ) = 0;
+
+        /**
+        * Prepare Camera Application Engine for still image capture with 
+        * specified image size, format, and desired snap image size. 
+        * The returned snap image size is always equal or bigger in both 
+        * dimensions than the given size. The returned size is stepwise 
+        * downscaled  from the captured image size. The parameter aSnapSize 
+        * is ignored if the image format does not support it in the engine.
+        * Calls observer method McaeoStillPrepareComplete().
+        * @since 2.1
+        * @param aSize Still image size.
+        * @param aFormat Still image format.
+        * @param aCompressionQuality Still image compression quality [0...100].
+        * @param aCropRect Desired cropping/clipping rectangle. The size (0,0) means that this parameter is ignored.
+        * @param aSnapSize Desired snap image size. Returns the real snap image size.
+        * @return void
+        */
+        virtual void PrepareStillCaptureL(
+            const TSize& aSize, 
+            CCamera::TFormat aFormat,  
+            TInt aCompressionQuality, 
+            const TRect& aCropRect,
+            TSize& aSnapSize ) = 0;
+
+        /**
+        * Sets the exposure value (EV) compensation index.
+        * @since 2.1
+        * @param aEvIndex Exposure value compensation index to set.
+        * @return void
+        */
+        virtual void SetEvCompensationL( TInt aEvIndex = 0 ) = 0;
+
+        /**
+        * Gets the current exposure value (EV) compensation index.
+        * @since 2.1
+        * @return Exposure value compensation index.
+        */
+        virtual TInt EvCompensation() const = 0;
+                
+        /**
+        * Sets snap image creation on/off.
+        * @since 2.1
+        * @param aCreateSnapImage Boolean indicating if "snap-images" for
+        * displaying should be created, leading to calls of McaeoSnapImageReady.
+        * @return void
+        */
+        virtual void SetSnapImageCreation( 
+            TBool aCreateSnapImage = ETrue ) = 0;
+        
+        /** 
+        * A static (factory) function to create the class instance.
+        * @since 2.6
+        * @param aCameraIndex Index from 0 to CamerasAvailable()-1 inclusive 
+        * specifying the camera device to use.
+        * @return Pointer to a fully constructed CCaeEngine object. 
+        * Ownership is passed to the caller.
+        */
+        IMPORT_C static CCaeEngine* NewL( 
+            TInt aCameraIndex );
+        
+        /** 
+        * Gets the number of cameras on the device.
+        * @since 2.6
+        * @return Count of cameras present on the device. 
+        */
+        IMPORT_C static TInt CamerasAvailable();
+        
+        /** 
+        * Enumerates through the available image capture sizes. 
+        * Returns the image size based on the specified size index and format. 
+        * The largest image resolution is returned for index 0, the smallest 
+        * for index TCamAppEngineInfo::iNumImageSizesSupported-1.
+        * The size index must be in the range 0 to 
+        * TCamAppEngineInfo::iNumImageSizesSupported-1 inclusive.
+        * @since 2.6
+        * @param aSize Returned image size.
+        * @param aSizeIndex Size index.
+        * @param aFormat The image format. 
+        * @return void
+        */
+        virtual void EnumerateStillCaptureSizes(
+            TSize& aSize, 
+            TInt aSizeIndex, 
+            CCamera::TFormat aFormat ) const = 0;
+        
+        /** 
+        * Sets the quality value to use with JPEG and Exif image formats. 
+        * @since 2.6
+        * @param aQuality The quality value to use, clamped to the range 1 to 100.
+        * @return void
+        */
+        virtual void SetJpegQuality(
+            TInt aQuality ) = 0;
+        
+        /** 
+        * Gets the currently set JPEG quality value.
+        * Returns 0 if not previously prepared or set.
+        * @since 2.6
+        * @return The currently set JPEG quality value. 
+        */
+        virtual TInt JpegQuality() const = 0;
+
+        /**
+        * Gets a custom interface. The client has to cast the returned pointer.
+        * @since 2.6
+        * @return  "TAny*" Custom interface pointer. NULL if the requested interface is not supported.
+        */
+        virtual TAny* CustomInterface(
+        	TUid aInterface ) = 0;
+
+        /** 
+        * Sets the size of the snap image bitmap.
+        * @since 2.8
+        * @param aSize The size of the snap bitmap. Corrected size is returned. 
+        * @return void
+        */
+        virtual void SetSnapImageSizeL(
+            TSize& aSize ) = 0;
+         /** 
+        * Sets the color mode of the snap image bitmap
+        * @since 2.8
+        * @param aMode The color mode of the snap bitmap.
+        * @return void
+        */
+        virtual void SetSnapImageColorMode(
+            TDisplayMode aMode ) = 0;
+
+        /**
+        * Gets array of features per interfaces. Each feature is ordered in
+        * the current calling order e.g. when certain image prosessing 
+        * operation is applied to the captured image. If SetOrder() has not yet
+        * been called, the returned order is the default order.
+        * @since 2.8
+        * @param aOrderedFeatureArray Feature array sorted by the current calling order in an interface.
+        * @return  void
+        */
+        virtual void GetOrderL( RCaeOrderedFeatureList& aOrderedFeatureList ) = 0;
+
+        /**
+        * Sets array of features per interfaces. Each feature should be ordered
+        * according to the wanted calling order e.g. to define when certain image 
+        * prosessing operation is applied to the captured image. If this method
+        * leaves, the internal array has not been changed.
+        * @since 2.8
+        * @param aOrderedFeatureArray Feature array sorted by the wanted calling order in an interface.
+        * @return void. 
+        */
+        virtual void SetOrderL( const RCaeOrderedFeatureList& aOrderedFeatureList ) = 0;
+
+        /** 
+        * A static (factory) function to create the class instance.
+        * @since 2.6
+        * @param aCameraIndex Index from 0 to CamerasAvailable()-1 inclusive 
+        * specifying the camera device to use.
+        * @param aDisplayIndex Display index specifying the display to use.
+        * @return Pointer to a fully constructed CCaeEngine object. 
+        * Ownership is passed to the caller.
+        */
+        IMPORT_C static CCaeEngine* NewL( 
+            TInt aCameraIndex, TInt aDisplayIndex );
+        /** 
+        * Sets the source of the snap image bitmap.
+        * @since 2.8
+        * @param aSnapImageSource The source of the snap image bitmap.
+        * @return void
+        */
+        virtual void SetSnapImageSourceL(
+            TSnapImageSource aSnapImageSource ) = 0;
+
+        /** 
+        * Sets the specific image codec implementation to be used in decoding and encoding.
+        * @since 3.1
+        * @param aDecoderUid The UID of the specific image decoder to be used. KNullUid means the default decoder.
+        * @param aEncoderUid The UID of the specific image encoder to be used. KNullUid means the default encoder.
+        * @return void
+        */
+        virtual void SetImageCodecsL( 
+        	TUid aDecoderUid, TUid aEncoderUid ) = 0;
+
+        /** 
+        * Enumerate Video Frame Size.
+        * @since 3.2
+        * @param aSize enumerated size
+        * @return size index of camera HW. Returns -1 if aSize is not supported.
+        */
+        virtual TInt EnumerateVideoFrameSizeL(const TSize& aSize) = 0;
+        
+        /** 
+        * Gets the device-unique handle of camera object owned by the CCaeEngine.
+        * @since 3.2
+        * @return  Camera object handle
+        */
+        virtual TInt CCameraHandle() const = 0;
+
+        /**
+        * Set CamAppEngine internal camera state to reserved and power state on. 
+        * This method is used when client uses Camera-API directly through the duplicate instance in still mode,
+        * but wants to use CAE in video recording mode without using the CAE InitL.
+        * @since 3.2
+        * @return void
+        */
+        virtual void EnableVideoRecording() = 0;
+        
+        /**
+        * Set CamAppEngine internal camera state to released and power state off.
+        * @since 3.2
+        * @return void
+        */
+        virtual void DisableVideoRecording() = 0;
+
+        /** 
+        * Sets CAE to Extension processing mode.
+        * @since 3.2
+        * @param aExtModeActive Boolean indicating if extension mode is enabled or disabled.
+        * @param aCreateSnapImage Boolean indicating if "snap-images" should be created by CAE.
+        * @return void
+        */
+        virtual void SetCaeExtensionModeL( TBool aExtModeActive, TBool aCreateSnapImage ) = 0;
+
+        /** 
+        * Process extension for view finder.
+        * @since 3.2
+        * @param aFrame The view finder frame bitmap that is processed.
+        * @return void
+        */
+        virtual void ProcessExtViewFinderFrameReadyL( CFbsBitmap& aFrame ) = 0;
+
+        /** 
+        * Process extension for snap image.
+        * @since 3.2
+        * @param aSnapImage The bitmap of snap image. Does not transfer ownership.
+        * @return void
+        */
+        virtual void ProcessExtSnapImageL( CFbsBitmap& aSnapImage ) = 0;
+        
+        /** 
+        * Process extension for captured image.
+        * @since 3.2
+        * @param aBitmap The captured bitmap image. Does not transfer ownership.
+        * @param aLastImage Set when last image of the burst is completed.
+        * @return void
+        */
+        virtual void ProcessExtCapturedImageL( CFbsBitmap& aBitmap, TBool aLastImage ) = 0;
+
+        /** 
+        * Process extension for captured image.
+        * @since 3.2
+        * @param aImageData The captured image, if it is a formatted image and type of HBufC8. Ownership is transferred.
+        * @param aLastImage Set when last image of the burst is completed.
+        * @return void
+        */
+        virtual void ProcessExtCapturedImageL( HBufC8* aImageData, TBool aLastImage ) = 0;
+
+        /** 
+        * Process extension for captured image.
+        * @since 3.2
+        * @param aImageDataDes The captured image, if it is a formatted image and type of TDesC8. Does not transfer ownership.
+        * @param aLastImage Set when last image of the burst is completed.
+        * @return void
+        */
+        virtual void ProcessExtCapturedImageL( TDesC8& aImageDataDes, TBool aLastImage ) = 0;
+
+        /** 
+        * Cancels extensions processing
+        * @since 3.2
+        * @return void
+        */
+        virtual void ProcessExtCancel() = 0;
+
+        /** 
+        * Get list of skipped extensions. Application may define which extensions are skipped during image processing. 
+        * @since 3.2
+        * @param aSkippedExtensions The list of skipped extensions TUid. 
+        * @return void
+        */
+        virtual void SkippedExtensionListL( RCaeOrderedFeatureList& aSkippedExtensions ) = 0;
+
+        /** 
+        * Set list of skipped extensions. Application may define which extensions are skipped during image processing.
+        * The GetOrderL() returns the list of all installed extensions.
+        * @since 3.2
+        * @param aSkippedExtensions The list of installed and skipped extensions TUid. 
+        * @return void
+        */
+        virtual void SetSkippedExtensionList( RCaeOrderedFeatureList& aSkippedExtensions ) = 0;
+
+        /** 
+        * Set asynchronous video recording stop mode. When Enabled then StopVideoRecording will return quickly and
+        * MCamAppEngineObserver callbacks McaeoVideoRecordingStopped and McaeoVideoRecordingComplete
+        * are called asynchronously.
+        * @since 5.0
+        * @param aAsyncVideoStopEnabled The async stop state. 
+        * @return error code KErrNone if supported by the video framework and mode was changed.
+        */
+        virtual TInt SetAsyncVideoStopMode( TBool aAsyncVideoStopEnabled ) = 0;
+
+    };
+
+#endif // CAEENGINE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/EABI/STIFCaeTestU.DEF	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,36 @@
+EXPORTS
+	_Z9LibEntryLv @ 1 NONAME
+	_Z15SetRequirementsRP16CTestModuleParamRm @ 2 NONAME
+	_ZTI10CTestSuite @ 3 NONAME ; #<TI>#
+	_ZTI11CTestCallerI15CCaeTestReleaseE @ 4 NONAME ; #<TI>#
+	_ZTI11CTestCallerI19CCaeTestStillStatesE @ 5 NONAME ; #<TI>#
+	_ZTI11CTestCallerI19CCaeTestVideoStatesE @ 6 NONAME ; #<TI>#
+	_ZTI11CTestCallerI21CCaeTestStillSettingsE @ 7 NONAME ; #<TI>#
+	_ZTI11CTestCallerI21CCaeTestVideoSettingsE @ 8 NONAME ; #<TI>#
+	_ZTI14CAssertFailure @ 9 NONAME ; #<TI>#
+	_ZTI14CCaeTestClient @ 10 NONAME ; #<TI>#
+	_ZTI15CCaeTestRelease @ 11 NONAME ; #<TI>#
+	_ZTI19CCaeTestStillStates @ 12 NONAME ; #<TI>#
+	_ZTI19CCaeTestVideoStates @ 13 NONAME ; #<TI>#
+	_ZTI20CCaeTestStatesClient @ 14 NONAME ; #<TI>#
+	_ZTI21CCaeTestStillSettings @ 15 NONAME ; #<TI>#
+	_ZTI21CCaeTestVideoSettings @ 16 NONAME ; #<TI>#
+	_ZTI22CCaeTestSettingsClient @ 17 NONAME ; #<TI>#
+	_ZTI9CTestCase @ 18 NONAME ; #<TI>#
+	_ZTV10CTestSuite @ 19 NONAME ; #<VT>#
+	_ZTV11CTestCallerI15CCaeTestReleaseE @ 20 NONAME ; #<VT>#
+	_ZTV11CTestCallerI19CCaeTestStillStatesE @ 21 NONAME ; #<VT>#
+	_ZTV11CTestCallerI19CCaeTestVideoStatesE @ 22 NONAME ; #<VT>#
+	_ZTV11CTestCallerI21CCaeTestStillSettingsE @ 23 NONAME ; #<VT>#
+	_ZTV11CTestCallerI21CCaeTestVideoSettingsE @ 24 NONAME ; #<VT>#
+	_ZTV14CAssertFailure @ 25 NONAME ; #<VT>#
+	_ZTV14CCaeTestClient @ 26 NONAME ; #<VT>#
+	_ZTV15CCaeTestRelease @ 27 NONAME ; #<VT>#
+	_ZTV19CCaeTestStillStates @ 28 NONAME ; #<VT>#
+	_ZTV19CCaeTestVideoStates @ 29 NONAME ; #<VT>#
+	_ZTV20CCaeTestStatesClient @ 30 NONAME ; #<VT>#
+	_ZTV21CCaeTestStillSettings @ 31 NONAME ; #<VT>#
+	_ZTV21CCaeTestVideoSettings @ 32 NONAME ; #<VT>#
+	_ZTV22CCaeTestSettingsClient @ 33 NONAME ; #<VT>#
+	_ZTV9CTestCase @ 34 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/group/StifCaeTest.mmp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine interface/integration tests
+*
+*/
+
+
+#if defined(__S60_)
+        #include <platform_paths.hrh>
+#endif
+
+TARGET        STIFCaeTest.dll
+TARGETTYPE    dll
+// First UID is DLL UID, Second UID is STIF Test Framework UID
+UID             0x1000008D 0x101FB3E7
+
+CAPABILITY    CAP_GENERAL_DLL
+VENDORID      VID_DEFAULT
+
+// Define directories for the .def-files of WINS and WINSCW builds separately.
+// IMPORTANT NOTICE:  The lines in the example that end with a backslash 
+// must have one space after the backslash.
+#if defined(ARMCC)
+deffile ../EABI/ 
+#elif defined( WINSCW )
+deffile Bwinscw/ 
+#elif defined( WINS )
+deffile Bwins/ 
+#else
+deffile Bmarm/ 
+#endif
+
+SOURCEPATH      ../src
+
+SOURCE          StifCaeTestTop.cpp
+SOURCE          CaeTestClient.cpp
+SOURCE          CaeTestStillStates.cpp
+SOURCE          CaeTestVideoStates.cpp
+SOURCE          CaeTestStatesClient.cpp
+SOURCE          CaeTestStillSettings.cpp
+SOURCE          CaeTestVideoSettings.cpp
+SOURCE          CaeTestSettingsClient.cpp
+SOURCE          CaeTestRelease.cpp
+
+// STIF TFW files
+SOURCEPATH    ../src
+SOURCE        TestFrameWork/TestCase.cpp
+SOURCE        TestFrameWork/AssertFailure.cpp
+SOURCE        TestFrameWork/TestSuite.cpp
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../inc/TestFrameWork
+USERINCLUDE     ../../../../camappengine/Engine/Inc
+USERINCLUDE     ../../../../camappengine/StillConverter/Inc
+USERINCLUDE	    ../../../../inc      // MW level inc dir
+
+
+
+#if defined(__S60_)
+    MW_LAYER_SYSTEMINCLUDE
+#else
+    SYSTEMINCLUDE   /epoc32/include 
+#endif
+
+LIBRARY         euser.lib
+LIBRARY         efsrv.lib
+LIBRARY         fbscli.lib
+LIBRARY         ECAM.lib
+LIBRARY         caeengine.lib
+LIBRARY         stiftestinterface.lib
+
+EXPORTUNFROZEN
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/group/StifCaeTest.pkg	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,34 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: Camera Application Engine interface/integration tests
+;
+; Languages
+; =========
+&EN
+
+; Name, UID for installation, Maj.Ver., Min.Ver., Variant, FLAG TO SPECIFY UNICODE, System component
+; ==================================================================================================
+#{"STIFCAETEST"},(0x101FB3E7),1,0,1,TYPE=SA
+
+
+; Localised Vendor name
+%{"Nokia-EN"}
+
+; Unique Vendor name
+:"Nokia"
+
+"\epoc32\release\armv5\urel\stifcaetest.dll"      -"$:\sys\bin\stifcaetest.dll"
+
+; eof
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/group/bld.inf	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2002 - 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Camera Application Engine interface/integration tests
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTEXPORTS
+
+PRJ_EXPORTS
+
+PRJ_TESTMMPFILES
+StifCaeTest.mmp 
+
+PRJ_MMPFILES
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestClient.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,845 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestClient.h
+*
+*/
+#ifndef CAE_TEST_CLIENT_H
+#define CAE_TEST_CLIENT_H
+
+#include <e32base.h>
+#include <f32file.h>
+#include <gdi.h>
+
+
+#include "CaeEngine.h"
+
+#include "CaeTestVariation.h"
+
+#include "ECamColorToneCustomInterface.h"
+
+#ifdef CAE_TEST_VERSION
+#include "CaeEngineImpTestErrors.h"
+#include "CaeStillConverterTestErrors.h"
+#endif
+
+const TInt KNormalTimingDelay = 1000;
+const TInt KLongTimingDelay = 5*1000;
+
+const TInt KImgWidthSubQCIF  = 128; 
+const TInt KImgHeightSubQCIF = 96; 
+
+const TInt KImgWidthQCIF     = 176; 
+const TInt KImgHeightQCIF    = 144; 
+
+const TInt KImgWidthCIF      = 352; 
+const TInt KImgHeightCIF     = 288; 
+
+const TInt KImgWidthQQVGA    = 160; 
+const TInt KImgHeightQQVGA   = 120; 
+
+const TInt KImgWidthQVGA     = 320; 
+const TInt KImgHeightQVGA    = 240; 
+
+const TInt KImgWidthVGA      = 640; 
+const TInt KImgHeightVGA     = 480; 
+
+const TInt KImgWidthSVGA      = 800; 
+const TInt KImgHeightSVGA     = 600; 
+
+const TInt KImgWidthTooBig   = 4096; 
+const TInt KImgHeightTooBig  = 4096; 
+
+const TInt KImgWidthMP1      = 1152; 
+const TInt KImgHeightMP1     = 864; 
+
+const TInt KImgWidthMP1M3      = 1280; 
+const TInt KImgHeightMP1M3     = 960; 
+
+const TInt KImgWidthMP2        = 1600; 
+const TInt KImgHeightMP2       = 1200; 
+
+const TInt KImgWidthMP3        = 2048; 
+const TInt KImgHeightMP3       = 1536; 
+
+const TInt KMaxVideoCodecSet     = 10; 
+
+enum TestClientLeavingCodes
+    {
+    KErrGetNotEqualToValuePreviouslySet = 98
+    };
+
+#if ( defined (__WINS__) || defined (__WINSCW) )
+#define KFileNameBase _L("c:\\")
+_LIT(KProcessFileName, "c:\\CaeTestClient.dat");
+_LIT(KiSnapFileName, "C:\\cae_test_out_snapimage.mbm");
+_LIT(KiStillFileName, "C:\\cae_test_out_stillimage.jpg");
+_LIT(KiVideoFileName, "C:\\cae_test_out_videoclip.3gp");
+_LIT(KiVideoFileName2, "C:\\cae_test_out_videoclip2.3gp");
+_LIT(KiVideoFileName3, "C:\\cae_test_out_videoclip3.3gp");
+_LIT(KiVideoFileName4, "C:\\cae_test_out_videoclip4.3gp");
+#else
+#define KFileNameBase _L("e:\\temp\\")
+_LIT(KProcessFileName, "e:\\temp\\CaeTestClient.dat");
+_LIT(KiSnapFileName, "e:\\temp\\cae_test_out_snapimage.mbm");
+_LIT(KiStillFileName, "e:\\temp\\cae_test_out_stillimage.jpg");
+_LIT(KiVideoFileName, "e:\\temp\\cae_test_out_videoclip.3gp");
+_LIT(KiVideoFileName2, "e:\\temp\\cae_test_out_videoclip2.3gp");
+_LIT(KiVideoFileName3, "e:\\temp\\cae_test_out_videoclip3.3gp");
+_LIT(KiVideoFileName4, "e:\\temp\\cae_test_out_videoclip4.3gp");
+#endif
+
+#ifdef _DEBUG
+#include <e32svr.h>
+#define PRINT(x) RDebug::Print x
+#else
+#define PRINT(x)
+#endif
+
+
+#if MIRAGE_X_PROD1
+const TInt KDefaultStillImageWidth = KImgWidthMP1;
+const TInt KDefaultStillImageHeight = KImgHeightMP1;
+const CCamera::TFormat KDefaultStillDataFormat = CCamera::EFormatExif;
+#elif (MIRAGE_X_PROD2) || (MIRAGE_X_PROD4)
+const TInt KDefaultStillImageWidth = KImgWidthMP1M3;
+const TInt KDefaultStillImageHeight = KImgHeightMP1M3;
+const CCamera::TFormat KDefaultStillDataFormat = CCamera::EFormatExif;
+#elif MIRAGE_X_PROD7
+const TInt KDefaultStillImageWidth = KImgWidthMP2;
+const TInt KDefaultStillImageHeight = KImgHeightMP2;
+const CCamera::TFormat KDefaultStillDataFormat = CCamera::EFormatExif;
+#else
+const TInt KDefaultStillImageWidth = KImgWidthVGA;
+const TInt KDefaultStillImageHeight = KImgHeightVGA;
+const CCamera::TFormat KDefaultStillDataFormat = CCamera::EFormatFbsBitmapColor16M;
+#endif
+
+const TInt KSymbianJpegDecoderValue = 0x101F45D7;
+const TInt KSymbianJpegEncoderValue = 0x101F45D9;
+
+const TInt KOptimizedJpegDecoderValue = 0x101FF555;
+const TInt KOptimizedJpegEncoderValue = 0x101FF554;
+
+
+class CCaeTestClient : public CTimer /* also CActive */, 
+                       public MCamAppEngineObserver, 
+                       public MCameraObserver,
+                       public MCameraObserver2,
+                       public MCaeStillBurstObserver
+    {
+    public:
+        
+        enum TestClientActions
+            {
+	        ENone,
+            EDefault, 
+
+            EEncodingError,
+            EDecodingError,
+            EPowerError,
+            EReserveError,
+            EStillCaptureError,
+            EVideoRecorderOpenError,
+            EVideoRecorderPrepareError,
+            EVideoRecordingCompleteError,
+            EPrepareVideoSettingsError,
+            ESnapImageError, 
+            EStillImageError,
+            EStillConvertError1, 
+            EStillConvertError2, 
+            EStillConvertError3, 
+
+            EInit, 
+            EInitVideoRecorder, 
+            EInitVideoRecorderWithUid, 
+            EGetInfo,
+            ESwitchPowerOnWhenInitialized, 
+            ESwitchPowerOnWhenStillPrepared, 
+            ESwitchPowerOffWhenStillPrepared, 
+            ESwitchPowerOffWhenVfRunning, 
+            ESwitchPowerOnWhenVideoPrepared, 
+            ESwitchPowerOnWhenRecordingVideo, 
+            ESwitchPowerOffWhenVideoPrepared, 
+            ESwitchPowerOffWhenRecordingVideo, 
+            EGetStillQualityIndexWhenEngineInitialized, 
+            EGetStillQualityIndexWhenPrepared, 
+            EGetVideoQualityIndexWhenEngineInitialized, 
+            EGetVideoQualityIndexWhenPrepared, 
+            EStartVideoRecordingWhenInitialized, 
+            EStartVideoRecordingWhenRecording, 
+            EStopVideoRecordingWhenInitialized, 
+            EStopVideoRecordingWhenPrepared, 
+            EIsVideoRecordingWhenPrepared, 
+            EIsVideoRecordingWhenRecording, 
+            ECaptureStillWhenEngineInitialized, 
+
+            EStartVfWhenInitNotReady,
+            EStartStillOpModeWhenInitNotReady,
+            EStartVideoOpModeWhenInitNotReady,
+            
+            ECancelCaptureStillWhenInitialized, 
+
+            ESwitchPowerOffAndOn,
+            EPowerOffPowerOff,
+            ERelease,
+            EReleaseRelease,
+            EReserveReserve,
+            EReleaseReserve,
+            EReleaseReserveCapture,
+            EReleaseReserveRecord,
+            
+            EDestroyEngineWhenStillPrepareReady,
+            EDestroyEngineWhenSnapImageReady,
+            EDestroyEngineWhenStillCaptureReady,
+            EDestroyEngineWhenSnapImageReadyInStillBurst,
+            EDestroyEngineWhenStillImageReadyInStillBurst,
+            EDestroyEngineWhenStillBurstReady, 
+            EDestroyEngineWhenVideoPrepareReady,
+            EDestroyEngineWhenVideoRecordingOn,
+            EDestroyEngineWhenVideoRecordingPaused,
+            EDestroyEngineWhenVideoRecordingReady,
+            
+            EEnumerateCaptureSizes, 
+            
+            ESpecifiedPrepareStill, 
+            ESpecifiedPrepareStillWhenPrepared, 
+            ESpecifiedPrepareAndCaptureStill, 
+            ESpecifiedPrepareAndCaptureStill2nd, 
+            EPrepareStillCapturing,
+            EPrepareStillCapturingWhenPrepared, 
+            EPrepareAndCaptureStill,
+            EPrepareAndCaptureAndCancelStill, 
+            EPrepareAndCaptureAndCancelStillAtSnap,  
+
+            EStartAndStopVfWhenStillPreparedAndCaptured, 
+            EPrepareStillCaptureWhenPowerOff, 
+            EPrepareStillCaptureWhenRecording,
+
+            EPrepareCroppedStillCapturing, 
+
+            EPrepareAndCaptureStillBurst,
+            ESpecPrepAndCaptureStillBurst, 
+            EPrepareAndSetStillBurstCaptureInterval,
+            EPrepareAndCaptureAndCancelStillBurst, 
+            EPrepareAndCaptureAndCancelStillBurstAtMoment, 
+            EPrepareAndCaptureAndCancelStillBurstAtSnap, 
+            EPrepareAndCaptureAndStopStillBurst,
+            EPrepareAndCaptureCaptureStillBurst,
+            ESpecPrepAndCaptureCaptureStillBurst,  
+            EPrepareAndCaptureStillBurstCaptureStill,
+            ESpecPrepAndCaptureStillBurstCaptureStill, 
+
+            EPrepareAndCaptureStillBurstExif,
+            EPrepareAndCaptureAndCancelStillBurstExif,
+			EStartVfPrepareCaptureStillStartAndStopVfExif,
+			EStartVfPrepareCaptureStillStartAndStopVfSnapExif,
+			ECaptureStillSetSnapSizeExif,
+			ECaptureStillSetSnapColorModeExif,
+            ECaptureStillAfterPowerOff,
+            ECaptureStillAfterPowerOffOn,
+            
+            ESetVideoFileNameWhenInitialized, 
+            ESetVideoFileNameWhenNotInitialized, 
+            ESetEmptyVideoFileNameWhenInitialized, 
+            ESetVideoFileNameWhenPrepared,
+            ESetVideoFileNameWhenRecording,
+
+            ESpecifiedPrepareVideo, 
+            ESpecifiedPrepareVideoWhenPrepared, 
+            ESpecifiedPrepareAndRecordVideo, 
+            ESpecifiedPrepareAndRecordVideoNoInit, 
+            EPrepareVideoRecording,
+            EPrepareVideoRecordingWhenPrepared,
+            EPrepareAndRecordVideo,
+            EPrepareRecordPauseStopVideo, 
+            EPrepareRecordPauseResumeStopVideo,
+            EPrepareRecordPausePauseStopVideo, 
+            EPauseVideoWhenPrepared, 
+            EResumeVideoWhenPrepared,
+            EResumeVideoWhenNotPaused, 
+            EStartAndStopVfWhenVideoPreparedAndRecorded,
+            ESpecifiedPrepareAudioBrAndRecordVideo,
+            ESpecifiedPrepareAudioBrAndRecordVideoAT0,
+            ESpecifiedPrepareAudioBrAndRecordVideoATInv,
+   
+            EStartStillOpModeStopVf, 
+            EStartStillOpModeCaptureStartAndStopVf, 
+
+            EStartVideoOpModeStopVf, 
+            EStartVideoOpModeRecordStartAndStopVf, 
+
+            EStartAndStopVf,
+            EStartAndStopCroppedVf,
+            EStartAndStopDirectVf, 
+            EStartAndStopCroppedDirectVf,
+            ESetViewFinderMirror,
+            EStartVfPrepareCaptureStillStartAndStopVf,
+            EStartVfPrepareRecordVideoStartAndStopVf, 
+            EStartVfStartVf,
+            EStartVfWhenPowerOff,
+
+            ESetExposureModeWhenInitialized,
+			ESetEvCompensationWhenInitialized,
+            ESetWhiteBalanceModeWhenInitialized,
+            ESetFlashModeWhenInitialized,
+            ESetDigiZoomWhenInitialized, 
+            ESetBrightnessWhenInitialized, 
+            ESetContrastWhenInitialized,
+            ESetClipMaxSizeWhenVideoNotPrepared,
+
+            ESetExposureModeWhenStillPrepared,
+			ESetEvCompensationWhenStillPrepared,
+            ESetWhiteBalanceModeWhenStillPrepared,
+            ESetFlashModeWhenStillPrepared,
+            ESetDigiZoomWhenStillPrepared, 
+            ESetBrightnessWhenStillPrepared, 
+            ESetContrastWhenStillPrepared,
+            ESetJpegQualityWhenStillPrepared, 
+            ESetJpegCodecWhenStillPrepared, 
+
+            ESetExposureModeWhenVideoPrepared,
+            ESetEvCompensationWhenVideoPrepared,
+            ESetWhiteBalanceModeWhenVideoPrepared,
+            ESetFlashModeWhenVideoPrepared,            
+            ESetDigiZoomWhenVideoPrepared, 
+            ESetBrightnessWhenVideoPrepared, 
+            ESetContrastWhenVideoPrepared, 
+            ESetClipMaxSizeWhenVideoPrepared, 
+            ESetAudioWhenVideoPrepared,
+            EGetAudioWhenVideoNotInitialized,
+            ESetVideoTimesIntervalWhenVideoPrepared,
+
+            ESetExposureModeWhenVideoRecording,
+			ESetEvCompensationWhenVideoRecording,
+            ESetWhiteBalanceModeWhenVideoRecording,
+            ESetFlashModeWhenVideoRecording,            
+            ESetDigiZoomWhenVideoRecording, 
+            ESetBrightnessWhenVideoRecording, 
+            ESetContrastWhenVideoRecording,
+            ESetClipMaxSizeWhenVideoRecording,
+            ESetClipMaxSizeWhenVideoNotInitialized,
+            ESetAudioWhenVideoRecording,
+            ESetAudioWhenVideoNotInitialized,
+            ESetVideoTimesIntervalWhenVideoRecording,
+
+            EResetToDefaults,
+
+            EGetStillFrameSizeWhenInitialized,
+            EEstimatedStillSizeInBytesWhenInitialized,
+            EGetStillFrameSizeWhenPrepared,
+            EEstimatedStillSizeInBytesWhenPrepared,
+
+			ESetSnapImageSizeBeforePrepare,
+			ESetSnapImageSizeDuringAndAfterPrepare,
+
+            EGetVideoFrameSizeWhenInitialized,
+            EVideoFrameRateWhenInitialized,
+            EEstimatedVideoRecordingBitRateWhenInitialized,
+            EGetVideoFrameSizeWhenPrepared,
+            EVideoFrameRateWhenPrepared,
+            EEstimatedVideoRecordingBitRateWhenPrepared,
+
+            ECaptureCapture,
+            ESpecPrepCaptureCapture, 
+            ECaptureRecord,
+            ERecordCapture,
+            ERecordRecord,
+
+            ERecordCaptureComplexSequence1,
+            ERecordCaptureComplexSequence2, 
+
+            ERemainingTimeWhenVideoPrepared,
+            ERemainingTimeWhenVideoNotInitialized,
+
+            EGetCustomInterface,
+            ESetColorTone,
+            ESetColorToneWrongParams,
+            ESetColorToneVideoRecording,
+            ESetColorToneRelease,
+
+            EInitUid,
+
+            ESetDisplayIndex,
+            ESetCameraIndexLow,
+            ESetCameraIndexHigh,
+            
+            EEnumerateVideoFrameSize,
+			ECCameraHandle,
+			
+			EProcessExtViewFinderFrameReady,
+			EProcessExtSnapImage,
+			EProcessExtCapturedImage,
+			EProcessExtCapturedImageTDesC8,
+			EProcessExtCapturedImageCFbsBitmap,
+			EProcessExtCapturedImageBurst,
+			EProcessExtCapturedImageBurstTDesC8,
+			EProcessExtCancel,
+			EProcessExtCancel2,
+			EInstalledExtensionList,
+			ESkippedExtensionList,
+			ESetSkippedExtensionList,
+			EProcessExtCapturedImageNoInit
+            };
+
+        enum TestClientOpMode
+            {
+	        EClientOpModeStill,
+            EClientOpModeVideo
+            };
+
+    public:
+        
+        static CCaeTestClient* NewL();
+        
+        virtual ~CCaeTestClient();
+
+        void SetSnapImageCreation( TBool aCreateSnapImage );
+
+        void SetRunningWithViewFinder( TBool aRunWithViewFinder );
+
+        void SetViewFinderSize( const TSize& aSize );
+        
+        void SetStillQualityLevelIndex( TInt aQualityLevelIndex );
+        
+        void SetVideoQualityLevelIndex( TInt aQualityLevelIndex );
+        
+        void SetStillFormat( CCamera::TFormat aFormat );
+        
+        void SetStillCompressionQuality( TInt aCompressionQuality );
+
+        void SetStillFrameSize( const TSize& aSize );
+
+		void SetSnapImageSize( const TSize& aSize );
+
+        void SetSnapImageSource( CCaeEngine::TSnapImageSource aSnapImageSource );
+
+		void SetSnapImageColorMode( TDisplayMode aMode );
+
+		void SetImageCodecs( TUid aDecoderUid, TUid aEncoderUid );
+
+		void SetCropRect( const TRect& aRect );
+
+        void SetStillBurstLength( TInt aLength );
+        
+        void SetVideoFrameSize( const TSize& aSize );
+        
+        void SetVideoFrameRate( TReal32 aFrameRate );
+        
+        void SetVideoBitRate( TInt aBitRate );
+
+        void SetVideoAudio( TBool aAudioEnabled );
+        
+        void SetAudioBitRate( TInt aAudioBitRate );
+
+        void SetFileNameBase( const TFileName& aFileNameBase );
+
+        void SetVfFileName( const TFileName& aFileName ); 
+
+        void SetVideoStopMode( TBool aAsyncVideoStopEnabled );
+
+        void SetVfFileCountToSave( TInt aCountOfVfFilesToSave );
+
+        void SetSnapFileName( const TFileName& aFileName );
+
+        void SetStillFileName( const TFileName& aFileName );
+        
+        void SetVideoFileName( const TFileName& aFileName );
+
+        void SetTimeout( TTimeIntervalMicroSeconds32 aTimeout );
+
+        void SetStillBurstCaptureInterval( TTimeIntervalMicroSeconds aInterval );
+        
+        void SetExposureMode( TInt aExposureMode );
+
+        void SetEvCompensation( TInt aEvCompensation );
+
+        void SetWhiteBalanceMode( TInt aWhiteBalanceMode );
+
+        void SetFlashMode( TInt aFlashMode );
+
+        void SetBrightness( TInt aBrightness );
+
+        void SetContrast( TInt aContrast );
+
+        void SetZoomMode( TInt aZoomMode );
+
+        void SetDigiZoomValue( TInt aDigiZoomValue );
+
+        void SetVideoClipMaxSize( TInt aMaxClipSizeInBytes );
+
+        void SetVideoTimesInterval( TTimeIntervalMicroSeconds aInterval );
+
+        void SetOpMode( TestClientOpMode aOpMode );
+        
+        void SetDisplayIndex( TInt aDisplayIndex );
+
+        void SetStopOnErrorInMcaeoSnapImageReady( TBool aStopOnError );
+        
+        void SetStopOnErrorInMcaeoStillImageReady( TBool aStopOnError );
+        
+        void GetInfo( TCamAppEngineInfo& aInfo ) const;
+        
+        void GetStillFrameSize( TSize& aSize ) const;
+
+        TInt EstimatedStillSizeInBytes() const;
+
+        void GetVideoFrameSize( TSize& aSize ) const;
+
+        TReal32 VideoFrameRate() const;
+        
+        TInt EstimatedVideoRecordingBitRate() const;
+
+
+        TReal32 ViewFinderFrameFrequency();
+    
+        TInt CountInitComplete();
+
+        TInt CountStillPrepareComplete();
+
+        TInt CountStillBurstOn();
+
+        TInt CountStillBurstCaptureMoment();
+
+        TInt CountStillBurstComplete();
+
+        TInt CountImageDeliveredStillBurstComplete();
+
+        TInt CountVideoPrepareComplete();
+
+        TInt CountViewFinderFrameReady();
+
+        TInt CountSnapImageReady();
+
+        TInt CountStillImageReady();
+
+        TInt CountVideoRecordingOn();
+
+        TInt CountVideoRecordingComplete();
+
+        TInt CountVideoRecordingStopped();
+
+        TInt CountVideoRecordingPaused();
+
+        TInt CountVideoRecordingTimes();
+
+        void SetCustomInterfaceUid( TUid aCustomInterface );
+
+        TAny* CustomInterfacePointer();
+
+        void SetColorToneValue( MCameraColorToneSettings::TColorTone );
+
+        void SetVideoCodecSet( TInt aValue );
+
+    public:
+
+        virtual void RunTestActionL( TestClientActions aAction ) = 0;
+
+
+    public:
+        // from observer
+
+        void McaeoInitComplete( TInt aError );
+
+        void McaeoStillPrepareComplete( TInt aError );
+
+        void McaesboStillBurstCaptureMoment( TInt aError );
+
+        void McaesboStillBurstComplete( TInt aImageCountDelivered, 
+                                        TInt aError );
+
+        void McaeoVideoPrepareComplete( TInt aError );
+
+        void McaeoViewFinderFrameReady( CFbsBitmap& aFrame, TInt aError );
+
+        void McaeoSnapImageReady( const CFbsBitmap& aBitmap, TInt aError );
+
+        void McaeoStillImageReady( CFbsBitmap* aBitmap, HBufC8* aData, TInt aError );
+
+        void McaeoVideoRecordingOn( TInt aError );
+
+        void McaeoVideoRecordingComplete( TInt aError );
+
+        void McaeoVideoRecordingStopped();
+
+        void McaeoVideoRecordingPaused( TInt aError );
+
+	    void McaeoVideoRecordingTimes( TTimeIntervalMicroSeconds aTimeElapsed, 
+                                       TTimeIntervalMicroSeconds aTimeRemaining, 
+                                       TInt aError );
+
+
+    protected:
+
+	    CCaeTestClient();
+
+        void ConstructL();
+
+    protected:
+        
+        void InitStateVariables();
+
+        void StopOnError( TInt aError );
+
+
+    private:
+        
+        // from CActive
+        void RunL();
+        
+        // from CActive
+        void DoCancel();
+
+    private:
+        
+        virtual void RunTrappedL() = 0;
+        
+    private: // From MCameraObserver / ECam.h
+
+        void ReserveComplete( 
+            TInt aError );
+
+        void PowerOnComplete( 
+            TInt aError );
+
+        void ViewFinderFrameReady( 
+            CFbsBitmap& aFrame );
+
+        void ImageReady( 
+            CFbsBitmap* aBitmap, 
+            HBufC8*     aData, 
+            TInt        aError );
+
+        void FrameBufferReady( 
+            MFrameBuffer* /*aFrameBuffer*/, 
+            TInt          /*aError*/ ) {}; // Empty default because not in use.
+
+
+        /**
+        * From MCameraObserver2 Informs that client should handle a event
+        */
+        void HandleEvent(const TECAMEvent& aEvent);
+
+        /**
+        * From MCameraObserver2 Informs that viewfinder frame is ready
+        */
+        void ViewFinderReady(MCameraBuffer& aCameraBuffer,TInt aError);
+
+        /**
+        * From MCameraObserver2 Informs that a new captured image is ready
+        */
+        void ImageBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+    
+        /**
+        * From MCameraObserver2 Informs that a new captured video is ready
+        */
+        void VideoBufferReady(MCameraBuffer& aCameraBuffer,TInt aError);
+
+
+    protected:
+
+        // Camera Application Engine.
+        CCaeEngine* iCamAppEngine;
+        CCamera*    iCameraDup;
+
+        // Output data file.
+        RFile iFile; 
+        RFs   iFsSession;
+
+        // Camera Application Engine info object.
+        TCamAppEngineInfo iInfo;
+
+        // File name base (e.g. "e:\\")
+        TFileName               iFileNameBase;
+
+        // View finder image file name.
+        TFileName               iVfFileName;
+        
+        // Still image filename.
+        TFileName               iSnapFileName;
+        TFileName               iStillFileName;
+        TFileName               iVideoFileName;
+        TFileName               iVideoFileName2;
+        TFileName               iVideoFileName3;
+        TFileName               iVideoFileName4;
+
+        // For counting View Finder frames.
+        TInt                    iVfFrameCount;
+        TInt                    iVfFrameCountToSave;
+
+        // For counting Snap images.
+        TInt                    iSnapImageCount;
+
+        TInt                    iImageCountToCapture;
+        
+        TRect                   iCropRect;
+
+        TSize                   iSizeEmpty;
+
+        TInt  iError;
+
+        TBool iStop;
+
+        TBool iCreateSnapImage;
+
+        TBool iRunWithViewFinder;
+        TBool iStopViewFinder;
+
+        TBool iRunlForSnapImage;
+        TBool iRunlForStillImage;
+        
+        TBool iStopWhenCompleted;
+        TBool iContinueWhenCompleted;
+
+        TBool iInitReady;
+        TBool iPowerOn;
+        
+        TBool iViewFinderStarted;
+        TBool iViewFindingUsed;
+        
+        TBool iStillPrepareReady;
+        TBool iSnapImageReady;
+        TBool iStillCaptureReady;
+        TBool iStillCapturingOn;
+        TBool iStillCaptured;
+
+        TBool iStillBurstCaptureMoment;
+        TBool iStillBurstReady;
+        TBool iStopStillBurst;
+        TBool iCancelStillBurst;
+        TBool iCancelStillBurstAfterVfFrame;
+
+        TBool iVideoPrepareReady;
+        TBool iVideoRecordingReady;
+        TBool iVideoRecordingPaused;
+        TBool iVideoRecordingResumed;
+        TBool iVideoRecordingOn;
+        TBool iVideoRecorded;
+
+        TBool iStoppedOnError;
+
+        TInt  iCancelCount;
+
+        TInt  iCountInitComplete;
+        TInt  iCountStillPrepareComplete;
+        TInt  iCountStillBurstCaptureMoment;
+        TInt  iCountStillBurstComplete;
+        TInt  iCountVideoPrepareComplete;
+        TInt  iCountViewFinderFrameReady;
+        TInt  iCountSnapImageReady;
+        TInt  iCountStillImageReady;
+        TInt  iCountVideoRecordingOn;
+        TInt  iCountVideoRecordingComplete;
+        TInt  iCountVideoRecordingStopped;
+        TInt  iCountVideoRecordingPaused;
+        TInt  iCountVideoRecordingTimes;
+
+        TInt  iImageCountPreparedForStillBurst;
+        TInt  iImageCountDeliveredForStillBurst;
+
+        TTimeIntervalMicroSeconds32     iTimeout;
+        TTimeIntervalMicroSeconds     iStillBurstCaptureInterval;
+
+        TTime iNextRunLTime;
+
+        TestClientOpMode iOpMode;
+
+	    TestClientActions    iAction;
+	    TestClientActions    iSavedAction;
+
+        TBool   iSaveSnapImage; 
+        TBool   iSaveStillImage; 
+        TBool   iSaveVideoClip; 
+        TBool   iAcceptVideoCompletionError;
+        TBool   iStopOnErrorInMcaeoSnapImageReady;
+        TBool   iStopOnErrorInMcaeoStillImageReady;
+
+        // TBool   iDestroyTheEngineInSnapImageReady;
+        // TBool   iDestroyTheEngineInStillImageReady;
+        
+        TInt    iActionCycle;
+
+        TInt    iStillQualityLevelIndex;
+        TInt    iVideoQualityLevelIndex;
+
+        TSize   iViewFinderSize;
+
+        TSize   iStillFrameSize;
+
+        TSize   iSnapImageSize;
+        
+        CCaeEngine::TSnapImageSource iSnapImageSource;
+
+        CCamera::TFormat    iStillDataFormat;
+        TDisplayMode		iSnapImageColorMode;
+
+        TInt    iStillCompressionQuality;
+        
+        TUid 	iImageDecoderUid;
+        TUid 	iImageEncoderUid;
+
+        TInt    iStillBurstLength;
+
+        TSize   iVideoFrameSize;
+        TReal32 iVideoFrameRate;
+        TInt    iVideoBitRate;
+        TBool   iVideoAudioEnabled;
+        TInt    iAudioBitRate;
+        TInt    iVideoMaxClipSizeInBytes;
+
+        TTimeIntervalMicroSeconds iVideoTimesInterval;
+
+        TInt    iExposureMode;
+        TInt    iEvCompensation;
+        TInt    iWhiteBalanceMode;
+        TInt    iFlashMode;
+        TInt    iZoomMode;
+        TInt    iDigiZoomValue;
+        TInt    iBrightness;
+        TInt    iContrast;
+
+        TInt    iDisplayIndex;
+
+        TSize   iStillFrameSizeSet;
+        TInt    iEstimatedStillSizeInBytesSet;
+        TSize   iVideoFrameSizeSet;
+        TReal32 iVideoFrameRateSet;
+        TInt    iEstimatedVideoBitRateSet;
+
+        TUid    iCustomInterfaceUid;
+        TAny*   iCustomInterfacePointer;
+        MCameraColorToneSettings::TColorTone iColorToneValue;
+        TUint32 iTestedColorTones;
+        TBool   iReleaseDone;
+        TBool   iReserveDone;
+
+        TInt    iVideoCodecSet;
+        const TDesC8* iMimeTypeSet[KMaxVideoCodecSet];
+        const TDesC*  iPreferredSupplierSet[KMaxVideoCodecSet];
+        const TDesC8* iVideoTypeSet[KMaxVideoCodecSet];
+        const TDesC8* iAudioTypeSet[KMaxVideoCodecSet];
+
+        TInt iCameraHandle;
+        
+        CFbsBitmap* iBitmapSave;
+        HBufC8* iDataSave;
+        TBool iBitmapSendDone;
+        TBool iExtensionMode;
+        
+        TBool iVideoStopModeCommand;
+        TBool iAsyncVideoStopEnabled;
+
+
+    };
+
+#endif // CAE_TEST_CLIENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestRelease.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,288 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestRelease.h
+*
+*/
+#ifndef CAE_TEST_RELEASE_H
+#define CAE_TEST_RELEASE_H
+
+
+#include <e32base.h>
+#include "CaeTestVariation.h"
+
+#include "CaeTestStatesClient.h"
+#include "CaeTestSettingsClient.h"
+
+class CCaeTestRelease : public CTestCase
+{
+public:
+
+	CCaeTestRelease ();
+    ~CCaeTestRelease ();
+
+	// Allocate the resources for one test function
+    void setUpL ();
+
+	// Free the resources reserved in setUpL()
+	void tearDown ();
+
+	// A function to collect and return a suite of tests
+    static MTest* suiteL ();
+
+protected:
+
+	// Own test functions that use assertions and may leave:
+    void TestInitL();
+    void TestInitVideoRecorderL();
+    void TestPowerOffAndOnL();
+    void TestReleaseAndReserveL();
+    void TestCCameraHandleL();
+
+    void TestPowerOnWhenInitializedL();
+    void TestPowerOnWhenStillCapturePreparedL();
+    void TestPowerOffWhenStillCapturePreparedL();
+    void TestPowerOffWhenViewfinderRunningL();
+    void TestPowerOnWhenVideoRecordingPreparedL();
+    void TestPowerOnWhenRecordingL();
+    void TestPowerOffWhenVideoRecordingPreparedL();
+    void TestPowerOffWhenRecordingL();
+
+    void TestViewFinderStartAndStopQqvgaL();
+    void TestViewFinderStartAndStopSubqcifL();
+    void TestCroppedViewFinderStartAndStopL();
+    void TestViewFinderDirectStartAndStopL();
+    void TestCroppedViewFinderDirectStartAndStopL();
+
+    void TestCaptureQualityLevel0L();
+    void TestCaptureQualityLevel1L();
+    void TestCaptureQualityLevel2L();
+
+    void TestCaptureVga16ML();
+    void TestCaptureVga64KL();
+    void TestCaptureVga4KL();
+
+    void TestCaptureQqvga16ML();
+    void TestCaptureQqvga64KL();
+    void TestCaptureQqvga4KL();
+
+    void TestCaptureMp1_16ML();
+    void TestCaptureMp1_64KL();
+    void TestCaptureMp1_4KL();
+    
+    void TestCaptureJpegMp1L();
+
+    void TestCaptureMp1M3_16ML();
+    void TestCaptureMp1M3_64KL();
+    void TestCaptureMp1M3_4KL();
+    
+    void TestCaptureJpegMp1M3L();
+
+    void TestCaptureMp2_16ML();
+    void TestCaptureMp2_64KL();
+    void TestCaptureMp2_4KL();
+    void TestCaptureJpegMp2L();
+    void TestCaptureExifMp2L();
+    void TestCaptureExifSVGAL();
+
+	void TestCaptureCodecL();
+	void TestCaptureCodec2L();
+
+    void TestCaptureCaptureL();
+    void TestCaptureCaptureSpecPrepL();
+
+    void TestPrepareStillCapture0L();
+    void TestPrepareStillCapture1L();
+    void TestPrepareStillCapture2L();
+    void TestPrepareStillCapture0WhenPreparedL();
+    void TestSpecPrepareSCSupportedFormatWhenInitializedL();
+
+    void TestCaptureStillWhenEngineInitializedL();
+
+    void TestCaptureStillBurst3L();
+    void TestCaptureStillBurst0L();
+    void TestCaptureStillBurst100L();
+
+    void TestCancelCaptureStillBurst3L();
+    void TestStopCaptureStillBurstAfter2L();
+    
+    void TestSpecPrepCaptureStillBurst3L();
+    
+    void TestCaptureStillBurstInterval0L();
+    void TestCaptureStillBurstInterval1000000L();
+    void TestCaptureStillBurstIntervalM1L();
+
+	void TestCaptureStillBurstExif3L();
+	void TestCaptureStillBurstExif6L();
+	void TestCaptureStillBurstExif6NSL();
+	void TestCaptureStillBurstExif6_ThumbnailL();
+	void TestCaptureStillBurstExif100L();
+	void TestCaptureStillBurstExif6VfL();
+	void TestCaptureStillBurstExif6VfCancelL();
+
+    void TestCaptureVgaExifL();
+    void TestCaptureQqvgaExifL();
+	void TestCaptureVgaSnapOneHalfExifL();
+	void TestCaptureVgaSnapOneFourthExifL();
+	void TestCaptureVgaSnapOneEighthExifL();
+	void TestCaptureVgaSnapExifL();
+	void TestCaptureVgaSnapOneEighthJpegL();
+	void TestCaptureVgaSnapOneEighthExif2L();
+	void TestCaptureVgaSnapColor16MExifL();
+    void TestCaptureAfterPowerOffL();
+
+    void TestPrepareVideoRecording0L();
+    void TestPrepareVideoRecording1L();
+    void TestPrepareVideoRecording2L();
+    void TestPrepareVideoRecording0WhenPreparedL();
+    void TestSpecPrepareVRSupportedFormatWhenVRInitializedL();
+   
+    void TestRecordQualityLevel0L();
+    void TestRecordQualityLevel1L();
+    void TestRecordQualityLevel2L();
+
+    void TestStartAndStopVideoRecordingSubQcifL();
+    void TestStartAndStopVideoRecordingSubQcifNoInitL();
+    void TestStartAndStopVideoRecordingQcifL();
+
+    void TestSCDigiZoomVal0L();
+    void TestSCDigiZoomVal1VgaL();
+    void TestSCDigiZoomVal1QqvgaL();
+    void TestSCDigiZoomInitializedVal0L();
+    void TestSCDigiZoomInitializedVal1VgaL();
+    void TestSCDigiZoomInitializedVal1QqvgaL();
+    void TestVRDigiZoomVal0L();
+    void TestVRDigiZoomVal1L();
+    void TestVRDigiZoomRecordingVal0L();
+    void TestVRDigiZoomRecordingVal1L(); 
+    
+    void TestStartAndStopVRWhenTooBigSizeSubQcifL();
+
+    void TestGetInfoL();
+    void TestGetInfoPROD1MirageXL();
+    void TestGetInfoPROD2MirageXL();
+    void TestGetInfoPROD3MirageXPL();
+    void TestGetInfoPROD4MirageXL();
+    void TestGetInfoPROD6MirageXL();
+    void TestGetInfoPROD7Unagi2ML();
+    void TestGetInfoPROD8MirageXL();
+    void TestGetInfoPROD9HWL();
+    void TestGetInfoDevlonHWL();
+
+    void TestRecordPauseResumeStopL();
+
+    void TestSCExposureMode0L();
+    void TestSCExposureMode1L();
+    void TestSCExposureModeInitialized0L();
+    void TestSCExposureModeInitialized1L();
+
+    void TestVRExposureMode0L();
+    void TestVRExposureMode1L();
+    void TestVRExposureModeRecording0L();
+    void TestVRExposureModeRecording1L();
+
+	void TestSCEvCompensation0L();
+	void TestSCEvCompensationMaxL();
+	void TestSCEvCompensationMinL();
+	void TestSCEvCompensationInitialized0L();
+	void TestSCEvCompensationInitializedMaxL();
+	void TestSCEvCompensationInitializedMinL();
+	void TestSCEvCompensationInitializedInvalidL();
+
+	void TestVREvCompensationMinL();
+	void TestVREvCompensationRecordingMaxL();
+
+    void TestSCWhiteBalanceMode0L();
+    void TestSCWhiteBalanceModeInitialized0L();
+
+    void TestVRWhiteBalanceMode0L();
+    void TestVRWhiteBalanceModeRecording0L();
+
+    void TestSCContrast50L();
+    void TestSCContrastInitialized50L();
+
+    void TestSCBrightness50L();
+    void TestSCBrightnessInitialized50L();
+
+    void TestVRContrast50L();
+    void TestVRContrastRecording50L();
+
+    void TestVRBrightness50L();
+    void TestVRBrightnessRecording50L();
+
+    void TestVideoClipMaxSize10000L();
+    void TestVideoClipMaxSize10000_2L();
+    
+    void TestCancelCaptureStillL();
+
+    void TestGetStillQualityIndexWhenEngineInitializedL();
+    void TestGetStillQualityIndexWhenPreparedL();
+    void TestGetVideoQualityIndexWhenEngineInitializedL();
+    void TestGetVideoQualityIndexWhenPreparedL();
+
+    void TestRemainingTimeWhenVideoPreparedL();
+
+    void TestPrepareAudioBitRateVR5000L();
+    void TestPrepareAudioBitRateVR128L();
+    void TestPrepareAudioBitRateVR128InvVtypeL();
+
+    void TestCaptureVga16M_NoSnapL();
+    void TestCaptureQualityLevel0_NoSnapL();
+    void TestCaptureVgaExif_NoSnapL();
+    void TestCaptureStillBurst3_NoSnapL();
+    void TestSpecPrepCaptureStillBurst3_NoSnapL();
+    void TestCaptureStillBurstExif3_NoSnapL();
+    
+    void TestEnumerateCaptureSizesL();
+    void TestSetJpegQuality50L();
+    void TestSCCustomInterfaceL();    
+    
+    void TestFlashMode0L();
+    void TestFlashMode1L();
+    void TestFlashMode2L();
+    
+    void TestSCColorToneNormalL();
+    void TestSCColorToneSepiaL();
+    void TestSCColorToneGrayscaleL();
+    void TestSCColorToneNegativeL();
+    void TestVRColorToneL();
+    void TestSCColorToneWrongParams1L();
+    void TestSCColorToneWrongParams2L();
+    void TestSCColorToneReleaseL();
+
+    void TestSetDisplayIndexL();
+    void TestEnumerateVideoFrameSize001L();
+    void TestSecondaryCamera001L();
+    void TestProcessExtViewFinderFrameReadyL();
+    void TestProcessExtSnapImageL();
+    void TestProcessExtCapturedImageL();
+    void TestProcessExtCapturedImage2L();
+    void TestProcessExtCapturedImage3L();
+    void TestProcessExtCapturedImage4L();
+    void TestProcessExtCancelL();
+    void TestProcessExtCancel2L();
+    void TestProcessExtCapturedImageBurstL();
+    void TestProcessExtCapturedImageBurst2L();
+    void TestInstalledExtensionListL();
+    void TestSkippedExtensionListL();
+    void TestSetSkippedExtensionListL();
+    
+    void TestRecordAsyncStop001L();
+    void TestRecordAsyncStop002L();
+
+private:
+    CCaeTestStatesClient * iStatesClient;
+    CCaeTestSettingsClient * iSettingsClient;
+};
+
+#endif // CAE_TEST_RELEASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestSettingsClient.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestSettingsClient.h
+*
+*/
+#ifndef CAE_TEST_SETTINGS_CLIENT_H
+#define CAE_TEST_SETTINGS_CLIENT_H
+
+#include <e32base.h>
+#include "CaeTestClient.h"
+
+class CCaeTestSettingsClient : public CCaeTestClient
+    {
+    public:
+        static CCaeTestSettingsClient* NewL();
+        ~CCaeTestSettingsClient();
+
+    public:
+        void RunTestActionL( TestClientActions aAction );
+
+    protected:
+	    CCaeTestSettingsClient();
+        void ConstructL();
+
+    private:
+        void RunTrappedL();
+    };
+
+#endif // CAE_TEST_SETTINGS_CLIENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestStatesClient.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestStatesClient.h
+*
+*/
+#ifndef CAE_TEST_STATES_CLIENT_H
+#define CAE_TEST_STATES_CLIENT_H
+
+#include <e32base.h>
+#include "CaeTestClient.h"
+
+class CCaeTestStatesClient : public CCaeTestClient
+    {
+    
+    public:
+        static CCaeTestStatesClient* NewL();
+        ~CCaeTestStatesClient();
+
+    public:
+        void RunTestActionL( TestClientActions aAction );
+
+    protected:
+	    CCaeTestStatesClient();
+        void ConstructL();
+
+    private:
+        void RunTrappedL();
+    };
+
+#endif // CAE_TEST_STATES_CLIENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestStillSettings.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestStillSettings.h
+*
+*/
+#ifndef CAE_TEST_STILL_SETTINGS_H
+#define CAE_TEST_STILL_SETTINGS_H
+
+
+#include <e32base.h>
+
+#include "CaeTestSettingsClient.h"
+
+class CCaeTestStillSettings : public CTestCase
+{
+public:
+
+	CCaeTestStillSettings();
+    ~CCaeTestStillSettings();
+
+	// Allocate the resources for one test function
+    void setUpL();
+
+	// Free the resources reserved in setUpL()
+	void tearDown();
+
+	// A function to collect and return a suite of tests
+    static MTest* suiteL();
+
+protected:
+
+	// Own test functions that use assertions and may leave:
+    void TestDigiZoomVal2L();
+    void TestDigiZoomValNeg1L();
+    void TestOpticalZoomValMinL();
+    void TestOpticalZoomValMaxL();
+    void TestDigiZoomMode0L();
+    
+    void TestOpticalZoomMode1L();
+    void TestOpticalDigiZoomMode2L();
+    
+    void TestDigiZoomModeNeg1L();
+    
+    void TestBrightness0L();
+    void TestBrightness100L();
+    void TestBrightnessNeg100L();
+    void TestBrightness101L();
+    void TestBrightnessNeg101L();
+    
+    void TestContrast0L();
+    void TestContrast100L();
+    void TestContrastNeg100L();
+    void TestContrast101L();
+    void TestContrastNeg101L();
+    
+    void TestExposureMode2L();
+    void TestExposureMode4L();
+    void TestExposureModeNeg1L();
+    void TestExposureMode5L();
+    
+    void TestWhiteBalanceMode1L();
+    void TestWhiteBalanceMode2L();
+    void TestWhiteBalanceMode4L();
+    void TestWhiteBalanceMode8L();
+    void TestWhiteBalanceMode10L();
+    void TestWhiteBalanceModeNeg1L();
+    void TestWhiteBalanceMode5L();
+
+    void TestFlashMode4L();
+    void TestFlashMode8L();
+    void TestFlashModeNeg1L();
+    void TestFlashMode5L();
+    void TestFlashMode6L();
+    void TestFlashMode9L();
+    void TestFlashMode10L();
+    
+    void TestExposureModeInitialized2L();
+    void TestWhiteBalanceModeInitialized2L();
+    void TestFlashModeInitialized2L();
+    void TestDigiZoomInitializedMode0L();
+    
+    void TestGetInfo();
+    
+    void TestResetToDefaultsL();
+    void TestSetViewFinderMirrorL();
+
+    void TestGetStillFrameSizeWhenInitializedL();
+    void TestGetStillFrameSizeWhenPreparedL();
+    
+    void TestEstimatedStillSizeInBytesWhenInitializedL();
+    void TestEstimatedStillSizeInBytesWhenPreparedL();
+    void TestSetSnapImageSizeBeforePrepareL();
+    void TestSetSnapImageSizeDuringAndAfterPrepareL();
+
+    void TestInitUidL();
+    void TestSetJpegQuality0L();
+    void TestSetJpegQuality101L();
+
+    void TestCaptureStillBurstIntervalM2L();
+    
+    void TestSetJpegCodecInvalidL();
+
+private:
+    CCaeTestSettingsClient* iSettingsClient;
+};
+
+#endif // CAE_TEST_STILL_SETTINGS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestStillStates.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestStillStates.h
+*
+*/
+#ifndef CAE_TEST_STILL_STATES_H
+#define CAE_TEST_STILL_STATES_H
+
+
+#include <e32base.h>
+
+#include "CaeTestStatesClient.h"
+
+class CCaeTestStillStates : public CTestCase
+{
+public:
+
+	CCaeTestStillStates ();
+    ~CCaeTestStillStates ();
+
+	// Allocate the resources for one test function
+    void setUpL ();
+
+	// Free the resources reserved in setUpL()
+	void tearDown ();
+
+	// A function to collect and return a suite of tests
+    static MTest* suiteL ();
+
+protected:
+
+	// Own test functions that use assertions and may leave:
+    void TestPrepareStillCaptureNeg1L();   
+    void TestPrepareStillCapture3L();
+    void TestSpecPrepareSCUnsupportedFormatWhenInitializedL();
+    void TestSpecPrepareSCSupportedFormatWhenPreparedL();
+
+    void TestPrepareCroppedStillCapturingL();
+    void TestPrepareStillCaptureWhenPowerOffL();
+    void TestCaptureAfterPowerOffOnL();
+
+    void TestPrepareStillCaptureWhenRecordingL();
+    void TestPrepareStillCaptrureWrongSizeL();
+
+    void TestReleaseL();
+    void TestReleaseReleaseL();
+    void TestReserveL();
+    void TestReleaseReserveCaptureL();
+
+    void TestPowerOffPowerOffL();
+    void TestStartVfStartVfL();
+    void TestStartVfWhenPowerOffL();
+    
+    void TestCancelCaptureStillWhenInitializedL();
+    void TestCancelCaptureStillAtSnapL();
+
+    void TestCaptureCaptureStillBurst3L();
+    void TestSpecPrepCaptureCaptureStillBurst3L();
+    void TestCaptureStillBurst3CaptureStillL();
+    void TestSpecPrepCaptureStillBurst3CaptureStillL();
+    void TestCancelCaptureStillBurst3AtSnapL();
+    void TestCancelCaptureStillBurst3AtMomentL();
+	void TestCaptureStillBurstMp2Exif100IgnoreErrorsL();
+	void TestCaptureStillBurstMp1Exif100IgnoreErrorsL();
+	void TestCaptureStillBurstVgaBitmap100IgnoreErrorsL();
+	void TestCaptureStillBurstVgaJpeg100IgnoreErrorsL();
+
+    void TestDestroy1L();
+    void TestDestroy2L();
+    void TestDestroy3L();
+    void TestDestroy4L();
+    void TestDestroy5L();
+    void TestDestroy6L();
+    void TestDestroy7L();
+    
+    void TestEncodingErrorL();
+    void TestPowerErrorL();
+    void TestReserveErrorL();
+    void TestStillCaptureErrorL();
+    void TestSnapImageErrorL();
+    void TestStillImageErrorL();
+    void TestStillConvertError1L();
+    void TestStillConvertError2L();
+    void TestStillConvertError3L();
+    void TestSetCameraIndexLowL();
+    void TestSetCameraIndexHighL();
+
+private:
+
+    CCaeTestStatesClient * iStatesClient;
+};
+
+#endif // CAE_TEST_STILL_STATES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestTop.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestTop.h
+*
+*/
+#ifndef CAE_TEST_TOP_H
+#define CAE_TEST_TOP_H
+
+#include <e32base.h>
+#include "CaeTestVariation.h"
+
+EXPORT_C  MTest* CreateTopFct();
+
+class CCaeTestTop : public CTestSuite
+    {
+    public:
+	    CCaeTestTop();
+        ~CCaeTestTop();
+
+	    // A function to collect and return a suite of tests
+	    static MTest* suiteL();
+
+    protected:
+
+    private:
+
+    };
+
+#endif // CAE_TEST_TOP_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestVariation.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Cae Test DLL
+*
+*/
+
+
+#ifndef __CAETESTVARIATION_H
+#define __CAETESTVARIATION_H
+
+//  INCLUDES
+
+#ifdef USING_CPPUNIT_FRAMEWORK
+     /* CppUnit headers */
+    #include <CppUnit/Test.h>
+    #include <CppUnit/TestCase.h>
+    #include <CppUnit/TestCaller.h>
+    #include <CppUnit/TestSuite.h>
+#else
+    /* STIF TFW headers */
+    #include "TestFrameWork/test.h"
+    #include "TestFrameWork/testCase.h"
+    #include "TestFrameWork/testCaller.h"
+    #include "TestFrameWork/testSuite.h"
+#endif
+
+
+// CONSTANTS
+
+// Enable/disable test case image and video writing to memory card
+#define WRITE_SNAPIMAGE_TO_FILE     0
+#define WRITE_STILLIMAGE_TO_FILE    0
+#define WRITE_VIDEOCLIP_TO_FILE     1
+#define WRITE_VF_TO_FILE            0
+#define WRITE_VIDEOTIMES_TO_FILE    0
+
+// Select symbian (1) or optimized (0) jpeg codecs
+
+#if ( defined (__WINS__) || defined (__WINSCW) )
+#define SYMBIAN_CODECS  1
+#else
+#define SYMBIAN_CODECS  0
+#endif
+
+// MACROS
+
+// Select only one of these (if any).
+#define MIRAGE_X_PROD1 0
+#define MIRAGE_X_PROD2 0
+#define MIRAGE_X_PROD3 0
+#define MIRAGE_X_PROD4 0
+#define MIRAGE_X_PROD5 0
+#define MIRAGE_X_PROD6 0
+#define MIRAGE_X_PROD7 0
+#define MIRAGE_X_PROD8 0
+#define MIRAGE_X_PROD9 0
+#define HW_DEVLON 1 
+#define HW_DEVLON52 0
+
+#define VIDEO_RECORDING_TEST_CASES  1
+#define SECONDARY_CAMERA_TEST_CASES 0
+
+
+
+#if (MIRAGE_X_PROD1) || (MIRAGE_X_PROD2) || (MIRAGE_X_PROD3) || (MIRAGE_X_PROD4) || (MIRAGE_X_PROD5) || (MIRAGE_X_PROD6) || (MIRAGE_X_PROD8) ||\
+     (MIRAGE_X_PROD9) || (HW_DEVLON) || (HW_DEVLON52)
+    #define MIRAGE_X 1
+#else
+    #define MIRAGE_X 0
+#endif
+
+#if (MIRAGE_X_PROD7)
+    #define UNAGI_2M 1
+#else
+    #define UNAGI_2M 0
+#endif
+
+#if ((!MIRAGE_X) && (!UNAGI_2M)) || (MIRAGE_X_PROD5)
+    // S60 2.1 interface
+    #define CAE_INTERFACE_21
+#endif
+
+#if (MIRAGE_X_PROD3) || (MIRAGE_X_PROD4) 
+    #define COLOR_TONE_TEST_CASES 1
+#endif
+
+// For OOM testing in CppUnit. Set to 1 if you want this on. Set to 0 if not. 
+#define CAE_OOM_TESTING_HARNESS 0
+
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestVideoSettings.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestVideoSettings.h
+*
+*/
+#ifndef CAE_TEST_VIDEO_SETTINGS_H
+#define CAE_TEST_VIDEO_SETTINGS_H
+
+
+#include <e32base.h>
+
+#include "CaeTestSettingsClient.h"
+
+class CCaeTestVideoSettings : public CTestCase
+{
+public:
+
+	CCaeTestVideoSettings ();
+    ~CCaeTestVideoSettings ();
+
+	// Allocate the resources for one test function
+    void setUpL ();
+
+	// Free the resources reserved in setUpL()
+	void tearDown ();
+
+	// A function to collect and return a suite of tests
+    static MTest* suiteL ();
+
+protected:
+
+	// Own test functions that use assertions and may leave:
+    void TestDigiZoomVal2L();
+    void TestDigiZoomNegVal1L();
+    void TestDigiZoomMode0L();
+    void TestOpticalZoomMode1L();
+    void TestOpticalDigiZoomMode2L();
+    void TestDigiZoomNegMode1L();
+    void TestBrightness0L();
+    void TestBrightness100L();
+    void TestBrightnessNeg100L();
+    void TestBrightness101L();
+    void TestBrightnessNeg101L();
+    void TestContrast0L();
+    void TestContrast100L();
+    void TestContrastNeg100L();
+    void TestContrast101L();
+    void TestContrastNeg101L();
+    void TestExposureMode2L();
+    void TestExposureMode4L();
+    void TestExposureModeNeg1L();
+    void TestExposureMode5L();
+    void TestWhiteBalanceMode1L();
+    void TestWhiteBalanceMode2L();
+    void TestWhiteBalanceMode4L();
+    void TestWhiteBalanceMode8L();
+    void TestWhiteBalanceMode10L();
+    void TestWhiteBalanceModeNeg1L();
+    void TestWhiteBalanceMode5L();
+    void TestWhiteBalanceMode12L();
+    void TestFlashMode0L();
+    void TestFlashMode1L();
+    void TestFlashMode2L();
+    void TestFlashMode4L();
+    void TestFlashMode8L();
+    void TestFlashModeNeg1L();
+    void TestFlashMode5L();
+    void TestVideoClipMaxSize0L();
+    void TestVideoClipMaxSizeNeg1L();
+    void TestVideoClipMaxSize10001L(); 
+    void TestVideoClipMaxSizeWhenVideoNotPrepared0L();
+    void TestVideoClipMaxSizeWhenVideoNotPrepared5000L();
+    void TestVideoAudioETrueL();
+    void TestVideoAudioEFalseL();
+    void TestExposureModeRecording2L();
+    void TestWhiteBalanceModeRecording2L();
+    void TestFlashModeRecording2L();
+    void TestDigiZoomRecordingMode0L();
+    void TestVideoClipMaxSizeRecording10000L();
+    void TestVideoClipMaxSizeNotInitialized10000L();
+    void TestVideoAudioRecordingETrueL();
+    void TestVideoAudioNotInitializedL();
+    void TestGetVideoAudioNotInitializedL();
+
+    void TestSetVideoFileNameL();
+    void TestSetEmptyVideoFileNameL();
+    void TestSetVideoFileNameWhenPreparedL();
+    void TestSetVideoFileNameWhenNotInitializedL();
+    void TestSetVideoFileNameWhenRecordingL();
+
+    void TestSetVideoTimeIntervalSubQcifL();
+    void TestSetVideoTimeIntervalSubQcifWhenPreparedL();
+    void TestSetVideoTimeIntervalSubQcifWhenRecordingL();
+    void TestSetZeroVideoTimeIntervalSubQcifWhenPreparedL();
+    void TestSetVideoTimeIntervalNegativeL();
+    void TestSetVideoTimeIntervalHugeL();
+    
+    void TestGetVideoFrameSizeWhenInitializedL();
+    void TestGetVideoFrameSizeWhenPreparedL();
+    void TestVideoFrameRateWhenInitializedL();
+    void TestVideoFrameRateWhenPreparedL();
+    void TestEstimatedVideoRecordingBitRateWhenInitializedL();
+    void TestEstimatedVideoRecordingBitRateWhenPreparedL();
+
+
+private:
+    CCaeTestSettingsClient * iSettingsClient;
+};
+
+#endif // CAE_TEST_VIDEO_SETTINGS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/CaeTestVideoStates.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,221 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestVideoStates.h
+*
+*/
+#ifndef CAE_TEST_VIDEO_STATES_H
+#define CAE_TEST_VIDEO_STATES_H
+
+
+#include <e32base.h>
+
+#include "CaeTestStatesClient.h"
+
+class CCaeTestVideoStates : public CTestCase
+{
+public:
+
+	CCaeTestVideoStates ();
+    ~CCaeTestVideoStates ();
+
+	// Allocate the resources for one test function
+    void setUpL ();
+
+	// Free the resources reserved in setUpL()
+	void tearDown ();
+
+	// A function to collect and return a suite of tests
+    static MTest* suiteL ();
+
+protected:
+
+	// Own test functions that use assertions and may leave:
+
+    void TestPrepareAndRecordQualityLevel0L();
+    void TestPrepareAndRecordQualityLevel1L();
+    void TestPrepareAndRecordQualityLevel2L();
+
+    void TestVideoRecordingQcif60000Fr10NoAudioNoVfL();
+    void TestVideoRecordingQcif60000Fr10WithAudioNoVfL();
+    void TestVideoRecordingQcif60000Fr10NoAudioWithVfL();
+    void TestVideoRecordingQcif60000Fr10WithAudioWithVfL();
+
+    void TestRecordPauseStopL();
+    void TestPauseWhenPreparedL();
+    void TestRecordPausePauseStopL();
+
+    void TestResumeWhenPreparedL();
+    void TestResumeWhenNotPausedL();
+
+    void TestPrepareVideoRecordingNeg1L();   
+    void TestPrepareVideoRecording3L();
+    void TestSpecPrepareVRUnsupportedFormatWhenVRInitializedL();
+    void TestSpecPrepareVRSupportedFormatWhenPreparedL();
+
+    void TestStartVideoRecordingWhenVRInitializedL();
+    void TestStartVideoRecordingWhenRecordingL();
+
+    void TestStopVideoRecordingWhenVRInitializedL();
+    void TestStopVideoRecordingWhenPreparedL();
+
+    void TestCaptureRecordL();
+    void TestRecordCaptureL();
+    void TestRecordRecordL();
+
+    void TestRecordCaptureComplexSequence1L();
+    void TestRecordCaptureComplexSequence2L();
+
+    void TestReleaseReserveRecordL();
+
+    void TestDestroy1L();
+    void TestDestroy2L();
+    void TestDestroy3L();
+    void TestDestroy4L();
+
+    void TestVideoRecorderOpenErrorL();
+    void TestVideoRecorderPrepareErrorL();
+    void TestVideoRecordingCompleteErrorL();
+    void TestPrepareVideoSettingsErrorL();
+
+    void TestPrepareAudioBitRateVR0L();
+    void TestPrepareAudioBitRateVR5150L();
+    void TestPrepareAudioBitRateVR12200L();
+    void TestPrepareAudioBitRateVR20000L();
+    void TestPrepareAudioBitRateVR12200AudioType0L();
+    void TestPrepareAudioBitRateVR12200AudioTypeInvL();
+
+    void TestInitVideoRecorderWithUidL();
+    void TestRemainingTimeWhenVideoNotInitializedL();
+
+    	// Own test functions that use assertions and may leave (SET 1)
+
+    void TestPrepareAndRecordQualityLevel0QL();
+    void TestPrepareAndRecordQualityLevel1QL();
+    void TestPrepareAndRecordQualityLevel2QL();
+
+    void TestVideoRecordingQcif60000Fr10NoAudioNoVfQL();
+    void TestVideoRecordingQcif60000Fr10WithAudioNoVfQL();
+    void TestVideoRecordingQcif60000Fr10NoAudioWithVfQL();
+    void TestVideoRecordingQcif60000Fr10WithAudioWithVfQL();
+
+    void TestRecordPauseStopQL();
+    void TestPauseWhenPreparedQL();
+    void TestRecordPausePauseStopQL();
+
+    void TestResumeWhenPreparedQL();
+    void TestResumeWhenNotPausedQL();
+
+    void TestPrepareVideoRecordingNeg1QL();   
+    void TestPrepareVideoRecording3QL();
+    void TestSpecPrepareVRUnsupportedFormatWhenVRInitializedQL();
+    void TestSpecPrepareVRSupportedFormatWhenPreparedQL();
+
+    void TestStartVideoRecordingWhenVRInitializedQL();
+    void TestStartVideoRecordingWhenRecordingQL();
+
+    void TestStopVideoRecordingWhenVRInitializedQL();
+    void TestStopVideoRecordingWhenPreparedQL();
+
+    void TestCaptureRecordQL();
+    void TestRecordCaptureQL();
+    void TestRecordRecordQL();
+
+    void TestRecordCaptureComplexSequence1QL();
+    void TestRecordCaptureComplexSequence2QL();
+
+    void TestReleaseReserveRecordQL();
+
+    void TestDestroy1QL();
+    void TestDestroy2QL();
+    void TestDestroy3QL();
+    void TestDestroy4QL();
+
+    void TestVideoRecorderOpenErrorQL();
+    void TestVideoRecorderPrepareErrorQL();
+    void TestVideoRecordingCompleteErrorQL();
+    void TestPrepareVideoSettingsErrorQL();
+
+    void TestPrepareAudioBitRateVR0QL();
+    void TestPrepareAudioBitRateVR5150QL();
+    void TestPrepareAudioBitRateVR12200QL();
+    void TestPrepareAudioBitRateVR20000QL();
+    void TestPrepareAudioBitRateVR12200AudioType0QL();
+    void TestPrepareAudioBitRateVR12200AudioTypeInvQL();
+
+    void TestInitVideoRecorderWithUidQL();
+
+
+    	// Own test functions that use assertions and may leave (SET 2)
+
+    void TestPrepareAndRecordQualityLevel0Q4L();
+    void TestPrepareAndRecordQualityLevel1Q4L();
+    void TestPrepareAndRecordQualityLevel2Q4L();
+
+    void TestVideoRecordingQcif60000Fr10NoAudioNoVfQ4L();
+    void TestVideoRecordingQcif60000Fr10WithAudioNoVfQ4L();
+    void TestVideoRecordingQcif60000Fr10NoAudioWithVfQ4L();
+    void TestVideoRecordingQcif60000Fr10WithAudioWithVfQ4L();
+
+    void TestRecordPauseStopQ4L();
+    void TestPauseWhenPreparedQ4L();
+    void TestRecordPausePauseStopQ4L();
+
+    void TestResumeWhenPreparedQ4L();
+    void TestResumeWhenNotPausedQ4L();
+
+    void TestPrepareVideoRecordingNeg1Q4L();   
+    void TestPrepareVideoRecording3Q4L();
+    void TestSpecPrepareVRUnsupportedFormatWhenVRInitializedQ4L();
+    void TestSpecPrepareVRSupportedFormatWhenPreparedQ4L();
+
+    void TestStartVideoRecordingWhenVRInitializedQ4L();
+    void TestStartVideoRecordingWhenRecordingQ4L();
+
+    void TestStopVideoRecordingWhenVRInitializedQ4L();
+    void TestStopVideoRecordingWhenPreparedQ4L();
+
+    void TestCaptureRecordQ4L();
+    void TestRecordCaptureQ4L();
+    void TestRecordRecordQ4L();
+
+    void TestRecordCaptureComplexSequence1Q4L();
+    void TestRecordCaptureComplexSequence2Q4L();
+
+    void TestReleaseReserveRecordQ4L();
+
+    void TestDestroy1Q4L();
+    void TestDestroy2Q4L();
+    void TestDestroy3Q4L();
+    void TestDestroy4Q4L();
+
+    void TestVideoRecorderOpenErrorQ4L();
+    void TestVideoRecorderPrepareErrorQ4L();
+    void TestVideoRecordingCompleteErrorQ4L();
+    void TestPrepareVideoSettingsErrorQ4L();
+
+    void TestPrepareAudioBitRateVR0Q4L();
+    void TestPrepareAudioBitRateVR5150Q4L();
+    void TestPrepareAudioBitRateVR12200Q4L();
+    void TestPrepareAudioBitRateVR20000Q4L();
+    void TestPrepareAudioBitRateVR12200AudioType0Q4L();
+    void TestPrepareAudioBitRateVR12200AudioTypeInvQ4L();
+
+    void TestInitVideoRecorderWithUidQ4L();
+
+
+private:
+    CCaeTestStatesClient * iStatesClient;
+};
+
+#endif // CAE_TEST_VIDEO_STATES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/StifCaeTestTop.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  StifCaeTestTop.h
+*
+*
+*/
+
+
+
+#ifndef DEMOMODULE_H
+#define DEMOMODULE_H
+
+// INCLUDES
+#if defined (_MSC_VER) && (_MSC_VER >= 1000)
+#pragma once
+#endif
+
+#include <StifTestModule.h>
+#include "TestFrameWork/testSuite.h"
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// DATA TYPES
+// None
+
+// FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+class CTestModule;
+class TCaseInfo;
+
+// CLASS DECLARATION
+ 
+
+// DESCRIPTION
+// Demo testmodule class definition.
+NONSHARABLE_CLASS( CTestModule ) 
+        :public CTestModuleBase
+    {
+    public: // Enumerations
+    	// None
+
+    private: // Enumerations
+    	// None
+
+    public: // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        static CTestModule* NewL();
+        
+        /**
+        * Destructor.
+        */
+        ~CTestModule();
+
+    public: // New functions
+        // None
+        
+    public: // Functions from base classes
+
+        /**
+        * Test cases are inquired from the Test Module by calling GetTestCases. 
+        * Test cases are appended to RPointerArray<TTestCaseInfo>& aTestCases
+        * that is a list consisting of several TTestCaseInfo objects.
+        */
+        TInt GetTestCasesL( const TFileName& aConfigFile, 
+            RPointerArray<TTestCaseInfo>& aTestCases );
+        /**
+        * RunTestCase is used to run an individual test case.
+        */
+        TInt RunTestCaseL( const TInt aCaseNumber, 
+                          const TFileName& aConfig,
+                          TTestResult& aResult );
+        
+    protected: // New functions
+    	// None
+    	
+    protected: // Functions from base classes
+        // None
+    	
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CTestModule();
+
+        /**
+        * Symbian OS constructor.
+        */
+        void ConstructL();        
+
+        /**
+        * Function returning test case name and pointer to test case function
+        */
+        const TCaseInfo Case ( const TInt aCaseNumber ) const;
+
+        void SetAllocFailureSimulation( RHeap::TAllocFail aAllocFailureType, TInt aAllocFailureRate );
+        void AllocFailureSimulation ( TBool aSwitchedOn );
+
+        void RunTestCaseInOOMLoopL( const TInt aCaseNumber, TTestResult& aResult );
+            
+    private: // Data
+
+       CTestSuite *iTestSuite ;
+       CActiveScheduler* iScheduler;
+       RHeap::TAllocFail iAllocFailureType;
+       TInt iAllocFailureRate;    	    	  	
+       TInt iCurrentAllocFailureRate;    	    	  	
+    };
+
+
+
+
+#endif // DEMOMODULE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/TestFrameWork/AssertFailure.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: AssertFailure.h
+*
+*/
+
+
+
+#ifndef __CPPUNIT_ASSERT_FAILURE_H
+#define __CPPUNIT_ASSERT_FAILURE_H
+
+#include <e32base.h>
+
+_LIT8(KCppUnitUnknownFilename, "-unknown-");
+const TInt KCppUnitUnknownLineNumber=(-1);
+
+
+class CAssertFailure : public CBase
+	{
+public:
+
+	static CAssertFailure* NewL (const TDesC8& aMessage,
+	                             TInt aLineNumber=KCppUnitUnknownLineNumber,
+	                             const TDesC8& aFileName=KCppUnitUnknownFilename);
+
+	static CAssertFailure* NewLC (const TDesC8& aMessage,
+	                              TInt aLineNumber=KCppUnitUnknownLineNumber,
+	                              const TDesC8& aFileName=KCppUnitUnknownFilename);
+
+	static CAssertFailure* NewL (CAssertFailure& aAssertFailure);
+
+	static CAssertFailure* NewLC (CAssertFailure& aAssertFailure);
+
+    ~CAssertFailure ();
+
+    const TDesC8& What() const;
+    TInt LineNumber() const;
+    const TDesC8& FileName() const;
+
+	void SetMyHeapCellCount (TInt aHeapCellCount);
+	TInt MyHeapCellCount ();
+
+private:
+
+    CAssertFailure ();
+    CAssertFailure (TInt aLineNumber);
+    void ConstructL (const TDesC8& aMessage, const TDesC8& aFileName);
+    void ConstructL (CAssertFailure& aAssertFailure);
+
+    HBufC8* iMessage;
+    TInt  iLineNumber;
+    HBufC8* iFileName;
+	TInt iMyHeapCellCount;
+	};
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/TestFrameWork/TestResult.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CTestResult
+*
+*/
+
+
+
+#ifndef __CPPUNIT_TESTRESULT_H
+#define __CPPUNIT_TESTRESULT_H
+
+#include <e32base.h>
+
+class MTest;
+class CAssertFailure;
+class CTestFailure;
+
+
+/*
+ * A CTestResult collects the results of executing a test case. It is an 
+ * instance of the Collecting Parameter pattern.
+ *
+ * The test framework distinguishes between failures and errors.
+ * A failure is anticipated and checked for with assertions. Errors are
+ * unanticipated problems that are caused by "leaves" that are not generated
+ * by the framework.
+ *
+ * see MTest
+ */
+
+class CTestResult : public CBase
+	{
+public:
+
+	IMPORT_C static CTestResult* NewLC();
+	IMPORT_C static CTestResult* NewL();
+
+    IMPORT_C ~CTestResult ();
+
+    IMPORT_C TInt TestCount ();
+    IMPORT_C RPointerArray<CTestFailure>& Errors ();
+    IMPORT_C RPointerArray<CTestFailure>& Failures ();
+    IMPORT_C TBool WasSuccessful ();
+
+	void IncrementTestCount ();
+    void AddErrorL (MTest& aTest, TInt aError);
+    void AddFailureL (MTest& aTest, CAssertFailure* aAssertFailure);
+
+private:
+
+	void ConstructL ();
+	CTestResult ();
+
+    RPointerArray<CTestFailure> iErrors;
+    RPointerArray<CTestFailure> iFailures;
+	TInt iTestCount; 
+	};
+
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/TestFrameWork/test.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MTest
+*
+*/
+
+
+
+#ifndef __CPPUNIT_MTEST_H
+#define __CPPUNIT_MTEST_H
+
+#include <e32base.h>
+#include <StifTestModule.h>
+class CCppUnitLog;
+
+
+// A MTest can be run and collect its results. See CTestResult.
+//
+class MTest
+	{
+public:
+
+	virtual ~MTest() { }
+
+    virtual void ExecuteL (TTestResult& aResult) = 0;
+    
+	virtual TInt CountTestCases () = 0;
+    
+	virtual const TDesC8& Name () = 0;
+
+    // Same functions with an Index.
+    virtual void ExecuteTestL(TTestResult& aResult,
+                      TInt aIndex) = 0;
+
+    virtual const TDesC8& TestCaseName (TInt aIndex) = 0;
+	};
+
+// All the polymorphic DLLs containing tests should use the following UID:
+//
+const TInt KCppUnitTestDllUidValue=0x101F5380;
+const TUid KCppUnitTestDllUid={KCppUnitTestDllUidValue};
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/TestFrameWork/testCaller.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CTestCaller
+*
+*/
+
+
+
+#ifndef CPPUNIT_TESTCALLER_H
+#define CPPUNIT_TESTCALLER_H
+
+#include "TestFrameWork/testCase.h"
+
+
+/* 
+ * A test caller provides access to a test case method 
+ * on a test case class.  Test callers are useful when 
+ * you want to run an individual test or add it to a suite.
+ * 
+ * Here is an example:
+ * 
+ * class CMathTest : public CTestCase 
+ * {
+ *     public:
+ *         void         setUpL ();
+ *         void         tearDown ();
+ *
+ *     protected:
+ *         void         testAddL ();
+ *         void         testSubtractL ();
+ * };
+ *
+ * CTest* CMathTest::suiteL () 
+ * {
+ *     CTestSuite *suite = CTestSuite::NewL();
+ *     suite->addTestL(CTestCaller<MathTest>::NewL(_L("testAddL") testAddL));
+ *     suite->addTestL(CTestCaller<MathTest>::NewL(_L("testSubtractL") testSubtractL));
+ *     return suite;
+ * }
+ *
+ * You can use a CTestCaller to bind any test method on a CTestCase
+ * class, as long as it does not have parameters and returns void.
+ * 
+ * See CTestCase
+ */
+
+
+template <class Fixture> class CTestCaller : public CTestCase
+	{
+public:
+
+    typedef void (Fixture::*TestMethod)();
+
+    static CTestCaller* NewLC (const TDesC8& aName, TestMethod aTest);
+    static CTestCaller* NewL (const TDesC8& aName, TestMethod aTest);
+	~CTestCaller();
+
+protected:
+ 
+    // From CTestCase:
+    void setUpL ()       { iFixture->setUpL (); }
+    void executeTestL () { (iFixture->*iTest)(); } 
+    void tearDown ()     { iFixture->tearDown (); }
+
+private:
+
+    CTestCaller (TestMethod aTest) : iTest(aTest) { }
+    void ConstructL (const TDesC8& aName);
+
+    TestMethod iTest;
+    Fixture    *iFixture;
+	};
+
+
+template <class Fixture>
+CTestCaller<Fixture>* CTestCaller<Fixture>::NewLC (const TDesC8& aName,
+                                                   TestMethod aTest)
+	{
+	CTestCaller* self = new(ELeave) CTestCaller(aTest);
+	CleanupStack::PushL(self);
+	self->ConstructL(aName);
+	return self;
+	}
+
+template <class Fixture> 
+CTestCaller<Fixture>* CTestCaller<Fixture>::NewL (const TDesC8& aName,
+                                                  TestMethod aTest)
+	{
+	CTestCaller* self = NewLC(aName, aTest);
+	CleanupStack::Pop();
+	return self;
+	}
+
+
+template <class Fixture>
+void CTestCaller<Fixture>::ConstructL (const TDesC8& aName)
+	{
+	CTestCase::ConstructL(aName);
+	iFixture = new(ELeave)Fixture;
+	}
+
+
+template <class Fixture>
+CTestCaller<Fixture>::~CTestCaller () 
+	{
+	delete iFixture;
+	}
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/TestFrameWork/testCase.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,200 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CTestCase
+*
+*/
+
+
+
+#ifndef __CPPUNIT_CTESTCASE_H
+#define __CPPUNIT_CTESTCASE_H
+
+#include <e32base.h>
+#include "TestFrameWork/test.h"
+#include <StifTestModule.h>
+class CAssertFailure;
+class CTestResult;
+class CppUnitLog;
+
+/*
+ * A test case defines the fixture to run multiple tests. To define a test case
+ * 1) implement a subclass of CTestCase
+ * 2) define instance variables that store the state of the fixture
+ * 3) initialize the fixture state by overriding setUp
+ * 4) clean-up after a test by overriding tearDown.
+ *
+ * Each test runs in its own fixture so there can be no side effects 
+ * among test runs. Here is an example:
+ * 
+ * class CMathTest : public CTestCase 
+ * {
+ *     public:
+ *
+ *     void setUpL () 
+ *     {
+ *         iValue1 = 2;
+ *         iValue2 = 3;
+ *     }
+ *     
+ *     private:
+ *
+ *     TInt iValue1, iValue2;
+ * }
+ * 
+ * For each test implement a method which interacts with the fixture.
+ * Verify the expected results with assertions specified
+ * by calling assert on the expression you want to test:
+ * 
+ *    protected: 
+ *    void testAddL ()
+ *    {
+ *        TInt result = value1 + value2;
+ *        assertL (result == 5);
+ *    }
+ * 
+ * The tests to be run can be collected into a CTestSuite:
+ * 
+ * public: 
+ * static CMathTest::suiteL ()
+ * {
+ *      CTestSuite *suiteOfTests = CTestSuite::NewL(_L8("aSuite"));
+ *      suiteOfTests->addTestL(CTestCaller<MathTest>::NewL(_L8("testAddL"), testAddL));
+ *      return suiteOfTests;
+ * }
+ *
+ * see CTestSuite and CTestCaller
+ *
+ */
+
+
+class CTestCase : public MTest, public CBase 
+	{
+public:
+
+     ~CTestCase ();
+
+    // From MTest:
+     void ExecuteL (TTestResult& aResult);
+
+	// From MTest:
+     TInt CountTestCases ();
+	
+	// From MTest:
+     const TDesC8& Name ();
+
+    // From MTest:
+     void ExecuteTestL(TTestResult& aResult,
+                      TInt aIndex);
+
+    // From MTest:
+     const TDesC8& TestCaseName (TInt aIndex);
+
+protected:
+
+     virtual void ConstructL (const TDesC8& aName);
+
+     void AssertL (TBool aCondition, 
+                           const TDesC8& aConditionExpression,
+                           TInt  aLineNumber,
+                           const TDesC8& aFileName);
+
+     void AssertEqualsL (TInt  aExpected, 
+                                 TInt  aActual,
+                                 TInt  aLineNumber,
+                                 const TDesC8& aFileName);
+
+     void AssertEqualsL (TReal aExpected,
+                                 TReal aActual, 
+                                 TReal aDelta, 
+                                 TInt  aLineNumber,
+                                 const TDesC8& aFileName);
+
+     void AssertEqualsL (const TDesC8&  aExpected, 
+                                 const TDesC8&  aActual,
+                                 TInt           aLineNumber,
+                                 const          TDesC8& aFileName);
+
+     void AssertEqualsL (const TDesC16& aExpected, 
+                                 const TDesC16& aActual,
+                                 TInt           aLineNumber,
+                                 const          TDesC8& aFileName);
+
+	 void AllocFailureSimulation (TBool aSwitchedOn);
+
+    virtual void setUpL () = 0;
+    virtual void executeTestL () { }
+    virtual void tearDown () = 0;
+
+	 CTestCase ();
+
+private:
+
+	TInt ExecuteImplL ();
+
+    HBufC8* NotEqualsMessageLC (const TDesC8& aExpected,
+                                const TDesC8& aActual);
+
+    HBufC8* NotEqualsMessageLC (const TDesC16& aExpected,
+                                const TDesC16& aActual);
+
+	void AssertFailureToTlsL (const TDesC8& aMessage,
+	                          TInt  aLineNumber,
+	                          const TDesC8& aFileName);
+
+	CAssertFailure* AssertFailureFromTlsL ();
+
+	TInt HeapCellsReservedByAssertFailure ();
+
+    // data
+    HBufC8* iName;
+	RHeap::TAllocFail iAllocFailureType;
+	TUint iAllocFailureRate;
+	};
+
+
+// A set of macros which allow us to get the line number
+// and file name at the point of an assertion failure:
+
+#undef assertL
+#define assertL(condition)\
+        (this->AssertL ((condition), TPtrC8((TText8*)(#condition)),\
+                        __LINE__, TPtrC8((TText8*)__FILE__)))
+
+// Macros for primitive value comparisons
+#define assertTIntsEqualL(expected,actual)\
+        (this->AssertEqualsL ((expected), (actual),\
+                              __LINE__, TPtrC8((TText8*)__FILE__)))
+
+#define assertTRealsEqualL(expected,actual,delta)\
+        (this->AssertEqualsL ((expected), (actual), (delta),\
+                              __LINE__,TPtrC8((TText8*)__FILE__)))
+
+
+// Macros for descriptor comparisons
+#define assertTDesC8sEqualL(expected,actual)\
+        (this->AssertEqualsL ((expected), (actual),\
+                              __LINE__, TPtrC8((TText8*)__FILE__)))
+
+#define assertTDesC16sEqualL(expected,actual)\
+        (this->AssertEqualsL ((expected), (actual),\
+                              __LINE__, TPtrC8((TText8*)__FILE__)))
+
+#if defined(_UNICODE)
+#define assertTDesCsEqualL(expected,actual) assertTDesC16sEqualL(expected,actual)
+#else
+#define assertTDesCsEqualL(expected,actual) assertTDesC8sEqualL(expected,actual)
+#endif
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/inc/TestFrameWork/testSuite.h	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CTestSuite
+*
+*/
+
+
+
+#ifndef __CPPUNIT_CTESTSUITE_H
+#define __CPPUNIT_CTESTSUITE_H
+
+#include <e32base.h>
+#include "TestFrameWork/test.h"
+
+class TestResult;
+class CppUnitLog;
+
+/*
+* A CTestSuite is a Composite of MTests.
+* It runs a collection of test cases.
+*
+* see MTest and CTestCaller
+*/
+
+
+class CTestSuite : public MTest, public CBase
+    {
+    public:
+        
+        static CTestSuite* NewLC(const TDesC8& aName);
+        static CTestSuite* NewL(const TDesC8& aName);
+        ~CTestSuite ();
+        
+        void addTestL (MTest *aTest);
+        
+        // From MTest:
+        void ExecuteL (TTestResult& aResult);
+        
+        // From MTest:
+        TInt CountTestCases ();
+        
+        // From MTest:
+        const TDesC8& Name ();
+        
+        
+        // From MTest:
+        void ExecuteTestL(TTestResult& aResult,
+            TInt aIndex);
+        
+        // From MTest:
+        const TDesC8& TestCaseName (TInt aIndex);
+        
+    private:
+        
+        void ConstructL (const TDesC8& aName);
+        CTestSuite () { }
+        
+        RPointerArray<MTest> iTests;
+        HBufC8 *iName;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestClient.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,1691 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestClient.cpp
+*
+*/
+
+#include <fbs.h>
+
+#include "CaeTestClient.h"
+#include "CaeTestVariation.h"
+
+// Set 0
+_LIT8(KVideoMimeType, "video/3gpp");
+_LIT(KVideoPreferredSupplier, "Nokia");
+_LIT8(KVideoType, "video/H263-2000");
+_LIT8(KVideoAudioType, " AMR");
+// Set 1 for 2.7 
+_LIT8(KVideoMimeType1, "video/3gpp2");
+_LIT(KVideoPreferredSupplier1, "Nokia");
+_LIT8(KVideoType1, "video/H263-2000"); // H.263 video
+_LIT8(KVideoAudioType1, " AMR");       // AMR audio
+// Set 2 for 2.7 AAC
+_LIT8(KVideoMimeType2, "video/3gpp2");
+_LIT(KVideoPreferredSupplier2, "Nokia");
+_LIT8(KVideoType2, "video/mp4v-es");   // MPEG-4 video
+_LIT8(KVideoAudioType2, " AAC");       // AAC audio
+// Set 3 for 2.8
+_LIT8(KVideoMimeType3, "video/3gpp");
+_LIT(KVideoPreferredSupplier3, "Nokia");
+_LIT8(KVideoType3, "video/H263-2000; profile=0; level=45");
+_LIT8(KVideoAudioType3, " AMR");
+
+
+CCaeTestClient::CCaeTestClient () : 
+    CTimer( CActive::EPriorityStandard )
+    {
+    }
+
+
+CCaeTestClient::~CCaeTestClient()
+    {
+    Cancel();
+    delete iCameraDup;
+    delete iCamAppEngine;
+    
+    iFsSession.Close();
+    RFbsSession::Disconnect();
+    delete iBitmapSave;
+    delete iDataSave;
+
+    }
+
+
+void CCaeTestClient::ConstructL()
+    {
+    // Initializing: FBS session, bitmaps and so on.
+    User::LeaveIfError( FbsStartup() ); // Ensure Fbserv has started up OK
+    User::LeaveIfError( RFbsSession::Connect() );
+ 
+    // Connect and open output data file.
+    #if ( WRITE_VIDEOTIMES_TO_FILE )
+    User::LeaveIfError( iFsSession.Connect() );
+    User::LeaveIfError( iFile.Replace( iFsSession, KProcessFileName, EFileShareAny ) );
+    TInt aPos;
+    User::LeaveIfError( iFile.Seek( ESeekEnd, aPos ) );
+    iFile.Write( _L8( "CaeTestClient output data\n" ) );
+    iFile.Close();
+    #endif
+
+    iSnapFileName  = KiSnapFileName;
+    iStillFileName = KiStillFileName;
+    iVideoFileName = KiVideoFileName;
+    iVideoFileName2 = KiVideoFileName2;
+    iVideoFileName3 = KiVideoFileName3;
+    iVideoFileName4 = KiVideoFileName4;
+    
+    iCreateSnapImage = ETrue;
+    
+    TRect emptyRect( 0, 0, 0, 0 );
+    iCropRect = emptyRect;
+
+    TSize sizeEmpty;
+    iSizeEmpty = sizeEmpty;
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+    iViewFinderSize    = sizeSubQcif;
+
+    iStillFrameSize    = TSize( KDefaultStillImageWidth, KDefaultStillImageHeight );
+
+	iSnapImageSize = TSize(0, 0);
+
+    iSnapImageSource = CCaeEngine::ESnapImageSourceOriginal;
+    iStillDataFormat = KDefaultStillDataFormat;
+	iSnapImageColorMode = (TDisplayMode)0;
+
+    iStillCompressionQuality = 95;
+
+    iStillBurstLength = 1;
+
+    iVideoFrameSize = sizeSubQcif;
+    iBitmapSave = NULL;
+    iDataSave = NULL;
+
+    iCamAppEngine = CCaeEngine::NewL();
+
+// If interface after S60 2.1.
+#ifndef CAE_INTERFACE_21
+    if ( iAction != ESpecifiedPrepareAndRecordVideoNoInit )
+        {
+        // For testing with the version inputting camera index and 
+        // CCaeEngine::CamerasAvailable().
+        delete iCamAppEngine;
+        iCamAppEngine = NULL;
+        if ( CCaeEngine::CamerasAvailable() > 0 ) 
+            {
+            iCamAppEngine = CCaeEngine::NewL( 0 );
+            }
+        else 
+            {
+            User::Leave( KErrHardwareNotAvailable );
+            }
+    
+        }
+#endif
+
+    iCamAppEngine->SetCamAppEngineObserver( *this );
+    iCamAppEngine->SetCaeStillBurstObserver( *this );
+
+    iTimeout = 500000;
+
+	iCamAppEngine->GetInfo( iInfo );
+
+    iOpMode = EClientOpModeStill;
+
+	iStopOnErrorInMcaeoSnapImageReady = ETrue;
+	iStopOnErrorInMcaeoStillImageReady = ETrue;
+
+    iVideoCodecSet = 0; // default set in use
+
+    //set 0
+    iMimeTypeSet[0]          = &KVideoMimeType;
+    iPreferredSupplierSet[0] = &KVideoPreferredSupplier;
+    iVideoTypeSet[0]         = &KVideoType;
+    iAudioTypeSet[0]         = &KVideoAudioType;
+
+    //set 1
+    iMimeTypeSet[1]          = &KVideoMimeType1;
+    iPreferredSupplierSet[1] = &KVideoPreferredSupplier1;
+    iVideoTypeSet[1]         = &KVideoType1;
+    iAudioTypeSet[1]         = &KVideoAudioType1;
+
+    //set 2
+    iMimeTypeSet[2]          = &KVideoMimeType2;
+    iPreferredSupplierSet[2] = &KVideoPreferredSupplier2;
+    iVideoTypeSet[2]         = &KVideoType2;
+    iAudioTypeSet[2]         = &KVideoAudioType2;
+
+    //set 3
+    iMimeTypeSet[3]          = &KVideoMimeType3;
+    iPreferredSupplierSet[3] = &KVideoPreferredSupplier3;
+    iVideoTypeSet[3]         = &KVideoType3;
+    iAudioTypeSet[3]         = &KVideoAudioType3;
+
+    CTimer::ConstructL();
+    CActiveScheduler::Add( this );
+    }
+
+
+void CCaeTestClient::InitStateVariables()
+    {
+    iError = KErrNone;
+
+    iStop                   = EFalse;
+
+    iStopWhenCompleted      = EFalse;
+    iContinueWhenCompleted  = EFalse;
+
+    iStopViewFinder         = EFalse;
+    
+    iRunlForSnapImage       = EFalse;
+    iRunlForStillImage      = EFalse;
+
+    iInitReady              = EFalse;
+    iPowerOn                = EFalse;
+
+    iViewFinderStarted      = EFalse;
+    iViewFindingUsed        = EFalse;
+
+    iStillPrepareReady      = EFalse;
+    iSnapImageReady         = EFalse;
+    iStillCaptureReady      = EFalse;
+    iStillCapturingOn       = EFalse;
+    iStillCaptured          = EFalse;
+
+    iStillBurstCaptureMoment = EFalse;
+    iStillBurstReady        = EFalse;
+    iStopStillBurst         = EFalse;
+    iCancelStillBurst       = EFalse;
+    iCancelStillBurstAfterVfFrame = EFalse;
+    
+    iVideoPrepareReady      = EFalse;
+    iVideoRecordingReady    = EFalse;
+    iVideoRecordingPaused   = EFalse;
+    iVideoRecordingResumed  = EFalse;
+    iVideoRecordingOn       = EFalse;
+    iVideoRecorded          = EFalse;
+
+	iStoppedOnError			= EFalse;
+
+    iAcceptVideoCompletionError = EFalse;    
+
+    iVfFrameCount           = 0;
+    
+    iImageCountToCapture    = 1;
+    
+    iCancelCount            = 0;
+    
+    iCountInitComplete              = 0;
+    iCountStillPrepareComplete      = 0;
+    iCountStillBurstCaptureMoment   = 0;
+    iCountStillBurstComplete        = 0;
+    iCountVideoPrepareComplete      = 0;
+    iCountViewFinderFrameReady      = 0;
+    iCountSnapImageReady            = 0;
+    iCountStillImageReady           = 0;
+    iCountVideoRecordingOn          = 0;
+    iCountVideoRecordingComplete    = 0;
+    iCountVideoRecordingStopped     = 0;
+    iCountVideoRecordingPaused      = 0;
+    iCountVideoRecordingTimes       = 0;
+
+    #ifdef CAE_TEST_VERSION
+    CaeSetMcaeseoHBufC8ImageReadyError( KErrNone );
+    CaeSetMcaeseoHBufC8ImageReadyError( KErrNone );
+    CaeSetPowerOnCompleteError( KErrNone );
+    CaeSetReserveCompleteError( KErrNone );
+    CaeSetImageReadyError( KErrNone );
+    CaeSetMvruoOpenCompleteError( KErrNone );
+    CaeSetMvruoPrepareCompleteError( KErrNone );
+    CaeSetMvruoRecordCompleteError( KErrNone );
+    CaeSetPrepareVideoSettingsError( KErrNone );
+    CaeSetCreateAndDeliverSnapImageError( KErrNone );
+    CaeSetCreateAndDeliverStillImageError( KErrNone );
+    CaeSetConvertCFbsBitmapToHBufC8Error( KErrNone );
+    CaeSetConvertHBufC8ToCFbsBitmapError( KErrNone );
+    CaeSetStillConvertError( KErrNone );
+    #endif // CAE_TEST_VERSION
+
+    iReleaseDone = EFalse;
+    iReserveDone = EFalse;
+
+    iNextRunLTime.HomeTime();
+
+    iExtensionMode        = EFalse;
+    iBitmapSendDone       = EFalse;
+
+    }
+
+
+void CCaeTestClient::SetSnapImageCreation( TBool aCreateSnapImage )
+    {
+    iCreateSnapImage = aCreateSnapImage;
+    }
+
+
+void CCaeTestClient::SetRunningWithViewFinder( TBool aRunWithViewFinder )
+    {
+    iRunWithViewFinder = aRunWithViewFinder;
+    }
+
+
+void CCaeTestClient::SetViewFinderSize( const TSize& aSize )
+    {
+    iViewFinderSize = aSize;
+    }
+
+
+void CCaeTestClient::SetStillQualityLevelIndex( TInt aQualityLevelIndex )
+    {
+    iStillQualityLevelIndex = aQualityLevelIndex;
+    }
+
+
+void CCaeTestClient::SetVideoQualityLevelIndex( TInt aQualityLevelIndex )
+    {
+    iVideoQualityLevelIndex = aQualityLevelIndex;
+    }
+
+
+void CCaeTestClient::SetStillFormat( CCamera::TFormat aFormat )
+    {
+    iStillDataFormat = aFormat;
+    }
+
+
+void CCaeTestClient::SetStillCompressionQuality( TInt aCompressionQuality )
+    {
+    iStillCompressionQuality = aCompressionQuality;
+    }
+
+
+void CCaeTestClient::SetStillFrameSize( const TSize& aSize )
+    {
+    iStillFrameSize = aSize;
+    }
+
+
+void CCaeTestClient::SetSnapImageSize( const TSize& aSize )
+    {
+    iSnapImageSize = aSize;
+    }
+
+
+void CCaeTestClient::SetSnapImageSource( CCaeEngine::TSnapImageSource aSnapImageSource )
+    {
+    iSnapImageSource = aSnapImageSource;
+    }
+
+
+void CCaeTestClient::SetSnapImageColorMode( TDisplayMode aMode )
+    {
+    iSnapImageColorMode = aMode;
+    }
+
+
+void CCaeTestClient::SetImageCodecs( TUid aDecoderUid, TUid aEncoderUid )
+    {
+    iImageDecoderUid = aDecoderUid;
+    iImageEncoderUid = aEncoderUid;
+    }
+
+
+void CCaeTestClient::SetCropRect( const TRect& aRect )
+    {
+    iCropRect = aRect;
+    }
+
+
+void CCaeTestClient::SetStillBurstLength( TInt aLength )
+    {
+    iStillBurstLength = aLength;
+    }
+
+
+void CCaeTestClient::SetVideoFrameSize( const TSize& aSize )
+    {
+    iVideoFrameSize = aSize;
+    }
+
+
+void CCaeTestClient::SetVideoFrameRate( TReal32 aFrameRate )
+    {
+    iVideoFrameRate = aFrameRate;
+    }
+
+
+void CCaeTestClient::SetVideoBitRate( TInt aBitRate )
+    {
+    iVideoBitRate = aBitRate;
+    }
+
+
+void CCaeTestClient::SetVideoAudio( TBool aAudioEnabled )
+    {
+    iVideoAudioEnabled = aAudioEnabled;
+    }
+
+
+void CCaeTestClient::SetAudioBitRate( TInt aAudioBitRate )
+    {
+    iAudioBitRate = aAudioBitRate;
+    }
+
+
+void CCaeTestClient::SetFileNameBase( const TFileName& aFileNameBase ) 
+    {
+    iFileNameBase = aFileNameBase;
+    }
+
+
+void CCaeTestClient::SetVfFileName( const TFileName& aFileName ) 
+    {
+    iVfFileName = iFileNameBase;
+    iVfFileName.Append ( aFileName );
+#if ( WRITE_VF_TO_FILE )
+    iVfFrameCountToSave = 1;
+#else
+    iVfFrameCountToSave = 0;
+#endif
+    }
+
+void CCaeTestClient::SetVideoStopMode( TBool aAsyncVideoStopEnabled )
+    {
+    iVideoStopModeCommand = ETrue; // mark for new command
+    iAsyncVideoStopEnabled = aAsyncVideoStopEnabled; // new stop mode
+    }
+
+
+void CCaeTestClient::SetVfFileCountToSave( TInt aCountOfVfFilesToSave ) 
+    {
+    iVfFrameCountToSave = aCountOfVfFilesToSave;
+#if ( WRITE_VF_TO_FILE )
+    iVfFrameCountToSave = aCountOfVfFilesToSave;
+#else
+    iVfFrameCountToSave = 0;
+#endif
+    }
+
+
+void CCaeTestClient::SetSnapFileName( const TFileName& aFileName ) 
+    {
+    iSnapFileName = iFileNameBase;
+    iSnapFileName.Append ( aFileName );
+#if ( WRITE_SNAPIMAGE_TO_FILE )
+    iSaveSnapImage = ETrue;
+#else
+    iSaveSnapImage = EFalse;
+#endif
+    }
+
+
+void CCaeTestClient::SetStillFileName( const TFileName& aFileName ) 
+    {
+    iStillFileName = iFileNameBase;
+    iStillFileName.Append ( aFileName );
+#if ( WRITE_STILLIMAGE_TO_FILE )
+    iSaveStillImage = ETrue;
+#else
+    iSaveStillImage = EFalse;
+#endif
+    }
+
+
+void CCaeTestClient::SetVideoFileName( const TFileName& aFileName ) 
+    {
+    iVideoFileName = iFileNameBase;
+    iVideoFileName.Append ( aFileName );
+#if ( WRITE_VIDEOCLIP_TO_FILE )
+    iSaveVideoClip = ETrue;
+#else
+    iSaveVideoClip = EFalse;
+#endif
+    }
+
+
+void CCaeTestClient::SetTimeout( TTimeIntervalMicroSeconds32 aTimeout )
+    {
+	iTimeout = aTimeout;
+    }
+
+
+void CCaeTestClient::SetStillBurstCaptureInterval( TTimeIntervalMicroSeconds aInterval )
+    {
+    iStillBurstCaptureInterval = aInterval;
+    }
+
+
+void CCaeTestClient::SetExposureMode( TInt aExposureMode )
+    {
+    iExposureMode = aExposureMode;
+    }
+
+
+void CCaeTestClient::SetEvCompensation( TInt aEvCompensation )
+    {
+    iEvCompensation = aEvCompensation;
+    }
+
+
+void CCaeTestClient::SetWhiteBalanceMode( TInt aWhiteBalanceMode )
+    {
+    iWhiteBalanceMode = aWhiteBalanceMode;
+    }
+
+
+void CCaeTestClient::SetFlashMode( TInt aFlashMode )
+    {
+    iFlashMode = aFlashMode;
+    }
+
+
+void CCaeTestClient::SetBrightness( TInt aBrightness )
+    {
+    iBrightness = aBrightness;
+    }
+
+
+void CCaeTestClient::SetContrast( TInt aContrast )
+    {
+    iContrast = aContrast;
+    }
+
+
+void CCaeTestClient::SetZoomMode( TInt aZoomMode )
+    {
+    iZoomMode = aZoomMode;
+    }
+
+
+void CCaeTestClient::SetDigiZoomValue( TInt aDigiZoomValue )
+    {
+    iDigiZoomValue = aDigiZoomValue;
+    }
+
+void CCaeTestClient::SetVideoClipMaxSize( TInt aMaxClipSizeInBytes )
+    {
+    iVideoMaxClipSizeInBytes = aMaxClipSizeInBytes;
+    }
+
+
+void CCaeTestClient::SetVideoTimesInterval( TTimeIntervalMicroSeconds aInterval )
+    {
+    iVideoTimesInterval = aInterval;
+    }
+
+
+void CCaeTestClient::SetOpMode( TestClientOpMode aOpMode )
+    {
+    iOpMode = aOpMode;
+    }
+  
+
+void CCaeTestClient::SetDisplayIndex( TInt aDisplayIndex )
+    {
+    iDisplayIndex = aDisplayIndex;
+    }
+  
+
+void CCaeTestClient::SetStopOnErrorInMcaeoSnapImageReady( TBool aStopOnError )
+    {
+    iStopOnErrorInMcaeoSnapImageReady = aStopOnError;
+    }
+
+
+void CCaeTestClient::SetStopOnErrorInMcaeoStillImageReady( TBool aStopOnError )
+    {
+    iStopOnErrorInMcaeoStillImageReady = aStopOnError;
+    }
+
+
+void CCaeTestClient::GetInfo( TCamAppEngineInfo& aInfo ) const
+    {
+    aInfo = iInfo;
+    }
+
+
+void CCaeTestClient::GetStillFrameSize( TSize& aSize ) const
+    {
+    aSize = iStillFrameSizeSet;
+    }
+
+
+TInt CCaeTestClient::EstimatedStillSizeInBytes() const
+    {
+    return iEstimatedStillSizeInBytesSet;
+    }
+
+
+void CCaeTestClient::GetVideoFrameSize( TSize& aSize ) const
+    {
+    aSize = iVideoFrameSizeSet;
+    }
+
+
+TReal32 CCaeTestClient::VideoFrameRate() const
+    {
+    return iVideoFrameRateSet;
+    }
+
+TInt CCaeTestClient::EstimatedVideoRecordingBitRate() const
+    {
+    return iEstimatedVideoBitRateSet;
+    }
+
+
+TReal32 CCaeTestClient::ViewFinderFrameFrequency()
+    {
+    return 15.0;
+    }
+
+
+TInt CCaeTestClient::CountInitComplete()
+    {
+    return iCountInitComplete;
+    }
+
+
+TInt CCaeTestClient::CountStillPrepareComplete()
+    {
+    return iCountStillPrepareComplete;
+    }
+
+
+TInt CCaeTestClient::CountStillBurstCaptureMoment()
+    {
+    return iCountStillBurstCaptureMoment;
+    }
+
+
+TInt CCaeTestClient::CountStillBurstComplete()
+    {
+    return iCountStillBurstComplete;
+    }
+
+TInt CCaeTestClient::CountImageDeliveredStillBurstComplete()
+    {
+    return iImageCountDeliveredForStillBurst;
+    }
+
+
+TInt CCaeTestClient::CountVideoPrepareComplete()
+    {
+    return iCountVideoPrepareComplete;
+    }
+
+
+TInt CCaeTestClient::CountViewFinderFrameReady()
+    {
+    return iCountViewFinderFrameReady;
+    }
+
+
+TInt CCaeTestClient::CountSnapImageReady()
+    {
+    return iCountSnapImageReady;
+    }
+
+
+TInt CCaeTestClient::CountStillImageReady()
+    {
+    return iCountStillImageReady;
+    }
+
+
+TInt CCaeTestClient::CountVideoRecordingOn()
+    {
+    return iCountVideoRecordingOn;
+    }
+
+
+TInt CCaeTestClient::CountVideoRecordingComplete()
+    {
+    return iCountVideoRecordingComplete;
+    }
+
+TInt CCaeTestClient::CountVideoRecordingStopped()
+    {
+    return iCountVideoRecordingStopped;
+    }
+
+
+TInt CCaeTestClient::CountVideoRecordingPaused()
+    {
+    return iCountVideoRecordingPaused;
+    }
+
+
+TInt CCaeTestClient::CountVideoRecordingTimes()
+    {
+    return iCountVideoRecordingTimes;
+    }
+
+void CCaeTestClient::SetCustomInterfaceUid( TUid aCustomInterfaceUid )
+    {
+    iCustomInterfaceUid = aCustomInterfaceUid;
+    }
+
+TAny* CCaeTestClient::CustomInterfacePointer()
+    {
+    return iCustomInterfacePointer;
+    }
+
+void CCaeTestClient::SetColorToneValue( MCameraColorToneSettings::TColorTone aValue)
+    {
+    iColorToneValue = aValue;
+    }
+
+void CCaeTestClient::SetVideoCodecSet( TInt aValue)
+    {
+    iVideoCodecSet = aValue;
+    }
+
+// Trap RunL, to catch if the AO leaves.
+// A Walkaround...
+// RunError() should be used in this case, but
+// Apparently, it is not possible to use the AO RunError() virtual function
+// for that purpose, it is not called.
+void CCaeTestClient::RunL()
+    {
+    TRAPD( error, RunTrappedL() );
+	if ( error )
+	    {
+    	#ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::RunL() RunTrappedL leaved! %d" ), error );
+        #endif
+        StopOnError( error );
+        // After the Stop, execution should continue at the end of RunTestAction()
+        }
+    }
+
+
+void CCaeTestClient::DoCancel()
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::DoCancel() entering" ) );
+    #endif
+	
+    if ( iCamAppEngine->IsViewFinding() )
+	    {
+        iCamAppEngine->StopViewFinder();
+        iViewFinderStarted = EFalse;
+        }
+    
+    iCamAppEngine->CancelCaptureStill();
+    
+    if ( iCamAppEngine->IsVideoRecording() ) 
+        {
+        iCamAppEngine->StopVideoRecording();
+        }
+    
+    delete iCamAppEngine;
+	iCamAppEngine = NULL;
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::DoCancel() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestClient::McaeoInitComplete( TInt aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoInitComplete() entering: %d" ), iCountInitComplete );
+    #endif
+
+    iCountInitComplete++;
+
+    #if CAE_OOM_TESTING_HARNESS
+    // For OOM testing in CppUnit.
+    TInt* memTest = new TInt( 1 );
+    if ( !memTest ) 
+        {
+        #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoInitComplete(): OOM test, calling CancelCaptureStill()" ) );
+        #endif
+        iCamAppEngine->CancelCaptureStill();
+        StopOnError( KErrNoMemory );
+        }
+    else 
+        {
+        delete memTest;
+        }
+    #endif
+
+    if ( aError ) 
+        {
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoInitComplete(): error detected: %d" ), aError );
+        #endif
+        StopOnError( aError );
+        }
+    else
+        {
+        if ( !(iAction == ECaptureStillAfterPowerOffOn && iStopWhenCompleted) ) 
+            {
+            iInitReady = ETrue;
+            }
+        iPowerOn   = ETrue;
+        CTimer::After( KNormalTimingDelay );
+        }
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoInitComplete() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestClient::McaeoStillPrepareComplete( TInt aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoStillPrepareComplete() entering: %d" ), iCountStillPrepareComplete );
+    #endif
+
+    iCountStillPrepareComplete++;
+
+    #if CAE_OOM_TESTING_HARNESS
+    // For OOM testing in CppUnit.
+    TInt* memTest = new TInt( 1 );
+    if ( !memTest ) 
+        {
+        #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoStillPrepareComplete(): OOM test, calling CancelCaptureStill()" ) );
+        #endif
+        iCamAppEngine->CancelCaptureStill();
+        StopOnError( KErrNoMemory );
+        }
+    else 
+        {
+        delete memTest;
+        }
+    #endif
+
+    if ( aError ) 
+        {
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoStillPrepareComplete(): error detected" ) );
+        #endif
+        StopOnError( aError );
+        }
+    else
+        {
+        iStillPrepareReady = ETrue;
+        CTimer::After( KNormalTimingDelay );
+        }
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoStillPrepareComplete() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestClient::McaeoVideoPrepareComplete( TInt aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoPrepareComplete() entering: %d" ), iCountVideoPrepareComplete );
+    #endif
+
+    iCountVideoPrepareComplete++;
+
+    if ( aError ) 
+        {
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoPrepareComplete(): error detected: %d" ), aError );
+        #endif
+        StopOnError( aError );
+        }
+    else
+        {
+        iVideoPrepareReady = ETrue;
+
+        if ( iVideoStopModeCommand ) // New command should be sent once
+            {
+            iVideoStopModeCommand = EFalse;
+            TInt err = iCamAppEngine->SetAsyncVideoStopMode( iAsyncVideoStopEnabled );
+            if ( err ) 
+                {
+	            #ifdef _DEBUG
+                RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoPrepareComplete(): error detected in SetAsyncVideoStopMode: %d" ), err );
+                #endif
+                StopOnError( err );
+                }
+            }
+        
+        CTimer::After( KNormalTimingDelay );
+        }
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoPrepareComplete() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestClient::McaeoViewFinderFrameReady( CFbsBitmap& aFrame, TInt aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoViewFinderFrameReady() entering: %d" ), iCountViewFinderFrameReady );
+    #endif
+    TSize sizeEmpty;
+
+    iCountViewFinderFrameReady++;
+
+    #if CAE_OOM_TESTING_HARNESS
+    // For OOM testing in CppUnit.
+    TInt* memTest = new TInt( 1 );
+    if ( !memTest ) 
+        {
+        #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoViewFinderFrameReady(): OOM test, calling CancelCaptureStill()" ) );
+        #endif
+        iCamAppEngine->CancelCaptureStill();
+        StopOnError( KErrNoMemory );
+        }
+    else 
+        {
+        delete memTest;
+        }
+    #endif
+
+    if ( aError ) 
+        {
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoViewFinderFrameReady(): error detected: %d" ), aError );
+        #endif
+        StopOnError( aError );
+        }
+    else
+        {
+        iViewFinderStarted = ETrue;
+
+        iVfFrameCount++;
+
+
+		if ( iCancelStillBurstAfterVfFrame && ( iCountStillBurstCaptureMoment == 2 ) )
+			{
+			iCamAppEngine->CancelCaptureStill();
+            iStop = ETrue;
+			CTimer::After( KNormalTimingDelay );
+			}
+        
+        // TSize viewFinderSize;
+        // iCamAppEngine->GetViewFinderSize( viewFinderSize );
+        // AsyncAssert( viewFinderSize==iViewFinderSize, KErrGeneral );
+
+        if ( iVfFrameCount <= iVfFrameCountToSave ) 
+            {
+            TFileName fn( iVfFileName );
+            TInt length = fn.Length();
+            TBuf<4> ext;
+            ext = fn.Right( 4 );
+            fn.SetLength( length  - 4 );
+            TBuf<10> num;
+            num.Num( iVfFrameCount - 1 );
+            fn.Append( _L("_") );
+            fn.Append( num );
+            fn.Append( ext );
+
+            #ifdef _DEBUG
+            RDebug::Print( fn );
+            #endif
+
+            iError = aFrame.Save( fn );
+            if ( iError ) 
+                {
+                StopOnError( iError );
+                }
+            } 
+            
+        // Create a duplicate bitmap and save it
+        if ( iAction == EProcessExtViewFinderFrameReady  &&
+            !iBitmapSave &&
+            aFrame.SizeInPixels() != sizeEmpty ) 
+            {
+            iBitmapSave = new CFbsBitmap;
+            if ( iBitmapSave )
+                {
+                TInt err = iBitmapSave->Duplicate( aFrame.Handle() );
+                if ( err ) 
+                    {
+//                        LOGTEXT2( _L( "Cae: CCaeEngineImp::ProcessExtSnapImageL(): Duplicate error:%d" ), err);
+                        delete iBitmapSave;
+                        iBitmapSave = NULL;
+//                        User::Leave( KErrNoMemory );
+                     }
+                }
+            else
+                {
+//                LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtSnapImageL(): new CFbsBitmap failed" ));
+//                User::Leave( KErrNoMemory );
+                }
+            }
+                       
+        }
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoViewFinderFrameReady() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestClient::McaeoSnapImageReady( const CFbsBitmap& aBitmap, TInt aError ) 
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoSnapImageReady() entering: %d" ), iCountSnapImageReady );
+    #endif
+    TSize sizeEmpty;
+
+    iCountSnapImageReady++;
+
+    #if CAE_OOM_TESTING_HARNESS
+    // For OOM testing in CppUnit.
+    TInt* memTest = new TInt( 1 );
+    if ( !memTest ) 
+        {
+        #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoSnapImageReady(): OOM test, calling CancelCaptureStill()" ) );
+        #endif
+        iCamAppEngine->CancelCaptureStill();
+        StopOnError( KErrNoMemory );
+        }
+    else 
+        {
+        delete memTest;
+        }
+    #endif
+
+    if ( aError ) 
+        {
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoSnapImageReady(): error detected: %d" ), aError );
+        #endif
+		if (iStopOnErrorInMcaeoSnapImageReady)
+			{
+			StopOnError( aError );
+			}
+        }
+    else
+        {
+        if ( iSaveSnapImage && ( iCountSnapImageReady < 10 ) )
+            {
+            if ( aBitmap.SizeInPixels() != iSizeEmpty ) 
+                {
+                // create bitmap 3 as a duplicate of bitmap 2
+                CFbsBitmap* bitmapSave = new CFbsBitmap;
+                if ( bitmapSave )
+                    {
+                    iError = bitmapSave->Duplicate( aBitmap.Handle() );
+                    if ( iError ) 
+                        {
+                        delete bitmapSave;
+                        bitmapSave = NULL;
+                        StopOnError( iError );
+                        }
+
+                    TFileName fn( iSnapFileName );
+                    TInt length = fn.Length();
+                    TBuf<4> ext;
+                    ext = fn.Right( 4 );
+                    fn.SetLength( length  - 4 );
+                    TBuf<10> num;
+                    num.Num( iCountSnapImageReady - 1 );
+                    fn.Append( _L("_") );
+                    fn.Append( num );
+                    fn.Append( ext );
+
+	                #ifdef _DEBUG
+                    RDebug::Print( fn );
+                    #endif
+
+                    iError = bitmapSave->Save( fn );
+
+                    delete bitmapSave;
+                    bitmapSave = NULL;
+
+                    if ( iError ) 
+                        {
+                        StopOnError( iError );
+                        }
+                    }
+                }
+            }
+        // Extension mode
+        // Create a duplicate bitmap and save it
+        if ( (iAction == EProcessExtSnapImage || iAction == EProcessExtCapturedImageBurst ||
+            iAction == EProcessExtCapturedImageBurstTDesC8 || iAction == EProcessExtCapturedImageCFbsBitmap) &&
+            !iBitmapSave &&
+            aBitmap.SizeInPixels() != sizeEmpty ) 
+            {
+            iBitmapSave = new CFbsBitmap;
+            if ( iBitmapSave )
+                {
+                TInt err = iBitmapSave->Duplicate( aBitmap.Handle() );
+                if ( err ) 
+                    {
+//                        LOGTEXT2( _L( "Cae: CCaeEngineImp::ProcessExtSnapImageL(): Duplicate error:%d" ), err);
+                        delete iBitmapSave;
+                        iBitmapSave = NULL;
+//                        User::Leave( KErrNoMemory );
+                     }
+                }
+            else
+                {
+//                LOGTEXT( _L( "Cae: CCaeEngineImp::ProcessExtSnapImageL(): new CFbsBitmap failed" ));
+//                User::Leave( KErrNoMemory );
+                }
+            if ( iExtensionMode &&  // If CAE is switched to ext mode
+                iAction == EProcessExtSnapImage )   // Only snap image is sent in this test case
+                {
+                CTimer::After( KNormalTimingDelay ); // start timer for next action
+                }
+            }
+
+        if ( iRunlForSnapImage && ( iCountSnapImageReady < 2 ) )
+            {
+            iSnapImageReady = ETrue;
+            CTimer::After( KNormalTimingDelay );
+            }
+        }
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoSnapImageReady() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestClient::McaeoStillImageReady( CFbsBitmap* aBitmap, HBufC8* aData, TInt aError ) 
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoStillImageReady() entering: %d" ), iCountStillImageReady );
+    #endif
+
+    iCountStillImageReady++;
+
+    #if CAE_OOM_TESTING_HARNESS
+    // For OOM testing in CppUnit.
+    TInt* memTest = new TInt( 1 );
+    if ( !memTest ) 
+        {
+        #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoStillImageReady(): OOM test, calling CancelCaptureStill()" ) );
+        #endif
+        iCamAppEngine->CancelCaptureStill();
+        StopOnError( KErrNoMemory );
+        }
+    else 
+        {
+        delete memTest;
+        }
+    #endif
+
+    if ( aError ) 
+        {
+        if ( aBitmap )
+            {
+            delete aBitmap;
+            aBitmap = NULL;
+            }
+    
+        if ( aData ) 
+            {
+            delete aData;
+            aData = NULL;
+            }
+
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoStillImageReady(): error detected: %d" ), aError );
+        #endif
+		if (iStopOnErrorInMcaeoStillImageReady)
+			{
+			StopOnError( aError );
+			}
+        }
+    else
+        {
+        if ( ( aBitmap == NULL ) && ( aData == NULL ) ) 
+            {
+            StopOnError( KErrBadHandle );
+            }
+
+        if ( iSaveStillImage  && ( iCountStillImageReady < 10 ) )
+            {
+            TFileName fn( iStillFileName );
+            TInt length = fn.Length();
+            TBuf<4> ext;
+            ext = fn.Right( 4 );
+            fn.SetLength( length  - 4 );
+            TBuf<10> num;
+            num.Num( iCountStillImageReady - 1 );
+            fn.Append( _L("_") );
+            fn.Append( num );
+            fn.Append( ext );
+
+	        #ifdef _DEBUG
+            RDebug::Print( fn );
+            #endif
+
+            if ( aBitmap ) 
+                {
+                aBitmap->Save( fn );
+                }
+            else if ( aData ) 
+                {
+                RFs fsSession;
+                RFile file;
+                if ( fsSession.Connect() == KErrNone )
+                    {
+                    file.Replace( fsSession, fn, EFileWrite );
+                    file.Write( aData->Des() );
+                    file.Close();
+                    fsSession.Close();
+                    }
+                }
+            }
+            
+        // Extension mode handling, don't delete image data
+        if ( (iAction == EProcessExtCapturedImage ||
+            iAction == EProcessExtCapturedImageTDesC8 ||
+            iAction == EProcessExtCapturedImageCFbsBitmap ||
+            iAction == EProcessExtCancel2 ||
+            iAction == EProcessExtCapturedImageBurst ||
+            iAction == EProcessExtCapturedImageBurstTDesC8 ||
+            iAction == EProcessExtCapturedImageNoInit)  &&
+            !iDataSave )
+            {
+            // save captured image for extension testing
+            iDataSave = aData;
+            aData = NULL;
+            }
+
+    
+        if ( aBitmap )
+            {
+            delete aBitmap;
+            aBitmap = NULL;
+            }
+    
+        if ( aData ) 
+            {
+            delete aData;
+            aData = NULL;
+            }
+
+        if ( iRunlForStillImage || ( !iRunlForSnapImage && ( iImageCountToCapture == 1 ) ) )
+            {
+            iStillCaptureReady = ETrue;
+            iStillCapturingOn = EFalse;
+            CTimer::After( KNormalTimingDelay );
+            }
+        }
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoStillImageReady() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestClient::McaesboStillBurstCaptureMoment( TInt aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaesboStillBurstCaptureMoment() entering: %d" ), iCountStillBurstCaptureMoment );
+    #endif
+
+    iCountStillBurstCaptureMoment++;
+
+    if ( aError ) 
+        {
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaesboStillBurstCaptureMoment(): error detected: %d" ), aError );
+        #endif
+        StopOnError( aError );
+        }
+
+    if ( iStopStillBurst && ( iCountStillBurstCaptureMoment >= 3 ) )
+        {
+        iCamAppEngine->StopStillBurstCapture();
+        }
+    else if ( iCancelStillBurst && ( iCountStillBurstCaptureMoment >= 2 ) ) 
+        {
+        iStillBurstCaptureMoment = ETrue;
+        iCancelCount++;
+        iCamAppEngine->CancelCaptureStill();
+        CTimer::After( KNormalTimingDelay );
+        }
+	else if (iRunWithViewFinder && ( iCountStillBurstCaptureMoment == iStillBurstLength) )
+		{
+		// View finder is running and the last burst image will be taken
+		if ( iCountViewFinderFrameReady < ( iStillBurstLength - 1 ) )
+			{
+			// Error! There should be at least one VF frame between every burst image
+			#ifdef _DEBUG
+			RDebug::Print( _L( "Cae: CCaeTestClient::McaesboStillBurstCaptureMoment() Error! Not enought VF frames during the burst! %d" ), iCountViewFinderFrameReady);
+			#endif
+			StopOnError( KErrGeneral );
+			}
+		}
+    #if CAE_OOM_TESTING_HARNESS
+    else
+        {
+        // For OOM testing in CppUnit.
+        TInt* memTest = new TInt( 1 );
+        if ( !memTest ) 
+            {
+            #ifdef _DEBUG
+            RDebug::Print( _L( "Cae: CCaeTestClient::McaesboStillBurstCaptureMoment(): OOM test, calling CancelCaptureStill()" ) );
+            #endif
+            iCamAppEngine->CancelCaptureStill();
+            StopOnError( KErrNoMemory );
+            }
+        else 
+            {
+            delete memTest;
+            }
+        }
+    #endif
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaesboStillBurstCaptureMoment() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestClient::McaesboStillBurstComplete( TInt aImageCountDelivered, 
+                                                TInt aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaesboStillBurstComplete() entering: %d" ), iCountStillBurstComplete );
+    #endif
+
+    iCountStillBurstComplete++;
+
+    #if CAE_OOM_TESTING_HARNESS
+    // For OOM testing in CppUnit.
+    TInt* memTest = new TInt( 1 );
+    if ( !memTest ) 
+        {
+        #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaesboStillBurstComplete(): OOM test, calling CancelCaptureStill()" ) );
+        #endif
+        iCamAppEngine->CancelCaptureStill();
+        StopOnError( KErrNoMemory );
+        }
+    else 
+        {
+        delete memTest;
+        }
+    #endif
+
+    iImageCountDeliveredForStillBurst = aImageCountDelivered;
+
+    if ( aError ) 
+        {
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaesboStillBurstComplete(): error detected: %d" ), aError );
+        #endif
+        StopOnError( aError );
+        }
+    else
+        {
+        iStillBurstReady = ETrue;
+        iStillCapturingOn = EFalse;
+        CTimer::After( KNormalTimingDelay );
+        }
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaesboStillBurstComplete() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestClient::McaeoVideoRecordingOn( TInt aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingOn() entering: %d" ), iCountVideoRecordingOn );
+    #endif
+
+    iCountVideoRecordingOn++;
+    
+    if ( aError ) 
+        {
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingOn(): error detected: %d" ), aError );
+        #endif
+        StopOnError( aError );
+        }
+    else
+        {
+        iVideoRecordingOn = ETrue;
+        iVideoRecordingPaused = EFalse;
+        CTimer::After( iTimeout );
+        }
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingOn() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestClient::McaeoVideoRecordingComplete( TInt aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingComplete() entering: %d" ), iCountVideoRecordingComplete );
+    #endif
+
+    iCountVideoRecordingComplete++;
+
+    if ( aError ) 
+        {
+        if ( !iAcceptVideoCompletionError || aError != KErrCompletion )
+            {
+	        #ifdef _DEBUG
+            RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingComplete(): error detected: %d" ), aError );
+            #endif
+            StopOnError( aError );
+            }
+        else
+            {
+            iVideoRecordingReady = ETrue;
+            iVideoRecordingOn = EFalse;
+            // No CTimer::After call here because there's one pending  
+            // from McaeoVideoRecordingOn.
+            }
+        }
+    else
+        {
+        iVideoRecordingReady = ETrue;
+        iVideoRecordingOn = EFalse;
+        CTimer::After( KNormalTimingDelay );
+        }
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingComplete() returning" ) );
+    #endif
+    }
+
+void CCaeTestClient::McaeoVideoRecordingStopped()
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingStopped() entering: %d" ), iCountVideoRecordingStopped );
+    #endif
+
+    iCountVideoRecordingStopped++;
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingStopped() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestClient::McaeoVideoRecordingPaused( TInt aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingPaused() entering: %d" ), iCountVideoRecordingPaused );
+    #endif
+
+    iCountVideoRecordingPaused++;
+    
+    if ( aError && iAction != EPrepareRecordPausePauseStopVideo ) // Note double pause test exception
+        {
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingPaused(): error detected: %d" ), aError );
+        #endif
+        StopOnError( aError );
+        }
+    else
+        {
+        // Start CTimer only once, not two times for double pause test
+        if ( !iVideoRecordingPaused )
+            {
+            iVideoRecordingPaused = ETrue;
+            CTimer::After( KNormalTimingDelay );
+            }
+        }
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingPaused() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestClient::McaeoVideoRecordingTimes( TTimeIntervalMicroSeconds aTimeElapsed, 
+                                               TTimeIntervalMicroSeconds aTimeRemaining, 
+                                               TInt aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingTimes() entering: %d" ), iCountVideoRecordingTimes );
+    #endif
+
+    iCountVideoRecordingTimes++;
+
+    if ( aError ) 
+        {
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingTimes(): error detected: %d" ), aError );
+        #endif
+        StopOnError( aError );
+        }
+
+    TBuf8<128> textVideoTimes;
+    
+    _LIT(KVideoTimesTitle, "Video times (elapsed remaining):\n");
+    _LIT(KSpaceSeparator, " ");
+
+    textVideoTimes.Append( KVideoTimesTitle );
+    textVideoTimes.AppendNum( aTimeElapsed.Int64() );
+    textVideoTimes.Append( KSpaceSeparator );
+    textVideoTimes.AppendNum( aTimeRemaining.Int64() );
+    textVideoTimes.Append( _L("\n") );
+
+    // Save video times info to data file. 
+    #if ( WRITE_VIDEOTIMES_TO_FILE )
+    const TDesC8& text = textVideoTimes;
+    TInt err = iFile.Open( iFsSession, KProcessFileName, EFileWrite );
+    TInt aPos;
+    err = iFile.Seek( ESeekEnd, aPos );
+    iFile.Write( text );
+    iFile.Close();
+    #endif
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::McaeoVideoRecordingTimes() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestClient::StopOnError( TInt aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::StopOnError(): Error: %d" ), aError );
+    #endif
+
+	__ASSERT_ALWAYS( !iStoppedOnError, User::Invariant());
+
+    // Error => mark down the error code and stop.
+    iError = aError;
+
+    if ( iCamAppEngine->IsViewFinding() )
+	    {
+        iCamAppEngine->StopViewFinder();
+        iViewFinderStarted = EFalse;
+        }
+
+    iCamAppEngine->CancelCaptureStill();
+
+    if ( iCamAppEngine->IsVideoRecording() ) 
+        {
+        iCamAppEngine->StopVideoRecording();
+        }
+    
+    CActiveScheduler::Stop();
+
+	iStoppedOnError = ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeTestClient::ReserveComplete
+// Camera reservation is complete. 
+// Called asynchronously when CCamera::Reserve() completes.
+// From McameraObserver interface
+// -----------------------------------------------------------------------------
+//
+void CCaeTestClient::ReserveComplete(                                 
+    TInt aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::ReserveComplete() entering, aError=%d" ), aError );
+    #endif
+
+    if ( aError == KErrNone )
+        {
+        iCameraDup->PowerOn();
+        }
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::ReserveComplete() returning" ));
+    #endif
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeEngineImp::PowerOnComplete
+// Indicates camera power on is complete.
+// Called on completion of CCamera:PowerOn().
+// From McameraObserver interface
+// -----------------------------------------------------------------------------
+//
+void CCaeTestClient::PowerOnComplete( 
+    TInt aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::PowerOnComplete() entering, aError=%d" ), aError );
+    #endif
+    if ( !aError)
+        {
+        iInitReady = ETrue;
+        iPowerOn   = ETrue;
+        }
+    CTimer::After( KNormalTimingDelay ); // This will start the test case AO to run
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::PowerOnComplete() returning" ) );
+    #endif
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeTestClient::ViewFinderFrameReady
+// Transfers the current view finder image from the camera. The frame is 
+// From McameraObserver interface
+// -----------------------------------------------------------------------------
+//
+void CCaeTestClient::ViewFinderFrameReady( 
+    CFbsBitmap& /*aFrame*/ )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::ViewFinderFrameReady() entering" ) );
+    #endif
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeTestClient::ImageReady
+// Transfers the current image from the camera. 
+// Called asynchronously when CCamera::CaptureImage() completes.
+// From McameraObserver interface
+// -----------------------------------------------------------------------------
+//
+void CCaeTestClient::ImageReady( 
+    CFbsBitmap* aBitmap, 
+    HBufC8*     aImageData, 
+    TInt        aError )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestClient::ViewFinderFrameReady() entering %d" ), aError );
+    #endif
+    if ( aBitmap )
+        delete aBitmap;
+    if ( aImageData )
+        delete aImageData;
+    aError++;
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeTestClient::HandleEvent
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCaeTestClient::HandleEvent( const TECAMEvent& aEvent)
+    {
+    PRINT(( _L( "CCaeTestClient::HandleEvent() entering, type=%x, err=%d" ), aEvent.iEventType.iUid, aEvent.iErrorCode ));
+
+    if ( aEvent.iEventType == KUidECamEventCameraNoLongerReserved )
+        {
+        PRINT(( _L( "CCaeTestClient::HandleEvent() KUidECamEventCameraNoLongerReserved" ) ));
+        }
+    else if ( aEvent.iEventType == KUidECamEventPowerOnComplete )
+        {
+        PRINT(( _L( "CCaeTestClient::HandleEvent() KUidECamEventPowerOnComplete" ) ));
+        PowerOnComplete( aEvent.iErrorCode );
+        }
+    else if ( aEvent.iEventType == KUidECamEventReserveComplete )
+       {
+       PRINT(( _L( "CCaeTestClient::HandleEvent() KUidECamEventReserveComplete" ) ));
+       ReserveComplete( aEvent.iErrorCode );
+       }
+
+    PRINT(( _L( "CCaeTestClient::HandleEvent() returning" ) ));
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeTestClient::ViewFinderReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCaeTestClient::ViewFinderReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCaeTestClient::ViewFinderReady() NOT HANDLED err=%d"), aError ));
+
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCaeTestClient::ImageBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCaeTestClient::ImageBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCaeTestClient::ImageBufferReady() NOT HANDLED, err=%d" ), aError ));
+	
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CCaeTestClient::VideoBufferReady
+// MCameraObserver2 call-back handler
+// -----------------------------------------------------------------------------
+//
+void CCaeTestClient::VideoBufferReady( MCameraBuffer& aCameraBuffer, TInt aError)
+    {
+    PRINT(( _L( "CCaeTestClient::VideoBufferReady() NOT HANDLED entering, err=%d" ), aError ));
+	
+    if ( !aError )
+        {
+	    aCameraBuffer.Release();
+        }
+    
+    PRINT(( _L( "CCaeTestClient::VideoBufferReady() returning" )));
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestRelease.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,6459 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestRelease.cpp
+*
+*/
+
+#include "CaeTestRelease.h"
+#include <f32file.h>
+#include <e32base.h>
+#include <e32svr.h>
+
+
+const TReal32 KViewFinderFrameFrequencyMinimum = 15.0;
+
+
+
+CCaeTestRelease::CCaeTestRelease ()
+    {
+    }
+
+
+
+CCaeTestRelease::~CCaeTestRelease ()
+    {
+    }
+
+
+void CCaeTestRelease::setUpL ()
+    {
+    iStatesClient = CCaeTestStatesClient::NewL( );
+
+    iStatesClient->SetFileNameBase( KFileNameBase );
+
+    iSettingsClient = CCaeTestSettingsClient::NewL();
+
+    iSettingsClient->SetFileNameBase( KFileNameBase );
+    }
+
+
+void CCaeTestRelease::tearDown ()
+    {
+    // pointers in other test e.g. still states tests etc. are not cleared
+    delete iStatesClient; 
+    iStatesClient = NULL;
+    delete iSettingsClient;   
+    iSettingsClient = NULL;
+//    User::After(30000000);
+    }
+
+
+//
+// Own test functions.
+//
+// The framework will do for a test function:
+//
+// setUpL();
+// TRAPD(leaveCode, 'myTestFunction()');
+// "Report leave error or assertion failure for 'myTestFunction()'".
+// tearDown();
+//
+
+
+/********************************************************/
+/*                   GENERAL TESTS                      */
+/********************************************************/
+
+void CCaeTestRelease::TestInitL()
+    {
+    // ID: CAE.GEN.INITL.001
+	//
+    // General
+    // 
+    // Action : Test call InitL() when instatiation is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EInit );// here we have to put the correct action
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestInitVideoRecorderL()
+    {
+    // ID: CAE.GEN.INITVIDEORECORDERL.001
+	//
+    // General
+    // 
+    // Action : Test Call InitVideoRecorderL() when initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EInitVideoRecorder );// here we have to put the correct action
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestPowerOffAndOnL()
+    {
+    // ID: CAE.GEN.POWEROFFANDON.001
+	//
+    // General
+    // 
+    // Action : Test to turn camera power off and on when initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESwitchPowerOffAndOn );
+    assertL( iStatesClient->CountInitComplete() == 2 );
+    }
+
+void CCaeTestRelease::TestReleaseAndReserveL()
+    {
+    // ID: CAE.GEN.RELESEANDRESERVE.001
+	//
+    // General
+    // 
+    // Action : Release vapauttaa kameran muiden sovellusten käyttöön.
+    //          Reserve varaa kameran (uudestaan) ja palauttaa entiset asetukset (kontrasti,....) voimaan. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EReleaseReserve );
+    assertL( iStatesClient->CountInitComplete() == 2 );
+    }
+
+void CCaeTestRelease::TestCCameraHandleL()
+    {
+    // ID: CAE.GEN.CCAMERAHANDLE.001
+	//
+    // General
+    // 
+    // Action : Test call CCameraHandle when instatiation is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ECCameraHandle );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+/********************************************************/
+/*            STILL CAPTURE GENERAL TESTS               */
+/********************************************************/
+
+void CCaeTestRelease::TestPowerOnWhenInitializedL()
+    {
+    // ID: CAE.GEN-SC.POWERON.001
+	//
+    // General
+    // 
+    // Action : Test to turn camera power on when initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESwitchPowerOnWhenInitialized );// here we have to put the correct action
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestPowerOnWhenStillCapturePreparedL()
+    {
+    // ID: CAE.GEN-SC.POWERON.002
+	//
+    // General
+    // 
+    // Action : Test to turn camera power on when still capture prepared.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESwitchPowerOnWhenStillPrepared );// here we have to put the correct action
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestPowerOffWhenStillCapturePreparedL()
+    {
+    // ID: CAE.GEN-SC.POWEROFF.001
+	//
+    // General
+    // 
+    // Action : Test to turn camera power off when still capture prepared.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESwitchPowerOffWhenStillPrepared );// here we have to put the correct action
+    
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestPowerOffWhenViewfinderRunningL()
+    {
+    // ID: CAE.GEN-SC.POWEROFF.002
+	//
+    // General
+    // 
+    // Action : Test to turn camera power off when viewfinder running.
+	//      
+	// Output : OK.   
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESwitchPowerOffWhenVfRunning );// here we have to put the correct action
+    
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+
+/********************************************************/
+/*           VIDEO RECORDING GENERAL TESTS              */
+/********************************************************/
+
+void CCaeTestRelease::TestPowerOnWhenVideoRecordingPreparedL()
+    {
+    // ID: CAE.GEN-VR.POWERON.003
+	//
+    // General
+    // 
+    // Action : Test to turn camera power on when video recording prepared.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESwitchPowerOnWhenVideoPrepared );// here we have to put the correct action
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestPowerOnWhenRecordingL()
+    {
+    // ID: CAE.GEN.VR.POWERON.004
+	//
+    // General
+    // 
+    // Action : Test to turn camera power on when recording.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 1000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESwitchPowerOnWhenRecordingVideo );// here we have to put the correct action
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestPowerOffWhenVideoRecordingPreparedL()
+    {
+    // ID: CAE.GEN-VR.POWEROFF.003
+	//
+    // General
+    // 
+    // Action : Test to turn camera power off video recording prepared.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESwitchPowerOffWhenVideoPrepared );// here we have to put the correct action
+    }
+
+void CCaeTestRelease::TestPowerOffWhenRecordingL()
+    {
+    // ID: CAE.GEN-VR.POWEROFF.004
+	//
+    // General
+    // 
+    // Action : Test to turn camera power off when recording.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 1000000 );
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESwitchPowerOffWhenRecordingVideo );// here we have to put the correct action
+    }
+
+/********************************************************/
+/*                    VIEW FINDER                       */
+/********************************************************/
+
+void CCaeTestRelease::TestViewFinderStartAndStopQqvgaL()
+    {
+	// CAE.VF.STARTSTOPVIEWFINDER.QQVGA.001
+    //
+    // View Finder
+    // 
+    // Action : Test to start and stop QQVGA view finder when initialization is done.
+	//      
+	// Output : OK.   
+
+    TSize sizeQqvga( KImgWidthQQVGA, KImgHeightQQVGA );
+
+    iStatesClient->SetViewFinderSize( sizeQqvga );
+    iStatesClient->SetTimeout( 10000000 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartAndStopVf );
+
+    TReal32 viewFinderFrameFrequency = iStatesClient->ViewFinderFrameFrequency();
+
+    assertL( viewFinderFrameFrequency >= KViewFinderFrameFrequencyMinimum );
+    }
+
+void CCaeTestRelease::TestViewFinderStartAndStopSubqcifL()
+    {
+	// CAE.VF.STARTSTOPVIEWFINDER.SUBQCIF.002
+    //
+    // View Finder
+    // 
+    // Action : Test to start and stop SUBQCIF view finder when initialization is done.
+	//      
+	// Output : OK.   
+
+    TSize sizeSubqcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetViewFinderSize( sizeSubqcif );
+    iStatesClient->SetTimeout( 10000000 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartAndStopVf );
+
+    TReal32 viewFinderFrameFrequency = iStatesClient->ViewFinderFrameFrequency();
+
+    assertL( viewFinderFrameFrequency >= KViewFinderFrameFrequencyMinimum );
+    }
+
+void CCaeTestRelease::TestCroppedViewFinderStartAndStopL()
+    {
+	// CAE.VF.STARTSTOPVIEWFINDER.CROPPED.003
+    //
+    // View Finder
+    // 
+    // Action : Test to start and stop cropped view finder when initialization is done.
+	//      
+	// Output : OK.   
+
+    TSize sizeQqvga( KImgWidthQQVGA, KImgHeightQQVGA );
+
+    iStatesClient->SetViewFinderSize( sizeQqvga );
+    iStatesClient->SetTimeout( 100000 );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartAndStopCroppedVf ) );
+    if( error == KErrNoMemory )
+        {
+        User::Leave( error ); // For memory test
+        }
+    assertL( error == KErrNotSupported );
+
+    TReal32 viewFinderFrameFrequency = iStatesClient->ViewFinderFrameFrequency();
+
+    assertL( viewFinderFrameFrequency >= KViewFinderFrameFrequencyMinimum );
+    }
+
+void CCaeTestRelease::TestViewFinderDirectStartAndStopL()
+    {
+	// CAE.VF.STARTSTOPVIEWFINDERDIRECT.001
+    //
+    // View Finder
+    // 
+    // Action : Test to start and stop view finder direct when initialization is done.
+	//      
+	// Output : Leave.  
+    
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartAndStopDirectVf ) );
+    if( error == KErrNoMemory )
+        {
+        User::Leave( error ); // For memory test
+        }
+#if (HW_DEVLON)
+    assertL( error != KErrNotSupported );  // Returns error because illegal parameters (NULL)
+#else
+    assertL( error == KErrNotSupported );
+#endif
+    }
+
+void CCaeTestRelease::TestCroppedViewFinderDirectStartAndStopL()
+    {
+	// CAE.VF.STARTSTOPVIEWFINDERDIRECT.002
+    //
+    // View Finder
+    // 
+    // Action : Test to start and stop cropped view finder direct when initialization is done.
+	//      
+	// Output : Leave.  
+    
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartAndStopCroppedDirectVf ) );
+    if( error == KErrNoMemory )
+        {
+        User::Leave( error ); // For memory test
+        }
+#if (HW_DEVLON)
+    assertL( error == KErrNotSupported );  // Not supported
+#else
+    assertL( error == KErrNotSupported );
+#endif
+    }
+
+/********************************************************/
+/*              STILL CAPTURE QUALITY LEVEL             */
+/********************************************************/
+
+void CCaeTestRelease::TestCaptureQualityLevel0L()
+    {
+	// ID: CAE.SC.CAPTURESTILL.JPEGVGA90.008
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture quality level 0 
+    //          image when initialization is done and viewfinder is running.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_vga16M.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_ql_0_vga90.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareCaptureStillStartAndStopVf );
+    
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureQualityLevel1L()
+    {
+	// ID: CAE.SC.CAPTURESTILL.JPEGVGA50.009
+
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture quality level 1 
+    //          image when initialization is done and viewfinder is running.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 1 );
+    
+    iStatesClient->SetStillFileName( _L("cae_ql_1_vga50.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareCaptureStillStartAndStopVf );
+    }
+
+
+void CCaeTestRelease::TestCaptureQualityLevel2L()
+    {
+	// ID: CAE.SC.CAPTURESTILL.JPEGQQVGA90.010
+
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture quality level 2 
+    //          image when initialization is done and viewfinder is running.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 2 );
+    
+    iStatesClient->SetStillFileName( _L("cae_ql_2_qqvga90.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareCaptureStillStartAndStopVf );
+    }
+
+
+/********************************************************/
+/*                    STILL CAPTURE                     */
+/********************************************************/
+
+void CCaeTestRelease::TestCaptureVga16ML()
+    {
+	// ID: CAE.SC.CAPTURESTILL.VGA16M.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture VGA 16M  
+    //          image when initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    iStatesClient->SetStillFileName( _L("cae_vga16M.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureVga64KL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.VGA64K.003
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture VGA 64K  
+    //          image when initialization is done.
+	//      
+	// Output : OK.   
+
+    RDebug::Print(_L("XYZ:TestCaptureVga64KL start"));
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor64K );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    iStatesClient->SetStillFileName( _L("cae_vga64K.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    
+    RDebug::Print(_L("XYZ:TestCaptureVga64KL ending"));
+    }
+
+
+void CCaeTestRelease::TestCaptureVga4KL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.VGA4K.004
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture VGA 4K 
+    //          image when initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor4K );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    iStatesClient->SetStillFileName( _L("cae_vga4K.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestRelease::TestCaptureQqvga16ML()
+    {
+	// ID: CAE.SC.CAPTURESTILL.QQVGA16M.005
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture QQVGA 16M  
+    //          image when initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizeQqvga( KImgWidthQQVGA, KImgHeightQQVGA );
+
+    iStatesClient->SetStillFrameSize( sizeQqvga );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_qqvga16M.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_qqvga16M.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+    }
+
+
+void CCaeTestRelease::TestCaptureQqvga64KL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.QQVGA64K.006
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture QQVGA 64K  
+    //          image when initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor64K );
+
+    TSize sizeQqvga( KImgWidthQQVGA, KImgHeightQQVGA );
+
+    iStatesClient->SetStillFrameSize( sizeQqvga );
+
+    iStatesClient->SetStillFileName( _L("cae_qqvga64K.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+    }
+
+
+void CCaeTestRelease::TestCaptureQqvga4KL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.QQVGA4K.007
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture QQVGA 4K 
+    //          image when initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor4K );
+
+    TSize sizeQqvga( KImgWidthQQVGA, KImgHeightQQVGA );
+
+    iStatesClient->SetStillFrameSize( sizeQqvga );
+
+    iStatesClient->SetStillFileName( _L("cae_qqvga4K.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+    }
+
+
+void CCaeTestRelease::TestCaptureMp1_16ML()
+    {
+	// ID: CAE.SC.CAPTURESTILL.MP1.16M.011
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture 1MegaPixel 16M  
+    //          image when initialization is done.
+	//      
+    //       ** For Mirage X PROD1**
+    //
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizeMp1( KImgWidthMP1, KImgHeightMP1 );
+
+    iStatesClient->SetStillFrameSize( sizeMp1 );
+
+    iStatesClient->SetStillFileName( _L("cae_mp1_16M.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureMp1_64KL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.MP1.64K.012
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture 1MegaPixel 64K  
+    //          image when initialization is done.
+	//      
+    //       ** For Mirage X PROD1**
+    //
+	// Output : OK.   
+
+    RDebug::Print(_L("XYZ:TestCaptureMp1_64KL start"));
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor64K );
+
+    TSize sizeMp1( KImgWidthMP1, KImgHeightMP1 );
+
+    iStatesClient->SetStillFrameSize( sizeMp1 );
+
+    iStatesClient->SetStillFileName( _L("cae_mp1_64K.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    
+    RDebug::Print(_L("XYZ:TestCaptureMp1_64KL ending"));
+    }
+
+
+void CCaeTestRelease::TestCaptureMp1_4KL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.MP1.4K.013
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture 1Mega Pixel 4K 
+    //          image when initialization is done.
+	//      
+    //       ** For Mirage X PROD1**
+    //
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor4K );
+
+    TSize sizeMp1( KImgWidthMP1, KImgHeightMP1 );
+
+    iStatesClient->SetStillFrameSize( sizeMp1 );
+
+    iStatesClient->SetStillFileName( _L("cae_mp1_4K.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestRelease::TestCaptureJpegMp1L()
+    {
+	// ID: CAE.SC.CAPTURESTILL.JPEGMP1.014
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture 1MegaPixel Jpeg 
+    //          image when initialization is done.
+	//      
+    //       ** For Mirage X PROD1**
+    //
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
+
+    iStatesClient->SetStillCompressionQuality( 50 );
+
+    TSize sizeMp1( KImgWidthMP1, KImgHeightMP1 );
+
+    iStatesClient->SetStillFrameSize( sizeMp1 );
+
+    iStatesClient->SetStillFileName( _L("cae_jpegmp1_50.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureMp1M3_16ML()
+    {
+	// ID: CAE.SC.CAPTURESTILL.MP1M3.16M.018
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture 1,3MegaPixel 16M  
+    //          image when initialization is done.
+	//      
+    //       ** For Mirage X PROD2**
+    //
+    // Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizeMp1M3( KImgWidthMP1M3, KImgHeightMP1M3 );
+
+    iStatesClient->SetStillFrameSize( sizeMp1M3 );
+
+    iStatesClient->SetStillFileName( _L("cae_mp1m3_16M.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureMp1M3_64KL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.MP1M3.64K.019
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture 1,3MegaPixel 64K  
+    //          image when initialization is done.
+	//      
+    //       ** For Mirage X PROD2**
+    //
+	// Output : OK.   
+
+    RDebug::Print(_L("XYZ:TestCaptureMp1_64KL start"));
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor64K );
+
+    TSize sizeMp1M3( KImgWidthMP1M3, KImgHeightMP1M3 );
+
+    iStatesClient->SetStillFrameSize( sizeMp1M3 );
+
+    iStatesClient->SetStillFileName( _L("cae_mp1m3_64K.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    
+    RDebug::Print(_L("XYZ:TestCaptureMp1_64KL ending"));
+    }
+
+
+void CCaeTestRelease::TestCaptureMp1M3_4KL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.MP1M3.4K.020
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture 1,3Mega Pixel 4K 
+    //          image when initialization is done.
+	//      
+    //       ** For Mirage X PROD2**
+    //
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor4K );
+
+    TSize sizeMp1M3( KImgWidthMP1M3, KImgHeightMP1M3 );
+
+    iStatesClient->SetStillFrameSize( sizeMp1M3 );
+
+    iStatesClient->SetStillFileName( _L("cae_mp1m3_4K.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestRelease::TestCaptureJpegMp1M3L()
+    {
+	// ID: CAE.SC.CAPTURESTILL.JPEGMP1M3.021
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture 1,3MegaPixel Jpeg 
+    //          image when initialization is done.
+	//      
+    //       ** For Mirage X PROD2**
+    //
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
+
+    iStatesClient->SetStillCompressionQuality( 50 );
+
+    TSize sizeMp1M3( KImgWidthMP1M3, KImgHeightMP1M3 );
+
+    iStatesClient->SetStillFrameSize( sizeMp1M3 );
+
+    iStatesClient->SetStillFileName( _L("cae_jpegmp1m3_50.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureMp2_16ML()
+    {
+	// ID: CAE.SC.CAPTURESTILL.MP2.16M.025
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture 2 MegaPixel 16M  
+    //          image when initialization is done.
+	//      
+    //       ** For UNAGI 2M PROD7 **
+    //
+    // Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizeMp2( KImgWidthMP2, KImgHeightMP2 );
+
+    iStatesClient->SetStillFrameSize( sizeMp2 );
+
+    iStatesClient->SetStillFileName( _L("cae_mp2_16M.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureMp2_64KL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.MP2.64K.026
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture 2 MegaPixel 64K  
+    //          image when initialization is done.
+	//      
+    //       ** For UNAGI 2M PROD7 **
+    //
+	// Output : OK.   
+
+    RDebug::Print(_L("XYZ:TestCaptureMp2_64KL start"));
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor64K );
+
+    TSize sizeMp2( KImgWidthMP2, KImgHeightMP2 );
+
+    iStatesClient->SetStillFrameSize( sizeMp2 );
+
+    iStatesClient->SetStillFileName( _L("cae_mp2_64K.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    
+    RDebug::Print(_L("XYZ:TestCaptureMp2_64KL ending"));
+    }
+
+
+void CCaeTestRelease::TestCaptureMp2_4KL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.MP2.4K.027
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture 2 Mega Pixel 4K 
+    //          image when initialization is done.
+	//      
+    //       ** For UNAGI 2M PROD7 **
+    //
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor4K );
+
+    TSize sizeMp2( KImgWidthMP2, KImgHeightMP2 );
+
+    iStatesClient->SetStillFrameSize( sizeMp2 );
+
+    iStatesClient->SetStillFileName( _L("cae_mp2_4K.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestRelease::TestCaptureJpegMp2L()
+    {
+	// ID: CAE.SC.CAPTURESTILL.JPEG.MP2.028
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture 2 MegaPixel Jpeg 
+    //          image when initialization is done.
+	//      
+    //       ** For UNAGI 2M PROD7 **
+    //
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
+
+    iStatesClient->SetStillCompressionQuality( 50 );
+
+    TSize sizeMp2( KImgWidthMP2, KImgHeightMP2 );
+
+    iStatesClient->SetStillFrameSize( sizeMp2 );
+
+    iStatesClient->SetStillFileName( _L("cae_jpegmp2_50.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestRelease::TestCaptureExifMp2L()
+    {
+	// ID: CAE.SC.CAPTURESTILL.EXIF.MP2.029
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture 2 MegaPixel Exif 
+    //          image when initialization is done.
+	//      
+    //       ** For UNAGI 2M PROD7 **
+    //
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetStillCompressionQuality( 95 );
+
+    TSize sizeMp2( KImgWidthMP2, KImgHeightMP2 );
+
+    iStatesClient->SetStillFrameSize( sizeMp2 );
+
+    iStatesClient->SetStillFileName( _L("cae_exifmp2_95.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestRelease::TestCaptureExifSVGAL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.EXIF.SVGA.030
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture SVGA (800x600) Exif 
+    //          image when initialization is done.
+	//      
+    //       ** For UNAGI 2M PROD7 **
+    //
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetStillCompressionQuality( 30 );
+
+    TSize sizeSVGA( KImgWidthSVGA, KImgHeightSVGA );
+
+    iStatesClient->SetStillFrameSize( sizeSVGA );
+
+    iStatesClient->SetStillFileName( _L("cae_exif_svga_30.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestRelease::TestCaptureCodecL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.CODEC.031
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture an image 
+    //          when codec has been set to default.
+	//      
+    //
+	// Output : OK.   
+
+    iSettingsClient->SetStillFormat( CCamera::EFormatExif );
+
+    iSettingsClient->SetStillFileName( _L("cae_exif_codec.jpg") );
+   
+    iSettingsClient->SetImageCodecs( KNullUid, KNullUid );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetJpegCodecWhenStillPrepared );
+
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountStillPrepareComplete() == 1 );
+    assertL( iSettingsClient->CountSnapImageReady() == 1 );
+    assertL( iSettingsClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureCodec2L()
+    {
+	// ID: CAE.SC.CAPTURESTILL.CODEC.032
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture an image 
+    //          when codec has been set to specific uid.
+	//      
+    //
+	// Output : OK.   
+
+    iSettingsClient->SetStillFormat( CCamera::EFormatExif );
+
+    iSettingsClient->SetStillFileName( _L("cae_exif_codec.jpg") );
+    
+    #if ( SYMBIAN_CODECS )
+    iSettingsClient->SetImageCodecs( TUid::Uid( KSymbianJpegDecoderValue ), TUid::Uid( KSymbianJpegEncoderValue ) );
+    #else
+    iSettingsClient->SetImageCodecs( TUid::Uid( KOptimizedJpegDecoderValue ), TUid::Uid( KOptimizedJpegEncoderValue ) );
+    #endif
+    
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetJpegCodecWhenStillPrepared );
+
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountStillPrepareComplete() == 1 );
+    assertL( iSettingsClient->CountSnapImageReady() == 1 );
+    assertL( iSettingsClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureCaptureL()
+    {
+	// ID:      CAE.SC.CAPTURECAPTURE.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Capture photo two times successively
+	//      
+	// Output : No leave.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillFileName( _L("cae_capturecapture_ql0.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ECaptureCapture );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 2 );
+    assertL( iStatesClient->CountStillImageReady() == 2 );
+    }
+
+
+void CCaeTestRelease::TestCaptureCaptureSpecPrepL()
+    {
+	// ID:      CAE.SC.CAPTURECAPTURE.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Capture photo two times successively
+	//      
+	// Output : No leave.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizeQqvga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeQqvga );
+
+    iStatesClient->SetStillFileName( _L("cae_capturecapture_vga16M.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecPrepCaptureCapture );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 2 );
+    assertL( iStatesClient->CountStillImageReady() == 2 );
+    }
+
+void CCaeTestRelease::TestCaptureAfterPowerOffL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.POWEROFF.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture Vga Exif image 
+    //          image after poweroff.
+	//      
+	// Output : No leave
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    //iStatesClient->SetSnapFileName( _L("cae_snap_1_8_vga_poweroff.mbm") );
+
+    iStatesClient->SetSnapImageSize( TSize( 44, 52 ) );
+
+    iStatesClient->SetStillFileName( _L("cae_snap_1_8_vga_poweroff.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ECaptureStillAfterPowerOff );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == 0 );
+    }
+
+
+/********************************************************/
+/*              PREPARE STILL CAPTURE                   */
+/********************************************************/
+
+void CCaeTestRelease::TestPrepareStillCapture0L()
+    {
+	// ID: CAE.SC.PREPARESTILLCAPTUREL.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Prepare the engine for still image capture on specified quality level. 
+    //          Initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareStillCapturing );
+    }
+
+void CCaeTestRelease::TestPrepareStillCapture1L()
+    {
+	// ID: CAE.SC.PREPARESTILLCAPTUREL.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Prepare the engine for still image capture on specified quality level. 
+    //          Initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 1 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareStillCapturing );
+    }
+
+void CCaeTestRelease::TestPrepareStillCapture2L()
+    {
+	// ID: CAE.SC.PREPARESTILLCAPTUREL.003
+    //
+    // Group:   Capture
+    // 
+    // Action : Prepare the engine for still image capture on specified quality level. 
+    //          Initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareStillCapturing );
+    }
+
+void CCaeTestRelease::TestPrepareStillCapture0WhenPreparedL()
+    {
+	// ID: CAE.SC.PREPARESTILLCAPTUREL.004
+    //
+    // Group:   Capture
+    // 
+    // Action : Prepare the engine for still image capture on specified quality 
+    //          level when already prepared.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareStillCapturingWhenPrepared );//we have to put correct action
+    }
+
+void CCaeTestRelease::TestSpecPrepareSCSupportedFormatWhenInitializedL()
+    {
+	// ID: CAE.SC.PREPARESTILLCAPTUREL.007
+    //
+    // Group:   Capture
+    // 
+    // Action : Set still image capturing format to a format supported by Camera API implementation. 
+	//          Initialization is done.
+    //
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareStill );//verified if is correct action
+    }
+
+/********************************************************/
+/*           STILL CAPTURE ENGINE INITIALIZED           */
+/********************************************************/
+
+void CCaeTestRelease::TestCaptureStillWhenEngineInitializedL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Capture still image. Engine initialization is done.
+	//      
+	// Output : Leave.   
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ECaptureStillWhenEngineInitialized ) );// verified if is correct action
+    if( error == KErrNoMemory )
+        {
+        User::Leave( error ); // For memory test
+        }
+    assertL( error != KErrNone );
+    }
+
+
+/********************************************************/
+/*                    STILL BURST CAPTURE               */
+/********************************************************/
+
+void CCaeTestRelease::TestCaptureStillBurst3L()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.3.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          images in a burst when initialization is done.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_vga16M_burst3.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_vga16M_burst3.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurst );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountSnapImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestCaptureStillBurst0L()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.0.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture  
+    //          images in a burst when BurstLength has to small value, 
+    //          when initialization is done.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 0;
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurst ) );
+    if( error == KErrNoMemory )
+        {
+        User::Leave( error ); // For memory test
+        }
+    assertL( error == KErrArgument );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );    
+    assertL( iStatesClient->CountSnapImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 0 );
+    }
+
+void CCaeTestRelease::TestCaptureStillBurst100L()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.100.003
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture  
+    //          images in a burst when BurstLength has to big value, 
+    //          when initialization is done.
+	//      
+	// Output : Leave.   
+
+    const TInt KStillBurstLength = 100;
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+	TInt error = KErrNone;
+	TRAP( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurst ) );
+    assertL( error == KErrNoMemory );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+
+    // assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestCancelCaptureStillBurst3L()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.CANCEL.004
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          images in a burst and cancel still burst, initialization is done.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_vga16M_burst_cancel.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_vga16M_burst_cancel.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureAndCancelStillBurst );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == 1 ); // 3.1 and later
+    //assertL( iStatesClient->CountStillBurstCaptureMoment() == 0 ); // 3.0 and earlier 
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == 0 );
+    assertL( iStatesClient->CountStillBurstComplete() == 0 );
+    }
+
+void CCaeTestRelease::TestStopCaptureStillBurstAfter2L()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.STOP2.005
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          images in a burst and stop still burst, when initialization is done.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 5;
+    const TInt KStillBurstStoppedLength = 2;
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_vga16M_burst_stop.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_vga16M_burst_stop.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureAndStopStillBurst );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstStoppedLength + 1 );
+    assertL( iStatesClient->CountSnapImageReady() == KStillBurstStoppedLength );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstStoppedLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestSpecPrepCaptureStillBurst3L()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.3.006
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          images in a burst when initialization is done.
+    //          Preparation is done using explicitly specified image format parameters.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizevga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizevga );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_vga16M_spburst3.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_vga16M_spburst3.mbm") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecPrepAndCaptureStillBurst );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountSnapImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestCaptureStillBurstInterval0L()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTINTERVAL.0.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode, 
+    //          SetStillBurstCaptureIntervalL, StillBurstCaptureInterval 
+    //          and capture three images in a burst when initialization is done.
+	//      
+	// Output : Leave.   
+
+    const TInt KStillBurstLength = 3;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetSnapFileName( _L("cae_snap_vga16M_burst_intvl_0.mbm") );
+
+    iSettingsClient->SetStillFileName( _L("cae_vga16M_burst_intvl_0.jpg") );
+
+    iSettingsClient->SetStillBurstLength( KStillBurstLength );
+    
+    TTimeIntervalMicroSeconds burstInterval( 0 );
+    
+    iSettingsClient->SetStillBurstCaptureInterval( burstInterval );
+
+    iSettingsClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndSetStillBurstCaptureInterval );
+
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountStillPrepareComplete() == 1 );
+    assertL( iSettingsClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iSettingsClient->CountSnapImageReady() == KStillBurstLength );
+    assertL( iSettingsClient->CountStillImageReady() == KStillBurstLength );
+    assertL( iSettingsClient->CountStillBurstComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestCaptureStillBurstInterval1000000L()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTINTERVAL.1000000.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode,
+    //          SetStillBurstCaptureIntervalL, StillBurstCaptureInterval  
+    //          and capture three images in a burst, when initialization is done.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetSnapFileName( _L("cae_snap_vga16M_burst_intvl_1000000.mbm") );
+
+    iSettingsClient->SetStillFileName( _L("cae_vga16M_burst_intvl_1000000.jpg") );
+
+    iSettingsClient->SetStillBurstLength( KStillBurstLength );
+   
+    TTimeIntervalMicroSeconds burstInterval( 1000000 );
+    
+    iSettingsClient->SetStillBurstCaptureInterval( burstInterval );
+
+    iSettingsClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndSetStillBurstCaptureInterval );
+
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountStillPrepareComplete() == 1 );
+    assertL( iSettingsClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iSettingsClient->CountSnapImageReady() == KStillBurstLength );
+    assertL( iSettingsClient->CountStillImageReady() == KStillBurstLength );
+    assertL( iSettingsClient->CountStillBurstComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestCaptureStillBurstIntervalM1L()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTINTERVAL.M1.003
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode,
+    //          SetStillBurstCaptureIntervalL, StillBurstCaptureInterval  
+    //          and capture three images in a burst, when initialization is done.
+	//      
+	// Output : Leave.   
+
+    const TInt KStillBurstLength = 3;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetStillBurstLength( KStillBurstLength );
+   
+    TTimeIntervalMicroSeconds burstInterval( -1 );
+    
+    iSettingsClient->SetStillBurstCaptureInterval( burstInterval );
+
+    TRAPD( error, iSettingsClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndSetStillBurstCaptureInterval ) );
+    if( error == KErrNoMemory )
+        {
+        User::Leave( error ); // For memory test
+        }
+    assertL( error == KErrArgument );
+
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountStillPrepareComplete() == 1 );
+    assertL( iSettingsClient->CountStillBurstCaptureMoment() == 0 );
+    assertL( iSettingsClient->CountSnapImageReady() == 0 );
+    assertL( iSettingsClient->CountStillImageReady() == 0 );
+    assertL( iSettingsClient->CountStillBurstComplete() == 0 );
+    }
+
+void CCaeTestRelease::TestCaptureStillBurstExif3L()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTEXIF.3.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          VGA Exif images in a burst when initialization is done.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+     TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_burst3_exif.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_burst3_exif.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurstExif );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
+
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureStillBurstExif6L()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTEXIF.6.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture six  
+    //          Exif images in a burst when initialization is done. Uses default
+    //          image resolution.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 6;
+
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_burst6_exif.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_burst6_exif.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurstExif );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountViewFinderFrameReady() == 0 );
+
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestCaptureStillBurstExif6NSL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTEXIF.6.006
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture six  
+    //          Exif images in a burst when initialization is done. Uses default
+    //          image resolution. Test will not stop on errors in call-backs
+    //          and this will test the completeStillBurst() call if run out of memory.
+	//          in cppUnit memory tests.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 6;
+
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_burst6_exif.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_burst6_exif.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->SetStopOnErrorInMcaeoSnapImageReady( EFalse );
+
+	iStatesClient->SetStopOnErrorInMcaeoStillImageReady( EFalse );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurstExif );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountViewFinderFrameReady() == 0 );
+
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureStillBurstExif6_ThumbnailL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTEXIF.6.007
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture six  
+    //          Exif images in a burst when initialization is done. Uses default
+    //          image resolution. Exif image thumbnails are decoded to snap images.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 6;
+
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_burst6_7_exif.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_burst6_7_exif.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->SetSnapImageSource( CCaeEngine::ESnapImageSourceThumbnail );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurstExif );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountViewFinderFrameReady() == 0 );
+
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureStillBurstExif100L()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTEXIF.100.003
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture  
+    //          exif images in a burst when BurstLength has to big value, 
+    //          when initialization is done.
+	//      
+	// Output : Leave.   
+
+    const TInt KStillBurstLength = 100;
+
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+	TInt error = KErrNone;
+	TRAP( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurstExif ) );
+    assertL( error == KErrNoMemory );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+
+    assertL( iStatesClient->CountStillBurstComplete() == 0 );
+    }
+
+
+void CCaeTestRelease::TestCaptureStillBurstExif6VfL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTEXIF.6.VF.004
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture six  
+    //          Exif images in a burst when initialization is done. Uses default
+    //          image resolution. The view finder is running during the burst.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 6;
+
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_burst6_exif.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_burst6_exif.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+	iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurstExif );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
+
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureStillBurstExif6VfCancelL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTEXIF.6.VF.CANCEL.005
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and cancel the burst after   
+    //          the first capture. Intention is to test the situation when the burst is pending
+	//			the view finder to occur before it continues and cancel the burst at that 
+	//			point. Uses default image resolution. The view finder is running 
+	//          during the burst.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 6;
+
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_burst6_exif.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_burst6_exif.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+	iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureAndCancelStillBurstExif );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == 0 );
+
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == 2 );
+    assertL( iStatesClient->CountStillBurstComplete() == 0 );
+    }
+
+
+/********************************************************/
+/*              STILL CAPTURE EXIF                      */
+/********************************************************/
+
+void CCaeTestRelease::TestCaptureVgaExifL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.VGA.EXIF.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture Vga Exif 
+    //          image when initialization is done and viewfinder is running.
+	//      
+	// Output : OK.   
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_vga_exif.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_vga_exif.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareCaptureStillStartAndStopVfExif );
+    
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureQqvgaExifL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.QQVGA.EXIF.002
+
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture Qqvga Exif 
+    //          image when initialization is done and viewfinder is running.
+	//      
+	// Output : OK.   
+
+    TSize sizeQqvga( KImgWidthQQVGA, KImgHeightQQVGA );
+
+    iStatesClient->SetStillFrameSize( sizeQqvga );
+
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_qqvga_exif.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_qqvga_exif.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareCaptureStillStartAndStopVfExif );
+    }
+
+
+void CCaeTestRelease::TestCaptureVgaSnapOneHalfExifL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.VGA.EXIF.003
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture Vga Exif image 
+    //          image when initialization is done and viewfinder is running.
+	//			The snap image is downscaled to 1/2 on Exif decoding.
+	//      
+	// Output : OK.   
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_1_2_vga_exif.mbm") );
+
+    iStatesClient->SetSnapImageSize( TSize( 176, 208 ) );
+
+    iStatesClient->SetStillFileName( _L("cae_snap_1_2_vga_exif.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareCaptureStillStartAndStopVfSnapExif );
+    
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureVgaSnapOneFourthExifL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.VGA.EXIF.004
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture Vga Exif image 
+    //          image when initialization is done and viewfinder is running.
+	//			The snap image is downscaled 1/4 on Exif decoding.
+	//      
+	// Output : OK.   
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_1_4_vga_exif.mbm") );
+
+    iStatesClient->SetSnapImageSize( TSize( 88, 104 ) );
+
+    iStatesClient->SetStillFileName( _L("cae_snap_1_4_vga_exif.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareCaptureStillStartAndStopVfSnapExif );
+    }
+
+
+void CCaeTestRelease::TestCaptureVgaSnapOneEighthExifL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.VGA.EXIF.005
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture Vga Exif image 
+    //          image when initialization is done and viewfinder is running.
+	//			The snap image is downscaled 1/8 on Exif decoding.
+	//      
+	// Output : OK.   
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_1_8_vga_exif.mbm") );
+
+    iStatesClient->SetSnapImageSize( TSize( 44, 52 ) );
+
+    iStatesClient->SetStillFileName( _L("cae_snap_1_8_vga_exif.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareCaptureStillStartAndStopVfSnapExif );
+    }
+
+
+void CCaeTestRelease::TestCaptureVgaSnapExifL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.VGA.EXIF.006
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture Vga Exif image 
+    //          image when initialization is done and viewfinder is running.
+	//			The snap image is given but not downscaled on Exif decoding.
+	//      
+	// Output : OK.   
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_vga_exif.mbm") );
+
+    iStatesClient->SetSnapImageSize( TSize( 176, 250 ) );
+
+    iStatesClient->SetStillFileName( _L("cae_snap_vga_exif.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareCaptureStillStartAndStopVfSnapExif );
+    }
+
+
+void CCaeTestRelease::TestCaptureVgaSnapOneEighthJpegL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.VGA.JPEG.007
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture Vga Jpeg 
+    //          image when initialization is done and viewfinder is running.
+	//			The snap image is downscaled 1/8 on Jpeg decoding.
+    //          This is same as CAE.SC.CAPTURESTILL.VGA.EXIF.005 but format is Jpeg.
+	//      
+	// Output : OK.   
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    
+    iStatesClient->SetStillFormat( CCamera::EFormatJpeg ); // test Jpeg format too
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_1_8_vga_jpeg.mbm") );
+
+    iStatesClient->SetSnapImageSize( TSize( 44, 52 ) );
+
+    iStatesClient->SetStillFileName( _L("cae_snap_1_8_vga_jpeg.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareCaptureStillStartAndStopVfSnapExif );
+    }
+
+void CCaeTestRelease::TestCaptureVgaSnapOneEighthExif2L()
+    {
+	// ID: CAE.SC.CAPTURESTILL.VGA.EXIF.008
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture Vga Exif image 
+    //          image when initialization is done and viewfinder is running.
+	//			The snap image is downscaled 1/8 on Exif decoding. The snap 
+	//			image size is set only after prepare.
+	//      
+	// Output : OK. Visual check of snap file size.
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_1_8_vga_exif2.mbm") );
+
+    iStatesClient->SetSnapImageSize( TSize( 44, 52 ) );
+
+    iStatesClient->SetStillFileName( _L("cae_snap_1_8_vga_exif2.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ECaptureStillSetSnapSizeExif );
+    }
+
+
+void CCaeTestRelease::TestCaptureVgaSnapColor16MExifL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.VGA.EXIF.009
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture Vga Exif image 
+    //          when initialization is done and viewfinder is running.
+	//			The snap image color mode is set to EColor16M.
+	//      
+	// Output : OK. Visual check of snap file color mode.
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_color_mode_vga_exif.mbm") );
+
+    iStatesClient->SetSnapImageColorMode( EColor16M );
+
+    iStatesClient->SetStillFileName( _L("cae_snap_color_mode_vga_exif.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ECaptureStillSetSnapColorModeExif );
+    }
+
+
+/********************************************************/
+/*              PREPARE VIDEO RECORDING                 */
+/********************************************************/
+
+void CCaeTestRelease::TestPrepareVideoRecording0L()
+    {
+	// ID: CAE.VR.PREPAREVIDEORECORDINGL.001
+    //
+    // Group:   Record
+    // 
+    // Action : Prepare the engine for video recording on specified quality level. 
+    //          Initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iStatesClient->SetVideoFileName( _L("cae_prepare_vr_0.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareVideoRecording );
+        
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestPrepareVideoRecording1L()
+    {
+	// ID: CAE.VR.PREPAREVIDEORECORDINGL.002
+    //
+    // Group:   Record
+    // 
+    // Action : Prepare the engine for video recording on specified quality level. 
+    //          Initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 1 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iStatesClient->SetVideoFileName( _L("cae_prepare_vr_1.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareVideoRecording );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestPrepareVideoRecording2L()
+    {
+	// ID: CAE.VR.PREPAREVIDEORECORDINGL.003
+    //
+    // Group:   Record
+    // 
+    // Action : Prepare the engine for video recording on specified quality level. 
+    //          Initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 2 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iStatesClient->SetVideoFileName( _L("cae_prepare_vr_2.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareVideoRecording );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestPrepareVideoRecording0WhenPreparedL()
+    {
+	// ID: CAE.VR.PREPAREVIDEORECORDINGL.004
+    //
+    // Group:   Record
+    // 
+    // Action : Prepare the engine for video recording on specified quality 
+    //          level when already prepared.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iStatesClient->SetVideoFileName( _L("cae_prepared_vr_0.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareVideoRecordingWhenPrepared );//we have to put correct action
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 2 );
+    }
+
+void CCaeTestRelease::TestSpecPrepareVRSupportedFormatWhenVRInitializedL()
+{
+    // ID: CAE.VR.PREPAREVIDEORECORDINGL.007
+    //
+    // Group:   Record.
+    // 
+    // Action : Set video recording format to a format supported by MMF Camcorder plug-in 
+    //          and Camera API implementation. 
+    //          Video recorder initialization is done.
+	//      
+	// Output : OK.    
+
+    iStatesClient->SetTimeout( 1000000 );
+
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( 10.0 );
+    iStatesClient->SetVideoBitRate( 50000 );
+    iStatesClient->SetVideoAudio( ETrue );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    //iStatesClient->SetVideoFileName( _L("cae_video_format_initialized.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareVideo );//verified if is correct action
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    }
+
+/********************************************************/
+/*             VIDEO RECORDING QUALITY LEVEL            */
+/********************************************************/
+
+void CCaeTestRelease::TestRecordQualityLevel0L()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.QCIF64000FR15.001
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 0 
+    //          video clip when initialization is done and viewfinder is running.
+	//      
+	// Output : No leave. File cae_ql_0.3gp.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetViewFinderSize( sizeSubQcif );
+    
+    iStatesClient->SetVfFileName( _L("cae_video_ql_0_vfimg.mbm") ); 
+
+    // iStatesClient->SetVfFileCountToSave( 150 );
+        
+    iStatesClient->SetTimeout( 30000000 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iStatesClient->SetVideoFileName( _L("cae_ql_0.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareRecordVideoStartAndStopVf );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+void CCaeTestRelease::TestRecordQualityLevel1L()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.SUBQCIF60000FR15.002
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 1 
+    //          video clip when initialization is done and viewfinder is running.
+	//      
+	// Output : No leave. File cae_ql_1.3gp.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 1 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetViewFinderSize( sizeSubQcif );
+    
+    iStatesClient->SetTimeout( 20000000 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iStatesClient->SetVideoFileName( _L("cae_ql_1.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareRecordVideoStartAndStopVf );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+void CCaeTestRelease::TestPrepareAudioBitRateVR128L()
+    {
+	// ID:      CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.002
+    //
+    // Group:   Record.
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          Use high video bitrate. This is for PROD7.
+	//      
+	// Output : No leave. File cae_subqcif_VideoBitRate_128000.3gp.   
+
+    TSize sizeSubQcif( 176, 144 );
+
+    iStatesClient->SetViewFinderSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 15.0 ) );
+
+    iStatesClient->SetVideoBitRate( TInt( 128000 ) );
+    iStatesClient->SetAudioBitRate( TInt( 12200 ) );
+    
+    iStatesClient->SetTimeout( 20000000 );
+
+    // 3: AMR audio, H.263 video, video type video/H263-2000; profile=0; level=45
+    // 0: AMR audio, H.263 video, video type video/H263-2000
+    iStatesClient->SetVideoCodecSet( 3 ); 
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_VideoBitRate_128000.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestPrepareAudioBitRateVR128InvVtypeL()
+    {
+	// ID:      CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.003
+    //
+    // Group:   Record.
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          Use high video bitrate and invalid videotype.
+	//      
+	// Output : Leave   
+
+    TSize sizeSubQcif( 176, 144 );
+
+    iStatesClient->SetViewFinderSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 15.0 ) );
+
+    iStatesClient->SetVideoBitRate( TInt( 128000 ) );
+    iStatesClient->SetAudioBitRate( TInt( 12200 ) );
+    
+    iStatesClient->SetTimeout( 20000000 );
+
+    // 3: AMR audio, H.263 video, video type video/H263-2000; profile=0; level=45
+    // 0: AMR audio, H.263 video, video type video/H263-2000
+    iStatesClient->SetVideoCodecSet( 0 ); 
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_VideoBitRate_128000inv.3gp") );
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+    assertL( err != KErrNone );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestRelease::TestRecordQualityLevel2L()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.SUBQCIF40000FR5.003
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 2 
+    //          video clip when initialization is done and viewfinder is running.
+	//      
+	// Output : No leave. File cae_q2_0.3gp.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 2 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetViewFinderSize( sizeSubQcif );
+    
+    iStatesClient->SetTimeout( 20000000 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iStatesClient->SetVideoFileName( _L("cae_ql_2.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareRecordVideoStartAndStopVf );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*            START AND STOP VIDEO RECORDING            */
+/********************************************************/
+
+void CCaeTestRelease::TestStartAndStopVideoRecordingSubQcifL()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.SUBQCIF.001
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording subQCIF sized video works. 
+    //          Video recording prepared for subQCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestStartAndStopVideoRecordingQcifL()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.QCIF.002
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording QCIF sized video works. 
+    //          Video recording prepared for QCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 50000 ) );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iStatesClient->SetVideoFileName( _L("cae_qcif.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*             STILL CAPTURE DIGITAL ZOOM VALUE         */
+/********************************************************/
+
+void CCaeTestRelease::TestSCDigiZoomVal0L()
+{
+	// Group:   Settings
+    //
+    // ID:      CAE.SET-SC.SETZOOMVALUEL.001
+    // 
+    // Action : Test digital zoom.
+	//      
+	// Output : OK.  
+ 
+    RDebug::Print(_L("XYZ:TestSCDigiZoomVal0L start"));
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetDigiZoomValue( 0 );
+
+    iSettingsClient->SetSnapFileName( _L("cae_digizoom_val_0_vga.mbm") );
+
+    iSettingsClient->SetStillFileName( _L("cae_digizoom_val_0_vga.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenStillPrepared );
+ 
+    RDebug::Print(_L("XYZ:TestSCDigiZoomVal0L ending"));
+}
+
+void CCaeTestRelease::TestSCDigiZoomVal1VgaL()
+{
+	// Group:   Settings
+    //
+    // ID:      CAE.SET-SC.SETZOOMVALUEL.002_vga
+    // 
+    // Action : Test digital zoom.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetDigiZoomValue( info.iMaxDigitalZoom );
+
+    iSettingsClient->SetSnapFileName( _L("cae_digizoom_val_1_vga.mbm") );
+
+    iSettingsClient->SetStillFileName( _L("cae_digizoom_val_1_vga.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenStillPrepared );
+}
+
+void CCaeTestRelease::TestSCDigiZoomVal1QqvgaL()
+{
+	// Group:   Settings
+    //
+    // ID:      CAE.SET-SC.SETZOOMVALUEL.002_qqvga
+    // 
+    // Action : Test digital zoom.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 2 );
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetDigiZoomValue( info.iMaxDigitalZoom );
+
+    iSettingsClient->SetSnapFileName( _L("cae_digizoom_val_1_qqvga.mbm") );
+    
+    iSettingsClient->SetStillFileName( _L("cae_digizoom_val_1_qqvga.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenStillPrepared );
+}
+
+void CCaeTestRelease::TestSCDigiZoomInitializedVal0L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETZOOMVALUEL.005
+    //
+    // Action : Test digital zoom.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetDigiZoomValue( 0 );
+
+    iSettingsClient->SetSnapFileName( _L("cae_digizoom_initialized_val_0_vga.mbm") );
+
+    iSettingsClient->SetStillFileName( _L("cae_digizoom_initialized_val_0_vga.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenInitialized );
+}
+
+void CCaeTestRelease::TestSCDigiZoomInitializedVal1VgaL()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETZOOMVALUEL.012_vga
+    //
+    // Action : Test digital zoom.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetDigiZoomValue( info.iMaxDigitalZoom );
+
+    iSettingsClient->SetSnapFileName( _L("cae_digizoom_initialized_val_1_vga.mbm") );
+
+    iSettingsClient->SetStillFileName( _L("cae_digizoom_initialized_val_1_vga.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenInitialized );
+}
+
+void CCaeTestRelease::TestSCDigiZoomInitializedVal1QqvgaL()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETZOOMVALUEL.012_qqvga
+    //
+    // Action : Test digital zoom.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 2 );
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetDigiZoomValue( info.iMaxDigitalZoom );
+
+    iSettingsClient->SetSnapFileName( _L("cae_digizoom_initialized_val_1_qqvga.mbm") );
+
+    iSettingsClient->SetStillFileName( _L("cae_digizoom_initialized_val_1_qqvga.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenInitialized );
+}
+
+/********************************************************/
+/*             VIDEO RECORDING DIGITAL ZOOM VALUE       */
+/********************************************************/
+
+void CCaeTestRelease::TestVRDigiZoomVal0L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETZOOMVALUEL.006
+    //
+    // Action : Test digital zoom.
+	//      
+	// Output : OK.
+
+    iSettingsClient->SetTimeout( 4000000 );
+    
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetDigiZoomValue( 0 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_digizoom_val_0.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenVideoPrepared );
+}
+
+void CCaeTestRelease::TestVRDigiZoomVal1L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETZOOMVALUEL.007
+    //
+    // Action : Test digital zoom.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetTimeout( 4000000 );
+    
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetDigiZoomValue( info.iMaxDigitalZoom );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_digizoom_val_1.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenVideoPrepared );
+}
+
+void CCaeTestRelease::TestVRDigiZoomRecordingVal0L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETZOOMVALUEL.010
+    //
+    // Action : Test digital zoom.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetTimeout( 4000000 );
+    
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetDigiZoomValue( 0 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_digizoom_recording_val_0.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenVideoRecording );
+}
+
+void CCaeTestRelease::TestVRDigiZoomRecordingVal1L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETZOOMVALUEL.011
+    //
+    // Action : Test digital zoom.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetTimeout( 4000000 );
+    
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+    iSettingsClient->SetDigiZoomValue( info.iMaxDigitalZoom );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_digizoom_recording_val_1.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenVideoRecording );
+}
+
+/********************************************************/
+/*        START AND STOP VIDEO RECORDING DISK FULL      */
+/********************************************************/
+
+void CCaeTestRelease::TestStartAndStopVRWhenTooBigSizeSubQcifL()
+    {
+	// ID: CAE.VR.STARTSTOPVRTOOBIGSIZE.SUBQCIF.001
+    //
+    // Group:   Record
+    // 
+    // Action : 
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetTimeout( 100000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    //iStatesClient->SetVideoFileName( _L("cae_too_big_subqcif.3gp") );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo ) );//we have to put correct action
+    if( error == KErrNoMemory )
+        {
+        User::Leave( error ); // For memory test
+        }
+    assertL( error == KErrDiskFull );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*                     GET INFO                         */
+/********************************************************/
+
+void CCaeTestRelease::TestGetInfoL()
+    {
+    // Group:   Settings
+    //
+    // ID:      CAE.GEN.GETINFO.001
+    // 
+    // Action : Call GetInfo. Engine initialized
+    //      
+    // Output : OK.   
+    
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetInfo );
+    
+    // Get Camera Application Engine info object.
+    TCamAppEngineInfo info;
+    iSettingsClient->GetInfo( info );
+    
+    // Do comparisons.
+
+    /*
+    TVersion hardwareVersion = TVersion(0,0,0);
+    assertL( ( info.iHardwareVersion.iMajor == hardwareVersion.iMajor ) &&
+             ( info.iHardwareVersion.iMinor == hardwareVersion.iMinor ) &&
+             ( info.iHardwareVersion.iBuild == hardwareVersion.iBuild ) );
+
+    TVersion softwareVersion = TVersion(0,0,0);
+    assertL( ( info.iSoftwareVersion.iMajor == softwareVersion.iMajor ) &&
+             ( info.iSoftwareVersion.iMinor == softwareVersion.iMinor ) &&
+             ( info.iSoftwareVersion.iBuild == softwareVersion.iBuild ) );
+    */
+
+    TCameraInfo::TCameraOrientation orientation = TCameraInfo::EOrientationOutwards;
+    assertL( info.iOrientation == orientation );
+
+    TUint32 optionsSupported = TCameraInfo::EViewFinderBitmapsSupported |
+                               TCameraInfo::EImageCaptureSupported |
+                               TCameraInfo::EVideoCaptureSupported |
+                               TCameraInfo::EContrastSupported |
+                               TCameraInfo::EBrightnessSupported;
+    assertL( info.iOptionsSupported == optionsSupported );
+    
+    TUint32 flashModesSupported = CCamera::EFlashNone;
+    assertL( info.iFlashModesSupported == flashModesSupported );
+
+    TUint32 exposureModesSupported = CCamera::EExposureAuto | 
+                                     CCamera::EExposureNight;
+    assertL( info.iExposureModesSupported == exposureModesSupported );
+    
+    TUint32 whiteBalanceModesSupported = CCamera::EWBAuto;
+    assertL( info.iWhiteBalanceModesSupported == whiteBalanceModesSupported );
+
+    TInt minzoom = 0;
+    assertL( info.iMinZoom == minzoom );
+
+    TInt maxZoom = 0;
+    assertL( info.iMaxZoom == maxZoom );
+
+    TInt maxDigitalZoom = 1;
+    assertL( info.iMaxDigitalZoom == maxDigitalZoom );
+    
+    TReal32 minZoomFactor = 0.0;
+    assertL( info.iMinZoomFactor == minZoomFactor );
+
+    TReal32 maxZoomFactor = 0.0;
+    assertL( info.iMaxZoomFactor == maxZoomFactor );
+
+    TReal32 maxDigitalZoomFactor = 2.0;
+    assertL( info.iMaxDigitalZoomFactor == maxDigitalZoomFactor );
+
+    TInt numImageSizesSupported = 2;
+    assertL( info.iNumImageSizesSupported == numImageSizesSupported );
+
+    TUint32 imageFormatsSupported = CCamera::EFormatFbsBitmapColor4K |
+                                    CCamera::EFormatFbsBitmapColor64K |
+                                    CCamera::EFormatFbsBitmapColor16M;
+    assertL( info.iImageFormatsSupported == imageFormatsSupported );
+
+    TInt numStillQualityLevelsSupported = 3;
+    assertL( info.iNumStillQualityLevelsSupported == numStillQualityLevelsSupported );
+
+    TInt numVideoQualityLevelsSupported = 3;
+    assertL( info.iNumVideoQualityLevelsSupported == numVideoQualityLevelsSupported );
+
+    }
+
+void CCaeTestRelease::TestGetInfoPROD1MirageXL()
+    {
+    // Group:   Settings
+    //
+    // ID:      CAE.GEN.GETINFO.002
+    // 
+    // Action : Call GetInfo. Engine initialized
+    //          ** For PROD1 Mirage X**
+    //      
+    // Output : OK.   
+    
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetInfo );
+    
+    // Get Camera Application Engine info object.
+    TCamAppEngineInfo info;
+    iSettingsClient->GetInfo( info );
+    
+    // Do comparisons.
+
+    /*
+    TVersion hardwareVersion = TVersion(0,0,0);
+    assertL( ( info.iHardwareVersion.iMajor == hardwareVersion.iMajor ) &&
+             ( info.iHardwareVersion.iMinor == hardwareVersion.iMinor ) &&
+             ( info.iHardwareVersion.iBuild == hardwareVersion.iBuild ) );
+
+    TVersion softwareVersion = TVersion(0,0,0);
+    assertL( ( info.iSoftwareVersion.iMajor == softwareVersion.iMajor ) &&
+             ( info.iSoftwareVersion.iMinor == softwareVersion.iMinor ) &&
+             ( info.iSoftwareVersion.iBuild == softwareVersion.iBuild ) );
+    */
+
+    TCameraInfo::TCameraOrientation orientation = TCameraInfo::EOrientationOutwards;
+    assertL( info.iOrientation == orientation );
+
+    TUint32 optionsSupported = TCameraInfo::EViewFinderBitmapsSupported |
+                               TCameraInfo::EImageCaptureSupported |
+                               TCameraInfo::EVideoCaptureSupported |
+                               TCameraInfo::EContrastSupported |
+                               TCameraInfo::EBrightnessSupported;
+    assertL( info.iOptionsSupported == optionsSupported );
+    
+    TUint32 flashModesSupported = CCamera::EFlashNone;
+    assertL( info.iFlashModesSupported == flashModesSupported );
+
+    TUint32 exposureModesSupported = CCamera::EExposureAuto | 
+                                     CCamera::EExposureNight;
+    assertL( info.iExposureModesSupported == exposureModesSupported );
+    
+    TUint32 whiteBalanceModesSupported = CCamera::EWBAuto;
+    assertL( info.iWhiteBalanceModesSupported == whiteBalanceModesSupported );
+
+    TInt minzoom = 0;
+    assertL( info.iMinZoom == minzoom );
+
+    TInt maxZoom = 0;
+    assertL( info.iMaxZoom == maxZoom );
+
+    TInt maxDigitalZoom = 3;
+    assertL( info.iMaxDigitalZoom == maxDigitalZoom );
+    
+    TReal32 minZoomFactor = 0.0;
+    assertL( info.iMinZoomFactor == minZoomFactor );
+
+    TReal32 maxZoomFactor = 0.0;
+    assertL( info.iMaxZoomFactor == maxZoomFactor );
+
+    TReal32 maxDigitalZoomFactor = 4.0;
+    assertL( info.iMaxDigitalZoomFactor == maxDigitalZoomFactor );
+
+    TInt numImageSizesSupported = 4;
+    assertL( info.iNumImageSizesSupported == numImageSizesSupported );
+
+    TUint32 imageFormatsSupported = CCamera::EFormatFbsBitmapColor4K |
+                                    CCamera::EFormatFbsBitmapColor64K |
+                                    CCamera::EFormatFbsBitmapColor16M;
+    assertL( info.iImageFormatsSupported == imageFormatsSupported );
+
+    TInt numStillQualityLevelsSupported = 3;
+    assertL( info.iNumStillQualityLevelsSupported == numStillQualityLevelsSupported );
+
+    TInt numVideoQualityLevelsSupported = 3;
+    assertL( info.iNumVideoQualityLevelsSupported == numVideoQualityLevelsSupported );
+
+    }
+
+
+void CCaeTestRelease::TestGetInfoPROD2MirageXL()
+    {
+    // Group:   Settings
+    //
+    // ID:      CAE.GEN.GETINFO.003
+    // 
+    // Action : Call GetInfo. Engine initialized
+    //          ** For PROD2 Mirage X**
+    //      
+    // Output : OK.   
+    
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetInfo );
+    
+    // Get Camera Application Engine info object.
+    TCamAppEngineInfo info;
+    iSettingsClient->GetInfo( info );
+    
+    // Do comparisons.
+
+    /*
+    TVersion hardwareVersion = TVersion(0,0,0);
+    assertL( ( info.iHardwareVersion.iMajor == hardwareVersion.iMajor ) &&
+             ( info.iHardwareVersion.iMinor == hardwareVersion.iMinor ) &&
+             ( info.iHardwareVersion.iBuild == hardwareVersion.iBuild ) );
+
+    TVersion softwareVersion = TVersion(0,0,0);
+    assertL( ( info.iSoftwareVersion.iMajor == softwareVersion.iMajor ) &&
+             ( info.iSoftwareVersion.iMinor == softwareVersion.iMinor ) &&
+             ( info.iSoftwareVersion.iBuild == softwareVersion.iBuild ) );
+    */
+
+    TCameraInfo::TCameraOrientation orientation = TCameraInfo::EOrientationOutwards;
+    assertL( info.iOrientation == orientation );
+
+    TUint32 optionsSupported = TCameraInfo::EViewFinderBitmapsSupported |
+                               TCameraInfo::EImageCaptureSupported |
+                               TCameraInfo::EVideoCaptureSupported |
+                               TCameraInfo::EContrastSupported |
+                               TCameraInfo::EBrightnessSupported;
+    assertL( info.iOptionsSupported == optionsSupported );
+    
+    TUint32 flashModesSupported = CCamera::EFlashNone;
+    assertL( info.iFlashModesSupported == flashModesSupported );
+
+    TUint32 exposureModesSupported = CCamera::EExposureAuto | 
+                                     CCamera::EExposureNight |
+                                     CCamera::EExposureCenter |
+                                     CCamera::EExposureBacklight;
+    assertL( info.iExposureModesSupported == exposureModesSupported );
+    
+    TUint32 whiteBalanceModesSupported = CCamera::EWBAuto;
+    assertL( info.iWhiteBalanceModesSupported == whiteBalanceModesSupported );
+
+    TInt minzoom = 0;
+    assertL( info.iMinZoom == minzoom );
+
+    TInt maxZoom = 0;
+    assertL( info.iMaxZoom == maxZoom );
+
+    TInt maxDigitalZoom = 52;
+    assertL( info.iMaxDigitalZoom == maxDigitalZoom );
+    
+    TReal32 minZoomFactor = 0.0;
+    assertL( info.iMinZoomFactor == minZoomFactor );
+
+    TReal32 maxZoomFactor = 0.0;
+    assertL( info.iMaxZoomFactor == maxZoomFactor );
+
+    TReal32 maxDigitalZoomFactor = 6.0;
+    assertL( info.iMaxDigitalZoomFactor == maxDigitalZoomFactor );
+
+    TInt numImageSizesSupported = 3;
+    assertL( info.iNumImageSizesSupported == numImageSizesSupported );
+
+    TUint32 imageFormatsSupported = CCamera::EFormatFbsBitmapColor4K |
+                                    CCamera::EFormatFbsBitmapColor64K |
+                                    CCamera::EFormatFbsBitmapColor16M |
+                                    CCamera::EFormatExif;
+    assertL( info.iImageFormatsSupported == imageFormatsSupported );
+
+    TInt numStillQualityLevelsSupported = 3;
+    assertL( info.iNumStillQualityLevelsSupported == numStillQualityLevelsSupported );
+
+    TInt numVideoQualityLevelsSupported = 3;
+    assertL( info.iNumVideoQualityLevelsSupported == numVideoQualityLevelsSupported );
+
+    }
+
+
+void CCaeTestRelease::TestGetInfoPROD3MirageXPL()
+    {
+    // Group:   Settings
+    //
+    // ID:      CAE.GEN.GETINFO.004
+    // 
+    // Action : Call GetInfo. Engine initialized
+    //          ** For PROD3 Mirage XP**
+    //      
+    // Output : OK.   
+    
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetInfo );
+    
+    // Get Camera Application Engine info object.
+    TCamAppEngineInfo info;
+    iSettingsClient->GetInfo( info );
+    
+    // Do comparisons.
+
+    /*
+    TVersion hardwareVersion = TVersion(0,0,0);
+    assertL( ( info.iHardwareVersion.iMajor == hardwareVersion.iMajor ) &&
+             ( info.iHardwareVersion.iMinor == hardwareVersion.iMinor ) &&
+             ( info.iHardwareVersion.iBuild == hardwareVersion.iBuild ) );
+
+    TVersion softwareVersion = TVersion(0,0,0);
+    assertL( ( info.iSoftwareVersion.iMajor == softwareVersion.iMajor ) &&
+             ( info.iSoftwareVersion.iMinor == softwareVersion.iMinor ) &&
+             ( info.iSoftwareVersion.iBuild == softwareVersion.iBuild ) );
+    */
+
+    TCameraInfo::TCameraOrientation orientation = TCameraInfo::EOrientationOutwards;
+    assertL( info.iOrientation == orientation );
+
+    TUint32 optionsSupported = TCameraInfo::EViewFinderBitmapsSupported |
+                               TCameraInfo::EImageCaptureSupported |
+                               TCameraInfo::EVideoCaptureSupported |
+                               TCameraInfo::EContrastSupported |
+                               TCameraInfo::EBrightnessSupported;
+    assertL( info.iOptionsSupported == optionsSupported );
+    
+    TUint32 flashModesSupported = CCamera::EFlashNone |
+                                  CCamera::EFlashAuto | 
+                                  CCamera::EFlashForced;
+    assertL( info.iFlashModesSupported == flashModesSupported );
+
+    TUint32 exposureModesSupported = CCamera::EExposureAuto | 
+                                     CCamera::EExposureNight;
+    assertL( info.iExposureModesSupported == exposureModesSupported );
+    
+    TUint32 whiteBalanceModesSupported = CCamera::EWBAuto |
+                                         CCamera::EWBDaylight |
+                                         CCamera::EWBCloudy | 
+                                         CCamera::EWBTungsten |
+                                         CCamera::EWBFluorescent;
+    assertL( info.iWhiteBalanceModesSupported == whiteBalanceModesSupported );
+
+    TInt minzoom = 0;
+    assertL( info.iMinZoom == minzoom );
+
+    TInt maxZoom = 0;
+    assertL( info.iMaxZoom == maxZoom );
+
+    TInt maxDigitalZoom = 3;
+    assertL( info.iMaxDigitalZoom == maxDigitalZoom );
+    
+    TReal32 minZoomFactor = 0.0;
+    assertL( info.iMinZoomFactor == minZoomFactor );
+
+    TReal32 maxZoomFactor = 0.0;
+    assertL( info.iMaxZoomFactor == maxZoomFactor );
+
+    TReal32 maxDigitalZoomFactor = 4.0;
+    assertL( info.iMaxDigitalZoomFactor == maxDigitalZoomFactor );
+
+    TInt numImageSizesSupported = 3; // 4 with HW version of Camera API !
+    assertL( info.iNumImageSizesSupported == numImageSizesSupported );
+
+    TUint32 imageFormatsSupported = CCamera::EFormatFbsBitmapColor4K |
+                                    CCamera::EFormatFbsBitmapColor64K |
+                                    CCamera::EFormatFbsBitmapColor16M |
+                                    CCamera::EFormatExif;
+    assertL( info.iImageFormatsSupported == imageFormatsSupported );
+
+    TInt numStillQualityLevelsSupported = 3;
+    assertL( info.iNumStillQualityLevelsSupported == numStillQualityLevelsSupported );
+
+    TInt numVideoQualityLevelsSupported = 3;
+    assertL( info.iNumVideoQualityLevelsSupported == numVideoQualityLevelsSupported );
+
+    }
+
+void CCaeTestRelease::TestGetInfoPROD4MirageXL()
+    {
+    // Group:   Settings
+    //
+    // ID:      CAE.GEN.GETINFO.005
+    // 
+    // Action : Call GetInfo. Engine initialized
+    //          ** For PROD4 Mirage X**
+    //      
+    // Output : OK.   
+    
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetInfo );
+    
+    // Get Camera Application Engine info object.
+    TCamAppEngineInfo info;
+    iSettingsClient->GetInfo( info );
+    
+    // Do comparisons.
+
+    /*
+    TVersion hardwareVersion = TVersion(0,0,0);
+    assertL( ( info.iHardwareVersion.iMajor == hardwareVersion.iMajor ) &&
+             ( info.iHardwareVersion.iMinor == hardwareVersion.iMinor ) &&
+             ( info.iHardwareVersion.iBuild == hardwareVersion.iBuild ) );
+
+    TVersion softwareVersion = TVersion(0,0,0);
+    assertL( ( info.iSoftwareVersion.iMajor == softwareVersion.iMajor ) &&
+             ( info.iSoftwareVersion.iMinor == softwareVersion.iMinor ) &&
+             ( info.iSoftwareVersion.iBuild == softwareVersion.iBuild ) );
+    */
+
+    TCameraInfo::TCameraOrientation orientation = TCameraInfo::EOrientationOutwards;
+    assertL( info.iOrientation == orientation );
+
+    TUint32 optionsSupported = TCameraInfo::EViewFinderBitmapsSupported |
+                               TCameraInfo::EImageCaptureSupported |
+                               TCameraInfo::EVideoCaptureSupported |
+                               TCameraInfo::EContrastSupported |
+                               TCameraInfo::EBrightnessSupported;
+    assertL( info.iOptionsSupported == optionsSupported );
+    
+    TUint32 flashModesSupported = CCamera::EFlashNone | 
+                                           CCamera::EFlashAuto |
+                                           CCamera::EFlashForced;
+    assertL( info.iFlashModesSupported == flashModesSupported );
+
+    TUint32 exposureModesSupported = CCamera::EExposureAuto | 
+                                     CCamera::EExposureNight |
+                                     CCamera::EExposureCenter |
+                                     CCamera::EExposureBacklight;
+    assertL( info.iExposureModesSupported == exposureModesSupported );
+    
+    TUint32 whiteBalanceModesSupported = CCamera::EWBAuto;
+    assertL( info.iWhiteBalanceModesSupported == whiteBalanceModesSupported );
+
+    TInt minzoom = 0;
+    assertL( info.iMinZoom == minzoom );
+
+    TInt maxZoom = 0;
+    assertL( info.iMaxZoom == maxZoom );
+
+    TInt maxDigitalZoom = 52;
+    assertL( info.iMaxDigitalZoom == maxDigitalZoom );
+    
+    TReal32 minZoomFactor = 0.0;
+    assertL( info.iMinZoomFactor == minZoomFactor );
+
+    TReal32 maxZoomFactor = 0.0;
+    assertL( info.iMaxZoomFactor == maxZoomFactor );
+
+    TReal32 maxDigitalZoomFactor = 6.0;
+    assertL( info.iMaxDigitalZoomFactor == maxDigitalZoomFactor );
+
+    TInt numImageSizesSupported = 3;
+    assertL( info.iNumImageSizesSupported == numImageSizesSupported );
+
+    TUint32 imageFormatsSupported = CCamera::EFormatFbsBitmapColor4K |
+                                    CCamera::EFormatFbsBitmapColor64K |
+                                    CCamera::EFormatFbsBitmapColor16M |
+                                    CCamera::EFormatExif;
+    assertL( info.iImageFormatsSupported == imageFormatsSupported );
+
+    TInt numStillQualityLevelsSupported = 3;
+    assertL( info.iNumStillQualityLevelsSupported == numStillQualityLevelsSupported );
+
+    TInt numVideoQualityLevelsSupported = 3;
+    assertL( info.iNumVideoQualityLevelsSupported == numVideoQualityLevelsSupported );
+
+    }
+
+void CCaeTestRelease::TestGetInfoPROD6MirageXL()
+    {
+    // Group:   Settings
+    //
+    // ID:      CAE.GEN.GETINFO.006
+    // 
+    // Action : Call GetInfo. Engine initialized
+    //          ** For PROD6 Mirage X**
+    //      
+    // Output : OK.   
+    
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetInfo );
+    
+    // Get Camera Application Engine info object.
+    TCamAppEngineInfo info;
+    iSettingsClient->GetInfo( info );
+    
+    // Do comparisons.
+
+    /*
+    TVersion hardwareVersion = TVersion(0,0,0);
+    assertL( ( info.iHardwareVersion.iMajor == hardwareVersion.iMajor ) &&
+             ( info.iHardwareVersion.iMinor == hardwareVersion.iMinor ) &&
+             ( info.iHardwareVersion.iBuild == hardwareVersion.iBuild ) );
+
+    TVersion softwareVersion = TVersion(0,0,0);
+    assertL( ( info.iSoftwareVersion.iMajor == softwareVersion.iMajor ) &&
+             ( info.iSoftwareVersion.iMinor == softwareVersion.iMinor ) &&
+             ( info.iSoftwareVersion.iBuild == softwareVersion.iBuild ) );
+    */
+
+    TCameraInfo::TCameraOrientation orientation = TCameraInfo::EOrientationOutwards;
+    assertL( info.iOrientation == orientation );
+
+    TUint32 optionsSupported = TCameraInfo::EViewFinderBitmapsSupported |
+                               TCameraInfo::EImageCaptureSupported |
+                               TCameraInfo::EVideoCaptureSupported |
+                               TCameraInfo::EViewFinderMirrorSupported;
+
+    assertL( info.iOptionsSupported == optionsSupported );
+    
+    TUint32 flashModesSupported = CCamera::EFlashNone;
+    assertL( info.iFlashModesSupported == flashModesSupported );
+
+    TUint32 exposureModesSupported = CCamera::EExposureAuto |
+    								 CCamera::EExposureNight; 
+    assertL( info.iExposureModesSupported == exposureModesSupported );
+    
+    TUint32 whiteBalanceModesSupported = CCamera::EWBAuto;
+    assertL( info.iWhiteBalanceModesSupported == whiteBalanceModesSupported );
+
+    TInt minzoom = 0;
+    assertL( info.iMinZoom == minzoom );
+
+    TInt maxZoom = 0;
+    assertL( info.iMaxZoom == maxZoom );
+
+    TInt maxDigitalZoom = 52;
+    assertL( info.iMaxDigitalZoom == maxDigitalZoom );
+    
+    TReal32 minZoomFactor = 0.0;
+    assertL( info.iMinZoomFactor == minZoomFactor );
+
+    TReal32 maxZoomFactor = 0.0;
+    assertL( info.iMaxZoomFactor == maxZoomFactor );
+
+    TReal32 maxDigitalZoomFactor = 6.0;
+    assertL( info.iMaxDigitalZoomFactor == maxDigitalZoomFactor );
+
+    TInt numImageSizesSupported = 3;
+    assertL( info.iNumImageSizesSupported == numImageSizesSupported );
+
+    TUint32 imageFormatsSupported = CCamera::EFormatFbsBitmapColor4K |
+                                    CCamera::EFormatFbsBitmapColor64K |
+                                    CCamera::EFormatFbsBitmapColor16M |
+                                    CCamera::EFormatExif;
+    assertL( info.iImageFormatsSupported == imageFormatsSupported );
+
+    TInt numStillQualityLevelsSupported = 3;
+    assertL( info.iNumStillQualityLevelsSupported == numStillQualityLevelsSupported );
+
+    TInt numVideoQualityLevelsSupported = 3;
+    assertL( info.iNumVideoQualityLevelsSupported == numVideoQualityLevelsSupported );
+
+    }
+
+
+void CCaeTestRelease::TestGetInfoPROD7Unagi2ML()
+    {
+    // Group:   Settings
+    //
+    // ID:      CAE.GEN.GETINFO.007
+    // 
+    // Action : Call GetInfo. Engine initialized
+    //          ** For PROD7 Unagi 2M **
+    //      
+    // Output : OK.   
+    
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetInfo );
+    
+    // Get Camera Application Engine info object.
+    TCamAppEngineInfo info;
+    iSettingsClient->GetInfo( info );
+    
+    // Do comparisons.
+
+    /*
+    TVersion hardwareVersion = TVersion(0,0,0);
+    assertL( ( info.iHardwareVersion.iMajor == hardwareVersion.iMajor ) &&
+             ( info.iHardwareVersion.iMinor == hardwareVersion.iMinor ) &&
+             ( info.iHardwareVersion.iBuild == hardwareVersion.iBuild ) );
+
+    TVersion softwareVersion = TVersion(0,0,0);
+    assertL( ( info.iSoftwareVersion.iMajor == softwareVersion.iMajor ) &&
+             ( info.iSoftwareVersion.iMinor == softwareVersion.iMinor ) &&
+             ( info.iSoftwareVersion.iBuild == softwareVersion.iBuild ) );
+    */
+
+    TCameraInfo::TCameraOrientation orientation = TCameraInfo::EOrientationOutwards;
+    assertL( info.iOrientation == orientation );
+
+    TUint32 optionsSupported = TCameraInfo::EViewFinderBitmapsSupported |
+                               TCameraInfo::EImageCaptureSupported |
+                               TCameraInfo::EVideoCaptureSupported |
+                               TCameraInfo::EViewFinderMirrorSupported;
+                               //TCameraInfo::EContrastSupported |
+                               //TCameraInfo::EBrightnessSupported;
+    assertL( info.iOptionsSupported == optionsSupported );
+    
+    TUint32 flashModesSupported = CCamera::EFlashNone | 
+                                  CCamera::EFlashAuto |
+                                  CCamera::EFlashForced |
+                                  CCamera::EFlashRedEyeReduce;
+    assertL( info.iFlashModesSupported == flashModesSupported );
+
+    TUint32 exposureModesSupported = CCamera::EExposureAuto | 
+                                     CCamera::EExposureNight |
+                                     CCamera::EExposureCenter |
+                                     CCamera::EExposureBacklight |
+                                     CCamera::EExposureSport;
+    assertL( info.iExposureModesSupported == exposureModesSupported );
+    
+    TUint32 whiteBalanceModesSupported = CCamera::EWBAuto |
+                                         CCamera::EWBDaylight |
+                                         CCamera::EWBCloudy |
+                                         CCamera::EWBTungsten |
+                                         CCamera::EWBFluorescent;
+    assertL( info.iWhiteBalanceModesSupported == whiteBalanceModesSupported );
+
+    TInt minzoom = 0;
+    assertL( info.iMinZoom == minzoom );
+
+    TInt maxZoom = 0;
+    assertL( info.iMaxZoom == maxZoom );
+
+    TInt maxDigitalZoom = 71;
+    assertL( info.iMaxDigitalZoom == maxDigitalZoom );
+    
+    TReal32 minZoomFactor = 0.0;
+    assertL( info.iMinZoomFactor == minZoomFactor );
+
+    TReal32 maxZoomFactor = 0.0;
+    assertL( info.iMaxZoomFactor == maxZoomFactor );
+
+    TReal32 maxDigitalZoomFactor = 20.0;
+    assertL( info.iMaxDigitalZoomFactor == maxDigitalZoomFactor );
+
+    TInt numImageSizesSupported = 4;
+    assertL( info.iNumImageSizesSupported == numImageSizesSupported );
+
+    TUint32 imageFormatsSupported = CCamera::EFormatFbsBitmapColor4K |
+                                    CCamera::EFormatFbsBitmapColor64K |
+                                    CCamera::EFormatFbsBitmapColor16M |
+                                    CCamera::EFormatExif;
+    assertL( info.iImageFormatsSupported == imageFormatsSupported );
+
+    TInt numStillQualityLevelsSupported = 3;
+    assertL( info.iNumStillQualityLevelsSupported == numStillQualityLevelsSupported );
+
+    TInt numVideoQualityLevelsSupported = 3;
+    assertL( info.iNumVideoQualityLevelsSupported == numVideoQualityLevelsSupported );
+
+    }
+
+
+
+void CCaeTestRelease::TestGetInfoPROD8MirageXL()
+
+    {
+
+    // Group:   Settings
+    //
+    // ID:      CAE.GEN.GETINFO.008
+    // 
+    // Action : Call GetInfo. Engine initialized
+    //          ** For PROD8 Mirage X**
+    //      
+    // Output : OK.   
+    
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetInfo );   
+
+    // Get Camera Application Engine info object.
+    TCamAppEngineInfo info;
+    iSettingsClient->GetInfo( info );  
+
+    // Do comparisons.
+
+    /*
+    TVersion hardwareVersion = TVersion(0,0,0);
+    assertL( ( info.iHardwareVersion.iMajor == hardwareVersion.iMajor ) &&
+             ( info.iHardwareVersion.iMinor == hardwareVersion.iMinor ) &&
+             ( info.iHardwareVersion.iBuild == hardwareVersion.iBuild ) );
+
+    TVersion softwareVersion = TVersion(0,0,0);
+    assertL( ( info.iSoftwareVersion.iMajor == softwareVersion.iMajor ) &&
+             ( info.iSoftwareVersion.iMinor == softwareVersion.iMinor ) &&
+             ( info.iSoftwareVersion.iBuild == softwareVersion.iBuild ) );
+    */
+
+    TCameraInfo::TCameraOrientation orientation = TCameraInfo::EOrientationOutwards;
+    assertL( info.iOrientation == orientation );
+
+    TUint32 optionsSupported = TCameraInfo::EViewFinderBitmapsSupported |
+                               TCameraInfo::EImageCaptureSupported |
+                               TCameraInfo::EVideoCaptureSupported;                               
+    assertL( info.iOptionsSupported == optionsSupported );
+  
+    TUint32 flashModesSupported = CCamera::EFlashNone;
+    assertL( info.iFlashModesSupported == flashModesSupported );
+
+    TUint32 exposureModesSupported = CCamera::EExposureAuto |
+    								 CCamera::EExposureNight |
+    								 CCamera::EExposureSport |
+                                     CCamera::EExposureCenter;
+                                     
+    assertL( info.iExposureModesSupported == exposureModesSupported );
+
+    TUint32 whiteBalanceModesSupported = CCamera::EWBAuto |
+                                         CCamera::EWBDaylight |
+                                         CCamera::EWBCloudy |
+                                         CCamera::EWBTungsten |
+                                         CCamera::EWBFluorescent;
+
+    assertL( info.iWhiteBalanceModesSupported == whiteBalanceModesSupported );
+
+    TInt minzoom = 0;
+    assertL( info.iMinZoom == minzoom );
+
+    TInt maxZoom = 0;
+    assertL( info.iMaxZoom == maxZoom );
+
+    TInt maxDigitalZoom = 71;
+    assertL( info.iMaxDigitalZoom == maxDigitalZoom );
+
+    TReal32 minZoomFactor = 0.0;
+    assertL( info.iMinZoomFactor == minZoomFactor );
+
+    TReal32 maxZoomFactor = 0.0;
+    assertL( info.iMaxZoomFactor == maxZoomFactor );
+
+    TReal32 maxDigitalZoomFactor = 20.0;
+    assertL( info.iMaxDigitalZoomFactor == maxDigitalZoomFactor );
+
+    TInt numImageSizesSupported = 5;
+    assertL( info.iNumImageSizesSupported == numImageSizesSupported );
+
+    TUint32 imageFormatsSupported = CCamera::EFormatFbsBitmapColor4K |
+                                    CCamera::EFormatFbsBitmapColor64K |
+                                    CCamera::EFormatFbsBitmapColor16M |
+                                    CCamera::EFormatExif;
+
+    assertL( info.iImageFormatsSupported == imageFormatsSupported );
+
+    TInt numStillQualityLevelsSupported = 3;
+    assertL( info.iNumStillQualityLevelsSupported == numStillQualityLevelsSupported );
+
+    TInt numVideoQualityLevelsSupported = 3;
+    assertL( info.iNumVideoQualityLevelsSupported == numVideoQualityLevelsSupported );
+
+    }
+    
+
+void CCaeTestRelease::TestGetInfoPROD9HWL()
+
+    {
+
+    // Group:   Settings
+    //
+    // ID:      CAE.GEN.GETINFO.009
+    // 
+    // Action : Call GetInfo. Engine initialized
+    //          ** For PROD9 HW **
+    //      
+    // Output : OK.   
+    
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetInfo );   
+
+    // Get Camera Application Engine info object.
+    TCamAppEngineInfo info;
+    iSettingsClient->GetInfo( info );  
+
+    // Do comparisons.
+
+    /*
+    TVersion hardwareVersion = TVersion(0,0,0);
+    assertL( ( info.iHardwareVersion.iMajor == hardwareVersion.iMajor ) &&
+             ( info.iHardwareVersion.iMinor == hardwareVersion.iMinor ) &&
+             ( info.iHardwareVersion.iBuild == hardwareVersion.iBuild ) );
+
+    TVersion softwareVersion = TVersion(0,0,0);
+    assertL( ( info.iSoftwareVersion.iMajor == softwareVersion.iMajor ) &&
+             ( info.iSoftwareVersion.iMinor == softwareVersion.iMinor ) &&
+             ( info.iSoftwareVersion.iBuild == softwareVersion.iBuild ) );
+    */
+
+    TCameraInfo::TCameraOrientation orientation = TCameraInfo::EOrientationOutwards;
+    assertL( info.iOrientation == orientation );
+
+    TUint32 optionsSupported = TCameraInfo::EViewFinderBitmapsSupported |
+                               TCameraInfo::EImageCaptureSupported |
+                               TCameraInfo::EVideoCaptureSupported;                               
+    assertL( info.iOptionsSupported == optionsSupported );
+  
+    TUint32 flashModesSupported =           CCamera::EFlashAuto     |
+                                            CCamera::EFlashForced   |
+                                            CCamera::EFlashRedEyeReduce;
+    assertL( info.iFlashModesSupported == flashModesSupported );
+
+    TUint32 exposureModesSupported = CCamera::EExposureAuto |
+    								 CCamera::EExposureNight |
+    								 CCamera::EExposureBacklight |
+                                     CCamera::EExposureCenter |
+                                     CCamera::EExposureSuperNight;
+                                     
+    RDebug::Print(_L("info.iExposureModesSupported = 0x%x / 0x%x"), info.iExposureModesSupported, exposureModesSupported);
+    assertL( info.iExposureModesSupported == exposureModesSupported );
+
+    TUint32 whiteBalanceModesSupported = CCamera::EWBAuto |
+                                         CCamera::EWBDaylight |
+                                         CCamera::EWBTungsten |
+                                         CCamera::EWBFluorescent;
+
+    assertL( info.iWhiteBalanceModesSupported == whiteBalanceModesSupported );
+
+    TInt minzoom = 0;
+    assertL( info.iMinZoom == minzoom );
+
+    TInt maxZoom = 0;
+    assertL( info.iMaxZoom == maxZoom );
+
+    TInt maxDigitalZoom = 40;
+    assertL( info.iMaxDigitalZoom == maxDigitalZoom );
+
+    TReal32 minZoomFactor = 0.0;
+    assertL( info.iMinZoomFactor == minZoomFactor );
+
+    TReal32 maxZoomFactor = 0.0;
+    assertL( info.iMaxZoomFactor == maxZoomFactor );
+
+    TReal32 maxDigitalZoomFactor = 4.0;
+    assertL( info.iMaxDigitalZoomFactor == maxDigitalZoomFactor );
+
+#if ( defined (__WINS__) || defined (__WINSCW) ) // this different on hw
+    TInt numImageSizesSupported = 3;
+#else
+    TInt numImageSizesSupported = 4;
+#endif
+    RDebug::Print(_L("info.iNumImageSizesSupported = %d"), info.iNumImageSizesSupported);
+
+    assertL( info.iNumImageSizesSupported == numImageSizesSupported );
+
+    TUint32 imageFormatsSupported = CCamera::EFormatFbsBitmapColor4K |
+                                    CCamera::EFormatFbsBitmapColor64K |
+                                    CCamera::EFormatFbsBitmapColor16M |
+                                    CCamera::EFormatExif;
+
+    assertL( info.iImageFormatsSupported == imageFormatsSupported );
+
+    TInt numStillQualityLevelsSupported = 3;
+    assertL( info.iNumStillQualityLevelsSupported == numStillQualityLevelsSupported );
+
+    TInt numVideoQualityLevelsSupported = 3;
+    assertL( info.iNumVideoQualityLevelsSupported == numVideoQualityLevelsSupported );
+
+    }
+    
+
+void CCaeTestRelease::TestGetInfoDevlonHWL()
+    {
+
+    // Group:   Settings
+    //
+    // ID:      CAE.GEN.GETINFO.010
+    // 
+    // Action : Call GetInfo. Engine initialized
+    //          ** For Devlon HW **
+    //      
+    // Output : OK. Note only interfaces are tested, not the content itself anymore
+    
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetInfo );   
+
+    // Get Camera Application Engine info object.
+    TCamAppEngineInfo info;
+    iSettingsClient->GetInfo( info );  
+
+//    TCameraInfo::TCameraOrientation orientation = TCameraInfo::EOrientationOutwards;
+//    assertL( info.iOrientation == orientation );
+    RDebug::Print(_L("info.iOrientation = 0x%x"), info.iOrientation);
+
+//    TUint32 optionsSupported = TCameraInfo::EViewFinderBitmapsSupported |
+//                               TCameraInfo::EImageCaptureSupported |
+//                               TCameraInfo::EVideoCaptureSupported;                               
+//    assertL( info.iOptionsSupported == optionsSupported );
+    RDebug::Print(_L("info.iOptionsSupported = 0x%x"), info.iOptionsSupported);
+  
+//    TUint32 flashModesSupported =           CCamera::EFlashAuto     |
+//                                            CCamera::EFlashForced   |
+//                                            CCamera::EFlashRedEyeReduce;
+//    assertL( info.iFlashModesSupported == flashModesSupported );
+    RDebug::Print(_L("info.iFlashModesSupported = 0x%x"), info.iFlashModesSupported);
+
+//    TUint32 exposureModesSupported = CCamera::EExposureAuto |
+//    								 CCamera::EExposureNight |
+//    								 CCamera::EExposureBacklight |
+//                                     CCamera::EExposureCenter;
+                                     
+//    assertL( info.iExposureModesSupported == exposureModesSupported );
+    RDebug::Print(_L("info.iExposureModesSupported = 0x%x"), info.iExposureModesSupported);
+
+//    TUint32 whiteBalanceModesSupported = CCamera::EWBAuto |
+//                                         CCamera::EWBDaylight |
+//                                         CCamera::EWBTungsten |
+//                                         CCamera::EWBFluorescent;
+
+//    assertL( info.iWhiteBalanceModesSupported == whiteBalanceModesSupported );
+    RDebug::Print(_L("info.iWhiteBalanceModesSupported = 0x%x"), info.iWhiteBalanceModesSupported);
+
+//    TInt minzoom = 0;
+//    assertL( info.iMinZoom == minzoom );
+    RDebug::Print(_L("info.iMinZoom = 0x%x"), info.iMinZoom);
+
+//    TInt maxZoom = 0;
+//    assertL( info.iMaxZoom == maxZoom );
+    RDebug::Print(_L("info.iMaxZoom = 0x%x"), info.iMaxZoom);
+
+//    TInt maxDigitalZoom = 40;
+//    assertL( info.iMaxDigitalZoom == maxDigitalZoom );
+    RDebug::Print(_L("info.iMaxDigitalZoom = 0x%x"), info.iMaxDigitalZoom);
+
+//    TReal32 minZoomFactor = 0.0;
+//    assertL( info.iMinZoomFactor == minZoomFactor );
+    RDebug::Print(_L("info.minZoomFactor = 0x%x"), info.iMinZoomFactor);
+
+//    TReal32 maxZoomFactor = 0.0;
+//    assertL( info.iMaxZoomFactor == maxZoomFactor );
+    RDebug::Print(_L("info.iMaxZoomFactor = 0x%x"), info.iMaxZoomFactor);
+
+//    TReal32 maxDigitalZoomFactor = 4.0;
+//    assertL( info.iMaxDigitalZoomFactor == maxDigitalZoomFactor );
+    RDebug::Print(_L("info.iMaxDigitalZoomFactor = 0x%x"), info.iMaxDigitalZoomFactor);
+
+//#if ( defined (__WINS__) || defined (__WINSCW) ) // this different on hw
+//    TInt numImageSizesSupported = 3;
+//#else
+//    TInt numImageSizesSupported = 4;
+//#endif
+//    RDebug::Print(_L("info.iNumImageSizesSupported = %d"), info.iNumImageSizesSupported);
+
+//    assertL( info.iNumImageSizesSupported == numImageSizesSupported );
+    RDebug::Print(_L("info.iNumImageSizesSupported = 0x%x"), info.iNumImageSizesSupported);
+
+//    TUint32 imageFormatsSupported = CCamera::EFormatFbsBitmapColor4K |
+//                                    CCamera::EFormatFbsBitmapColor64K |
+//                                    CCamera::EFormatFbsBitmapColor16M |
+//                                    CCamera::EFormatExif;
+
+//    assertL( info.iImageFormatsSupported == imageFormatsSupported );
+    RDebug::Print(_L("info.iImageFormatsSupported = 0x%x"), info.iImageFormatsSupported);
+
+//    TInt numStillQualityLevelsSupported = 3;
+//    assertL( info.iNumStillQualityLevelsSupported == numStillQualityLevelsSupported );
+    RDebug::Print(_L("info.iNumStillQualityLevelsSupported = 0x%x"), info.iNumStillQualityLevelsSupported);
+
+//    TInt numVideoQualityLevelsSupported = 3;
+//    assertL( info.iNumVideoQualityLevelsSupported == numVideoQualityLevelsSupported );
+    RDebug::Print(_L("info.iNumVideoQualityLevelsSupported = 0x%x"), info.iNumVideoQualityLevelsSupported);
+
+    }
+    
+
+/********************************************************/
+/*               RESUME VIDEO RECORDING                 */
+/********************************************************/
+
+void CCaeTestRelease::TestRecordPauseResumeStopL()
+    {
+	// ID:      CAE.VR.RESUMEVIDEORECORDING.001
+    //
+    // Group:   Record.
+    // 
+    // Action : Resume video clip recording after pause. 
+    //          Video recording.
+	//      
+	// Output : No leave. File KVideoFileName, "videoclip.3gp".   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iStatesClient->SetVideoFileName( _L("cae_pause_resume.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareRecordPauseResumeStopVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 2 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*             STILL CAPTURE EXPOSURE MODE              */
+/********************************************************/
+
+void CCaeTestRelease::TestSCExposureMode0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETEXPOSUREMODEL.001
+    //
+    // Action : Test auto exposure mode setting with still image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetExposureMode( 0 ); // auto mode should be supported
+
+    iSettingsClient->SetStillFileName( _L("cae_exposure_mode_0.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenStillPrepared );
+}
+
+void CCaeTestRelease::TestSCExposureMode1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETEXPOSUREMODEL.002
+    //
+    // Action : Test night exposure mode setting with still image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetExposureMode( 1 ); // night mode should be supported
+
+    iSettingsClient->SetStillFileName( _L("cae_exposure_mode_1.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenStillPrepared );
+}
+
+void CCaeTestRelease::TestSCExposureModeInitialized0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETEXPOSUREMODEL.015
+    //
+    // Action : Test auto exposure mode setting with still image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetExposureMode( 0 ); // auto mode should be supported
+
+    iSettingsClient->SetStillFileName( _L("cae_exposure_mode_initialized_0.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenInitialized );
+}
+
+void CCaeTestRelease::TestSCExposureModeInitialized1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETEXPOSUREMODEL.016
+    //
+    // Action : Test night exposure mode setting with still image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetExposureMode( 1 ); // night mode should be supported
+
+    iSettingsClient->SetStillFileName( _L("cae_exposure_mode_initialized_1.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenInitialized );
+}
+
+/********************************************************/
+/*             VIDEO RECORDING EXPOSURE MODE            */
+/********************************************************/
+
+void CCaeTestRelease::TestVRExposureMode0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETEXPOSUREMODEL.008
+    //
+    // Action : Test auto exposure mode setting with video recording and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetTimeout( 4000000 );
+
+    iSettingsClient->SetExposureMode( 0 ); // auto mode should be supported
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_exposure_mode_0.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenVideoPrepared );
+}
+
+void CCaeTestRelease::TestVRExposureMode1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETEXPOSUREMODEL.009
+    //
+    // Action : Test night exposure mode setting with video recording and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetTimeout( 4000000 );
+
+    iSettingsClient->SetExposureMode( 1 ); // night mode should be supported
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_exposure_mode_1.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenVideoPrepared );
+}
+
+void CCaeTestRelease::TestVRExposureModeRecording0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETEXPOSUREMODEL.017
+    //
+    // Action : Test auto exposure mode setting with Video image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetTimeout( 4000000 );
+
+    iSettingsClient->SetExposureMode( 0 ); // auto mode should be supported
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_exposure_mode_recording_0.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenVideoRecording );
+}
+
+void CCaeTestRelease::TestVRExposureModeRecording1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETEXPOSUREMODEL.018
+    //
+    // Action : Test night exposure mode setting with Video image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetTimeout( 4000000 );
+
+    iSettingsClient->SetExposureMode( 1 ); // night mode should be supported
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_exposure_mode_recording_1.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenVideoRecording );
+}
+
+/********************************************************/
+/*             STILL CAPTURE EV COMPENSATION            */
+/********************************************************/
+
+void CCaeTestRelease::TestSCEvCompensation0L()
+{
+	// Group:   Settings
+    //
+    // ID:      CAE.SET-SC.SETEVCOMP.001
+    // 
+    // Action : Test Ev compensation with still image capture and viewfinding.
+	//      
+	// Output : KErrNotSupported.  
+ 
+    iSettingsClient->SetEvCompensation( 0 );
+
+    iSettingsClient->SetSnapFileName( _L("cae_evcomp_0.mbm") );
+
+    iSettingsClient->SetStillFileName( _L("cae_evcomp_0.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenStillPrepared ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+
+	assertL(err == KErrNotSupported);
+}
+
+void CCaeTestRelease::TestSCEvCompensationMaxL()
+{
+	// Group:   Settings
+    //
+    // ID:      CAE.SET-SC.SETEVCOMP.002
+    // 
+    // Action : Test Ev compensation with still image capture and viewfinding.
+	//      
+	// Output : KErrNotSupported.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetEvCompensation( info.iMaxEvCompensation );
+
+    iSettingsClient->SetSnapFileName( _L("cae_evcomp_max.mbm") );
+
+    iSettingsClient->SetStillFileName( _L("cae_evcomp_max.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenStillPrepared ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+
+	assertL(err == KErrNotSupported);
+}
+
+void CCaeTestRelease::TestSCEvCompensationMinL()
+{
+	// Group:   Settings
+    //
+    // ID:      CAE.SET-SC.SETEVCOMP.003
+    // 
+    // Action : Test Ev compensation with still image capture and viewfinding.
+	//      
+	// Output : KErrNotSupported.   
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetEvCompensation( info.iMinEvCompensation );
+
+    iSettingsClient->SetSnapFileName( _L("cae_evcomp_min.mbm") );
+
+    iSettingsClient->SetStillFileName( _L("cae_evcomp_min.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenStillPrepared ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+
+	assertL(err == KErrNotSupported);
+}
+
+
+void CCaeTestRelease::TestSCEvCompensationInitialized0L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETEVCOMP.004
+    //
+    // Action : Test Ev compensation with still image capture and viewfinding.
+	//      
+	// Output : KErrNotSupported.   
+
+    iSettingsClient->SetEvCompensation( 0 );
+
+    iSettingsClient->SetSnapFileName( _L("cae_evcomp_initialized_0.mbm") );
+
+    iSettingsClient->SetStillFileName( _L("cae_evcomp_initialized_0.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenInitialized ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+
+	assertL(err == KErrNotSupported);
+}
+
+void CCaeTestRelease::TestSCEvCompensationInitializedMaxL()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETEVCOMP.005
+    //
+    // Action : Test Ev compensation with still image capture and viewfinding.
+	//      
+	// Output : KErrNotSupported.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetEvCompensation( info.iMaxEvCompensation );
+
+    iSettingsClient->SetSnapFileName( _L("cae_evcomp_initilized_max.mbm") );
+
+    iSettingsClient->SetStillFileName( _L("cae_evcomp_initilized_max.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenInitialized ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+
+	assertL(err == KErrNotSupported);
+}
+
+void CCaeTestRelease::TestSCEvCompensationInitializedMinL()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETEVCOMP.006
+    //
+    // Action : Test Ev compensation with still image capture and viewfinding.
+	//      
+	// Output : KErrNotSupported.   
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetEvCompensation( info.iMinEvCompensation );
+
+    iSettingsClient->SetSnapFileName( _L("cae_evcomp_initialized_min.mbm") );
+
+    iSettingsClient->SetStillFileName( _L("cae_evcomp_initialized_min.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenInitialized ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+
+	assertL(err == KErrNotSupported);
+}
+
+void CCaeTestRelease::TestSCEvCompensationInitializedInvalidL()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETEVCOMP.007
+    //
+    // Action : Test Ev compensation with still image capture and viewfinding.
+	//      
+	// Output : KErrNotSupported.   
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetEvCompensation( info.iMaxEvCompensation + 1 );
+
+    TRAPD( error, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenInitialized ) );
+    if( error == KErrNoMemory )
+        {
+        User::Leave( error ); // For memory test
+        }
+	assertL(error == KErrNotSupported);
+}
+
+
+
+/********************************************************/
+/*             VIDEO RECORDING EV COMPENSATION          */
+/********************************************************/
+
+void CCaeTestRelease::TestVREvCompensationMinL()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETEVCOMP.001
+    //
+    // Action : Test Ev compensation with Video image capture and viewfinding.
+	//      
+	// Output : KErrNotSupported.   
+
+    iSettingsClient->SetTimeout( 4000000 );
+    
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetEvCompensation( info.iMinEvCompensation );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_evcomp_min.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenVideoPrepared ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+
+	assertL(err == KErrNotSupported);
+}
+
+void CCaeTestRelease::TestVREvCompensationRecordingMaxL()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETEVCOMP.002
+    //
+    // Action : Test Ev compensation with Video image capture and viewfinding.
+	//      
+	// Output : KErrNotSupported.   
+
+    iSettingsClient->SetTimeout( 4000000 );
+    
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetEvCompensation( info.iMaxEvCompensation );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_evcomp_recording_max.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenVideoRecording ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+
+	assertL(err == KErrNotSupported);
+}
+
+
+/* UNUSED
+
+void CCaeTestRelease::TestVREvCompensation0L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETEVCOMP.001
+    //
+    // Action : Test Ev compensation with Video image capture and viewfinding.
+	//      
+	// Output : OK.
+
+    iSettingsClient->SetTimeout( 4000000 );
+    
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetEvCompensation( 0 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_evcomp_0.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenVideoPrepared );
+}
+
+void CCaeTestRelease::TestVREvCompensationMaxL()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETEVCOMP.002
+    //
+    // Action : Test Ev compensation with Video image capture and viewfinding.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetTimeout( 4000000 );
+    
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetEvCompensation( info.iMaxEvCompensation );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_evcomp_max.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenVideoPrepared );
+}
+
+void CCaeTestRelease::TestVREvCompensationRecording0L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETEVCOMP.004
+    //
+    // Action : Test Ev compensation with Video image capture and viewfinding.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetTimeout( 4000000 );
+    
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetEvCompensation( 0 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_evcomp_recording_0.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenVideoRecording );
+}
+
+void CCaeTestRelease::TestVREvCompensationRecordingMinL()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETEVCOMP.006
+    //
+    // Action : Test Ev compensation with Video image capture and viewfinding.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetTimeout( 4000000 );
+    
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetEvCompensation( info.iMinEvCompensation );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_evcomp_recording_min.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenVideoRecording );
+}
+
+void CCaeTestRelease::TestVREvCompensationRecordingInvalidL()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETEVCOMP.007
+    //
+    // Action : Test Ev compensation with Video image capture and viewfinding.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetTimeout( 4000000 );
+    
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+    iSettingsClient->SetEvCompensation( info.iMinEvCompensation - 1 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_evcomp_recording_invalid.3gp") );
+    
+    TRAPD( error, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEvCompensationWhenVideoRecording ) );
+	assertL(error == KErrNotSupported);
+}
+
+*/
+
+/********************************************************/
+/*           STILL CAPTURE WHITE BALANCE MODE           */
+/********************************************************/
+
+void CCaeTestRelease::TestSCWhiteBalanceMode0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETWHITEBALANCEMODEL.001
+    //
+    // Action : Test white balance setting with still image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( 0 ); // auto mode should always be supported
+
+    iSettingsClient->SetStillFileName( _L("cae_white_balance_mode_0.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenStillPrepared );
+}
+
+void CCaeTestRelease::TestSCWhiteBalanceModeInitialized0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETWHITEBALANCEMODEL.019
+    //
+    // Action : Test white balance setting with still image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( 0 ); // auto mode should always be supported
+
+    iSettingsClient->SetStillFileName( _L("cae_white_balance_mode_initialized_0.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenInitialized );
+}
+
+/********************************************************/
+/*           VIDEO RECORDING WHITE BALANCE MODE         */
+/********************************************************/
+
+void CCaeTestRelease::TestVRWhiteBalanceMode0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETWHITEBALANCEMODEL.010
+    //
+    // Action : Test white balance setting with video recording and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetTimeout( 4000000 );
+
+    iSettingsClient->SetWhiteBalanceMode( 0 ); // auto mode should always be supported
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_white_balance_mode_0.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenVideoPrepared );
+}
+
+void CCaeTestRelease::TestVRWhiteBalanceModeRecording0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETWHITEBALANCEMODEL.020
+    //
+    // Action : Test white balance setting with Video image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetTimeout( 4000000 );
+
+    iSettingsClient->SetWhiteBalanceMode( 0 ); // auto mode should always be supported
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_white_balance_mode_recording_0.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenVideoRecording );
+}
+
+/********************************************************/
+/*             STILL CAPTURE CONTRAST                   */
+/********************************************************/
+
+void CCaeTestRelease::TestSCContrast50L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETCONTRASTL.001
+    //
+    // Action : Test contrast setting with still image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetContrast( 50 );
+
+    iSettingsClient->SetStillFileName( _L("cae_contrast_50.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenStillPrepared ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestRelease::TestSCContrastInitialized50L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETCONTRASTL.007
+    //
+    // Action : Test contrast setting with still image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetContrast( 50 );
+
+    iSettingsClient->SetStillFileName( _L("cae_contrast_initialized_50.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenInitialized ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+/********************************************************/
+/*             STILL CAPTURE BRIGHTNESS                 */
+/********************************************************/
+
+void CCaeTestRelease::TestSCBrightness50L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETBRIGHTNESSL.001
+    //
+    // Action : Test brightness setting with still image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetBrightness( 50 );
+
+    iSettingsClient->SetStillFileName( _L("cae_brightness_50.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenStillPrepared ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestRelease::TestSCBrightnessInitialized50L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETBRIGHTNESSL.007
+    //
+    // Action : Test brightness setting with still image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetBrightness( 50 );
+
+    iSettingsClient->SetStillFileName( _L("cae_brightness_initialized_50.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenInitialized ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+/********************************************************/
+/*             VIDEO RECORDING CONTRAST                 */
+/********************************************************/
+
+void CCaeTestRelease::TestVRContrast50L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETCONTRASTL.008
+    //
+    // Action : Test contrast setting with video recording and viewfinding.
+	//      
+	// Output : No leave.   
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetTimeout( 4000000 );
+
+    iSettingsClient->SetContrast( 50 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_contrast_50.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenVideoPrepared ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestRelease::TestVRContrastRecording50L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETCONTRASTL.014
+    //
+    // Action : Test contrast setting with Video image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetTimeout( 4000000 );
+
+    iSettingsClient->SetContrast( 50 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_contrast_recording_50.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenVideoRecording ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+/********************************************************/
+/*             VIDEO RECORDING BRIGHTNESS               */
+/********************************************************/
+
+void CCaeTestRelease::TestVRBrightness50L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETBRIGHTNESSL.008
+    //
+    // Action : Test brightness setting with video recording and viewfinding.
+	//      
+	// Output : No leave.   
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetTimeout( 4000000 );
+
+    iSettingsClient->SetBrightness( 50 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_brightness_50.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenVideoPrepared ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestRelease::TestVRBrightnessRecording50L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETBRIGHTNESSL.014
+    //
+    // Action : Test brightness setting with Video image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+ 	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo(info);
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetTimeout( 4000000 );
+
+    iSettingsClient->SetBrightness( 50 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_brightness_recording_50.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenVideoRecording ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+/********************************************************/
+/*             VIDEO RECORDING CLIP MAX SIZE            */
+/********************************************************/
+
+void CCaeTestRelease::TestVideoClipMaxSize10000L()
+    {
+	// Group:   Settings.
+    // 
+    //ID:       CAE.SET-VR.SETVIDEOCLIPMAXSIZEL.002
+    //
+    // Action : Test video clip max size setting with recording.
+	//      
+	// Output : Leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetTimeout( 20000000 );
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoClipMaxSize( 10000 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iSettingsClient->SetVideoFileName( _L("cae_clip_max_size_10000.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetClipMaxSizeWhenVideoPrepared ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+    assertL( err == KErrCompletion );
+    }
+
+/********************************************************/
+/*               CANCEL CAPTURE STILL                   */
+/********************************************************/
+
+void CCaeTestRelease::TestCancelCaptureStillL()
+    {
+	// ID: CAE.SC.CANCELCAPTURESTILL.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Cancel on-going still image capture request, 
+    //          when already prepared.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureAndCancelStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == 0 );
+    }
+
+/********************************************************/
+/*               GET QUALITY INDEX                      */
+/********************************************************/
+
+void CCaeTestRelease::TestGetStillQualityIndexWhenEngineInitializedL()
+    {
+	// ID: CAE.SC.GETSTILLQUALITYINDEX.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Get still quality index, when engine is initialized.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 1 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EGetStillQualityIndexWhenEngineInitialized );
+    }
+
+void CCaeTestRelease::TestGetStillQualityIndexWhenPreparedL()
+    {
+	// ID: CAE.SC.GETSTILLQUALITYINDEX.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Get still quality index, when still image capture is prepared.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 1 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EGetStillQualityIndexWhenPrepared );
+    }
+
+void CCaeTestRelease::TestGetVideoQualityIndexWhenEngineInitializedL()
+{
+	// Group:   Video.
+    // 
+    // ID:      CAE.VR.GETVIDEOQUALITYINDEX.001
+    //
+    // Action : Get video quality index, when engine is initialized.
+	//      
+	// Output : No leave.   
+
+    iStatesClient->SetTimeout( 1000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 1 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EGetVideoQualityIndexWhenEngineInitialized );
+}
+
+void CCaeTestRelease::TestGetVideoQualityIndexWhenPreparedL()
+{
+	// Group:   Video.
+    // 
+    // ID:      CAE.VR.GETVIDEOQUALITYINDEX.002
+    //
+    // Action : Get video quality index, when video recording is prepared.
+	//      
+	// Output : No leave.   
+
+    iStatesClient->SetTimeout( 1000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EGetVideoQualityIndexWhenPrepared );
+}
+
+/********************************************************/
+/*            REMAINING VIDEO RECORDING TIME            */
+/********************************************************/
+
+void CCaeTestRelease::TestRemainingTimeWhenVideoPreparedL()
+{
+	// Group:   Video.
+    // 
+    // ID:      CAE.VR.REMAININGVIDEORECORDINGTIME.001
+    //
+    // Action : Get RemainingVideoRecordingTime, when video recording is prepared.
+	//      
+	// Output : No leave.   
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERemainingTimeWhenVideoPrepared );
+}
+
+/********************************************************/
+/*      PREPARE AUDIO BIT RATE AND RECORD VIDEO         */
+/********************************************************/
+
+void CCaeTestRelease::TestPrepareAudioBitRateVR5000L()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.001
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    iStatesClient->SetAudioBitRate( TInt( 5000 ) );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_5000.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+/************************************************************************/
+/*   STILL AND STILL BURST CAPTURE - snap-image creation switched off   */
+/************************************************************************/
+
+void CCaeTestRelease::TestCaptureVga16M_NoSnapL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.VGA16M.015
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing and capture VGA 16M  
+    //          image when initialization is done. 
+    //          Snap image creation switched off.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetSnapImageCreation( EFalse );
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    // iStatesClient->SetStillFileName( _L("cae_vga16M_NoSnap.mbm") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureQualityLevel0_NoSnapL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.JPEGVGA90.016
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture quality level 0 
+    //          image when initialization is done and viewfinder is running.
+    //          Snap image creation switched off.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetSnapImageCreation( EFalse );
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    // iStatesClient->SetStillFileName( _L("cae_ql_0_vga90_NoSnap.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareCaptureStillStartAndStopVf );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureVgaExif_NoSnapL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.VGA.EXIF.017
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture Vga Exif 
+    //          image when initialization is done and viewfinder is running.
+    //          Snap image creation switched off.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetSnapImageCreation( EFalse );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    // iStatesClient->SetStillFileName( _L("cae_vga_exif_NoSnap.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareCaptureStillStartAndStopVfExif );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureStillBurst3_NoSnapL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.3.007
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          images in a burst when initialization is done.
+    //          Snap image creation switched off.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetSnapImageCreation( EFalse );
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    // iStatesClient->SetStillFileName( _L("cae_vga16M_burst3_NoSnap.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurst );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+
+void CCaeTestRelease::TestSpecPrepCaptureStillBurst3_NoSnapL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.3.008
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          images in a burst when initialization is done.
+    //          Preparation is done using explicitly specified image format parameters.
+    //          Snap image creation switched off.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetSnapImageCreation( EFalse );
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizevga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizevga );
+
+    // iStatesClient->SetStillFileName( _L("cae_qqvga16M_spburst3_NoSnap.mbm") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecPrepAndCaptureStillBurst );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+
+void CCaeTestRelease::TestCaptureStillBurstExif3_NoSnapL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTEXIF.3.004
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          VGA Exif images in a burst when initialization is done.
+    //          Snap image creation switched off.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetSnapImageCreation( EFalse );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    // iStatesClient->SetStillFileName( _L("cae_burst3_exif_NoSnap.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurstExif );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
+
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+
+void CCaeTestRelease::TestEnumerateCaptureSizesL()
+    {
+	// ID: CAE.GEN.ENUMERATE.001
+    //
+    // Group:   General
+    // 
+    // Action : Test to enumerate still capture sizes. Tests the largest image size only.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+#if (MIRAGE_X_PROD1)
+    TSize sizeMp1( KImgWidthMP1, KImgHeightMP1 );
+    iStatesClient->SetStillFrameSize( sizeMp1 );
+#elif (MIRAGE_X_PROD2) || (MIRAGE_X_PROD4) || (MIRAGE_X_PROD3)
+    TSize sizeMp1M3( KImgWidthMP1M3, KImgHeightMP1M3 );
+    iStatesClient->SetStillFrameSize( sizeMp1M3 );
+#elif (MIRAGE_X_PROD7)
+    TSize sizeMp2( KImgWidthMP2, KImgHeightMP2 );
+    iStatesClient->SetStillFrameSize( sizeMp2 );
+#elif (MIRAGE_X_PROD6) || (MIRAGE_X_PROD8) || (MIRAGE_X_PROD9)
+    TSize sizeMp2( KImgWidthMP2, KImgHeightMP2 );
+    iStatesClient->SetStillFrameSize( sizeMp2 );
+#elif (HW_DEVLON)
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+    TSize sizeMp3( KImgWidthMP3, KImgHeightMP3 );
+    iStatesClient->SetStillFrameSize( sizeMp3 );
+#else
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+    iStatesClient->SetStillFrameSize( sizeVga ); 
+#endif
+
+		// ignore errors if correct resolution was not found
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::EEnumerateCaptureSizes ) );
+
+		if ( err )
+        {
+        RDebug::Print(_L("CCaeTestRelease::TestEnumerateCaptureSizesL() failed = %d, ignored"), err);
+        }
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 0 );
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == 0 );
+    }
+
+
+void CCaeTestRelease::TestSetJpegQuality50L()
+    {
+	// ID: CAE.SET-SC.SETJPEGQUALITY.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture quality level 0 
+    //          image when initialization is done and viewfinder is running.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetStillFormat( CCamera::EFormatJpeg );
+
+    iSettingsClient->SetStillCompressionQuality( 50 );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iSettingsClient->SetStillFrameSize( sizeVga );
+
+    // iSettingsClient->SetStillFileName( _L("cae_jpeg_quality_setting_50.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestStatesClient::ESetJpegQualityWhenStillPrepared );
+    
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountStillPrepareComplete() == 1 );
+    assertL( iSettingsClient->CountSnapImageReady() == 1 );
+    assertL( iSettingsClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestRelease::TestSCCustomInterfaceL()
+    {
+	// ID: CAE.GEN.CUSTOMINTERFACE.001
+    //
+    // Group:   General
+    // 
+    // Action : Test custom interface with illegal UID values -1, 0 and 1.
+	//      
+	// Output : Returns 0 with illegal UID values.   
+
+    TUid interfaceUid;
+
+    interfaceUid.iUid = -1;
+    iStatesClient->SetCustomInterfaceUid( interfaceUid );
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EGetCustomInterface );
+    assertL( iStatesClient->CustomInterfacePointer() == 0 );
+
+    interfaceUid.iUid = 0;
+    iStatesClient->SetCustomInterfaceUid( interfaceUid );
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EGetCustomInterface );
+    assertL( iStatesClient->CustomInterfacePointer() == 0 );
+
+    interfaceUid.iUid = 1;
+    iStatesClient->SetCustomInterfaceUid( interfaceUid );
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EGetCustomInterface );
+    assertL( iStatesClient->CustomInterfacePointer() == 0 );
+    }
+
+/******************************/
+/*        FLASH MODE          */
+/******************************/
+
+void CCaeTestRelease::TestFlashMode0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETFLASHMODEL.001
+    //
+    // Action : Test flash mode setting with still image capture and viewfinding.
+	//      
+	// Output : No leave.   
+
+	const TInt KSetVal = 0;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_flash_mode_0.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenStillPrepared );
+}
+
+void CCaeTestRelease::TestFlashMode1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETFLASHMODEL.002
+    //
+    // Action : Test flash mode setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 1;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_flash_mode_1.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenStillPrepared ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+	if ( KSetVal & info.iFlashModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestRelease::TestFlashMode2L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETFLASHMODEL.003
+    //
+    // Action : Test flash mode setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 2;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_flash_mode_2.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenStillPrepared ) );
+    if( err == KErrNoMemory )
+        {
+        User::Leave( err ); // For memory test
+        }
+	if ( KSetVal & info.iFlashModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestRelease::TestSCColorToneNormalL()
+    {
+	// ID: CAE.SET-SC.COLORTONE.001
+    //
+    // Group:   General
+    // 
+    // Action : Test Color Tone interface with ENormal parameter.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetColorToneValue( MCameraColorToneSettings::ENormal );
+    iStatesClient->SetCustomInterfaceUid( KCameraColorToneSettingsUid );
+    iStatesClient->SetSnapFileName( _L("cae_snap_colortone_normal1.mbm") );
+    iStatesClient->SetStillFileName( _L("cae_colortone_normal.jpg") );
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESetColorTone );
+    assertL( iStatesClient->CustomInterfacePointer() != 0 );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestRelease::TestSCColorToneSepiaL()
+    {
+	// ID: CAE.SET-SC.COLORTONE.002
+    //
+    // Group:   General
+    // 
+    // Action : Test Color Tone interface with ESepia parameter.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetColorToneValue( MCameraColorToneSettings::ESepia );
+    iStatesClient->SetCustomInterfaceUid( KCameraColorToneSettingsUid );
+    iStatesClient->SetSnapFileName( _L("cae_snap_colortone_sepia.mbm") );
+    iStatesClient->SetStillFileName( _L("cae_colortone_sepia.jpg") );
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESetColorTone );
+    assertL( iStatesClient->CustomInterfacePointer() != 0 );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestRelease::TestSCColorToneGrayscaleL()
+    {
+	// ID: CAE.SET-SC.COLORTONE.003
+    //
+    // Group:   General
+    // 
+    // Action : Test Color Tone interface with EGrayscale parameter.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetColorToneValue( MCameraColorToneSettings::EGrayscale );
+    iStatesClient->SetCustomInterfaceUid( KCameraColorToneSettingsUid );
+    iStatesClient->SetSnapFileName( _L("cae_snap_colortone_grayscale.mbm") );
+    iStatesClient->SetStillFileName( _L("cae_colortone_grayscale.jpg") );
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESetColorTone );
+    assertL( iStatesClient->CustomInterfacePointer() != 0 );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestRelease::TestSCColorToneNegativeL()
+    {
+	// ID: CAE.SET-SC.COLORTONE.004
+    //
+    // Group:   General
+    // 
+    // Action : Test Color Tone interface with ENegative parameter.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetColorToneValue( MCameraColorToneSettings::ENegative );
+    iStatesClient->SetCustomInterfaceUid( KCameraColorToneSettingsUid );
+    iStatesClient->SetSnapFileName( _L("cae_snap_colortone_negative.mbm") );
+    iStatesClient->SetStillFileName( _L("cae_colortone_negative.jpg") );
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESetColorTone );
+    assertL( iStatesClient->CustomInterfacePointer() != 0 );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestRelease::TestVRColorToneL()
+    {
+	// ID: CAE.SET-VR.COLORTONE.005
+    //
+    // Group:   General
+    // 
+    // Action : Test Color Tone interface with video recording. Test case will start video recording
+    //          and then sets every supported color tone with 5 second interval. Total execution time is 
+    //          then with 4 color tones 20 seconds. Test case will report interface failures. Color tone 
+    //          fuctionality must be checked manually from .3gp file.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+#if (MIRAGE_X_PROD3)
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+#else
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+#endif
+
+    iStatesClient->SetVideoFileName( _L("cae_colortone.3gp") );
+    iStatesClient->SetTimeout( 5000000 ); // time for one color, then change
+    
+    // this walue is set before exiting
+    iStatesClient->SetColorToneValue( MCameraColorToneSettings::ENormal );
+    iStatesClient->SetCustomInterfaceUid( KCameraColorToneSettingsUid );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESetColorToneVideoRecording );
+
+    assertL( iStatesClient->CustomInterfacePointer() != 0 );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestSCColorToneWrongParams1L()
+    {
+	// ID: CAE.SET-SC.COLORTONE.006
+    //
+    // Group:   General
+    // 
+    // Action : Test Color Tone interface with illegal Color Tone parameter 2^31.
+    //          Should leave with code KErrNotSupported.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetColorToneValue( (MCameraColorToneSettings::TColorTone) 0x80000000 );
+    iStatesClient->SetCustomInterfaceUid( KCameraColorToneSettingsUid );
+    iStatesClient->SetSnapFileName( _L("cae_snap_colortone_wrong_params.mbm") );
+    iStatesClient->SetStillFileName( _L("cae_colortone_wrong_params.jpg") );
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESetColorToneWrongParams ) );
+    if( error == KErrNoMemory )
+        {
+        User::Leave( error ); // For memory test
+        }
+    assertL( error == KErrNotSupported );
+    }
+
+void CCaeTestRelease::TestSCColorToneWrongParams2L()
+    {
+	// ID: CAE.SET-SC.COLORTONE.007
+    //
+    // Group:   General
+    // 
+    // Action : Test Color Tone interface with illegal Color Tone parameter 0x07.
+    //          Should leave with code KErrArgument.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetColorToneValue( (MCameraColorToneSettings::TColorTone) 0x07 );
+    iStatesClient->SetCustomInterfaceUid( KCameraColorToneSettingsUid );
+    iStatesClient->SetSnapFileName( _L("cae_snap_colortone_wrong_params.mbm") );
+    iStatesClient->SetStillFileName( _L("cae_colortone_wrong_params.jpg") );
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESetColorToneWrongParams ) );
+    if( error == KErrNoMemory )
+        {
+        User::Leave( error ); // For memory test
+        }
+    assertL( error == KErrArgument );
+    }
+
+void CCaeTestRelease::TestSCColorToneReleaseL()
+    {
+	// ID: CAE.SET-SC.COLORTONE.008
+    //
+    // Group:   General
+    // 
+    // Action : Test Color Tone interface with ENegative parameter when
+    //          Release() and Reserve() has been used. After Reserve() the default 
+    //          values should be set (ENormal) by CameraAPI
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetColorToneValue( MCameraColorToneSettings::ENegative );
+    iStatesClient->SetCustomInterfaceUid( KCameraColorToneSettingsUid );
+    iStatesClient->SetSnapFileName( _L("cae_snap_colortone_release.mbm") );
+    iStatesClient->SetStillFileName( _L("cae_colortone_release.jpg") );
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESetColorToneRelease );
+    assertL( iStatesClient->CustomInterfacePointer() != 0 );
+    assertL( iStatesClient->CountInitComplete() == 2 ); // reserve() calls once McaeoInitComplete
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+/********************************************************/
+/*           DISPLAY INDEX                              */
+/********************************************************/
+
+void CCaeTestRelease::TestSetDisplayIndexL()
+    {
+	// ID: CAE.SC.SETDISPLAYINDEX.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Set display index to 1 and capture a still image.
+	//      
+	// Output : No errors. Snap image should be enhanced.  
+
+    iStatesClient->SetDisplayIndex( 1 );
+    iStatesClient->SetSnapFileName( _L("cae_snap_disp_index_1.mbm") );
+    //iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill );
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESetDisplayIndex );
+    }
+
+/********************************************************/
+/*             VIDEO RECORDING ENUMERATE FRAME SIZES    */
+/********************************************************/
+
+void CCaeTestRelease::TestEnumerateVideoFrameSize001L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.ENUMERATEVIDEOFRAMESIZE.001
+    //
+    // Action : Test that enumerate can be called with correct and incorrect frame sizes
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EEnumerateVideoFrameSize );
+}
+
+
+/********************************************************/
+/*             Extension mode test cases                */
+/********************************************************/
+
+void CCaeTestRelease::TestProcessExtViewFinderFrameReadyL()
+{
+	// Group:   still capture/extension mode.
+    // 
+    // ID:      CAE.SC.ProcessExtViewFinderFrameReadyL.001
+    //
+    // Action : Test extension mode ProcessExtViewFinderFrameReadyL normal operation
+	//      
+	// Output : No leave.   
+
+    TSize sizeQqvga( KImgWidthQQVGA, KImgHeightQQVGA );
+    iSettingsClient->SetViewFinderSize( sizeQqvga );
+	iSettingsClient->SetRunningWithViewFinder( ETrue );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EProcessExtViewFinderFrameReady );
+}
+
+void CCaeTestRelease::TestProcessExtSnapImageL()
+{
+	// Group:   still capture/extension mode.
+    // 
+    // ID:      CAE.SC.ProcessExtSnapImageL.001
+    //
+    // Action : Test extension mode ProcessExtSnapImageL normal operation
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EProcessExtSnapImage );
+}
+
+void CCaeTestRelease::TestProcessExtCapturedImageL()
+{
+	// Group:   still capture/extension mode.
+    // 
+    // ID:      CAE.SC.ProcessExtCapturedImageL.001
+    //
+    // Action : Test extension mode ProcessExtCapturedImageL normal operation with HBufC8 param 
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EProcessExtCapturedImage );
+}
+
+
+void CCaeTestRelease::TestProcessExtCapturedImage2L()
+{
+	// Group:   still capture/extension mode.
+    // 
+    // ID:      CAE.SC.ProcessExtCapturedImageL.002
+    //
+    // Action : Test extension mode ProcessExtCapturedImageL normal operation with TDesC8 param
+    //          Test that Relese() can be called
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EProcessExtCapturedImageTDesC8 );
+}
+
+void CCaeTestRelease::TestProcessExtCapturedImage3L()
+{
+	// Group:   still capture/extension mode.
+    // 
+    // ID:      CAE.SC.ProcessExtCapturedImageL.003
+    //
+    // Action : Test extension mode ProcessExtCapturedImageL normal operation with CFbsBitmap param
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EProcessExtCapturedImageCFbsBitmap );
+}
+
+void CCaeTestRelease::TestProcessExtCapturedImage4L()
+{
+	// Group:   still capture/extension mode.
+    // 
+    // ID:      CAE.SC.ProcessExtCapturedImageL.004
+    //
+    // Action : Test extension mode ProcessExtCapturedImageL normal operation with HBufC8 param 
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EProcessExtCapturedImageNoInit );
+}
+
+void CCaeTestRelease::TestProcessExtCancelL()
+{
+	// Group:   still capture/extension mode.
+    // 
+    // ID:      CAE.SC.ProcessExtCancel.001
+    //
+    // Action : Test extension mode ProcessExtCancel call before extension interface is used
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EProcessExtCancel );
+}
+
+
+void CCaeTestRelease::TestProcessExtCancel2L()
+{
+	// Group:   still capture/extension mode.
+    // 
+    // ID:      CAE.SC.ProcessExtCancel.002
+    //
+    // Action : Test extension mode ProcessExtCancel normal operation. Cancell is called when extension
+    //          processing is in progress
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EProcessExtCancel2 );
+}
+
+void CCaeTestRelease::TestProcessExtCapturedImageBurstL()
+{
+	// Group:   still capture/extension mode.
+    // 
+    // ID:      CAE.SC.ProcessExtCapturedImageBurstL.001
+    //
+    // Action : Test extension mode ProcessExtCapturedImageL normal burst operation with HBufC8 param
+    //          One image is captured and then it is sent as 6 burst images to extension handling.
+    //          Also snap images are sent 6 times.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetStillBurstLength( 6 );
+    iSettingsClient->SetStillFormat( CCamera::EFormatExif );
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EProcessExtCapturedImageBurst );
+    assertL( iSettingsClient->CountStillImageReady() == 6 );
+    assertL( iSettingsClient->CountSnapImageReady() == 6 );
+    assertL( iSettingsClient->CountStillBurstComplete() == 1 );
+}
+
+void CCaeTestRelease::TestProcessExtCapturedImageBurst2L()
+{
+	// Group:   still capture/extension mode.
+    // 
+    // ID:      CAE.SC.ProcessExtCapturedImageBurstL.002
+    //
+    // Action : Test extension mode ProcessExtCapturedImageL normal burst operation with TDesC8 param 
+    //          One image is captured and then it is sent as 6 burst images to extension handling
+    //          Also snap images are sent 6 times.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetStillBurstLength( 6 );
+    iSettingsClient->SetStillFormat( CCamera::EFormatExif );
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EProcessExtCapturedImageBurstTDesC8 );
+    assertL( iSettingsClient->CountSnapImageReady() == 6 );
+    assertL( iSettingsClient->CountStillImageReady() == 6 );
+    assertL( iSettingsClient->CountStillBurstComplete() == 1 );
+}
+
+void CCaeTestRelease::TestInstalledExtensionListL()
+{
+	// Group:   still capture/extension mode.
+    // 
+    // ID:      CAE.SC.InstalledExtensionList.001
+    //
+    // Action : Test extension mode InstalledExtensionList normal operation
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EInstalledExtensionList );
+}
+
+void CCaeTestRelease::TestSkippedExtensionListL()
+{
+	// Group:   still capture/extension mode.
+    // 
+    // ID:      CAE.SC.SkippedExtensionListL.001
+    //
+    // Action : Test extension mode SkippedExtensionList normal operation
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESkippedExtensionList );
+}
+
+void CCaeTestRelease::TestSetSkippedExtensionListL()
+{
+	// Group:   still capture/extension mode.
+    // 
+    // ID:      CAE.SC.SetSkippedExtensionList.001
+    //
+    // Action : Test extension mode SetSkippedExtensionList normal operation
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetSkippedExtensionList );
+}
+
+
+void CCaeTestRelease::TestStartAndStopVideoRecordingSubQcifNoInitL()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.SUBQCIF.NOINIT.001
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording subQCIF sized video works. 
+    //          Video recording prepared for subQCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_noinit.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideoNoInit );
+
+    assertL( iStatesClient->CountInitComplete() == 0 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+
+void CCaeTestRelease::TestSecondaryCamera001L()
+    {
+	// ID: CAE.SC.SecondaryCamera.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to setup still capturing for secondary camera and capture Jpeg 
+    //          image when initialization is done.
+	//      
+    //       ** For PROD9 320x240 camera **
+    //
+	// Output : OK.   
+
+    TSize sizeQVGA( KImgWidthQVGA, KImgHeightQVGA );
+
+    iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
+    iStatesClient->SetStillCompressionQuality( 80 );
+    iStatesClient->SetStillFrameSize( sizeQVGA ); // only supported size
+    iStatesClient->SetSnapImageSize( TSize( 240, 180 ) ); // no action, cae returns qvga if no adis
+    iStatesClient->SetSnapImageSource( CCaeEngine::ESnapImageSourceThumbnail ); // no action as C-API returns bitmap
+    iStatesClient->SetStillFileName( _L("cae_jpegsecond_001.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndCaptureStill2nd );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestRelease::TestRecordAsyncStop001L()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.AsyncStop.001
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 0 
+    //          video clip when async stop is enabled.
+	//      
+	// Output : No leave.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetViewFinderSize( sizeSubQcif );
+    
+    iStatesClient->SetVfFileName( _L("cae_video_asyncstop_001.mbm") ); 
+
+    iStatesClient->SetVideoStopMode( ETrue ); 
+
+    iStatesClient->SetTimeout( 30000000 );
+
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoFileName( _L("cae_video_asyncstop_001.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareRecordVideoStartAndStopVf );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingStopped() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestRelease::TestRecordAsyncStop002L()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.AsyncStop.002
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 0 
+    //          video clip when async stop is disabled.
+	//      
+	// Output : No leave.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetViewFinderSize( sizeSubQcif );
+    
+    iStatesClient->SetVfFileName( _L("cae_video_asyncstop_001.mbm") ); 
+
+    iStatesClient->SetVideoStopMode( EFalse ); 
+
+    iStatesClient->SetTimeout( 30000000 );
+
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoFileName( _L("cae_video_asyncstop_001.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfPrepareRecordVideoStartAndStopVf );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingStopped() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+
+#if 1
+    
+MTest* CCaeTestRelease::suiteL ()
+    {
+	// Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL( _L8("CCaeTestRelease") );
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.INITL.001"), &TestInitL ) );
+    
+#if VIDEO_RECORDING_TEST_CASES
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.INITVIDEORECORDERL.001"), &TestInitVideoRecorderL ) );
+#endif
+    
+#if (!MIRAGE_X) && (!UNAGI_2M) 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.GETINFO.001"), &TestGetInfoL ) );
+#endif
+
+#if MIRAGE_X_PROD1 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.GETINFO.002"), &TestGetInfoPROD1MirageXL ) );
+#endif
+    
+#if MIRAGE_X_PROD2 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.GETINFO.003"), &TestGetInfoPROD2MirageXL ) );
+#endif
+    
+#if MIRAGE_X_PROD3 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.GETINFO.004"), &TestGetInfoPROD3MirageXPL ) );
+#endif
+    
+#if MIRAGE_X_PROD4 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.GETINFO.005"), &TestGetInfoPROD4MirageXL ) );
+#endif
+
+#if MIRAGE_X_PROD6 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.GETINFO.006"), &TestGetInfoPROD6MirageXL ) );
+#endif
+
+#if MIRAGE_X_PROD7 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.GETINFO.007"), &TestGetInfoPROD7Unagi2ML ) );
+#endif
+
+#if MIRAGE_X_PROD8 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.GETINFO.008"), &TestGetInfoPROD8MirageXL ) );
+#endif
+
+#if MIRAGE_X_PROD9 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.GETINFO.009"), &TestGetInfoPROD9HWL ) );
+#endif
+
+#if HW_DEVLON 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.GETINFO.010"), &TestGetInfoDevlonHWL ) );
+#endif
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.POWEROFFANDON.001"), &TestPowerOffAndOnL ) );
+     
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.RELESEANDRESERVE.001"), &TestReleaseAndReserveL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN-SC.POWERON.001"), &TestPowerOnWhenInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN-SC.POWERON.002"), &TestPowerOnWhenStillCapturePreparedL ) );
+
+#if VIDEO_RECORDING_TEST_CASES
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN-VR.POWERON.003"), &TestPowerOnWhenVideoRecordingPreparedL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN-VR.POWERON.004"), &TestPowerOnWhenRecordingL ) );
+#endif
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN-SC.POWEROFF.001"), &TestPowerOffWhenStillCapturePreparedL ) );    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN-SC.POWEROFF.002"), &TestPowerOffWhenViewfinderRunningL ) );
+
+#if VIDEO_RECORDING_TEST_CASES
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN-VR.POWEROFF.003"), &TestPowerOffWhenVideoRecordingPreparedL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN-VR.POWEROFF.004"), &TestPowerOffWhenRecordingL ) );
+#endif
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VF.STARTSTOPVIEWFINDER.QQVGA.001"), &TestViewFinderStartAndStopQqvgaL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VF.STARTSTOPVIEWFINDER.SUBQCIF.002"), &TestViewFinderStartAndStopSubqcifL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VF.STARTSTOPVIEWFINDER.CROPPED.003"), &TestCroppedViewFinderStartAndStopL ) );
+#if !( (HW_DEVLON) )
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VF.STARTSTOPVIEWFINDERDIRECT.001"), &TestViewFinderDirectStartAndStopL ) );
+#endif
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VF.STARTSTOPVIEWFINDERDIRECT.002"), &TestCroppedViewFinderDirectStartAndStopL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.001"), &TestCaptureStillWhenEngineInitializedL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.VGA16M.002"), &TestCaptureVga16ML ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.VGA64K.003"), &TestCaptureVga64KL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.VGA4K.004"), &TestCaptureVga4KL ) );
+
+#if !( (MIRAGE_X_PROD9) || (HW_DEVLON) )
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.QQVGA16M.005"), &TestCaptureQqvga16ML ) ); 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.QQVGA64K.006"), &TestCaptureQqvga64KL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.QQVGA4K.007"), &TestCaptureQqvga4KL ) );
+#endif
+    
+#if MIRAGE_X_PROD1 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.MP1.16M.011"), &TestCaptureMp1_16ML ) );
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.MP1.64K.012"), &TestCaptureMp1_64KL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.MP1.4K.013"), &TestCaptureMp1_4KL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.JPEGMP1.014"), &TestCaptureJpegMp1L ) );    
+
+#endif
+
+#if (MIRAGE_X_PROD2) || (MIRAGE_X_PROD4) || (MIRAGE_X_PROD3)
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.MP1M3.16M.018"), &TestCaptureMp1M3_16ML ) );
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.MP1M3.64K.019"), &TestCaptureMp1M3_64KL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.MP1M3.4K.020"), &TestCaptureMp1M3_4KL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.JPEGMP1M3.021"), &TestCaptureJpegMp1M3L ) );    
+
+#endif // (MIRAGE_X_PROD2) || (MIRAGE_X_PROD4) || (MIRAGE_X_PROD3)
+
+#if MIRAGE_X_PROD7
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.MP2.16M.025"), &TestCaptureMp2_16ML ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.MP2.64K.026"), &TestCaptureMp2_64KL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.MP2.4K.027"), &TestCaptureMp2_4KL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.JPEG.MP2.028"), &TestCaptureJpegMp2L ) );    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.EXIF.MP2.029"), &TestCaptureExifMp2L ) );    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.EXIF.SVGA.030"), &TestCaptureExifSVGAL ) );    
+#endif // MIRAGE_X_PROD7
+
+#if MIRAGE_X_PROD8
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.CODEC.031"), &TestCaptureCodecL ) );    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.CODEC.032"), &TestCaptureCodec2L ) );
+#endif // MIRAGE_X_PROD8
+        
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.JPEGVGA90.008"), &TestCaptureQualityLevel0L ) );
+   
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.JPEGVGA50.009"), &TestCaptureQualityLevel1L ) );
+
+#if !( (MIRAGE_X_PROD9) || (HW_DEVLON) )
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.JPEGQQVGA90.010"), &TestCaptureQualityLevel2L ) );
+#endif
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURECAPTURE.001"), &TestCaptureCaptureL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURECAPTURE.002"), &TestCaptureCaptureSpecPrepL ) );
+    
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.001"), &TestPrepareStillCapture0L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.002"), &TestPrepareStillCapture1L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.003"), &TestPrepareStillCapture2L ) );    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.004"), &TestPrepareStillCapture0WhenPreparedL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.007"), &TestSpecPrepareSCSupportedFormatWhenInitializedL ) );
+    
+#if VIDEO_RECORDING_TEST_CASES
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.001"), &TestPrepareVideoRecording0L ) );
+
+#if !( (HW_DEVLON) )
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.002"), &TestPrepareVideoRecording1L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.003"), &TestPrepareVideoRecording2L ) );    
+#endif
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.004"), &TestPrepareVideoRecording0WhenPreparedL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.007"), &TestSpecPrepareVRSupportedFormatWhenVRInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.VIDEORECORDING.QCIF64000FR15.001"), &TestRecordQualityLevel0L ) );  
+
+#if !( (HW_DEVLON) )
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.VIDEORECORDING.SUBQCIF60000FR15.002"), &TestRecordQualityLevel1L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.VIDEORECORDING.SUBQCIF40000FR5.003"), &TestRecordQualityLevel2L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.SUBQCIF.001"), &TestStartAndStopVideoRecordingSubQcifL ) );
+#endif
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.QCIF.002"), &TestStartAndStopVideoRecordingQcifL ) );
+#endif
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETZOOMVALUEL.001"), &TestSCDigiZoomVal0L ) );    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETZOOMVALUEL.002_vga"), &TestSCDigiZoomVal1VgaL ) );
+#if !( (MIRAGE_X_PROD9) || (HW_DEVLON) )
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETZOOMVALUEL.002_qqvga"), &TestSCDigiZoomVal1QqvgaL ) );
+#endif
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETZOOMVALUEL.005"), &TestSCDigiZoomInitializedVal0L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETZOOMVALUEL.012_vga"), &TestSCDigiZoomInitializedVal1VgaL ) );
+
+#if !( (MIRAGE_X_PROD9) || (HW_DEVLON) )
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETZOOMVALUEL.012_qqvga"), &TestSCDigiZoomInitializedVal1QqvgaL ) );
+#endif
+
+#if VIDEO_RECORDING_TEST_CASES
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETZOOMVALUEL.006"), &TestVRDigiZoomVal0L ) );    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETZOOMVALUEL.007"), &TestVRDigiZoomVal1L ) );    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETZOOMVALUEL.010"), &TestVRDigiZoomRecordingVal0L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETZOOMVALUEL.011"), &TestVRDigiZoomRecordingVal1L ) );
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.RESUMEVIDEORECORDING.001"), &TestRecordPauseResumeStopL ) );
+#endif
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETEXPOSUREMODEL.001"), &TestSCExposureMode0L ) );
+
+#if !MIRAGE_X_PROD6 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETEXPOSUREMODEL.002"), &TestSCExposureMode1L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETEXPOSUREMODEL.016"), &TestSCExposureModeInitialized1L ) );
+#endif
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETEXPOSUREMODEL.015"), &TestSCExposureModeInitialized0L ) );
+
+#if VIDEO_RECORDING_TEST_CASES
+#if !MIRAGE_X_PROD6 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETEXPOSUREMODEL.008"), &TestVRExposureMode0L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETEXPOSUREMODEL.009"), &TestVRExposureMode1L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETEXPOSUREMODEL.018"), &TestVRExposureModeRecording1L ) );
+#endif
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETEXPOSUREMODEL.017"), &TestVRExposureModeRecording0L ) );
+#endif
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETEVCOMP.001"), &TestSCEvCompensation0L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETEVCOMP.002"), &TestSCEvCompensationMaxL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETEVCOMP.003"), &TestSCEvCompensationMinL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETEVCOMP.004"), &TestSCEvCompensationInitialized0L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETEVCOMP.005"), &TestSCEvCompensationInitializedMaxL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETEVCOMP.006"), &TestSCEvCompensationInitializedMinL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETEVCOMP.007"), &TestSCEvCompensationInitializedInvalidL ) );
+
+#if VIDEO_RECORDING_TEST_CASES
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETEVCOMP.001"), &TestVREvCompensationMinL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETEVCOMP.002"), &TestVREvCompensationRecordingMaxL ) );
+#endif
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETWHITEBALANCEMODEL.001"), &TestSCWhiteBalanceMode0L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETWHITEBALANCEMODEL.019"), &TestSCWhiteBalanceModeInitialized0L ) );
+
+#if VIDEO_RECORDING_TEST_CASES
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETWHITEBALANCEMODEL.010"), &TestVRWhiteBalanceMode0L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETWHITEBALANCEMODEL.020"), &TestVRWhiteBalanceModeRecording0L ) );
+#endif
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETBRIGHTNESSL.001"), &TestSCBrightness50L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETBRIGHTNESSL.007"), &TestSCBrightnessInitialized50L ) );
+
+#if VIDEO_RECORDING_TEST_CASES
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETBRIGHTNESSL.008"), &TestVRBrightness50L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETBRIGHTNESSL.014"), &TestVRBrightnessRecording50L ) );
+#endif
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETCONTRASTL.001"), &TestSCContrast50L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETCONTRASTL.007"), &TestSCContrastInitialized50L ) );
+
+#if VIDEO_RECORDING_TEST_CASES
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETCONTRASTL.008"), &TestVRContrast50L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETCONTRASTL.014"), &TestVRContrastRecording50L ) );
+	
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.SETVIDEOCLIPMAXSIZEL.002"), &TestVideoClipMaxSize10000L ) );
+#endif
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CANCELCAPTURESTILL.001"), &TestCancelCaptureStillL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.GETSTILLQUALITYINDEX.001"), &TestGetStillQualityIndexWhenEngineInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.GETSTILLQUALITYINDEX.002"), &TestGetStillQualityIndexWhenPreparedL ) );
+    
+#if VIDEO_RECORDING_TEST_CASES
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.GETVIDEOQUALITYINDEX.001"), &TestGetVideoQualityIndexWhenEngineInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.GETVIDEOQUALITYINDEX.002"), &TestGetVideoQualityIndexWhenPreparedL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.REMAININGVIDEORECORDINGTIME.001"), &TestRemainingTimeWhenVideoPreparedL ) );
+    
+//    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.STARTSTOPVRTOOBIGSIZE.SUBQCIF.001"), &TestStartAndStopVRWhenTooBigSizeSubQcifL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.001"), &TestPrepareAudioBitRateVR5000L ) );
+
+#if (MIRAGE_X_PROD7)
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.002"), &TestPrepareAudioBitRateVR128L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.003"), &TestPrepareAudioBitRateVR128InvVtypeL ) );
+#endif
+
+#endif
+
+#ifdef __CAMERA_BURST_MODE
+    // Only if Still BURST is supported (built in).
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.3.001"), &TestCaptureStillBurst3L ) );   
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.0.002"), &TestCaptureStillBurst0L ) );
+
+//    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.100.003"), &TestCaptureStillBurst100L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.CANCEL.004"), &TestCancelCaptureStillBurst3L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.STOP2.005"), &TestStopCaptureStillBurstAfter2L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.3.006"), &TestSpecPrepCaptureStillBurst3L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTINTERVAL.0.001"), &TestCaptureStillBurstInterval0L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTINTERVAL.1000000.002"), &TestCaptureStillBurstInterval1000000L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTINTERVAL.M1.003"), &TestCaptureStillBurstIntervalM1L ) );
+#endif
+
+
+#if (MIRAGE_X_PROD2) || (MIRAGE_X_PROD4) || (MIRAGE_X_PROD3) || (MIRAGE_X_PROD7)
+
+#ifdef __CAMERA_BURST_MODE
+	// Exif burst test
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTEXIF.3.001"), &TestCaptureStillBurstExif3L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTEXIF.6.002"), &TestCaptureStillBurstExif6L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTEXIF.100.003"), &TestCaptureStillBurstExif100L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTEXIF.6.VF.004"), &TestCaptureStillBurstExif6VfL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTEXIF.6.VF.CANCEL.005"), &TestCaptureStillBurstExif6VfCancelL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTEXIF.6.006"), &TestCaptureStillBurstExif6NSL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTEXIF.6.007"), &TestCaptureStillBurstExif6_ThumbnailL ) );
+#endif
+
+	// Exif tests
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.VGA.EXIF.001"), &TestCaptureVgaExifL ) );	
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.QQVGA.EXIF.002"), &TestCaptureQqvgaExifL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.VGA.EXIF.003"), &TestCaptureVgaSnapOneHalfExifL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.VGA.EXIF.004"), &TestCaptureVgaSnapOneFourthExifL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.VGA.EXIF.005"), &TestCaptureVgaSnapOneEighthExifL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.VGA.EXIF.006"), &TestCaptureVgaSnapExifL ) );
+
+    // Jpeg tests
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.VGA.JPEG.007"), &TestCaptureVgaSnapOneEighthJpegL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.VGA.EXIF.008"), &TestCaptureVgaSnapOneEighthExif2L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.VGA.EXIF.009"), &TestCaptureVgaSnapColor16MExifL ) );
+#endif // (MIRAGE_X_PROD2) || (MIRAGE_X_PROD4) || (MIRAGE_X_PROD3) || (MIRAGE_X_PROD7)
+
+    // Test cases for snap-image creation switched off.
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.VGA16M.015"), &TestCaptureVga16M_NoSnapL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.JPEGVGA90.016"), &TestCaptureQualityLevel0_NoSnapL ) );
+#if (MIRAGE_X_PROD2) || (MIRAGE_X_PROD4) || (MIRAGE_X_PROD3) || (MIRAGE_X_PROD7)
+    // Exif tests
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.VGA.EXIF.017"), &TestCaptureVgaExif_NoSnapL ) );	
+#endif
+
+#ifdef __CAMERA_BURST_MODE
+    // Only if Still BURST is supported (built in).
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.3.007"), &TestCaptureStillBurst3_NoSnapL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.3.008"), &TestSpecPrepCaptureStillBurst3_NoSnapL ) );
+
+#if (MIRAGE_X_PROD2) || (MIRAGE_X_PROD4) || (MIRAGE_X_PROD3) || (MIRAGE_X_PROD7)
+    // Exif tests
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTEXIF.3.004"), &TestCaptureStillBurstExif3_NoSnapL ) );
+#endif
+#endif // __CAMERA_BURST_MODE
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.ENUMERATE.001"), &TestEnumerateCaptureSizesL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETJPEGQUALITY.001"), &TestSetJpegQuality50L ) );
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.CUSTOMINTERFACE.001"), &TestSCCustomInterfaceL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETFLASHMODEL.001"), &TestFlashMode0L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETFLASHMODEL.002"), &TestFlashMode1L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.SETFLASHMODEL.003"), &TestFlashMode2L ) );
+
+#if COLOR_TONE_TEST_CASES
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.COLORTONE.001"), &TestSCColorToneNormalL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.COLORTONE.002"), &TestSCColorToneSepiaL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.COLORTONE.003"), &TestSCColorToneGrayscaleL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.COLORTONE.004"), &TestSCColorToneNegativeL ) );
+#if VIDEO_RECORDING_TEST_CASES
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.COLORTONE.005"), &TestVRColorToneL ) );
+#endif
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.COLORTONE.006"), &TestSCColorToneWrongParams1L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.COLORTONE.007"), &TestSCColorToneWrongParams2L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-SC.COLORTONE.008"), &TestSCColorToneReleaseL ) );
+#endif // COLOR_TONE_TEST_CASES
+
+//#if (MIRAGE_X_PROD7)
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.SETDISPLAYINDEX.001"), &TestSetDisplayIndexL ) );
+//#endif
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.CAPTURESTILL.POWEROFF.001"), &TestCaptureAfterPowerOffL ) );
+
+    // new tests after 3.2
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SET-VR.ENUMERATEVIDEOFRAMESIZE.001"), &TestEnumerateVideoFrameSize001L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.GEN.CCAMERAHANDLE.001"), &TestCCameraHandleL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.ProcessExtViewFinderFrameReadyL.001"), &TestProcessExtViewFinderFrameReadyL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.ProcessExtSnapImageL.001"), &TestProcessExtSnapImageL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.ProcessExtCapturedImageL.001"), &TestProcessExtCapturedImageL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.ProcessExtCapturedImageL.002"), &TestProcessExtCapturedImage2L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.ProcessExtCapturedImageL.003"), &TestProcessExtCapturedImage3L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.ProcessExtCapturedImageL.004"), &TestProcessExtCapturedImage4L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.ProcessExtCancel.001"), &TestProcessExtCancelL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.ProcessExtCancel.002"), &TestProcessExtCancel2L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.ProcessExtCapturedImageBurstL.001"), &TestProcessExtCapturedImageBurstL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.ProcessExtCapturedImageBurstL.002"), &TestProcessExtCapturedImageBurst2L ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.InstalledExtensionList.001"), &TestInstalledExtensionListL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.SkippedExtensionListL.001"), &TestSkippedExtensionListL ) );
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.SetSkippedExtensionList.001"), &TestSetSkippedExtensionListL ) );
+
+#if VIDEO_RECORDING_TEST_CASES
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.SUBQCIF.NOINIT.001"), &TestStartAndStopVideoRecordingSubQcifNoInitL ) );
+#endif
+
+#if ( ((MIRAGE_X_PROD9) || (HW_DEVLON)) && (SECONDARY_CAMERA_TEST_CASES) ) 
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.SC.SecondaryCamera.001"), &TestSecondaryCamera001L ) );
+#endif
+
+    // Asynchronous video stop test cases
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.VIDEORECORDING.AsyncStop.001"), &TestRecordAsyncStop001L ) );  
+    suite->addTestL( CTestCaller<CCaeTestRelease>::NewL( _L8("CAE.VR.VIDEORECORDING.AsyncStop.002"), &TestRecordAsyncStop002L ) );  
+
+    return suite;
+    }
+
+#else
+
+
+MTest* CCaeTestRelease::suiteL ()
+    {
+	// Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL( _L8("CCaeTestRelease") );
+
+    
+    return suite;
+    }
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestSettingsClient.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,1597 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestSettingsClient.cpp
+*
+*/
+#include <fbs.h>
+
+#include "CaeTestSettingsClient.h"
+//#include "mmcleanup.h"
+
+//_LIT8(KVideoMimeType, "video/3gpp");
+//_LIT(KVideoPreferredSupplier, "Nokia");
+//_LIT8(KVideoType, "video/H263-2000");
+//_LIT8(KVideoAudioType, " AMR");
+
+const TUid KSdUidQltyLevels = {KNullUidValue};
+const TUid KSdIllegalUidQltyLevels = {666};
+
+CCaeTestSettingsClient::CCaeTestSettingsClient() 
+    {
+    }
+
+
+CCaeTestSettingsClient::~CCaeTestSettingsClient()
+    {
+    }
+
+
+CCaeTestSettingsClient* CCaeTestSettingsClient::NewL()
+    {
+    CCaeTestSettingsClient* self = new(ELeave) CCaeTestSettingsClient;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+void CCaeTestSettingsClient::ConstructL()
+    {
+    CCaeTestClient::ConstructL();
+
+    iRunWithViewFinder = EFalse;
+    }
+
+
+void CCaeTestSettingsClient::RunTestActionL( TestClientActions aAction )
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestVideoSettingsClient::RunTestActionL() entering" ) );
+    #endif
+    
+    iAction = aAction;
+	iSavedAction = aAction;
+
+    // Initialize all state variables.
+    InitStateVariables();
+
+    iCamAppEngine->InitL( KSdUidQltyLevels );
+
+	// Main part of program is a wait loop.
+	// This function completes when the scheduler stops.
+	CActiveScheduler::Start();
+    
+    if ( iError )
+        {
+    	#ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestSettingsClient::RunTestActionL() leaving (error detected)" ) );
+        #endif
+        User::Leave( iError );
+        }
+	
+    #ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestSettingsClient::RunTestActionL() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestSettingsClient::RunTrappedL()
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestSettingsClient::RunTrappedL() entering" ) );
+    #endif
+
+    if ( iStop ) 
+        {
+        if ( iCamAppEngine->IsViewFinding() )
+	        {
+            iCamAppEngine->StopViewFinder();
+            iViewFinderStarted = EFalse;
+            }
+        iCamAppEngine->CancelCaptureStill();
+        iCamAppEngine->CloseVideoRecording();
+        delete iBitmapSave;
+        iBitmapSave = NULL;
+        delete iDataSave;
+        iDataSave = NULL;
+        CActiveScheduler::Stop();
+        }
+    else if ( iInitReady ) 
+		{
+        
+        if ( iAction != ESetVideoFileNameWhenNotInitialized &&
+             iAction != ESetAudioWhenVideoNotInitialized &&
+             iAction != ESetClipMaxSizeWhenVideoNotInitialized &&
+             iAction != EGetAudioWhenVideoNotInitialized )
+            {
+            iCamAppEngine->InitVideoRecorderL( KSdUidQltyLevels );
+            }
+
+        User::After( 1000000 ); // Give some time for camera drivers to settle.
+
+        switch ( iAction )
+            {
+            case EGetInfo:
+                iCamAppEngine->GetInfo( iInfo );
+                iStop = ETrue;
+                break;
+            case ESetVideoFileNameWhenInitialized:
+            case ESetVideoFileNameWhenNotInitialized:
+                iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
+                iStop = ETrue;
+                break;
+            case ESetEmptyVideoFileNameWhenInitialized:
+                iCamAppEngine->SetVideoRecordingFileNameL( _L("") );
+                iStop = ETrue;
+                break;
+            case ESetDigiZoomWhenInitialized:
+                iAction = EDefault;
+                iCamAppEngine->SetZoomModeL( static_cast<CCaeEngine::TZoomMode>( iZoomMode ) );
+                iCamAppEngine->SetZoomValueL( iDigiZoomValue );
+                break;
+            case ESetBrightnessWhenInitialized:
+                iAction = EDefault;
+                iCamAppEngine->SetBrightnessL( iBrightness );
+                break;
+            case ESetContrastWhenInitialized:
+                {
+                iAction = EDefault;
+
+                //Test before setting, value is unknown?
+                TInt contrast = iCamAppEngine->Contrast();
+
+                iCamAppEngine->SetContrastL( iContrast );
+
+                //Test immediately that value is right
+                contrast = iCamAppEngine->Contrast();
+                if ( contrast != iContrast )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetExposureModeWhenInitialized:
+                iAction = EDefault;
+                iCamAppEngine->SetExposureModeL( static_cast<CCamera::TExposure>( iExposureMode ) );
+                break;
+            case ESetEvCompensationWhenInitialized:
+                {
+                // Read value before setting, should be zero if not supported
+                TInt evCompensation = iCamAppEngine->EvCompensation();
+                if ( evCompensation != 0 )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                iCamAppEngine->SetEvCompensationL( iEvCompensation );
+                }
+                break;
+            case ESetWhiteBalanceModeWhenInitialized:
+                iAction = EDefault;
+                iCamAppEngine->SetWhiteBalanceModeL( static_cast<CCamera::TWhiteBalance>( iWhiteBalanceMode ) );
+                break;
+            case ESetFlashModeWhenInitialized:
+                iAction = EDefault;
+                iCamAppEngine->SetFlashModeL( static_cast<CCamera::TFlash>( iFlashMode ) );
+                break;
+            case EResetToDefaults:
+                // iAction = EDefault;
+                iCamAppEngine->SetZoomModeL( static_cast<CCaeEngine::TZoomMode>( iZoomMode ) );
+                iCamAppEngine->SetZoomValueL( iDigiZoomValue );
+                if ( TCameraInfo::EBrightnessSupported & iInfo.iOptionsSupported )
+		            {
+                    iCamAppEngine->SetBrightnessL( iBrightness );
+                    }
+                if ( TCameraInfo::EContrastSupported & iInfo.iOptionsSupported )
+		            {
+                    iCamAppEngine->SetContrastL( iContrast );
+                    }
+                iCamAppEngine->SetExposureModeL( static_cast<CCamera::TExposure>( iExposureMode ) );
+                iCamAppEngine->SetWhiteBalanceModeL( static_cast<CCamera::TWhiteBalance>( iWhiteBalanceMode ) );
+                iCamAppEngine->SetFlashModeL( static_cast<CCamera::TFlash>( iFlashMode ) );
+                break;
+            case ESetViewFinderMirror:
+                {
+                TBool mirrorVF = iCamAppEngine->ViewFinderMirror();
+                if ( mirrorVF )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                iAction = EDefault;
+                iCamAppEngine->SetViewFinderMirrorL( ETrue );
+                break;
+            case EGetStillFrameSizeWhenInitialized:
+                // Test with invalid quality level index.
+                iCamAppEngine->GetStillFrameSize( -1, iStillFrameSizeSet );
+                iCamAppEngine->GetStillFrameSize( 666, iStillFrameSizeSet );
+                // Test with valid quality level index.
+                iCamAppEngine->GetStillFrameSize( iStillQualityLevelIndex, iStillFrameSizeSet );
+                iStop = ETrue;
+                break;
+            case EEstimatedStillSizeInBytesWhenInitialized:
+                // Test with invalid quality level index.
+                iEstimatedStillSizeInBytesSet = 
+                    iCamAppEngine->EstimatedStillSizeInBytes( -1 );
+                iEstimatedStillSizeInBytesSet = 
+                    iCamAppEngine->EstimatedStillSizeInBytes( 666 );
+                // Test with valid quality level index.
+                iEstimatedStillSizeInBytesSet = 
+                    iCamAppEngine->EstimatedStillSizeInBytes( iStillQualityLevelIndex );
+                iStop = ETrue;
+                break;
+            case EGetVideoFrameSizeWhenInitialized:
+                {
+                // test first with invalid index values: negative and too big, should not modify data
+                    TSize tempFrameSize1( KImgWidthQCIF, KImgHeightQCIF );
+                    TSize tempFrameSize2( KImgWidthQCIF, KImgHeightQCIF );
+
+                    iCamAppEngine->GetVideoFrameSize( -1, tempFrameSize1 );
+                    if ( tempFrameSize1 != tempFrameSize2 )
+                        {
+                        User::Leave ( KErrArgument );
+                        }
+                    iCamAppEngine->GetVideoFrameSize( 666, tempFrameSize1 );
+                    if ( tempFrameSize1 != tempFrameSize2 )
+                        {
+                        User::Leave ( KErrArgument );
+                        }
+                    iCamAppEngine->GetVideoFrameSize( iVideoQualityLevelIndex, iVideoFrameSizeSet );
+                    iStop = ETrue;
+                }
+                break;
+            case EVideoFrameRateWhenInitialized:
+                {
+                // test first with invalid index values: negative and too big, should return 0
+                iVideoFrameRateSet = iCamAppEngine->VideoFrameRate( -1 );
+                if ( iVideoFrameRateSet != 0 )
+                    {
+                    User::Leave ( KErrArgument );
+                    }
+                iVideoFrameRateSet = iCamAppEngine->VideoFrameRate( 666 );
+                if ( iVideoFrameRateSet != 0 )
+                    {
+                    User::Leave ( KErrArgument );
+                    }
+                iVideoFrameRateSet = iCamAppEngine->VideoFrameRate( iVideoQualityLevelIndex );
+                iStop = ETrue;
+                }
+                break;
+            case EEstimatedVideoRecordingBitRateWhenInitialized:
+                // test first with invalid index values: negative and too big, should return 0
+                iEstimatedVideoBitRateSet = 
+                    iCamAppEngine->EstimatedVideoRecordingBitRateL( -1 );
+                if ( iEstimatedVideoBitRateSet != 0 )
+                    {
+                    User::Leave ( KErrArgument );
+                    }
+                iEstimatedVideoBitRateSet = 
+                    iCamAppEngine->EstimatedVideoRecordingBitRateL( 666 );
+                if ( iEstimatedVideoBitRateSet != 0 )
+                    {
+                    User::Leave ( KErrArgument );
+                    }
+                iEstimatedVideoBitRateSet = 
+                    iCamAppEngine->EstimatedVideoRecordingBitRateL( iVideoQualityLevelIndex );
+                iStop = ETrue;
+                break;
+            case ESetClipMaxSizeWhenVideoNotPrepared:
+                iAction = EDefault;
+                iCamAppEngine->SetVideoClipMaxSizeL( iVideoMaxClipSizeInBytes );
+                break;
+            /*
+            case EPrepareAndSetStillBurstCaptureInterval:
+                iAction = EDefault;
+                iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+			    break;
+            */
+            case EInitUid:
+                iCamAppEngine->InitL( KSdIllegalUidQltyLevels );// will leave
+                iStop = ETrue;
+                break;
+            case ESetAudioWhenVideoNotInitialized:
+                iAction = EDefault;
+                iCamAppEngine->SetVideoAudioL( iVideoAudioEnabled );
+                break;
+            case ESetClipMaxSizeWhenVideoNotInitialized:
+                iAction = ENone;
+                iCamAppEngine->SetVideoClipMaxSizeL( iVideoMaxClipSizeInBytes );
+                break;
+            case EGetAudioWhenVideoNotInitialized:
+                {
+                iStop = ETrue;
+                TBool audio = iCamAppEngine->VideoAudio();
+                if ( audio != EFalse )
+                    {
+                    User::Leave ( KErrArgument );
+                    }
+                }
+                break;
+            case EEnumerateVideoFrameSize:
+                {
+                iStop = ETrue;
+                TInt enumIndVGA;
+                TInt enumIndCIF;
+                TInt enumIndQCIF;
+                TInt enumIndBIG;
+                TInt enumIndZERO;
+                TSize sizeVGA( KImgWidthVGA, KImgHeightVGA );
+                TSize sizeCIF( KImgWidthCIF, KImgHeightCIF );
+                TSize sizeQCIF( KImgWidthQCIF, KImgHeightQCIF );
+                TSize sizeBIG( KImgWidthTooBig, KImgHeightTooBig );
+                TSize sizeZERO( 0, 0 );
+
+                enumIndVGA  = iCamAppEngine->EnumerateVideoFrameSizeL( sizeVGA );
+                enumIndCIF  = iCamAppEngine->EnumerateVideoFrameSizeL( sizeCIF );
+                enumIndQCIF = iCamAppEngine->EnumerateVideoFrameSizeL( sizeQCIF );
+                enumIndBIG  = iCamAppEngine->EnumerateVideoFrameSizeL( sizeBIG );
+                enumIndZERO = iCamAppEngine->EnumerateVideoFrameSizeL( sizeZERO );
+
+                if ( ( enumIndVGA < 0 && enumIndCIF < 0 && enumIndQCIF < 0 ) ||
+                    enumIndBIG >= 0 || enumIndZERO >= 0 )
+                    {
+                    User::Leave ( KErrNotSupported );
+                    }
+                }
+                break;
+                
+            case EInstalledExtensionList:
+                {
+                RCaeOrderedFeatureList installedExtensions1;
+                RCaeOrderedFeatureList installedExtensions2;
+                TCaeOrderedFeatureListItem item;
+
+                // call the get function
+                iCamAppEngine->GetOrderL( installedExtensions1 );
+
+                // test that cae resets the parameter before usage
+                item.iFeatureUid = KSdIllegalUidQltyLevels;
+                installedExtensions2.Append( item );
+                iCamAppEngine->GetOrderL( installedExtensions2 );
+                
+                // Check that the both arrays are the same
+                if ( installedExtensions1.Count() != installedExtensions2.Count() )
+                    {
+                    installedExtensions1.Reset();
+                    installedExtensions2.Reset();
+                    RDebug::Print( _L( "Cae: CCaeTestSettingsClient: CAE doesn't reset the array" ) );
+                    User::Leave ( KErrArgument );
+                    }
+                for(TInt i=0; i < installedExtensions1.Count(); i++ )
+                    {
+                    if ( installedExtensions1[i].iServiceUid != installedExtensions2[i].iServiceUid ||
+                        installedExtensions1[i].iFeatureUid != installedExtensions2[i].iFeatureUid )
+                        {
+                        installedExtensions1.Reset();
+                        installedExtensions2.Reset();
+                        RDebug::Print( _L( "Cae: CCaeTestSettingsClient: CAE the array is not same" ) );
+                        User::Leave ( KErrArgument );
+                        }
+                    }
+                installedExtensions1.Reset();
+                installedExtensions2.Reset();
+                iStop = ETrue;
+                }
+                break;
+
+            case ESkippedExtensionList:
+                {
+                RCaeOrderedFeatureList skippedExtensions1;
+                RCaeOrderedFeatureList skippedExtensions2;
+                TCaeOrderedFeatureListItem item;
+                // call get function twice
+                iCamAppEngine->SkippedExtensionListL( skippedExtensions1 );
+                // test that cae resets non-empty parameter
+                item.iFeatureUid = KSdIllegalUidQltyLevels;
+                skippedExtensions2.Append( item );
+                iCamAppEngine->SkippedExtensionListL( skippedExtensions2 );
+                // Check that the both arrays are the same
+                if ( skippedExtensions1.Count() != skippedExtensions2.Count() )
+                    {
+                    skippedExtensions1.Reset();
+                    skippedExtensions2.Reset();
+                    RDebug::Print( _L( "Cae: CCaeTestSettingsClient: CAE doesn't reset the array" ) );
+                    User::Leave ( KErrArgument );
+                    }
+                for(TInt i=0; i < skippedExtensions1.Count(); i++ )
+                    {
+                    if ( skippedExtensions1[i].iServiceUid != skippedExtensions2[i].iServiceUid ||
+                        skippedExtensions1[i].iFeatureUid != skippedExtensions2[i].iFeatureUid )
+                        {
+                        skippedExtensions1.Reset();
+                        skippedExtensions2.Reset();
+                        RDebug::Print( _L( "Cae: CCaeTestSettingsClient: array is not same" ) );
+                        User::Leave ( KErrArgument );
+                        }
+                    }
+                skippedExtensions1.Reset();
+                skippedExtensions2.Reset();
+                iStop = ETrue;
+                }
+                break;
+                
+            case ESetSkippedExtensionList:
+                {
+                RCaeOrderedFeatureList skippedExtensions1;
+                RCaeOrderedFeatureList skippedExtensions2;
+                TCaeOrderedFeatureListItem item;
+
+                // call set function twice
+                iCamAppEngine->SetSkippedExtensionList( skippedExtensions1 );
+                iCamAppEngine->SetSkippedExtensionList( skippedExtensions1 );
+                
+                // read and verify
+                iCamAppEngine->SkippedExtensionListL( skippedExtensions1 );
+                if ( skippedExtensions1.Count() != 0 )
+                    {
+                    skippedExtensions1.Reset();
+                    RDebug::Print( _L( "Cae: CCaeTestSettingsClient: get/set error" ) );
+                    User::Leave ( KErrArgument );
+                    }
+
+                // Add one UID
+                item.iFeatureUid = KSdIllegalUidQltyLevels;
+                skippedExtensions1.Append( item );
+                iCamAppEngine->SetSkippedExtensionList( skippedExtensions1 );
+                iCamAppEngine->SetSkippedExtensionList( skippedExtensions1 );
+                
+                // read and verify
+                skippedExtensions1.Reset();
+                iCamAppEngine->SkippedExtensionListL( skippedExtensions1 );
+                if ( skippedExtensions1.Count() != 0 )
+                    {
+                    skippedExtensions1.Reset();
+                    RDebug::Print( _L( "Cae: CCaeTestSettingsClient: set inv. error" ) );
+                    User::Leave ( KErrArgument );
+                    }
+
+                // call the get function to get installed extensions
+                iCamAppEngine->GetOrderL( skippedExtensions1 );
+
+                // Add one invalid UID and set all skipped
+                item.iFeatureUid = KSdIllegalUidQltyLevels;
+                skippedExtensions1.Append( item );
+                iCamAppEngine->SetSkippedExtensionList( skippedExtensions1 );
+
+                // read and verify that both arrays are the same
+                iCamAppEngine->SkippedExtensionListL( skippedExtensions1 );
+                iCamAppEngine->GetOrderL( skippedExtensions2 );
+
+                // Check that the both arrays are the same
+                if ( skippedExtensions1.Count() != skippedExtensions2.Count() )
+                    {
+                    skippedExtensions1.Reset();
+                    skippedExtensions2.Reset();
+                    RDebug::Print( _L( "Cae: CCaeTestSettingsClient: CAE doesn't reset the array" ) );
+                    User::Leave ( KErrArgument );
+                    }
+                for(TInt i=0; i < skippedExtensions1.Count(); i++ )
+                    {
+                    if ( skippedExtensions1[i].iServiceUid != skippedExtensions2[i].iServiceUid ||
+                        skippedExtensions1[i].iFeatureUid != skippedExtensions2[i].iFeatureUid )
+                        {
+                        skippedExtensions1.Reset();
+                        skippedExtensions2.Reset();
+                        RDebug::Print( _L( "Cae: CCaeTestSettingsClient: array is not same" ) );
+                        User::Leave ( KErrArgument );
+                        }
+                    }
+
+                skippedExtensions1.Reset();
+                skippedExtensions2.Reset();
+                iStop = ETrue;
+                }
+                break;
+
+            default:
+                 //iVideoRecordingOn = EFalse;
+                 //iCamAppEngine->StopVideoRecording();
+                break;
+            }
+
+        User::After( 1000000 ); // Give some time for camera drivers to settle.
+        
+        if ( ( iAction != ENone ) && !iStop)
+            {
+            iInitReady = EFalse;
+            iViewFinderStarted = EFalse;
+            iStillPrepareReady = EFalse;
+            iVideoPrepareReady = EFalse;
+            switch ( iOpMode )
+                {
+                case EClientOpModeStill:
+					switch ( iAction )
+						{
+						case ESetEvCompensationWhenInitialized:
+						case ESetEvCompensationWhenStillPrepared:
+						case ESetJpegQualityWhenStillPrepared:
+						case EProcessExtCapturedImageBurst:
+						case EProcessExtCapturedImageBurstTDesC8:
+							if ( iAction == ESetEvCompensationWhenInitialized )
+								{
+								iAction = EDefault;
+								}
+							iCamAppEngine->PrepareStillCaptureL( iStillFrameSize, 
+																 iStillDataFormat, 
+																 iStillCompressionQuality );
+							break;
+						case ESetSnapImageSizeBeforePrepare:
+							iCamAppEngine->SetSnapImageSizeL( iSnapImageSize );
+							iCamAppEngine->PrepareStillCaptureL( iStillFrameSize, 
+																 iStillDataFormat, 
+																 iStillCompressionQuality );
+							break;
+						case ESetSnapImageSizeDuringAndAfterPrepare:
+							iCamAppEngine->PrepareStillCaptureL( iStillFrameSize, 
+																 iStillDataFormat, 
+																 iStillCompressionQuality,
+																 TRect(),
+																 iSnapImageSize );
+							break;
+		    			case ESetJpegCodecWhenStillPrepared: 
+                			iCamAppEngine->SetImageCodecsL( iImageDecoderUid, iImageEncoderUid );
+                			iCamAppEngine->PrepareStillCaptureL( iStillFrameSize, 
+                                                     			 iStillDataFormat, 
+                                                     			 iStillCompressionQuality );
+			    			break;
+						default:
+							iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+							break;
+						}
+			        break;
+                case EClientOpModeVideo:
+                    iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
+                    iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex );
+			        break;
+                default:
+                    User::Leave( KErrNotSupported );
+                    break;
+               }
+            }
+        else
+            {
+            CTimer::After( KNormalTimingDelay );
+            }
+        }
+    else if ( iStillPrepareReady ) 
+		{
+
+        if ( iRunWithViewFinder && !iCamAppEngine->IsViewFinding() )
+	        {
+            iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize );
+            // User::After( 1000000 ); // Give some time for camera drivers to settle.
+            }
+
+        iStillPrepareReady = EFalse;
+
+	    TBool capture = EFalse;
+
+        switch ( iAction )
+            {
+            case ESetDigiZoomWhenStillPrepared:
+                {
+                iAction = EDefault;
+                capture = ETrue;
+                iCamAppEngine->SetZoomModeL( static_cast<CCaeEngine::TZoomMode>( iZoomMode ) );
+                /*TInt zoomValue1 =*/ iCamAppEngine->ZoomValue();
+				iCamAppEngine->SetZoomValueL( iDigiZoomValue );
+                /*TInt zoomValue2 =*/ iCamAppEngine->ZoomValue();
+                }
+                break;
+            case ESetBrightnessWhenStillPrepared:
+                iAction = EDefault;
+                capture = ETrue;
+                iCamAppEngine->SetBrightnessL( iBrightness );
+                break;
+            case ESetContrastWhenStillPrepared:
+                iAction = EDefault;
+                capture = ETrue;
+                iCamAppEngine->SetContrastL( iContrast );
+                break;
+            case ESetExposureModeWhenStillPrepared:
+                iAction = EDefault;
+                capture = ETrue;
+                iCamAppEngine->SetExposureModeL( static_cast<CCamera::TExposure>( iExposureMode ) );
+                break;
+            case ESetEvCompensationWhenStillPrepared:
+                iAction = EDefault;
+                capture = ETrue;
+                iCamAppEngine->SetEvCompensationL( iEvCompensation );
+                break;
+            case ESetWhiteBalanceModeWhenStillPrepared:
+                iAction = EDefault;
+                capture = ETrue;
+                iCamAppEngine->SetWhiteBalanceModeL( static_cast<CCamera::TWhiteBalance>( iWhiteBalanceMode ) );
+                break;
+            case ESetFlashModeWhenStillPrepared:
+                iAction = EDefault;
+                capture = ETrue;
+                iCamAppEngine->SetFlashModeL( static_cast<CCamera::TFlash>( iFlashMode ) );
+                break;
+            case ESetJpegQualityWhenStillPrepared:
+                iAction = EDefault;
+                capture = ETrue;
+// If interface after S60 2.1.
+#ifndef CAE_INTERFACE_21
+                iCamAppEngine->SetJpegQuality( iStillCompressionQuality );
+#endif
+                break;
+            case EResetToDefaults:
+                iAction = EDefault;
+                capture = ETrue;
+                iCamAppEngine->ResetToDefaultsL();
+                {
+                CCaeEngine::TZoomMode zoomModeR = iCamAppEngine->ZoomMode();
+                if ( zoomModeR != CCaeEngine::EZoomModeDigital )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                TInt zoomValueR = iCamAppEngine->ZoomValue();
+                if ( zoomValueR != 0 )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                TInt brightnessR = iCamAppEngine->Brightness();
+                if ( brightnessR != 0 )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                TInt contrastR = iCamAppEngine->Contrast();
+                if ( contrastR != 0 )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                TInt exposuremodeR = iCamAppEngine->ExposureMode();
+                if ( exposuremodeR != CCamera::EExposureAuto )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                TInt whitebalancemodeR = iCamAppEngine->WhiteBalanceMode();
+                if ( whitebalancemodeR != CCamera::EWBAuto )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                TInt flashmodeR = iCamAppEngine->FlashMode();
+                if ( flashmodeR != CCamera::EFlashNone )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetViewFinderMirror:
+                {
+                iAction = EDefault;
+                TBool mirrorVF = iCamAppEngine->ViewFinderMirror();
+                capture = ETrue;
+                if ( !mirrorVF )
+                    {
+                    User::Leave( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case EGetStillFrameSizeWhenPrepared:
+                // Test with invalid quality level index.
+                iCamAppEngine->GetStillFrameSize( -1, iStillFrameSizeSet );
+                iCamAppEngine->GetStillFrameSize( 666, iStillFrameSizeSet );
+                // Test with valid quality level index.
+                iCamAppEngine->GetStillFrameSize( iStillQualityLevelIndex, iStillFrameSizeSet );
+                iStop = ETrue;
+                break;
+            case ESetSnapImageSizeDuringAndAfterPrepare:
+				iCamAppEngine->SetSnapImageSizeL( iSnapImageSize );
+                capture = ETrue;
+                break;
+            case EEstimatedStillSizeInBytesWhenPrepared:
+                // Test with invalid quality level index.
+                iEstimatedStillSizeInBytesSet = 
+                    iCamAppEngine->EstimatedStillSizeInBytes( -1 );
+                iEstimatedStillSizeInBytesSet = 
+                    iCamAppEngine->EstimatedStillSizeInBytes( 666 );
+                // Test with valid quality level index.
+                iEstimatedStillSizeInBytesSet = 
+                    iCamAppEngine->EstimatedStillSizeInBytes( iStillQualityLevelIndex );
+                iStop = ETrue;
+                break;
+            case EPrepareAndSetStillBurstCaptureInterval:
+                {
+                iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( iStillBurstLength );
+                iCamAppEngine->SetStillBurstCaptureIntervalL( iStillBurstCaptureInterval );
+                /*TInt imgCount =*/ iCamAppEngine->StillCaptureImageCount();
+                capture = ETrue;
+                // "prepare-version" of burst mode
+                // iCamAppEngine->PrepareStillBurstL( iStillBurstLength );
+                }
+                break;
+            default:
+                capture = ETrue;
+                break;
+            }
+
+        if ( capture )
+			{
+            iStillCaptureReady = EFalse;
+            iStillCapturingOn = ETrue;
+            iStillCaptured = ETrue;
+	        #ifdef _DEBUG
+            RDebug::Print( _L( "Cae: CCaeTestSettingsClient: calling iCamAppEngine->CaptureStill()" ) );
+            #endif
+            User::After( 1000000 ); // Give some time for camera drivers to settle.
+			iCamAppEngine->CaptureStill();
+			}
+        else 
+            {
+            CTimer::After( KNormalTimingDelay );
+            }
+        
+		}
+    else if ( iVideoPrepareReady ) 
+		{
+
+        if ( iRunWithViewFinder && !iCamAppEngine->IsViewFinding() )
+	        {
+            iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize );
+            // User::After( 1000000 ); // Give some time for camera drivers to settle.
+            }
+
+		TBool record( EFalse );
+
+        iVideoPrepareReady = EFalse;
+
+        switch ( iAction )
+            {
+            case ESetDigiZoomWhenVideoPrepared:
+                record = ETrue;
+                iCamAppEngine->SetZoomModeL( static_cast<CCaeEngine::TZoomMode>( iZoomMode ) );
+                iCamAppEngine->SetZoomValueL( iDigiZoomValue );
+                break;
+            case ESetBrightnessWhenVideoPrepared:
+                record = ETrue;
+                iCamAppEngine->SetBrightnessL( iBrightness );
+                break;
+            case ESetContrastWhenVideoPrepared:
+                record = ETrue;
+                iCamAppEngine->SetContrastL( iContrast );
+                break;
+            case ESetExposureModeWhenVideoPrepared:
+                record = ETrue;
+                iCamAppEngine->SetExposureModeL( static_cast<CCamera::TExposure>( iExposureMode ) );
+                break;
+            case ESetEvCompensationWhenVideoPrepared:
+                record = ETrue;
+                iCamAppEngine->SetEvCompensationL( iEvCompensation );
+                break;
+            case ESetWhiteBalanceModeWhenVideoPrepared:
+                record = ETrue;
+                iCamAppEngine->SetWhiteBalanceModeL( static_cast<CCamera::TWhiteBalance>( iWhiteBalanceMode ) );
+                break;
+            case ESetFlashModeWhenVideoPrepared:
+                record = ETrue;
+                iCamAppEngine->SetFlashModeL( static_cast<CCamera::TFlash>( iFlashMode ) );
+                break;
+            case ESetVideoTimesIntervalWhenVideoPrepared:
+                record = ETrue;
+                iCamAppEngine->SetVideoTimesIntervalL( iVideoTimesInterval );
+                break;
+            case ESetVideoFileNameWhenPrepared:
+                iAction = EDefault;
+                iCamAppEngine->StopViewFinder();
+                iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
+			    break;
+            case ESetClipMaxSizeWhenVideoPrepared:
+                iAction = EDefault;
+                iCamAppEngine->SetVideoClipMaxSizeL( iVideoMaxClipSizeInBytes );
+                break;
+            case ESetAudioWhenVideoPrepared:
+                iAction = EDefault;
+                iCamAppEngine->SetVideoAudioL( iVideoAudioEnabled );
+                break;
+            case EGetVideoFrameSizeWhenPrepared:
+                iCamAppEngine->GetVideoFrameSize( iVideoQualityLevelIndex, iVideoFrameSizeSet );
+                iStop = ETrue;
+                break;
+            case EVideoFrameRateWhenPrepared:
+                iVideoFrameRateSet = iCamAppEngine->VideoFrameRate( iVideoQualityLevelIndex );
+                iStop = ETrue;
+                break;
+            case EEstimatedVideoRecordingBitRateWhenPrepared:
+                iEstimatedVideoBitRateSet = 
+                    iCamAppEngine->EstimatedVideoRecordingBitRateL( iVideoQualityLevelIndex );
+                iStop = ETrue;
+                break;
+            default:
+                // iVideoPrepareReady = EFalse;
+                record = ETrue;
+                break;
+            }
+        /*
+        iVideoRecordingReady = EFalse;
+        iVideoRecordingOn = EFalse;
+        iVideoRecorded = ETrue;
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestSettingsClient: calling iCamAppEngine->StartVideoRecording()" ) );
+        #endif
+		iCamAppEngine->StartVideoRecording();
+        */
+        if ( record )
+			{
+            iVideoRecordingReady = EFalse;
+            iVideoRecordingOn = EFalse;
+            iVideoRecorded = ETrue;
+	        #ifdef _DEBUG
+            RDebug::Print( _L( "Cae: CCaeTestSettingsClient: calling iCamAppEngine->StartVideoRecording()" ) );
+            #endif
+            User::After( 1000000 ); // Give some time for camera drivers to settle.
+			iCamAppEngine->StartVideoRecording();
+			}
+        else if ( iAction != EDefault ) 
+            {
+            CTimer::After( KNormalTimingDelay );
+            }
+		}
+	else if ( iSnapImageReady )
+	    {
+	    iSnapImageReady = EFalse;
+	    }
+	else if ( iStillCaptureReady )
+	    {
+        // Check here if the settings were taken into use.
+        // (For settings with a get-method.)
+        switch ( iSavedAction )
+            {
+            case ESetDigiZoomWhenStillPrepared:
+            case ESetDigiZoomWhenInitialized:
+                {
+                CCaeEngine::TZoomMode zoomMode = iCamAppEngine->ZoomMode();
+                if ( zoomMode != CCaeEngine::EZoomModeDigital )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                TInt zoomValue = iCamAppEngine->ZoomValue();
+                if ( zoomValue != iDigiZoomValue )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetBrightnessWhenStillPrepared:
+            case ESetBrightnessWhenInitialized:
+                {
+                TInt brightness = iCamAppEngine->Brightness();
+                if ( brightness != iBrightness )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetContrastWhenStillPrepared:
+            case ESetContrastWhenInitialized:
+                {
+                TInt contrast = iCamAppEngine->Contrast();
+                if ( contrast != iContrast )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+
+                // Test poweroff case, contrast should be 0
+                iCamAppEngine->PowerOff();
+                contrast = iCamAppEngine->Contrast();
+                if ( contrast != 0 )
+                    {
+                    User::Leave ( KErrArgument );
+                    }
+                }
+                break;
+            case ESetExposureModeWhenStillPrepared:
+            case ESetExposureModeWhenInitialized:
+                {
+                TInt exposuremode = iCamAppEngine->ExposureMode();
+                if ( exposuremode != iExposureMode )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetEvCompensationWhenStillPrepared:
+            case ESetEvCompensationWhenInitialized:
+                {
+                TInt evCompensation = iCamAppEngine->EvCompensation();
+                if ( evCompensation != iEvCompensation )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetJpegQualityWhenStillPrepared:
+                {
+// If interface after S60 2.1.
+#ifndef CAE_INTERFACE_21
+                TInt jpegQuality = iCamAppEngine->JpegQuality();
+                if ( ( iStillCompressionQuality >= 1 ) && ( iStillCompressionQuality <= 100 ) )
+                    {
+                    if ( jpegQuality != iStillCompressionQuality )
+                        {
+                        User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                        }
+                    }
+                else
+                    {
+                    // Test clamping to the range 1-100.
+                    if ( iStillCompressionQuality < 1 )
+                        {
+                        if ( jpegQuality != 1 )
+                            {
+                            User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                            }
+                        }
+                    else if ( iStillCompressionQuality > 100 )
+                        {
+                        if ( jpegQuality != 100 )
+                            {
+                            User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                            }
+                        }
+                    }
+#endif
+                }
+                break;            
+            case ESetWhiteBalanceModeWhenStillPrepared:
+            case ESetWhiteBalanceModeWhenInitialized:
+                {
+                TInt whitebalancemode = iCamAppEngine->WhiteBalanceMode();
+                if ( whitebalancemode != iWhiteBalanceMode )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetFlashModeWhenStillPrepared:
+            case ESetFlashModeWhenInitialized:
+                {
+                TInt flashmode = iCamAppEngine->FlashMode();
+                if ( flashmode != iFlashMode )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case EPrepareAndSetStillBurstCaptureInterval:
+                break;
+            default:
+                break;
+            }
+
+        iStillCaptureReady = EFalse;
+        
+	    // #ifdef _DEBUG
+        // RDebug::Print( _L( "Cae: CCaeTestStillSettingsClient: calling iCamAppEngine->StartViewFinderBitmapsL()" ) );
+        // #endif
+        // iViewFindingUsed = ETrue;
+        // iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize );
+
+        if ( iAction == EProcessExtViewFinderFrameReady ||
+            iAction == EProcessExtSnapImage ||
+            iAction == EProcessExtCapturedImage ||
+            iAction == EProcessExtCapturedImageTDesC8 ||
+            iAction == EProcessExtCapturedImageCFbsBitmap ||
+            iAction == EProcessExtCapturedImageBurst ||
+            iAction == EProcessExtCapturedImageBurstTDesC8 ||
+            iAction == EProcessExtCancel ||
+            iAction == EProcessExtCancel2 )
+            {
+            if ( iAction == EProcessExtCapturedImageTDesC8 )
+                {
+                // Test also that release should not stop the extension mode operation
+                iCamAppEngine->Release();
+                }
+            iCamAppEngine->SetCaeExtensionModeL( ETrue, EFalse );
+            iExtensionMode = ETrue;
+            CTimer::After( iTimeout );
+            }
+        else if ( iAction == EProcessExtCapturedImageNoInit )
+            {
+            // test images are captured now, delete observer1 engine and create a new
+            delete iCamAppEngine;
+            iCamAppEngine = NULL;
+            iCamAppEngine = CCaeEngine::NewL( 0 );
+            iCamAppEngine->SetCamAppEngineObserver( *this );
+            iCamAppEngine->SetCaeStillBurstObserver( *this );
+        	iCamAppEngine->GetInfo( iInfo );
+        
+            // Move cae to extension mode without initl or prepare call    
+            iCamAppEngine->SetCaeExtensionModeL( ETrue, EFalse );
+            iExtensionMode = ETrue;
+            CTimer::After( iTimeout );
+            }
+        else if ( iStillBurstLength == 1 )
+            {
+            iStop = ETrue;
+            CTimer::After( iTimeout );
+            }
+	    }
+
+	else if ( iStillBurstReady )
+	    {
+        iStillBurstReady = EFalse;
+
+		switch ( iAction )
+		    {
+            case EPrepareAndSetStillBurstCaptureInterval:
+		    default:
+                iAction = ENone;
+                {
+                TTimeIntervalMicroSeconds stillburstcaptureinterval = 
+                iCamAppEngine->StillBurstCaptureInterval();
+                if ( stillburstcaptureinterval != iStillBurstCaptureInterval )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+
+                iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( 1 );
+                if ( iImageCountToCapture != 1 )
+                    {
+                    User::Leave( KErrGeneral );
+                    }
+                }
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+			    break;	
+		    }
+        }
+
+	else if ( iVideoRecordingOn )
+	    {
+        switch ( iAction )
+            {
+            case ESetDigiZoomWhenVideoRecording:
+                iAction = EDefault;
+                iCamAppEngine->SetZoomModeL( static_cast<CCaeEngine::TZoomMode>( iZoomMode ) );
+                iCamAppEngine->SetZoomValueL( iDigiZoomValue );
+                break;
+            case ESetBrightnessWhenVideoRecording:
+                iAction = EDefault;
+                iCamAppEngine->SetBrightnessL( iBrightness );
+                break;
+            case ESetContrastWhenVideoRecording:
+                iAction = EDefault;
+                iCamAppEngine->SetContrastL( iContrast );
+                break;
+            case ESetExposureModeWhenVideoRecording:
+                iAction = EDefault;
+                iCamAppEngine->SetExposureModeL( static_cast<CCamera::TExposure>( iExposureMode ) );
+                break;
+            case ESetEvCompensationWhenVideoRecording:
+                iAction = EDefault;
+                iCamAppEngine->SetEvCompensationL( iEvCompensation );
+                break;
+            case ESetWhiteBalanceModeWhenVideoRecording:
+                iAction = EDefault;
+                iCamAppEngine->SetWhiteBalanceModeL( static_cast<CCamera::TWhiteBalance>( iWhiteBalanceMode ) );
+                break;
+            case ESetFlashModeWhenVideoRecording:
+                iAction = EDefault;
+                iCamAppEngine->SetFlashModeL( static_cast<CCamera::TFlash>( iFlashMode ) );
+                break;
+            case ESetVideoTimesIntervalWhenVideoRecording:
+                iAction = EDefault;
+                iCamAppEngine->SetVideoTimesIntervalL( iVideoTimesInterval );
+                break;
+            case ESetClipMaxSizeWhenVideoRecording:
+                iAction = ENone;
+                iCamAppEngine->SetVideoClipMaxSizeL( iVideoMaxClipSizeInBytes );
+                break;
+            case ESetAudioWhenVideoRecording:
+                iAction = ENone;
+                iCamAppEngine->SetVideoAudioL( iVideoAudioEnabled );
+                break;
+            case ESetVideoFileNameWhenRecording:
+                iAction = EDefault;
+                iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
+                iStop = ETrue;
+                break;
+            case ESetVideoTimesIntervalWhenVideoPrepared:
+                iAction = ENone;
+                iVideoRecordingOn = EFalse;
+                iCamAppEngine->PauseVideoRecording();
+                break;
+
+            default:
+                iAction = ENone;
+                iVideoRecordingOn = EFalse;
+                iCamAppEngine->StopVideoRecording();
+                break;
+            }
+            
+        if ( iAction != ENone )
+            {
+            CTimer::After( iTimeout );
+            }
+	    }
+	else if ( iVideoRecordingPaused )
+	    {
+        iAction = ENone;
+        iVideoRecordingPaused = EFalse;
+        iCamAppEngine->ResumeVideoRecording();
+	    }
+	else if ( iVideoRecordingReady )
+	    {
+        // Check here if the settings were taken into use.
+        // (For settings with a get-method.)
+        switch ( iSavedAction )
+            {
+            case ESetDigiZoomWhenVideoPrepared:
+            case ESetDigiZoomWhenVideoRecording:
+                {
+                CCaeEngine::TZoomMode zoomMode = iCamAppEngine->ZoomMode();
+                if ( zoomMode != CCaeEngine::EZoomModeDigital )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                TInt zoomValue = iCamAppEngine->ZoomValue();
+                if ( zoomValue != iDigiZoomValue )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetBrightnessWhenVideoPrepared:
+            case ESetBrightnessWhenVideoRecording:
+                {
+                TInt brightness = iCamAppEngine->Brightness();
+                if ( brightness != iBrightness )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+
+                // Test poweroff case, brightness should be 0
+                iCamAppEngine->PowerOff();
+                brightness = iCamAppEngine->Brightness();
+                if ( brightness != 0 )
+                    {
+                    User::Leave ( KErrArgument );
+                    }
+                }
+                break;
+            case ESetContrastWhenVideoPrepared:
+            case ESetContrastWhenVideoRecording:
+                {
+                TInt contrast = iCamAppEngine->Contrast();
+                if ( contrast != iContrast )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetExposureModeWhenVideoPrepared:
+            case ESetExposureModeWhenVideoRecording:
+                {
+                TInt exposuremode = iCamAppEngine->ExposureMode();
+                if ( exposuremode != iExposureMode )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetEvCompensationWhenVideoPrepared:
+            case ESetEvCompensationWhenVideoRecording:
+                {
+                TInt evCompensation = iCamAppEngine->EvCompensation();
+                if ( evCompensation != iEvCompensation )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetWhiteBalanceModeWhenVideoPrepared:
+            case ESetWhiteBalanceModeWhenVideoRecording:
+                {
+                TInt whitebalancemode = iCamAppEngine->WhiteBalanceMode();
+                if ( whitebalancemode != iWhiteBalanceMode )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetFlashModeWhenVideoPrepared:
+            case ESetFlashModeWhenVideoRecording:
+                {
+                TInt flashmode = iCamAppEngine->FlashMode();
+                if ( flashmode != iFlashMode )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetClipMaxSizeWhenVideoNotPrepared:
+            case ESetClipMaxSizeWhenVideoPrepared:
+                {
+                TInt clipmaxsize = iCamAppEngine->VideoClipMaxSize();
+                if ( iVideoMaxClipSizeInBytes >= 0 )
+                    {
+                    if ( clipmaxsize != iVideoMaxClipSizeInBytes )
+                        {
+                        User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                        }
+                    }
+                else
+                    {
+                    if ( clipmaxsize != 0 )
+                        {
+                        User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                        }
+                    }
+                }
+                break;
+            case ESetAudioWhenVideoPrepared:
+                {
+                TBool audio = iCamAppEngine->VideoAudio();
+                if ( audio != iVideoAudioEnabled )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            case ESetVideoTimesIntervalWhenVideoPrepared:
+                {
+                TTimeIntervalMicroSeconds timesinterval = 
+                    iCamAppEngine->VideoTimesInterval();
+                if ( timesinterval != iVideoTimesInterval )
+                    {
+                    User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+                    }
+                }
+                break;
+            default:
+                break;
+            }
+
+		iAction = ENone;
+        iVideoRecordingReady = EFalse;
+        iStopViewFinder = ETrue;
+        CTimer::After( KNormalTimingDelay );
+
+	    }
+    else if ( !iStillCaptured && !iVideoRecorded && 
+              !iVideoRecordingOn && !iStopViewFinder ) 
+        {
+        switch ( iAction )
+		    {
+            case EStartVfPrepareCaptureStillStartAndStopVf:
+                if ( !iStillPrepareReady ) 
+                    {
+	                #ifdef _DEBUG
+                    RDebug::Print( _L( "Cae: CCaeTestSettingsClient: calling iCamAppEngine->PrepareStillCaptureL()" ) );
+                    #endif
+                    iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+                    }
+                break;
+            case EStartVfPrepareRecordVideoStartAndStopVf:
+                if ( !iVideoPrepareReady ) 
+                    {
+	                #ifdef _DEBUG
+                    RDebug::Print( _L( "Cae: CCaeTestSettingsClient: calling iCamAppEngine->PrepareVideoRecordingL()" ) );
+                    #endif
+                    iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex );
+                    }
+                break;
+            case ESwitchPowerOffWhenVfRunning:
+                iCamAppEngine->PowerOff();
+                iStopViewFinder = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            default:
+			    break;
+		    }
+        }
+	else if ( iStopViewFinder ) 
+        {
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestSettingsClient: calling iCamAppEngine->StopViewFinder()" ) );
+        #endif
+        iCamAppEngine->StopViewFinder();
+        iViewFinderStarted = EFalse;
+        iStop = ETrue;
+        CTimer::After( KNormalTimingDelay );
+        }
+	else if ( iExtensionMode ) 
+        {
+        switch ( iAction )
+		    {
+            case EProcessExtViewFinderFrameReady:
+            if ( !iBitmapSendDone && iBitmapSave )
+                {
+                // send the original bitmap to ext handling
+                // before sending the iBitmapSave bust be cleared because callback
+                // writes the handled bitmap back there
+                iBitmapSendDone = ETrue;
+                CFbsBitmap* tempBitmap = iBitmapSave;
+                iBitmapSave = NULL;
+                iCamAppEngine->ProcessExtViewFinderFrameReadyL( *tempBitmap );
+                // delete tempBitmap;
+                delete tempBitmap;
+                tempBitmap = NULL;
+                }
+            else if ( iBitmapSendDone )
+                {
+                // check that there is new handled bitmap
+                if ( !iBitmapSave )
+                    {
+            	    #ifdef _DEBUG
+                    RDebug::Print( _L( "Cae: CCaeTestSettingsClient: iBitmapSave not found after ProcessExtViewFinderFrameReadyL" ) );
+                    #endif
+                    User::Leave ( KErrNotFound );
+                    }
+                // all ok, set iAction to default to stop new VF frame copy and delete
+                // bitmap, return to normal mode and stop test case
+                iAction = EDefault;
+                delete iBitmapSave;
+                iBitmapSave = NULL;
+                iCamAppEngine->SetCaeExtensionModeL( EFalse, ETrue );
+                iExtensionMode = EFalse;
+                iBitmapSendDone = EFalse;
+                iStop = ETrue;
+                }
+
+                CTimer::After( KLongTimingDelay );
+                break;
+                
+            case EProcessExtSnapImage:
+            if ( !iBitmapSendDone && iBitmapSave )
+                {
+                // send the original snap bitmap to ext handling
+                // before sending the iBitmapSave bust be cleared because callback
+                // writes the handled bitmap back there
+                iBitmapSendDone = ETrue;
+                CFbsBitmap* tempBitmap = iBitmapSave;
+                iBitmapSave = NULL;
+                iCamAppEngine->ProcessExtSnapImageL( *tempBitmap );
+                // delete tempBitmap;
+                delete tempBitmap;
+                tempBitmap = NULL;
+                }
+            else if ( iBitmapSendDone )
+                {
+                // check that there is new handled bitmap
+                if ( !iBitmapSave )
+                    {
+            	    #ifdef _DEBUG
+                    RDebug::Print( _L( "Cae: CCaeTestSettingsClient: iBitmapSave not found after EProcessExtSnapImage" ) );
+                    #endif
+                    User::Leave ( KErrNotFound );
+                    }
+                // all ok, set iAction to default to stop new VF frame copy and delete
+                // bitmap, return to normal mode and stop test case
+                iAction = EDefault;
+                delete iBitmapSave;
+                iBitmapSave = NULL;
+                iCamAppEngine->SetCaeExtensionModeL( EFalse, ETrue );
+                iExtensionMode = EFalse;
+                iBitmapSendDone = EFalse;
+                iStop = ETrue;
+                CTimer::After( KLongTimingDelay );
+                }
+                break;
+                
+            case EProcessExtCapturedImage:
+            case EProcessExtCapturedImageTDesC8:
+		    case EProcessExtCapturedImageCFbsBitmap:
+            case EProcessExtCapturedImageNoInit:
+            if ( !iBitmapSendDone && iDataSave )
+                {
+                // send the original image to ext handling
+                // before sending the iDataSave must be cleared because callback
+                // writes the handled bitmap back there
+                // Note that iBitmapSendDone flag is used even though this there is no bitmap involved
+                iBitmapSendDone = ETrue;
+                HBufC8* tempData = iDataSave;
+                CleanupStack::PushL( tempData );
+                iDataSave = NULL;
+                if ( iAction == EProcessExtCapturedImage || iAction == EProcessExtCapturedImageNoInit)
+                    {
+                    // Test interface with HBufC8, CAE takes ownership of data
+                    iCamAppEngine->ProcessExtCapturedImageL( tempData, EFalse );
+                    }
+                else if ( iAction == EProcessExtCapturedImageTDesC8 )
+                    {
+                    // Test interface with TDesC8
+                    // Create new pointer
+                    TDesC8* tempDataDes = tempData;
+                    tempData = NULL;
+                    iCamAppEngine->ProcessExtCapturedImageL( *tempDataDes, EFalse );
+                    delete tempDataDes; // CAE makes own copy of this type
+                    tempDataDes = NULL;
+                    }
+                else if ( iAction == EProcessExtCapturedImageCFbsBitmap )
+                    {
+                    // Test interface with CFbsBitmap
+                    // Create new pointer
+
+                    CFbsBitmap* tempBitmap = iBitmapSave;
+                    CleanupStack::PushL( tempBitmap );
+                    iBitmapSave = NULL;
+                    delete tempData; // not used in this test case
+                    tempData = NULL;
+                    // CAE makes own copy of bitmap data (duplicate)
+                    iCamAppEngine->ProcessExtCapturedImageL( *tempBitmap, EFalse );
+                    CleanupStack::PopAndDestroy( tempBitmap );
+                    }
+                CleanupStack::Pop( /*tempData*/ );
+                }
+            else if ( iBitmapSendDone )
+                {
+                // check that there is new handled image
+                if ( !iDataSave )
+                    {
+            	    #ifdef _DEBUG
+                    RDebug::Print( _L( "Cae: CCaeTestSettingsClient: iDataSave not found after EProcessExtCapturedImage" ) );
+                    #endif
+                    User::Leave ( KErrNotFound );
+                    }
+                // all ok, set iAction to default to stop new VF frame copy and delete
+                // image data, return to normal mode and stop test case
+                iAction = EDefault;
+                delete iDataSave;
+                iDataSave = NULL;
+                iCamAppEngine->SetCaeExtensionModeL( EFalse, ETrue );
+                iExtensionMode = EFalse;
+                iBitmapSendDone = EFalse;
+                iStop = ETrue;
+                CTimer::After( KLongTimingDelay );
+                }
+                break;
+                
+            case EProcessExtCancel:
+                iCamAppEngine->ProcessExtCancel();
+                iAction = EDefault;
+                iCamAppEngine->SetCaeExtensionModeL( EFalse, ETrue );
+                iExtensionMode = EFalse;
+                iBitmapSendDone = EFalse;
+                iStop = ETrue;
+                CTimer::After( KLongTimingDelay );
+                break;
+            case EProcessExtCancel2:
+
+                if ( iDataSave )
+                    {
+                    // send the original image to ext handling
+                    iBitmapSendDone = ETrue;
+                    HBufC8* tempData = iDataSave;
+                    iDataSave = NULL;
+                    // Test interface with TDesC8
+                    TDesC8* tempDataDes = tempData;
+                    tempData = NULL;
+                    iCamAppEngine->ProcessExtCapturedImageL( *tempDataDes, EFalse );
+                    delete tempDataDes; // CAE makes own copy of this type
+                    tempDataDes = NULL;
+                    }
+                else
+                    {
+            	    #ifdef _DEBUG
+                    RDebug::Print( _L( "Cae: CCaeTestSettingsClient: iDataSave not found after EProcessExtCancel2" ) );
+                    #endif
+                    User::Leave ( KErrNotFound );
+                    }
+                
+                // Cancel image processing
+                iCamAppEngine->ProcessExtCancel();
+                
+                // return back to normal mode
+                iAction = EDefault;
+                delete iDataSave;
+                iDataSave = NULL;
+                iCamAppEngine->SetCaeExtensionModeL( EFalse, ETrue );
+                iExtensionMode = EFalse;
+                iBitmapSendDone = EFalse;
+                iStop = ETrue;
+                
+                // start timer as all activities are stopped
+                CTimer::After( KNormalTimingDelay );
+                break;
+
+            case EProcessExtCapturedImageBurst:
+            case EProcessExtCapturedImageBurstTDesC8:
+            if ( !iBitmapSendDone && iDataSave && iBitmapSave )
+                {
+                // send the original snap bitmap and image to ext handling
+                // before sending the iBitmapSave and iDataSave must be cleared because callback
+                // writes the handled bitmap back there
+
+                iBitmapSendDone = ETrue;
+                CFbsBitmap* tempBitmap = iBitmapSave;
+                iBitmapSave = NULL;
+                HBufC8* tempData = iDataSave;
+                iDataSave = NULL;
+              
+                // Change CAE state to burst mode
+                iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( iStillBurstLength );
+                iCountSnapImageReady = 0;  // Reset image counters
+                iCountStillImageReady = 0;
+                
+                // Send all burst snapimages and main images at once
+
+                for ( TInt i=0; i < iStillBurstLength; i++ )              
+                    {
+                    // Send bitmap
+                    iCamAppEngine->ProcessExtSnapImageL( *tempBitmap );
+                   
+                    // Copy main image
+                    HBufC8* msg =  HBufC8::NewL( tempData->Size());
+                    *msg = *tempData;
+
+                    // Send main image copy
+                    if ( iAction == EProcessExtCapturedImageBurst )
+                        {
+                        // Test interface with HBufC8
+                        iCamAppEngine->ProcessExtCapturedImageL( msg, i >= (iStillBurstLength - 1) );
+                        }
+                  else
+                        {
+                        // Test interface with TDesC8
+                        // Create new pointer
+                        TDesC8* tempDataDes = msg;
+                        msg = NULL;
+                        iCamAppEngine->ProcessExtCapturedImageL( *tempDataDes, i >= (iStillBurstLength - 1) );
+                        delete tempDataDes; // CAE makes own copy of this type
+                        tempDataDes = NULL;
+                        }
+                    }
+
+                delete tempBitmap;
+                tempBitmap = NULL;
+                delete tempData;
+                tempData = NULL;
+                }
+            else if ( iBitmapSendDone )
+                {
+                // check that there is at least one new handled image (snap + main)
+                //
+                if ( !iBitmapSave )
+                    {
+            	    #ifdef _DEBUG
+                    RDebug::Print( _L( "Cae: CCaeTestSettingsClient: iBitmapSave not found after EProcessExtCapturedImageBurst" ) );
+                    #endif
+                    User::Leave ( KErrNotFound );
+                    }
+                if ( !iDataSave )
+                    {
+            	    #ifdef _DEBUG
+                    RDebug::Print( _L( "Cae: CCaeTestSettingsClient: iDataSave not found after EProcessExtCapturedImageBurst" ) );
+                    #endif
+                    User::Leave ( KErrNotFound );
+                    }
+                // all ok, set iAction to default to stop new VF frame copy and delete
+                // image data, return to normal mode and stop test case
+                iAction = EDefault;
+                delete iBitmapSave;
+                iBitmapSave = NULL;
+                delete iDataSave;
+                iDataSave = NULL;
+                iCamAppEngine->SetCaeExtensionModeL( EFalse, ETrue );
+                iExtensionMode = EFalse;
+                iBitmapSendDone = EFalse;
+                iStop = ETrue;
+                CTimer::After( KLongTimingDelay );
+                }
+                break;
+
+            default:
+                break;
+		    }
+
+        }
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestSettingsClient::RunTrappedL() returning" ) );
+    #endif
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestStatesClient.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,1844 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestStatesClient.cpp
+*
+*/
+#include <fbs.h>
+#include <w32std.h>
+
+#include "CaeTestStatesClient.h"
+
+//_LIT8(KVideoMimeType, "video/3gpp");
+//_LIT(KVideoPreferredSupplier, "Nokia");
+//_LIT8(KVideoType, "video/H263-2000");
+//_LIT8(KVideoAudioType, " AMR");
+_LIT8(KVideoAudioTypeInv, " TOYOTA");
+const TUid KIllegalUidQltyLevels = {666};
+
+
+CCaeTestStatesClient::CCaeTestStatesClient() 
+    {
+    }
+
+
+CCaeTestStatesClient::~CCaeTestStatesClient()
+    {
+    }
+
+
+CCaeTestStatesClient* CCaeTestStatesClient::NewL()
+    {
+    CCaeTestStatesClient* self = new(ELeave) CCaeTestStatesClient;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+void CCaeTestStatesClient::ConstructL()
+    {
+    CCaeTestClient::ConstructL();
+
+    iRunWithViewFinder = EFalse;
+    }
+
+
+void CCaeTestStatesClient::RunTestActionL( TestClientActions aAction )
+    {
+
+    iAction = aAction;
+
+    iActionCycle = 0;
+
+    // Initialize all state variables.
+    InitStateVariables();
+
+    #ifdef CAE_TEST_VERSION
+    switch ( iAction )
+		{
+        case EEncodingError:
+            CaeSetMcaeseoHBufC8ImageReadyError( KErrAbort );
+            break;
+        case EDecodingError:
+            CaeSetMcaesdoCFbsBitmapImageReadyError( KErrAbort );
+            break;
+        case EPowerError:
+            CaeSetPowerOnCompleteError( KErrAbort );
+            break;
+        case EReserveError:
+            CaeSetReserveCompleteError( KErrAbort );
+            break;
+        case EStillCaptureError:
+            CaeSetImageReadyError( KErrAbort );
+            break;
+        case EVideoRecorderOpenError:
+            CaeSetMvruoOpenCompleteError( KErrAbort );
+            break;
+        case EVideoRecorderPrepareError:
+            CaeSetMvruoPrepareCompleteError( KErrAbort );
+            break;
+        case EVideoRecordingCompleteError:
+            CaeSetMvruoRecordCompleteError( KErrAbort );
+            break;
+        case EPrepareVideoSettingsError:
+            CaeSetPrepareVideoSettingsError( KErrAbort );
+            break;
+        case ESnapImageError:
+            CaeSetCreateAndDeliverSnapImageError( KErrAbort );
+            break;
+        case EStillImageError:
+            CaeSetCreateAndDeliverStillImageError( KErrAbort );
+            break;
+        case EStillConvertError1:
+            CaeSetConvertCFbsBitmapToHBufC8Error( KErrAbort );
+            break;
+        case EStillConvertError3:
+            CaeSetConvertHBufC8ToCFbsBitmapError( KErrAbort );
+            break;
+        case EStillConvertError2:
+            CaeSetStillConvertError( KErrAbort );
+            break;
+        default:
+            break;
+        }
+    #endif // CAE_TEST_VERSION
+
+
+    switch (iAction)
+        {
+    case ESetDisplayIndex:
+        {
+        delete iCamAppEngine;
+        iCamAppEngine = NULL;
+        iCamAppEngine = CCaeEngine::NewL( 0, iDisplayIndex );
+        iCamAppEngine->SetCamAppEngineObserver( *this );
+        iCamAppEngine->SetCaeStillBurstObserver( *this );
+	    iCamAppEngine->GetInfo( iInfo );
+        }
+        break;
+    case ESetCameraIndexLow:
+        {
+        delete iCamAppEngine;
+        iCamAppEngine = NULL;
+        iCamAppEngine = CCaeEngine::NewL( -1, iDisplayIndex );
+        iCamAppEngine->SetCamAppEngineObserver( *this );
+        iCamAppEngine->SetCaeStillBurstObserver( *this );
+	    iCamAppEngine->GetInfo( iInfo );
+        }
+        break;
+    case ESetCameraIndexHigh:
+        {
+        delete iCamAppEngine;
+        iCamAppEngine = NULL;
+        iCamAppEngine = CCaeEngine::NewL( 123456, iDisplayIndex );
+        iCamAppEngine->SetCamAppEngineObserver( *this );
+        iCamAppEngine->SetCaeStillBurstObserver( *this );
+	    iCamAppEngine->GetInfo( iInfo );
+        }
+        break;
+    case ESpecifiedPrepareAndCaptureStill2nd:
+        {
+        delete iCamAppEngine;
+        iCamAppEngine = NULL;
+        iCamAppEngine = CCaeEngine::NewL( 1 );
+        iCamAppEngine->SetCamAppEngineObserver( *this );
+        iCamAppEngine->SetCaeStillBurstObserver( *this );
+	    iCamAppEngine->GetInfo( iInfo );
+        }
+ 
+    default:
+        break;
+        }
+
+    
+// If interface after S60 2.1.
+#ifndef CAE_INTERFACE_21
+    if ( iAction != ESpecifiedPrepareAndCaptureStill &&
+        iAction != ESpecifiedPrepareAndRecordVideoNoInit )
+        {
+        // Normal case
+        // This starts operations and state changes.
+        if ( iCreateSnapImage ) 
+            {
+            iCamAppEngine->InitL();
+            }
+        else 
+            {
+            iCamAppEngine->InitL();
+            iCamAppEngine->SetSnapImageCreation( EFalse );
+            }
+        }
+    else if ( iAction == ESpecifiedPrepareAndCaptureStill ||
+            iAction == ESpecifiedPrepareAndCaptureStill2nd )
+        {
+        // 
+        // This starts operations and state changes.
+        if ( iCreateSnapImage ) 
+            {
+            iCamAppEngine->InitL( EFalse );
+            iCamAppEngine->SetSnapImageCreation( ETrue );
+            }
+        else 
+            {
+            iCamAppEngine->InitL( ETrue );
+            iCamAppEngine->SetSnapImageCreation( EFalse );
+            }
+        }
+    else if ( iAction == ESpecifiedPrepareAndRecordVideoNoInit )
+        {
+        // No CAE init here, used in 3.2 in case only CAE video features are used
+
+    	#ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTestActionL() reading cameraHandle" ) );
+        #endif
+
+        TInt cameraHandle = iCamAppEngine->CCameraHandle();
+
+    	#ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTestActionL() creating obs2 NewDuplicate2L cameraHandle=%d" ),cameraHandle );
+        #endif
+
+        // Create a new Camera API duplicate object, if supported
+        TRAPD( err, iCameraDup = CCamera::NewDuplicate2L( static_cast<MCameraObserver2&>(*this), cameraHandle ) );
+        if ( err )
+            {
+        	#ifdef _DEBUG
+            RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTestActionL() CCamera::NewDuplicate2L return code=%d" ), err ); 
+            #endif
+
+            // Create old Camera API duplicate object.
+            iCameraDup = CCamera::NewDuplicateL( static_cast<MCameraObserver&>(*this), cameraHandle );
+            }
+        else
+            {
+        	#ifdef _DEBUG
+            RDebug::Print( ( _L( "Cae: CCaeTestStatesClient::RunTestActionL() using duplicated MCameraObserver2" )) ); 
+            #endif
+            }
+
+    	#ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTestActionL() calling reserve iCameraDup=%x" ),iCameraDup );
+        #endif
+
+        iCameraDup->Reserve(); // Poweron called after this in reservecomplete
+
+        // Give C-API time to complete operation
+        User::After( 500000 );
+        
+    	#ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTestActionL() calling cae disable/enable videorecording" ) );
+        #endif
+
+        // Let CAE know that camera HW reservation is done,
+        // this will initialize some CAE flags so that video mode can be used
+        iCamAppEngine->DisableVideoRecording(); // Just to test release before reserve
+        iCamAppEngine->EnableVideoRecording(); // 
+        iCamAppEngine->DisableVideoRecording(); // test release 
+        iCamAppEngine->EnableVideoRecording(); // reserve again
+        iCamAppEngine->EnableVideoRecording(); // double reserve
+
+        } 
+#else   // CAE_INTERFACE_21
+        // This starts operations and state changes.
+        if ( iCreateSnapImage ) 
+            {
+            iCamAppEngine->InitL();
+            }
+        else 
+            {
+            iCamAppEngine->InitL( EFalse );
+            }
+#endif
+        
+	// Main part of program is a wait loop.
+	// This function completes when the scheduler stops.
+	CActiveScheduler::Start();
+    
+    if ( iError )
+        {
+    	#ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTestActionL() leaving (error detected)" ) );
+        #endif
+        User::Leave( iError );
+        }
+	
+    #ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTestActionL() returning" ) );
+    #endif
+    }
+
+
+void CCaeTestStatesClient::RunTrappedL()
+    {
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTrappedL() entering, iAction=%d" ),iAction );
+    #endif
+
+    // This is for timing critical cases
+    TTime currentTime; 
+    currentTime.HomeTime();
+    if ( iNextRunLTime.MicroSecondsFrom( currentTime ) > TTimeIntervalMicroSeconds(0) )
+        {
+        CTimer::At( iNextRunLTime );
+        return;
+        }
+
+    if ( iAction == ENone || iStop ) 
+        {
+        if ( iCamAppEngine->IsViewFinding() )
+	        {
+            iCamAppEngine->StopViewFinder();
+            iViewFinderStarted = EFalse;
+            }
+        iCamAppEngine->CancelCaptureStill();
+        iCancelCount++;
+        iCamAppEngine->CloseVideoRecording();
+        CActiveScheduler::Stop();
+        }
+    else if ( iInitReady ) 
+		{
+        iInitReady = EFalse;
+        iViewFinderStarted = EFalse;        
+
+        switch ( iAction )
+		    {
+            case EInit:
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case ECCameraHandle:
+                iStop = ETrue;
+                iCameraHandle = iCamAppEngine->CCameraHandle();
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EInitVideoRecorder:
+                iCamAppEngine->InitVideoRecorderL();
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EInitVideoRecorderWithUid:
+                iCamAppEngine->InitVideoRecorderL(KIllegalUidQltyLevels);
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case ESwitchPowerOnWhenInitialized:
+                if ( iStopWhenCompleted ) 
+                    {
+                    iStop = ETrue;
+                    CTimer::After( KNormalTimingDelay );
+                    }
+                else 
+                    {
+                    iStopWhenCompleted = ETrue;
+                    iInitReady = ETrue;
+                    iCamAppEngine->PowerOn();
+                    CTimer::After( KNormalTimingDelay );
+                    }
+                break;
+            case ESwitchPowerOffAndOn:
+                if ( iStopWhenCompleted ) 
+                    {
+                    iStop = ETrue;
+                    CTimer::After( KNormalTimingDelay );
+                    }
+                else if ( iPowerOn ) 
+                    {
+                    iCamAppEngine->PowerOff();
+                    iPowerOn = EFalse;
+                    iInitReady = ETrue;
+                    CTimer::After( KNormalTimingDelay );
+                    }
+                else 
+                    {
+                    iStopWhenCompleted = ETrue;
+                    iCamAppEngine->PowerOn();
+                    }
+                break;
+            case EPowerOffPowerOff:
+                iCamAppEngine->PowerOff();
+                iCamAppEngine->PowerOff();
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EStartVfWhenPowerOff:
+                iCamAppEngine->PowerOff();
+                iViewFindingUsed = ETrue;
+                iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize );
+                if( iCamAppEngine->IsViewFinding() )
+                    {
+                    User::Leave ( KErrGeneral );
+                    }
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay ); // Give some time for all Active objects to react to this command.
+                break;
+            case ERelease:
+                iCamAppEngine->Release();
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EReleaseRelease:
+                iCamAppEngine->Release();
+                iCamAppEngine->Release();
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EReserveReserve:
+                iCamAppEngine->Reserve();
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay ); // needed because this Reserve after InitL does do nothing (no call-back)
+                break;
+            case EReleaseReserve:
+                if ( iStopWhenCompleted ) 
+                    {
+                    iStop = ETrue;
+                    CTimer::After( KNormalTimingDelay );
+                    }
+                else if ( iPowerOn ) 
+                    {
+                    iCamAppEngine->Release();
+                    iPowerOn = EFalse;
+                    iInitReady = ETrue;
+                    CTimer::After( KNormalTimingDelay );
+                    }
+                else 
+                    {
+                    iStopWhenCompleted = ETrue;
+                    iCamAppEngine->Reserve();
+                    }
+                break;
+            case EReleaseReserveCapture:
+                if ( iContinueWhenCompleted ) 
+                    {
+                    iStillPrepareReady = EFalse;
+                    iVideoPrepareReady = EFalse;
+                    iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+                    }
+                else if ( iPowerOn ) 
+                    {
+                    iCamAppEngine->Release();
+                    iPowerOn = EFalse;
+                    iInitReady = ETrue;
+                    CTimer::After( KNormalTimingDelay );
+                    }
+                else 
+                    {
+                    iContinueWhenCompleted = ETrue;
+                    iCamAppEngine->Reserve();
+                    }
+                break;
+            case EReleaseReserveRecord:
+                if ( iContinueWhenCompleted ) 
+                    {
+                    iStillPrepareReady = EFalse;
+                    iVideoPrepareReady = EFalse;
+                    iCamAppEngine->InitVideoRecorderL();
+                    iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
+                    iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex );
+                    }
+                else if ( iPowerOn ) 
+                    {
+                    iCamAppEngine->Release();
+                    iPowerOn = EFalse;
+                    iInitReady = ETrue;
+                    CTimer::After( KNormalTimingDelay );
+                    }
+                else 
+                    {
+                    iContinueWhenCompleted = ETrue;
+                    iCamAppEngine->Reserve();
+                    }
+                break;
+            case EStartVideoRecordingWhenInitialized:
+                iCamAppEngine->StartVideoRecording();
+                break;
+            case EStopVideoRecordingWhenInitialized:
+                iCamAppEngine->StopVideoRecording();
+                break;
+            case EGetStillQualityIndexWhenEngineInitialized:
+                {
+                TInt stillQualityIndex = iCamAppEngine->StillQualityIndex();
+                if ( stillQualityIndex != -1 ) 
+                    {
+                    User::Leave( KErrGeneral );
+                    }
+                }
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EGetVideoQualityIndexWhenEngineInitialized:
+                {
+                TInt videoQualityIndex = iCamAppEngine->VideoQualityIndex();
+                if ( videoQualityIndex != -1 ) 
+                    {
+                    User::Leave( KErrGeneral );
+                    }
+                }
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EEnumerateCaptureSizes:
+                {
+                TSize stillFrameSize;
+                // Tests to get the largest image size (index value 0).
+                iCamAppEngine->EnumerateStillCaptureSizes( stillFrameSize, 0, iStillDataFormat );
+                if ( stillFrameSize != iStillFrameSize )
+                    {
+                    #ifdef _DEBUG
+                    RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTrappedL() got stillFrameSize w=%d, h=%d, leaving -2" ), stillFrameSize.iWidth, stillFrameSize.iHeight );
+                    #endif
+                    
+                    User::Leave( KErrGeneral );
+                    }
+                }
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EPrepareStillCapturing:
+            case EPrepareStillCapturingWhenPrepared:
+            case EPrepareAndCaptureStill:
+            case EPrepareAndCaptureAndCancelStill:
+            case EPrepareAndCaptureAndCancelStillAtSnap:
+            // Burst
+            case EPrepareAndCaptureStillBurst:
+            case EPrepareAndCaptureStillBurstCaptureStill:
+            case EPrepareAndCaptureAndCancelStillBurst:
+            case EPrepareAndCaptureAndCancelStillBurstAtMoment:
+            case EPrepareAndCaptureAndCancelStillBurstAtSnap:
+            case EPrepareAndCaptureAndStopStillBurst:
+            case EPrepareAndCaptureCaptureStillBurst:
+            // 
+            case EStartAndStopVfWhenStillPreparedAndCaptured:
+            case ECaptureCapture:
+            case ECaptureRecord:
+            case ESwitchPowerOnWhenStillPrepared:
+            case ESwitchPowerOffWhenStillPrepared:
+            case EGetStillQualityIndexWhenPrepared:
+            case EEncodingError:
+            case EStillCaptureError:
+            case EStillConvertError1:
+            case EStillConvertError2:
+            case EStillConvertError3:
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+			    break;
+            case EPrepareCroppedStillCapturing:
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                {
+                TRect cropRect; 
+                iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex, cropRect );
+                }
+			    break;
+            case EPrepareStillCaptureWhenPowerOff:
+                iCamAppEngine->PowerOff();
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+			    break;
+            case EPrepareVideoRecording:
+            case EPrepareVideoRecordingWhenPrepared:
+            case EPrepareAndRecordVideo:
+            case EStartAndStopVfWhenVideoPreparedAndRecorded:
+            case ERecordRecord:
+            case ERecordCapture:
+            case ERecordCaptureComplexSequence1:
+            case ERecordCaptureComplexSequence2:
+            case ESwitchPowerOnWhenVideoPrepared:
+            case ESwitchPowerOffWhenVideoPrepared:
+            case ESwitchPowerOnWhenRecordingVideo:
+            case ESwitchPowerOffWhenRecordingVideo:
+            case EStartVideoRecordingWhenRecording:
+            case EStopVideoRecordingWhenPrepared:
+            case EPauseVideoWhenPrepared:
+            case EResumeVideoWhenPrepared:
+            case EResumeVideoWhenNotPaused:
+            case EPrepareRecordPauseStopVideo:
+            case EPrepareRecordPauseResumeStopVideo:
+            case EPrepareRecordPausePauseStopVideo:
+            case EGetVideoQualityIndexWhenPrepared:
+            case ERemainingTimeWhenVideoPrepared:
+            case EVideoRecorderOpenError:
+            case EVideoRecorderPrepareError:
+            case EVideoRecordingCompleteError:
+            case EPrepareVideoSettingsError:
+            case EPrepareStillCaptureWhenRecording:
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                iCamAppEngine->InitVideoRecorderL();
+                iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
+                iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex );
+			    break;
+            case ESpecifiedPrepareStill:
+            case ESpecPrepCaptureCapture:
+            case ESpecifiedPrepareStillWhenPrepared:
+            case ESpecifiedPrepareAndCaptureStill:
+            case ESpecifiedPrepareAndCaptureStill2nd:
+            case EPrepareAndCaptureStillBurstExif:
+            case EPrepareAndCaptureAndCancelStillBurstExif:
+            case EStartVfPrepareCaptureStillStartAndStopVfExif:
+            case EStillImageError:
+		    case ESetDisplayIndex:
+            // Burst
+            case ESpecPrepAndCaptureStillBurst:
+            case ESpecPrepAndCaptureCaptureStillBurst:
+            case ESpecPrepAndCaptureStillBurstCaptureStill:
+            // "Destroy Engine"
+            case EDestroyEngineWhenStillPrepareReady:
+            case EDestroyEngineWhenSnapImageReady:
+            case EDestroyEngineWhenStillCaptureReady:
+            case EDestroyEngineWhenStillBurstReady:
+            case EDestroyEngineWhenSnapImageReadyInStillBurst:
+            case EDestroyEngineWhenStillImageReadyInStillBurst:
+            case ECaptureStillSetSnapSizeExif:
+            case ECaptureStillAfterPowerOff:
+            case ECaptureStillAfterPowerOffOn:
+            case ESnapImageError:
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                iCamAppEngine->PrepareStillCaptureL( iStillFrameSize, 
+                                                     iStillDataFormat, 
+                                                     iStillCompressionQuality );
+			    break;
+			case EStartVfPrepareCaptureStillStartAndStopVfSnapExif:
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                iCamAppEngine->PrepareStillCaptureL( iStillFrameSize, 
+                                                     iStillDataFormat, 
+                                                     iStillCompressionQuality,
+													 iCropRect,
+													 iSnapImageSize);
+			    break;
+            case ECaptureStillSetSnapColorModeExif:
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                iCamAppEngine->PrepareStillCaptureL( iStillFrameSize, 
+                                                     iStillDataFormat, 
+                                                     iStillCompressionQuality );
+				iCamAppEngine->SetSnapImageColorMode( EColor16M );
+			    break;
+            case ESpecifiedPrepareVideo: 
+            case ESpecifiedPrepareVideoWhenPrepared: 
+            case ESpecifiedPrepareAndRecordVideo: 
+            case ESpecifiedPrepareAndRecordVideoNoInit: 
+            // "Destroy Engine"
+            case EDestroyEngineWhenVideoPrepareReady:
+            case EDestroyEngineWhenVideoRecordingOn:
+            case EDestroyEngineWhenVideoRecordingPaused:
+            case EDestroyEngineWhenVideoRecordingReady:
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                iCamAppEngine->InitVideoRecorderL();
+                iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
+                {
+                iCamAppEngine->PrepareVideoRecordingL( iVideoFrameSize, 
+                                                       iVideoFrameRate, 
+                                                       iVideoBitRate, 
+                                                       iVideoAudioEnabled, 
+                                                       *iMimeTypeSet[iVideoCodecSet], 
+                                                       *iPreferredSupplierSet[iVideoCodecSet],
+                                                       *iVideoTypeSet[iVideoCodecSet], 
+                                                       *iAudioTypeSet[iVideoCodecSet] );
+                }
+			    break;
+            case ESpecifiedPrepareAudioBrAndRecordVideo:
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                iCamAppEngine->InitVideoRecorderL();
+                iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
+                {
+                iCamAppEngine->PrepareVideoRecordingL( iVideoFrameSize, 
+                                                       iVideoFrameRate, 
+                                                       iVideoBitRate, 
+                                                       iVideoAudioEnabled,
+                                                       iAudioBitRate,
+                                                       *iMimeTypeSet[iVideoCodecSet], 
+                                                       *iPreferredSupplierSet[iVideoCodecSet],
+                                                       *iVideoTypeSet[iVideoCodecSet], 
+                                                       *iAudioTypeSet[iVideoCodecSet] );
+                }
+			    break;
+            case ESpecifiedPrepareAudioBrAndRecordVideoAT0:
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                iCamAppEngine->InitVideoRecorderL();
+                iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
+                {
+                const TDesC8& audioType = KNullDesC8;
+                iCamAppEngine->PrepareVideoRecordingL( iVideoFrameSize, 
+                                                       iVideoFrameRate, 
+                                                       iVideoBitRate, 
+                                                       iVideoAudioEnabled,
+                                                       iAudioBitRate,
+                                                       *iMimeTypeSet[iVideoCodecSet], 
+                                                       *iPreferredSupplierSet[iVideoCodecSet],
+                                                       *iVideoTypeSet[iVideoCodecSet], 
+                                                       audioType );
+                }
+			    break;
+            case ESpecifiedPrepareAudioBrAndRecordVideoATInv:
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                iCamAppEngine->InitVideoRecorderL();
+                iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
+                {
+                const TDesC8& audioType = KVideoAudioTypeInv;
+                iCamAppEngine->PrepareVideoRecordingL( iVideoFrameSize, 
+                                                       iVideoFrameRate, 
+                                                       iVideoBitRate, 
+                                                       iVideoAudioEnabled,
+                                                       iAudioBitRate,
+                                                       *iMimeTypeSet[iVideoCodecSet], 
+                                                       *iPreferredSupplierSet[iVideoCodecSet],
+                                                       *iVideoTypeSet[iVideoCodecSet], 
+                                                       audioType );
+                }
+			    break;
+            case EStartAndStopVf:  
+                iViewFindingUsed = ETrue;
+                iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize );
+                // Test IsViewFinding()
+                if ( !iCamAppEngine->IsViewFinding() )
+                    {
+                    User::Leave( KErrGeneral );
+                    }
+                iStopViewFinder = ETrue;
+                CTimer::After( iTimeout );
+                break;
+            case EStartAndStopCroppedVf:  
+                iViewFindingUsed = ETrue;
+                {
+                TRect emptyRect;
+                iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize, emptyRect );
+                }
+                // Test IsViewFinding()
+                if ( !iCamAppEngine->IsViewFinding() )
+                    {
+                    User::Leave( KErrGeneral );
+                    }
+                iStopViewFinder = ETrue;
+                CTimer::After( iTimeout );
+                break;
+            case EStartAndStopDirectVf:  
+                iViewFindingUsed = ETrue;
+                {
+                RWsSession*      wsSession = NULL;
+                CWsScreenDevice* wsScreenDevice = NULL;
+                RWindowBase*     windowBase = NULL;
+                TRect*           tRect = NULL;
+                iCamAppEngine->StartViewFinderDirectL( *wsSession,
+                                                       *wsScreenDevice,
+                                                       *windowBase,
+                                                       *tRect);
+                }
+                // Test IsViewFinding()
+                if ( !iCamAppEngine->IsViewFinding() )
+                    {
+                    User::Leave( KErrGeneral );
+                    }
+                iStopViewFinder = ETrue;
+                CTimer::After( iTimeout );
+                break;
+            case EStartAndStopCroppedDirectVf:  
+                iViewFindingUsed = ETrue;
+                {
+                RWsSession*      wsSession = NULL;
+                CWsScreenDevice* wsScreenDevice = NULL;
+                RWindowBase*     windowBase = NULL;
+                TRect*           screenRect = NULL;
+                TRect*           cropRect = NULL;
+                iCamAppEngine->StartViewFinderDirectL( *wsSession,
+                                                       *wsScreenDevice,
+                                                       *windowBase,
+                                                       *screenRect,
+                                                       *cropRect );
+                }
+                // Test IsViewFinding()
+                if ( !iCamAppEngine->IsViewFinding() )
+                    {
+                    User::Leave( KErrGeneral );
+                    }
+                iStopViewFinder = ETrue;
+                CTimer::After( iTimeout );
+                break;
+            case ESwitchPowerOffWhenVfRunning:
+                iViewFindingUsed = ETrue;
+                iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize );
+                CTimer::After( iTimeout );
+                break;
+            case EStartVfPrepareCaptureStillStartAndStopVf:
+            case EStartVfPrepareRecordVideoStartAndStopVf:
+            case ESetColorToneVideoRecording:
+                iViewFindingUsed = ETrue;
+                iCamAppEngine->InitVideoRecorderL();
+                iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
+                iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize );
+                CTimer::After( 500000 );
+                break;
+            case EIsVideoRecordingWhenPrepared:
+                break;
+            case ECaptureStillWhenEngineInitialized:
+                iCamAppEngine->CaptureStill();
+                break;
+            case ECancelCaptureStillWhenInitialized:
+                iCamAppEngine->CancelCaptureStill();
+                iCancelCount++;
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;            
+            case EStartVfStartVf:
+                iViewFindingUsed = ETrue;
+                iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize );
+                iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize );
+                iStopViewFinder = ETrue;
+                CTimer::After( iTimeout );
+                break;
+                
+// If interface after S60 2.1.
+#ifndef CAE_INTERFACE_21
+            case EGetCustomInterface:
+                iCustomInterfacePointer = iCamAppEngine->CustomInterface( iCustomInterfaceUid );
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case ESetColorTone:
+            case ESetColorToneWrongParams:
+            case ESetColorToneRelease:
+                if ( iAction == ESetColorToneRelease && iReleaseDone )
+                    {
+                    // Do the Reserve, note that engine will call
+                    // CCaeTestClient::McaeoInitComplete when camera is ready
+                    iReleaseDone = EFalse;
+                    iReserveDone = ETrue;
+                    iInitReady   = ETrue; // continue in this case on next run
+                    iCamAppEngine->Reserve();
+                    // No timer call here, McaeoInitComplete does it
+                    }
+                else if ( iAction == ESetColorToneRelease && iReserveDone )
+                    {
+                    // state flags to defaults, release/reserve is done now
+                    iReleaseDone = EFalse;
+                    iReserveDone = EFalse;
+
+                    // Verify that settings are reset to default after reserve
+                    MCameraColorToneSettings* CTptr = NULL;
+                    CTptr = static_cast<MCameraColorToneSettings*> ( iCustomInterfacePointer );
+                    if ( CTptr->ColorTone() != MCameraColorToneSettings::ENormal )
+                        {
+                    	    #ifdef _DEBUG
+                            RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTrappedL() Error:ColorTone settings not reset after release()" ));
+                            #endif
+                            iStop = ETrue;
+                            CTimer::After( KNormalTimingDelay );
+                        }
+                    else
+                        {
+                        // all ok, capture a picture and verify manually normal settings
+                        iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+                        }
+                    }
+                else
+                    {
+                    iCustomInterfacePointer = iCamAppEngine->CustomInterface( iCustomInterfaceUid );
+                    if ( !iCustomInterfacePointer )
+                        {               // Interface not supported, exit test case
+                	    #ifdef _DEBUG
+                        RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTrappedL() CustomInterface returns 0 for uid %x" ), iCustomInterfaceUid.iUid );
+                        #endif
+                        iStop = ETrue;
+                        CTimer::After( KNormalTimingDelay );
+                        }
+                    else
+                        {
+                        MCameraColorToneSettings* CTptr = NULL;
+                        TUint32 supportedCT = 0 ;
+
+                        // cast the TAny pointer to the real color tone interface pointer and
+                        // read the bitmap of supported color tones
+                        CTptr = static_cast<MCameraColorToneSettings*> ( iCustomInterfacePointer );
+                        supportedCT = CTptr->SupportedColorTones();
+
+                        // Check that given parameter is supported by the interface
+                        if ( (iColorToneValue & supportedCT) ||
+                            iColorToneValue == MCameraColorToneSettings::ENormal ||
+                            iAction == ESetColorToneWrongParams)
+                            {
+                            // then set the new color tone and verify that it has been set
+                            CTptr->SetColorToneL( iColorToneValue );
+                            if ( CTptr->ColorTone() == iColorToneValue )
+                                {
+                                if ( iAction == ESetColorToneRelease )
+                                    {
+                                    // Do now release and then on next run the reserve
+                                    iCamAppEngine->Release();
+                                    iReleaseDone = ETrue;
+                                    iReserveDone = EFalse;
+                                    iInitReady   = ETrue; // this keeps the same switch active
+                                    CTimer::After( KNormalTimingDelay );
+                                    }
+                                else
+                                    {
+                                    // all ok, capture a picture and verify manually changes
+                                    iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+                                    }
+                                }
+                            else // Value not set
+                                {
+                            	#ifdef _DEBUG
+                                RDebug::Print( _L( "Cae: ESetColorTone: color iColorToneValue not set to: %d" ), iColorToneValue );
+                                #endif
+                                iStop = ETrue;
+                                CTimer::After( KNormalTimingDelay );
+                                }
+                            }
+                        else // Value not supported
+                            {
+                       	    #ifdef _DEBUG
+                            RDebug::Print( _L( "Cae: ESetColorTone: color iColorToneValue not supported: %d" ), iColorToneValue );
+                            #endif
+                            iStop = ETrue;
+                            CTimer::After( KNormalTimingDelay );
+                            }
+                        }
+                    }
+                break;
+#endif
+            case ERemainingTimeWhenVideoNotInitialized:
+                {
+                iAction = ENone;
+                TTimeIntervalMicroSeconds zeroRemainingTime( 0 );
+                TTimeIntervalMicroSeconds remainingTime( 1 );
+                remainingTime = iCamAppEngine->RemainingVideoRecordingTime();
+                if ( remainingTime != zeroRemainingTime )
+                    {
+                    User::Leave( KErrArgument );
+                    }
+                CTimer::After( KNormalTimingDelay );
+                }
+                break;
+            default:
+			    break;
+		    }
+		}
+    else if ( iStillPrepareReady ) 
+		{
+        
+        if ( iRunWithViewFinder && !iCamAppEngine->IsViewFinding() )
+	        {
+            iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize );
+            User::After( 1000000 ); // Give some time for camera drivers to settle.
+            }
+
+        iStillPrepareReady = EFalse;
+
+		TBool capture = EFalse;
+
+		switch ( iAction )
+			{
+            case ESwitchPowerOnWhenStillPrepared:
+                iAction = ENone;
+                iCamAppEngine->PowerOn();
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case ESwitchPowerOffWhenStillPrepared:
+                iAction = ENone;
+                iCamAppEngine->PowerOff();
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EGetStillQualityIndexWhenPrepared:
+                {
+                TInt stillQualityIndex = iCamAppEngine->StillQualityIndex();
+                if ( stillQualityIndex != iStillQualityLevelIndex ) 
+                    {
+                    User::Leave( KErrGeneral );
+                    }
+                }
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EStartStillOpModeStopVf:
+                iStopViewFinder = ETrue;
+                CTimer::After( iTimeout );
+                break;
+            case ESpecifiedPrepareStill:
+            case EPrepareStillCapturing:
+                iAction = ENone;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EPrepareStillCapturingWhenPrepared:
+                if ( iStopWhenCompleted ) 
+                    {
+                    iStop = ETrue;
+                    CTimer::After( KNormalTimingDelay );
+                    }
+                else 
+                    {
+                    iStopWhenCompleted = ETrue;
+                    iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+                    }
+                break;
+            case ESpecifiedPrepareStillWhenPrepared:
+                if ( iStopWhenCompleted ) 
+                    {
+                    iStop = ETrue;
+                    CTimer::After( KNormalTimingDelay );
+                    }
+                else 
+                    {
+                    iStopWhenCompleted = ETrue;
+                    iCamAppEngine->PrepareStillCaptureL( iStillFrameSize, 
+                                                         iStillDataFormat, 
+                                                         iStillCompressionQuality );
+                    }
+                break;
+            // Burst
+            case EPrepareAndCaptureStillBurst:
+            case EPrepareAndCaptureStillBurstExif:
+            case EPrepareAndCaptureAndCancelStillBurstExif:
+            case ESpecPrepAndCaptureStillBurst:
+            case EPrepareAndCaptureAndCancelStillBurst:
+            case EPrepareAndCaptureAndCancelStillBurstAtMoment:
+            case EPrepareAndCaptureAndCancelStillBurstAtSnap:
+            case EPrepareAndCaptureAndStopStillBurst:
+            case EPrepareAndCaptureCaptureStillBurst:
+            case ESpecPrepAndCaptureCaptureStillBurst:
+            case EPrepareAndCaptureStillBurstCaptureStill:
+            case ESpecPrepAndCaptureStillBurstCaptureStill:
+            case EDestroyEngineWhenStillBurstReady:
+            case EDestroyEngineWhenSnapImageReadyInStillBurst:
+            case EDestroyEngineWhenStillImageReadyInStillBurst:
+                if ( iImageCountToCapture == 1 ) 
+                    {
+                    iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( iStillBurstLength );
+                    }
+                if ( iSnapImageSource != CCaeEngine::ESnapImageSourceOriginal )
+                    {
+                    iCamAppEngine->SetSnapImageSourceL( iSnapImageSource );
+                    }
+                capture = ETrue;
+                break;
+			case ECaptureStillSetSnapSizeExif:
+				iCamAppEngine->SetSnapImageSizeL( iSnapImageSize );
+                capture = ETrue;
+			    break;
+            case ECaptureStillAfterPowerOff:
+				iCamAppEngine->PowerOff();
+                capture = ETrue;
+                iStop = ETrue;  // Engine cancels capture if power is not on
+                CTimer::After( KNormalTimingDelay );
+			    break;
+            case ECaptureStillAfterPowerOffOn:
+                if ( iStopWhenCompleted ) 
+                    {
+                    if ( iCountStillPrepareComplete <= 1 )
+                        {
+                        iCamAppEngine->PrepareStillCaptureL( iStillFrameSize, 
+                                                             iStillDataFormat, 
+                                                             iStillCompressionQuality );
+                        }
+                    else
+                        {
+                        capture = ETrue;
+                        }
+                    //CTimer::After( KNormalTimingDelay );
+                    }
+                else if ( iPowerOn ) 
+                    {
+                    iCamAppEngine->PowerOff();
+                    iPowerOn = EFalse;
+                    iStillPrepareReady = ETrue; // come back here on next run
+                    CTimer::After( KLongTimingDelay );
+                    }
+                else 
+                    {
+                    iStopWhenCompleted = ETrue;
+                    iCamAppEngine->PowerOn();
+                    iStillPrepareReady = ETrue; // come back here on next run
+//                    CTimer::After( KLongTimingDelay*100 );
+                    }
+			    break;
+			case EDestroyEngineWhenStillPrepareReady:
+                delete iCamAppEngine;
+                iCamAppEngine = NULL;
+                CActiveScheduler::Stop();
+			    break;
+			default:
+                capture = ETrue;
+                break;
+			}
+        
+        // Special treatments for some specific test actions:
+        switch ( iAction ) 
+            {
+            case EPrepareAndCaptureAndStopStillBurst:
+                iStopStillBurst = ETrue;
+                break;
+            case EPrepareAndCaptureAndCancelStillBurstAtMoment:
+                iCancelStillBurst = ETrue;
+                break;
+            case EPrepareAndCaptureAndCancelStillBurstExif:
+				// Cancel still burst after next view finder frame
+                iCancelStillBurstAfterVfFrame = ETrue; 
+                break;
+            case EPrepareAndCaptureAndCancelStillAtSnap:
+                iRunlForSnapImage = ETrue;
+                // Added delay so that the encoder has always time to finish before the next RunTrappedL.
+                // Before is was not so deterministic.
+                iNextRunLTime.HomeTime();
+                iNextRunLTime += TTimeIntervalMicroSeconds32(KLongTimingDelay*1000);
+                break;  
+            case EPrepareAndCaptureAndCancelStillBurstAtSnap:
+            case EDestroyEngineWhenSnapImageReady:
+            case EDestroyEngineWhenSnapImageReadyInStillBurst:
+                iRunlForSnapImage = ETrue;
+                break;
+            case EDestroyEngineWhenStillImageReadyInStillBurst:
+                iRunlForStillImage = ETrue; 
+                break;
+            default:
+                break;               
+            }
+        
+        // Capture still if requested for the test action.
+        if ( capture )
+			{
+            iStillCaptureReady = EFalse;
+            iStillCapturingOn = ETrue;
+            iStillCaptured = ETrue;
+	        #ifdef _DEBUG
+            RDebug::Print( _L( "Cae: CCaeTestStatesClient: calling iCamAppEngine->CaptureStill()" ) );
+            #endif
+			iCamAppEngine->CaptureStill();
+			}
+
+        if ( iAction == EPrepareAndCaptureAndCancelStill || 
+             iAction == EPrepareAndCaptureAndCancelStillBurst )
+            {
+            iCamAppEngine->CancelCaptureStill();
+            iCancelCount++;
+            iStop = ETrue;
+            CTimer::After( KNormalTimingDelay );
+            }
+
+		}
+    else if ( iVideoPrepareReady ) 
+		{
+
+        if ( iRunWithViewFinder && !iCamAppEngine->IsViewFinding() )
+	        {
+            iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize );
+            User::After( 1000000 ); // Give some time for camera drivers to settle.
+            }
+
+        iVideoPrepareReady = EFalse;
+
+        TBool record = EFalse;
+
+		switch ( iAction )
+			{
+            case ESwitchPowerOnWhenVideoPrepared:
+                iAction = ENone;
+                iCamAppEngine->PowerOn();
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case ESwitchPowerOffWhenVideoPrepared:
+                iAction = ENone;
+                iCamAppEngine->PowerOff();
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EGetVideoQualityIndexWhenPrepared:
+                {
+                TInt videoQualityIndex = iCamAppEngine->VideoQualityIndex();
+                if ( videoQualityIndex != iVideoQualityLevelIndex ) 
+                    {
+                    User::Leave( KErrGeneral );
+                    }
+                }
+                iStop = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EPrepareVideoRecording:
+            case ESpecifiedPrepareVideo:
+                iAction = ENone;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EPrepareVideoRecordingWhenPrepared:
+                if ( iStopWhenCompleted ) 
+                    {
+                    iStop = ETrue;
+                    CTimer::After( KNormalTimingDelay );
+                    }
+                else 
+                    {
+                    iStopWhenCompleted = ETrue;
+                    iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex );
+                    }
+                break;
+            case ESpecifiedPrepareVideoWhenPrepared:
+                if ( iStopWhenCompleted ) 
+                    {
+                    iStop = ETrue;
+                    CTimer::After( KNormalTimingDelay );
+                    }
+                else 
+                    {
+                    iStopWhenCompleted = ETrue;
+                    iCamAppEngine->PrepareVideoRecordingL( iVideoFrameSize, 
+                                                           iVideoFrameRate, 
+                                                           iVideoBitRate, 
+                                                           iVideoAudioEnabled, 
+                                                           *iMimeTypeSet[iVideoCodecSet], 
+                                                           *iPreferredSupplierSet[iVideoCodecSet],
+                                                           *iVideoTypeSet[iVideoCodecSet], 
+                                                           *iAudioTypeSet[iVideoCodecSet] );
+                    }
+                break;
+            case EPauseVideoWhenPrepared:
+                iCamAppEngine->PauseVideoRecording();
+                break;
+            case EResumeVideoWhenPrepared:
+                iCamAppEngine->ResumeVideoRecording();
+                break;
+            case EStopVideoRecordingWhenPrepared:
+                iCamAppEngine->StopVideoRecording();
+                break;
+            case EStartVideoOpModeStopVf:
+                iStopViewFinder = ETrue;
+                CTimer::After( iTimeout );
+                break;
+            case EIsVideoRecordingWhenPrepared:
+                iAction = ENone;
+                {
+                TBool isRecording = iCamAppEngine->IsVideoRecording();
+                if ( isRecording ) 
+                    {
+                    User::Leave ( KErrGeneral );
+                    }
+                }
+                break;
+            case ERemainingTimeWhenVideoPrepared:
+                {
+                iAction = ENone;
+                TTimeIntervalMicroSeconds remainingTime( 0 );
+                remainingTime = iCamAppEngine->RemainingVideoRecordingTime();
+                CTimer::After( KNormalTimingDelay );
+                }
+                break;
+			case EDestroyEngineWhenVideoPrepareReady:
+                delete iCamAppEngine;
+                iCamAppEngine = NULL;
+                CActiveScheduler::Stop();
+			    break;
+			    
+// If interface after S60 2.1.
+#ifndef CAE_INTERFACE_21
+            case ESetColorToneVideoRecording:
+                iCustomInterfacePointer = iCamAppEngine->CustomInterface( iCustomInterfaceUid );
+                if ( !iCustomInterfacePointer )
+                    {               // Interface not supported, exit test case
+            	    #ifdef _DEBUG
+                    RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTrappedL() CustomInterface returns 0 for uid %x" ), iCustomInterfaceUid.iUid );
+                    #endif
+                    iStop = ETrue;
+                    CTimer::After( KNormalTimingDelay );
+                    }
+                else
+                    {
+                    MCameraColorToneSettings* CTptr = NULL;
+
+                    // cast the TAny pointer to the real color tone interface pointer and
+                    // read the bitfield of supported color tones. All of them are tested once.
+                    CTptr = static_cast<MCameraColorToneSettings*> ( iCustomInterfacePointer );
+                    iTestedColorTones = CTptr->SupportedColorTones();
+                    record = ETrue;
+                    }
+				break;
+#endif
+            default:
+                record = ETrue;
+				break;
+			}
+        
+        if ( record )
+			{
+            iVideoRecordingReady = EFalse;
+            iVideoRecordingOn = EFalse;
+            iVideoRecorded = ETrue;
+	        #ifdef _DEBUG
+            RDebug::Print( _L( "Cae: CCaeTestStatesClient: calling iCamAppEngine->StartVideoRecording()" ) );
+            #endif
+			iCamAppEngine->StartVideoRecording();
+			}
+		}
+	else if ( iSnapImageReady )
+	    {
+	    iSnapImageReady = EFalse;
+
+		switch ( iAction )
+		    {
+            case EPrepareAndCaptureAndCancelStillAtSnap: 
+            case EPrepareAndCaptureAndCancelStillBurstAtSnap:
+                iCamAppEngine->CancelCaptureStill();
+                iCancelCount++;
+                if ( iCancelCount == 1 )
+                    {
+                    iCountSnapImageReady--;
+                    // To test that preparing does not ruin cancelling.
+                    iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex ); 
+                    }
+                else 
+                    {
+                    iCountSnapImageReady++;
+                    iStillCapturingOn = ETrue;
+                    iStillCaptured = ETrue;
+                    if ( iAction == EPrepareAndCaptureAndCancelStillAtSnap ) 
+                        {
+                        iRunlForStillImage = ETrue;
+                        }
+    			    iAction = ENone;
+    			    iCamAppEngine->CaptureStill();
+                    }
+                break;
+			case EDestroyEngineWhenSnapImageReady:
+			case EDestroyEngineWhenSnapImageReadyInStillBurst:
+			    iRunlForSnapImage = EFalse;
+                delete iCamAppEngine;
+                iCamAppEngine = NULL;
+                CActiveScheduler::Stop();
+			    break;
+			default:
+			    iRunlForSnapImage = EFalse;
+			    break;
+			}
+	    }
+	else if ( iStillCaptureReady )
+	    {
+	    iStillCaptureReady = EFalse;
+
+		switch ( iAction )
+		    {
+            case EPrepareAndCaptureStill:
+            case ESpecifiedPrepareAndCaptureStill:
+            case ESpecifiedPrepareAndCaptureStill2nd:
+            case ESetColorTone:
+            case ESetColorToneWrongParams:
+		    case ESetDisplayIndex:
+                iAction = ENone;
+                CTimer::After( KNormalTimingDelay );
+			    break;
+		    case ECaptureCapture:
+		    case ESpecPrepCaptureCapture:
+			    iAction = ENone;
+                iStillCapturingOn = ETrue;
+                iStillCaptured = ETrue;
+			    iCamAppEngine->CaptureStill();
+			    break;
+            case ECaptureRecord:
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                iCamAppEngine->InitVideoRecorderL();
+                iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
+                iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex );
+			    break;
+		    case ERecordCaptureComplexSequence1:
+		    case ERecordCaptureComplexSequence2:
+                iVideoRecordingReady = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EPrepareAndCaptureStillBurst:
+            case EPrepareAndCaptureStillBurstExif:
+            case EPrepareAndCaptureAndCancelStillBurstExif:
+            case ESpecPrepAndCaptureStillBurst:
+            case EPrepareAndCaptureAndCancelStillBurst:
+            case EPrepareAndCaptureAndCancelStillBurstAtSnap:            
+            case EPrepareAndCaptureAndStopStillBurst:
+                break;
+			case EDestroyEngineWhenStillCaptureReady:
+			case EDestroyEngineWhenStillImageReadyInStillBurst:
+                delete iCamAppEngine;
+                iCamAppEngine = NULL;
+                CActiveScheduler::Stop();
+			    break;
+		    default:
+                iAction = ENone;
+                iViewFindingUsed = ETrue;
+	            #ifdef _DEBUG
+                RDebug::Print( _L( "Cae: CCaeTestStatesClient: calling iCamAppEngine->StartViewFinderBitmapsL()" ) );
+                #endif
+                iCamAppEngine->StartViewFinderBitmapsL( iViewFinderSize );
+                iStopViewFinder = ETrue;
+                CTimer::After( iTimeout );
+			    break;	
+		    }
+		    
+		iRunlForStillImage = EFalse;
+	    
+	    }
+	else if ( iStillBurstCaptureMoment ) 
+        {
+        iStillBurstCaptureMoment = EFalse;
+
+		switch ( iAction )
+		    {
+            case EPrepareAndCaptureAndCancelStillBurstAtMoment:
+                // Note: Cancelling is done in the callback.
+                if ( iCancelCount == 1 )
+                    {
+                    // To test that preparing does not ruin cancelling.
+                    // The burst emerging from this is also cancelled!
+                    iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex ); 
+                    }
+                else 
+                    {
+    			    iAction = ENone;
+                    iStillCapturingOn = ETrue;
+                    iStillCaptured = ETrue;
+                    // Do not cancel this burst!
+                    iCancelStillBurst = EFalse;
+    			    iCamAppEngine->CaptureStill();
+                    }
+                break;
+			default:
+			    break;
+			}
+        }
+    else if ( iStillBurstReady )
+	    {
+        iStillBurstReady = EFalse;
+
+		switch ( iAction )
+		    {
+            case EPrepareAndCaptureCaptureStillBurst:
+            case ESpecPrepAndCaptureCaptureStillBurst:
+			    iAction = ENone;
+                iStillCapturingOn = ETrue;
+                iStillCaptured = ETrue;
+			    iCamAppEngine->CaptureStill();
+			    break;
+            case EPrepareAndCaptureStillBurstCaptureStill:
+            case ESpecPrepAndCaptureStillBurstCaptureStill:
+                // Re-set the image count to one to perform single image capture.
+                iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( 1 );
+                if ( iImageCountToCapture != 1 )
+                    {
+                    User::Leave( KErrGeneral );
+                    }
+			    iAction = ENone;
+                iStillCapturingOn = ETrue;
+                iStillCaptured = ETrue;
+			    iCamAppEngine->CaptureStill();
+			    break;
+            case EPrepareAndCaptureStillBurst:
+            case EPrepareAndCaptureStillBurstExif:
+            case EPrepareAndCaptureAndCancelStillBurstExif:
+            case ESpecPrepAndCaptureStillBurst:
+            case EPrepareAndCaptureAndCancelStillBurst:
+            case EPrepareAndCaptureAndStopStillBurst:
+                iAction = ENone;
+                iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( 1 );
+                if ( iImageCountToCapture != 1 )
+                    {
+                    User::Leave( KErrGeneral );
+                    }
+                CTimer::After( KNormalTimingDelay );
+			    break;	
+		    case ERecordCaptureComplexSequence1:
+		    case ERecordCaptureComplexSequence2:
+                iVideoRecordingReady = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+			case EDestroyEngineWhenStillBurstReady:
+                delete iCamAppEngine;
+                iCamAppEngine = NULL;
+                CActiveScheduler::Stop();
+			    break;
+		    default:
+                iAction = ENone;
+                iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( 1 );
+                if ( iImageCountToCapture != 1 )
+                    {
+                    User::Leave( KErrGeneral );
+                    }
+                CTimer::After( KNormalTimingDelay );
+			    break;	
+		    }
+        }
+	else if ( iVideoRecordingOn )
+	    {
+	    
+        switch ( iAction )
+		    {
+            case ESwitchPowerOnWhenRecordingVideo:
+                iVideoRecordingOn = EFalse;
+                iAction = ENone;
+                iCamAppEngine->PowerOn();
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case ESwitchPowerOffWhenRecordingVideo:
+                iVideoRecordingOn = EFalse;
+                iAction = ENone;
+                iCamAppEngine->PowerOff();
+                CTimer::After( KNormalTimingDelay );
+                break;
+            case EPrepareRecordPauseStopVideo:
+            case EPrepareRecordPauseResumeStopVideo:
+                iVideoRecordingOn = EFalse;
+                if ( !iVideoRecordingResumed ) 
+                    {
+                    iCamAppEngine->PauseVideoRecording();
+                    }
+                else 
+                    {
+                    iCamAppEngine->StopVideoRecording();
+                    }
+                break;
+            case EPrepareRecordPausePauseStopVideo:
+                iVideoRecordingOn = EFalse;
+                if ( !iVideoRecordingResumed ) 
+                    {
+                    iCamAppEngine->PauseVideoRecording();
+                    iCamAppEngine->PauseVideoRecording();
+                    }
+                else 
+                    {
+                    iCamAppEngine->StopVideoRecording();
+                    }
+                break;
+            case EResumeVideoWhenNotPaused:
+                iCamAppEngine->ResumeVideoRecording();
+                break;
+            case EStartVideoRecordingWhenRecording:
+                iCamAppEngine->StartVideoRecording();
+                break;
+            case EIsVideoRecordingWhenRecording:
+                iVideoRecordingOn = EFalse;
+                iAction = ENone;
+                {
+                TBool isRecording = iCamAppEngine->IsVideoRecording();
+                if ( !isRecording ) 
+                    {
+                    User::Leave ( KErrGeneral );
+                    }
+                }
+                break;
+            case EPrepareStillCaptureWhenRecording:
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+                break;
+			case EDestroyEngineWhenVideoRecordingOn:
+                delete iCamAppEngine;
+                iCamAppEngine = NULL;
+                CActiveScheduler::Stop();
+			    break;
+            case EDestroyEngineWhenVideoRecordingPaused:
+                iVideoRecordingOn = EFalse;
+                iCamAppEngine->PauseVideoRecording();
+                break;
+                
+// If interface after S60 2.1.
+#ifndef CAE_INTERFACE_21
+            case ESetColorToneVideoRecording:
+                {
+                    MCameraColorToneSettings* CTptr = NULL;
+
+                    if ( iTestedColorTones == 0) // All colors tested?
+                        {
+                        //Set the default color tone and stop
+                        CTptr = static_cast<MCameraColorToneSettings*> ( iCustomInterfacePointer );
+                        CTptr->SetColorToneL( iColorToneValue );
+                        iCamAppEngine->StopVideoRecording();
+                        }
+                    else
+                        {
+                        TInt i, nextColor;
+
+                        // Find out next not tested color
+                        for ( i = 0, nextColor = 0; i < 32; i++ )
+                            {
+                            nextColor = (1 << i);
+                            if ( nextColor &  iTestedColorTones )
+                                {
+                                iTestedColorTones &= ~nextColor; // Remove this color (bit)
+                                break;
+                                }
+                            }
+                        // cast the TAny pointer to the real color tone interface pointer and
+                        // then set the new color tone and verify that it has been set
+                        CTptr = static_cast<MCameraColorToneSettings*> ( iCustomInterfacePointer );
+                        CTptr->SetColorToneL( (MCameraColorToneSettings::TColorTone) nextColor );
+
+                        if ( CTptr->ColorTone() == nextColor )
+                            {
+                            CTimer::After( iTimeout ); // all ok, continue video recording
+                            }
+                        else
+                            {
+                          	#ifdef _DEBUG
+                            RDebug::Print( _L( "Cae: ESetColorToneVideoRecording: color not set to: %d" ), nextColor );
+                            #endif
+                            iStop = ETrue;
+                            CTimer::After( KNormalTimingDelay );
+                            }
+                        }
+                    break;
+                }
+#endif
+            default:
+                iCamAppEngine->StopVideoRecording();
+			    break;	
+		    }
+	    }
+	else if ( iVideoRecordingPaused )
+	    {
+        
+        switch ( iAction )
+		    {
+            case EPrepareRecordPauseStopVideo:
+            case EPrepareRecordPausePauseStopVideo:
+                iStop = ETrue;
+                iCamAppEngine->StopVideoRecording();
+                break;
+			case EDestroyEngineWhenVideoRecordingPaused:
+                delete iCamAppEngine;
+                iCamAppEngine = NULL;
+                CActiveScheduler::Stop();
+			    break;
+		    default:
+                iCamAppEngine->ResumeVideoRecording();
+                iVideoRecordingResumed = ETrue;
+			    break;	
+		    }
+	    }
+	else if ( iVideoRecordingReady )
+	    {
+		switch ( iAction )
+		    {
+		    case ERecordRecord:
+                iAction = EDefault;
+			    iVideoRecordingReady = EFalse;
+                iVideoRecordingOn = EFalse;
+                iVideoRecorded = ETrue;
+                // This leads to video prepare and then recording with the new name.
+                iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName2 );
+			    break;
+            case ERecordCapture:
+                iAction = EDefault;
+                iStillPrepareReady = EFalse;
+                iVideoPrepareReady = EFalse;
+                iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+                break;
+		    case ERecordCaptureComplexSequence1:
+            	#ifdef _DEBUG
+                RDebug::Print( _L( "Cae: ERecordCaptureComplexSequence1 case: %d" ), iActionCycle );
+                #endif
+			    iVideoRecordingReady = EFalse;
+                iVideoRecordingOn = EFalse;
+                iVideoRecorded = ETrue;
+		        switch ( iActionCycle )
+		            {
+		            case 0:
+                        // This leads to video prepare and then recording with the new name.
+                        iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName2 );
+                        break;
+		            case 1:
+                        // Accept video recording completion error because max clip size.
+                        iAcceptVideoCompletionError = ETrue;
+                        // This leads to video prepare and then recording with the previously given name.
+                        iCamAppEngine->SetVideoClipMaxSizeL( iVideoMaxClipSizeInBytes );
+                        break;
+                    /*
+		            case 2:
+                        // This leads to video recording with the previous name.
+                        iVideoPrepareReady = ETrue;
+                        CTimer::After( KNormalTimingDelay );
+                        break;
+                    */
+		            case 2:
+                        // This leads to video prepare and then recording with the new name.
+                        iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName3 );
+                        break;
+		            case 3:
+		                // This leads to single still image capture.
+                        iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+                        break;
+		            case 4:
+                        // Note, this is re-initialization of video recorder.
+                        // Leads to video prepare and then recording with new name.
+                        iAcceptVideoCompletionError = EFalse;
+                        iCamAppEngine->InitVideoRecorderL();
+                        iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName4 );
+                        iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex );
+                        break;
+		            case 5:
+		                // This leads to single still image capture.
+                        iCamAppEngine->CloseVideoRecording();
+                        iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+                        break;
+		            case 6:
+                        iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName );
+                        // Accept video recording completion error because max clip size.
+                        iAcceptVideoCompletionError = ETrue;
+                        iCamAppEngine->SetVideoClipMaxSizeL( iVideoMaxClipSizeInBytes );
+                        iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex );
+                        break;
+		            case 7:
+                        // Note, this is re-initialization of the whole engine.
+                        // Leads to video prepare and then recording with the original name.
+                        iAcceptVideoCompletionError = EFalse;
+                        iCamAppEngine->InitL();
+                        break;
+                    default:
+                        iStop = ETrue;
+                        CTimer::After( KNormalTimingDelay );
+                        break;
+                    }
+                iActionCycle++;
+                break;
+		    case ERecordCaptureComplexSequence2:
+            	#ifdef _DEBUG
+                RDebug::Print( _L( "Cae: ERecordCaptureComplexSequence2 case: %d" ), iActionCycle );
+                #endif
+			    iVideoRecordingReady = EFalse;
+                iVideoRecordingOn = EFalse;
+                iVideoRecorded = ETrue;
+		        switch ( iActionCycle )
+		            {
+		            case 0:
+                        // This leads to still burst capture.
+                        iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( iStillBurstLength );
+                        iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+                        break;
+		            case 1:
+                        // This leads to single image capture.
+                        iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( 1 );
+                        iStillPrepareReady = ETrue;
+                        CTimer::After( KNormalTimingDelay );
+                        break;
+		            case 2:
+                        // This leads to single image capture.
+                        iStillPrepareReady = ETrue;
+                        CTimer::After( KNormalTimingDelay );
+                        break;
+		            case 3:
+                        // This leads to still burst capture.
+                        iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( iStillBurstLength );
+                        iStillPrepareReady = ETrue;
+                        CTimer::After( KNormalTimingDelay );
+                        break;
+		            case 4:
+                        // This leads to video prepare and then recording with new name.
+                        iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName2 );
+                        break;
+		            case 5:
+		                // This leads to single image capture.
+                        iCamAppEngine->CloseVideoRecording();
+                        iImageCountToCapture = iCamAppEngine->SetStillCaptureImageCountL( 1 );
+                        iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+                        break;
+		            case 6:
+		                // This leads to video prepare and then recording with new name.
+                        iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName3 );
+                        // Accept video recording completion error because max clip size.
+                        iAcceptVideoCompletionError = ETrue;
+                        iCamAppEngine->SetVideoClipMaxSizeL( iVideoMaxClipSizeInBytes );
+                        iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex );
+                        break;
+		            case 7:
+                        // This leads to video prepare and then recording with new name.
+                        iCamAppEngine->SetVideoRecordingFileNameL( iVideoFileName4 );
+                        break;
+                    default:
+                        iStop = ETrue;
+                        CTimer::After( KNormalTimingDelay );
+                        break;
+                    }
+                iActionCycle++;
+                break;
+			case EDestroyEngineWhenVideoRecordingReady:
+                delete iCamAppEngine;
+                iCamAppEngine = NULL;
+                CActiveScheduler::Stop();
+			    break;
+		    default:
+			    iAction = ENone;
+                iVideoRecordingReady = EFalse;
+                iStopViewFinder = ETrue;
+                CTimer::After( KNormalTimingDelay );
+			    break;	
+		    }
+	    }
+    else if ( !iStillCaptured && !iVideoRecorded && !iVideoRecordingOn && !iStopViewFinder ) 
+        {
+        switch ( iAction )
+		    {
+            case EStartVfPrepareCaptureStillStartAndStopVf:
+                if ( !iStillPrepareReady ) 
+                    {
+	                #ifdef _DEBUG
+                    RDebug::Print( _L( "Cae: CCaeTestStatesClient: calling iCamAppEngine->PrepareStillCaptureL()" ) );
+                    #endif
+                    iCamAppEngine->PrepareStillCaptureL( iStillQualityLevelIndex );
+                    }
+                break;
+            case EStartVfPrepareRecordVideoStartAndStopVf:
+            case ESetColorToneVideoRecording:
+                if ( !iVideoPrepareReady ) 
+                    {
+	                #ifdef _DEBUG
+                    RDebug::Print( _L( "Cae: CCaeTestStatesClient: calling iCamAppEngine->PrepareVideoRecordingL()" ) );
+                    #endif
+                    iCamAppEngine->PrepareVideoRecordingL( iVideoQualityLevelIndex );
+                    }
+                break;
+            case ESwitchPowerOffWhenVfRunning:
+                iCamAppEngine->PowerOff();
+                iStopViewFinder = ETrue;
+                CTimer::After( KNormalTimingDelay );
+                break;
+            default:
+			    break;
+		    }
+        }
+	else if ( iStopViewFinder ) 
+        {
+	    #ifdef _DEBUG
+        RDebug::Print( _L( "Cae: CCaeTestStatesClient: calling iCamAppEngine->StopViewFinder()" ) );
+        #endif
+        iCamAppEngine->StopViewFinder();
+        // Test IsViewFinding()
+        if ( iCamAppEngine->IsViewFinding() )
+            {
+            User::Leave( KErrGeneral );
+            }
+        // Test GetViewFinderSize()
+        TSize sizeVF;
+        iCamAppEngine->GetViewFinderSize( sizeVF );
+        if ( sizeVF != iViewFinderSize )           
+            {
+            User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+            }
+
+        iViewFinderStarted = EFalse;
+        iAction = ENone;
+        CTimer::After( KNormalTimingDelay );
+        }
+
+	#ifdef _DEBUG
+    RDebug::Print( _L( "Cae: CCaeTestStatesClient::RunTrappedL() returning" ) );
+    #endif
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestStillSettings.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,1628 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestStillSettings.cpp
+*
+*/
+
+#include "CaeTestStillSettings.h"
+#include <f32file.h>
+
+
+CCaeTestStillSettings::CCaeTestStillSettings ()
+    {
+    }
+
+
+CCaeTestStillSettings::~CCaeTestStillSettings ()
+    {
+    }
+
+
+void CCaeTestStillSettings::setUpL ()
+    {
+	iSettingsClient = CCaeTestSettingsClient::NewL( );
+
+    iSettingsClient->SetFileNameBase( KFileNameBase );
+    }
+
+
+void CCaeTestStillSettings::tearDown ()
+    {
+    delete iSettingsClient;    
+    iSettingsClient = 0;
+    }
+
+
+//
+// Own test functions.
+//
+// The framework will do for a test function:
+//
+// setUpL();
+// TRAPD(leaveCode, 'myTestFunction()');
+// "Report leave error or assertion failure for 'myTestFunction()'".
+// tearDown();
+//
+
+
+/////////////////////////////////////////////////////////////////////
+//                       Capture tests
+/////////////////////////////////////////////////////////////////////
+
+/******************************/
+/*    DIGITAL ZOOM VALUE      */
+/******************************/
+
+void CCaeTestStillSettings::TestDigiZoomVal2L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETZOOMVALUEL.003
+    // 
+    // Action : Test out-of-bounds digital zoom value.
+	//      
+	// Output : Leave   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+	
+    iSettingsClient->SetDigiZoomValue( info.iMaxDigitalZoom + 1 );
+
+    //iSettingsClient->SetStillFileName( _L("cae_digizoom_val_2.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenStillPrepared ) );
+    assertL( err != KErrNone );
+}
+
+void CCaeTestStillSettings::TestDigiZoomValNeg1L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETZOOMVALUEL.004
+    // 
+    // Action : Test digital zoom.
+	//      
+	// Output : Leave   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetDigiZoomValue( -1 );
+
+    //iSettingsClient->SetStillFileName( _L("cae_digizoom_val_-1.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenStillPrepared ) );
+    assertL( err != KErrNone );
+}
+
+void CCaeTestStillSettings::TestOpticalZoomValMinL()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETZOOMVALUEL.005
+    // 
+    // Action : Test out-of-bounds optical zoom value.
+	//      
+	// Output : Leave   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetZoomMode( 1 );
+
+    TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+	
+    iSettingsClient->SetDigiZoomValue( -1 );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenStillPrepared ) );
+    assertL( err != KErrNone );
+}
+
+void CCaeTestStillSettings::TestOpticalZoomValMaxL()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETZOOMVALUEL.006
+    // 
+    // Action : Test out-of-bounds optical zoom value.
+	//      
+	// Output : Leave   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetZoomMode( 1 );
+
+    TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+	
+    iSettingsClient->SetDigiZoomValue( 99999 );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenStillPrepared ) );
+    assertL( err != KErrNone );
+}
+
+/******************************/
+/*    DIGITAL ZOOM MODE      */
+/******************************/
+
+void CCaeTestStillSettings::TestDigiZoomMode0L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETZOOMMODEL.001
+    //
+    // Action : Test digital zoom mode.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetZoomMode( 0 );
+
+    //iSettingsClient->SetStillFileName( _L("cae_digizoom_mode_0.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenStillPrepared ); 
+}
+
+void CCaeTestStillSettings::TestOpticalZoomMode1L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETZOOMMODEL.002
+    //
+    // Action : Test optical zoom mode.
+	//      
+	// Output : Leave   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetZoomMode( 1 );
+
+    //iSettingsClient->SetStillFileName( _L("cae_digizoom_mode_1.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenStillPrepared ) );
+    assertL( err != KErrNone );//verify if is correct action
+}
+
+void CCaeTestStillSettings::TestOpticalDigiZoomMode2L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETZOOMMODEL.003
+    //
+    // Action : Test optical digital zoom mode.
+	//      
+	// Output : Leave   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetZoomMode( 2 );
+
+    //iSettingsClient->SetStillFileName( _L("cae_digizoom_mode_2.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenStillPrepared ) );
+    assertL( err != KErrNone );//verify if is correct action
+}
+
+void CCaeTestStillSettings::TestDigiZoomModeNeg1L()
+    {
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETZOOMMODEL.004
+    //
+    // Action : Test digital zoom mode.
+	//      
+	// Output : Leave   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetZoomMode( -1 );
+
+    //iSettingsClient->SetStillFileName( _L("cae_digizoom_mode_-1.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenStillPrepared ) );
+    assertL( err != KErrNone );
+    }
+
+
+/******************************/
+/*       BRIGHTNESS           */
+/******************************/
+
+void CCaeTestStillSettings::TestBrightness0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETBRIGHTNESSL.002
+    //
+    // Action : Test brightness setting with still image capture and viewfinding.
+	//      
+	// Output : No leave if supported. Leave if not supported.  
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetBrightness( 0 );
+
+    iSettingsClient->SetStillFileName( _L("cae_brightness_0.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenStillPrepared ) );
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestBrightness100L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETBRIGHTNESSL.003
+    //
+    // Action : Test brightness setting with still image capture and viewfinding.
+	//      
+	// Output : No leave if supported. Leave if not supported.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetBrightness( 100 );
+
+    iSettingsClient->SetStillFileName( _L("cae_brightness_100.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenStillPrepared ) );
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestBrightnessNeg100L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETBRIGHTNESSL.004
+    //
+    // Action : Test brightness setting with still image capture and viewfinding.
+	//      
+	// Output : No leave if supported. Leave if not supported.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetBrightness( -100 );
+
+    iSettingsClient->SetStillFileName( _L("cae_brightness_-100.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenStillPrepared ) );
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestBrightness101L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETBRIGHTNESSL.005
+    //
+    // Action : Test brightness setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetBrightness( 101 );
+
+    //iSettingsClient->SetStillFileName( _L("cae_brightness_101.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenStillPrepared ) );
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNotSupported );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestBrightnessNeg101L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETBRIGHTNESSL.006
+    //
+    // Action : Test brightness setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetBrightness( -101 );
+
+    //iSettingsClient->SetStillFileName( _L("cae_brightness_-101.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenStillPrepared ) );
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNotSupported );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+
+/******************************/
+/*          CONTRAST          */
+/******************************/
+
+void CCaeTestStillSettings::TestContrast0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETCONTRASTL.002
+    //
+    // Action : Test contrast setting with still image capture and viewfinding.
+	//      
+	// Output : No leave if supported. Leave if not supported.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetContrast( 0 );
+
+    iSettingsClient->SetStillFileName( _L("cae_contrast_0.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenStillPrepared ) );
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestContrast100L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETCONTRASTL.003
+    //
+    // Action : Test contrast setting with still image capture and viewfinding.
+	//      
+	// Output : No leave if supported. Leave if not supported.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetContrast( 100 );
+
+    iSettingsClient->SetStillFileName( _L("cae_contrast_100.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenStillPrepared ) );
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestContrastNeg100L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETCONTRASTL.004
+    //
+    // Action : Test contrast setting with still image capture and viewfinding.
+	//      
+	// Output : No leave if supported. Leave if not supported.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetContrast( -100 );
+
+    iSettingsClient->SetStillFileName( _L("cae_contrast_-100.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenStillPrepared ) );
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestContrast101L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETCONTRASTL.005
+    //
+    // Action : Test contrast setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetContrast( 101 );
+
+    //iSettingsClient->SetStillFileName( _L("cae_contrast_101.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenStillPrepared ) );
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNotSupported );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestContrastNeg101L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETCONTRASTL.006
+    //
+    // Action : Test contrast setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetContrast( -101 );
+
+    //iSettingsClient->SetStillFileName( _L("cae_contrast_-101.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenStillPrepared ) );
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNotSupported );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+
+/******************************/
+/*      EXPOSURE MODE         */
+/******************************/
+
+
+void CCaeTestStillSettings::TestExposureMode2L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETEXPOSUREMODEL.003
+    //
+    // Action : Test exposure mode 2.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 2;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetExposureMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_exposure_mode_2.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenStillPrepared ) );
+	if ( KSetVal & info.iExposureModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestExposureMode4L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETEXPOSUREMODEL.004
+    //
+    // Action : Test exposure mode 4
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 4;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetExposureMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_exposure_mode_4.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenStillPrepared ) );
+	if ( KSetVal & info.iExposureModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestExposureModeNeg1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETEXPOSUREMODEL.005
+    //
+    // Action : Test invalid exposure mode
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = -1;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetExposureMode( KSetVal );
+
+    //iSettingsClient->SetStillFileName( _L("cae_exposure_mode_-1.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenStillPrepared ) );
+    assertL( err == KErrNotSupported );
+}
+
+void CCaeTestStillSettings::TestExposureMode5L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETEXPOSUREMODEL.006
+    //
+    // Action : Test combined exposure modes.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 5;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetExposureMode( KSetVal );
+
+    //iSettingsClient->SetStillFileName( _L("cae_exposure_mode_5.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenStillPrepared ) );
+    if ( KSetVal & info.iExposureModesSupported )
+		{
+		assertL( err != KErrNotSupported );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+/******************************/
+/*    WHITE BALANCE MODE      */
+/******************************/
+
+void CCaeTestStillSettings::TestWhiteBalanceMode1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETWHITEBALANCEMODEL.002
+    //
+    // Action : Test white balance setting with still image capture and viewfinding.
+	//      
+	// Output : No leave, if supported. Leave, if not supported.    
+
+	const TInt KSetVal = 1;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_white_balance_mode_1.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenStillPrepared ) );
+	if ( KSetVal & info.iWhiteBalanceModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestWhiteBalanceMode2L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETWHITEBALANCEMODEL.003
+    //
+    // Action : Test white balance setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 2;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_white_balance_mode_2.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenStillPrepared ) );
+	if ( KSetVal & info.iWhiteBalanceModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestWhiteBalanceMode4L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETWHITEBALANCEMODEL.004
+    //
+    // Action : Test white balance setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+	
+	const TInt KSetVal = 4;
+	
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_white_balance_mode_4.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenStillPrepared ) );
+	if ( KSetVal & info.iWhiteBalanceModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestWhiteBalanceMode8L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETWHITEBALANCEMODEL.005
+    //
+    // Action : Test white balance setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 8;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_white_balance_mode_8.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenStillPrepared ) );
+	if ( KSetVal & info.iWhiteBalanceModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestWhiteBalanceMode10L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETWHITEBALANCEMODEL.006
+    //
+    // Action : Test white balance setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 0x10;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_white_balance_mode_10.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenStillPrepared ) );
+	if ( KSetVal & info.iWhiteBalanceModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestWhiteBalanceModeNeg1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETWHITEBALANCEMODEL.007
+    //
+    // Action : Test white balance setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = -1;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    //iSettingsClient->SetStillFileName( _L("cae_white_balance_mode_-1.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenStillPrepared ) );
+    assertL( err == KErrNotSupported );
+}
+
+void CCaeTestStillSettings::TestWhiteBalanceMode5L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETWHITEBALANCEMODEL.008
+    //
+    // Action : Test white balance setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 5;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    //iSettingsClient->SetStillFileName( _L("cae_white_balance_mode_5.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenStillPrepared ) );
+    assertL( err == KErrNotSupported || err == KErrArgument );
+}
+
+
+/******************************/
+/*        FLASH MODE          */
+/******************************/
+
+void CCaeTestStillSettings::TestFlashMode4L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETFLASHMODEL.004
+    //
+    // Action : Test flash mode setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 4;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_flash_mode_4.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenStillPrepared ) );
+	if ( KSetVal & info.iFlashModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestFlashMode8L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETFLASHMODEL.005
+    //
+    // Action : Test flash mode setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 8;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_flash_mode_8.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenStillPrepared ) );
+	if ( KSetVal & info.iFlashModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestStillSettings::TestFlashModeNeg1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETFLASHMODEL.006
+    //
+    // Action : Test flash mode setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = -1;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    //iSettingsClient->SetStillFileName( _L("cae_flash_mode_-1.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenStillPrepared ) );
+    assertL( err == KErrNotSupported );
+}
+
+void CCaeTestStillSettings::TestFlashMode5L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETFLASHMODEL.007
+    //
+    // Action : Test flash mode setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 5;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    //iSettingsClient->SetStillFileName( _L("cae_flash_mode_5.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenStillPrepared ) );
+    assertL( err == KErrArgument || err == KErrNotSupported );
+}
+
+void CCaeTestStillSettings::TestFlashMode6L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETFLASHMODEL.008
+    //
+    // Action : Test flash mode setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 6;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    //iSettingsClient->SetStillFileName( _L("cae_flash_mode_6.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenStillPrepared ) );
+    assertL( err == KErrArgument || err == KErrNotSupported );
+}
+void CCaeTestStillSettings::TestFlashMode9L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETFLASHMODEL.009
+    //
+    // Action : Test flash mode setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 9;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    //iSettingsClient->SetStillFileName( _L("cae_flash_mode_9.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenStillPrepared ) );
+    assertL( err == KErrArgument || err == KErrNotSupported );
+}
+void CCaeTestStillSettings::TestFlashMode10L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETFLASHMODEL.010
+    //
+    // Action : Test flash mode setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 10;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    //iSettingsClient->SetStillFileName( _L("cae_flash_mode_10.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenStillPrepared ) );
+    assertL( err == KErrArgument || err == KErrNotSupported );
+}
+
+/******************************/
+/*        INITIALIZED         */
+/******************************/
+
+void CCaeTestStillSettings::TestExposureModeInitialized2L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETEXPOSUREMODEL.007
+    //
+    // Action : Test exposure mode.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 2;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetExposureMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_exposure_mode_initialized_2.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenInitialized ) );
+	if ( KSetVal & info.iExposureModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err != KErrNone );
+		}
+}
+
+void CCaeTestStillSettings::TestWhiteBalanceModeInitialized2L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETWHITEBALANCEMODEL.009
+    //
+    // Action : Test white balance mode setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 2;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_white_balance_mode_initialized_2.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenInitialized ) );
+	if ( KSetVal & info.iWhiteBalanceModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err != KErrNone );
+		}
+}
+
+void CCaeTestStillSettings::TestFlashModeInitialized2L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-SC.SETFLASHMODEL.008
+    //
+    // Action : Test flash mode setting with still image capture and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 2;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_flash_mode_initialized_2.jpg") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenInitialized ) );
+
+#if (MIRAGE_X_PROD3) || (MIRAGE_X_PROD4) || (MIRAGE_X_PROD7) ||(MIRAGE_X_PROD9)
+    assertL( err == KErrNone );
+#else
+    assertL( err != KErrNone );
+#endif
+}
+
+void CCaeTestStillSettings::TestDigiZoomInitializedMode0L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-SC.SETZOOMMODEL.005
+    //
+    // Action : Test digital zoom mode.
+	//      
+	// Output : OK.   
+
+	const TInt KSetVal = 0;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetZoomMode( KSetVal );
+
+    iSettingsClient->SetStillFileName( _L("cae_digizoom_initialized_mode_0.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenInitialized );
+}
+
+/******************************/
+/*          GET INFO          */
+/******************************/
+
+void CCaeTestStillSettings::TestGetInfo()
+{
+	// Group:   Settings
+    //
+    // ID:      CAE.GEN.GETINFO.001
+    // 
+    // Action : Call GetInfo. Engine initialized
+	//      
+	// Output : OK.   
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetInfo );
+}
+
+/********************************************************/
+/*                  RESET TO DEFAULTS                   */
+/********************************************************/
+
+void CCaeTestStillSettings::TestResetToDefaultsL()
+    {
+	// ID: CAE.GEN.RESETTODEFAULTSL.001
+    //
+    // Group:   General Settings
+    // 
+    // Action :  Resets the following settings: exposure mode, white balance mode, 
+    //           zoom mode, zoom value, flash mode, brightness, and contrast.
+    //
+	// Output : OK.   
+
+    iSettingsClient->SetContrast( 50 );
+
+    iSettingsClient->SetBrightness( 50 );
+
+#if MIRAGE_X_PROD7
+    iSettingsClient->SetDigiZoomValue( 0 );
+#else
+    iSettingsClient->SetDigiZoomValue( 1 );
+#endif
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EResetToDefaults );
+    }
+
+
+/********************************************************/
+/*                  VIEW FINDER MIRROR                  */
+/********************************************************/
+
+void CCaeTestStillSettings::TestSetViewFinderMirrorL()
+    {
+	// ID:      CAE.VF.SETVIEWFINDERMIRROR.001
+    //
+    // Group:   View Finder
+    // 
+    // Action:  Test view finder mirror when initialization is done.
+	//      
+	// Output:  No leave if supported, leave if not supported. 
+    
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetViewFinderMirror ) );
+    if ( TCameraInfo::EViewFinderMirrorSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+    }
+
+/********************************************************/
+/*               GET STILL FRAME SIZE                   */
+/********************************************************/
+
+void CCaeTestStillSettings::TestGetStillFrameSizeWhenInitializedL()
+    {
+	// ID: CAE.SC.GETSTILLFRAMESIZE.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Get still image frame size for the specified quality level.  
+    //          Initialization is done.
+	//      
+	// Output : No leave if supported. Leave if not supported.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetStillFrameSizeWhenInitialized );
+    
+    TSize size( 640, 480 );
+
+    TSize stillFrameSize;
+    iSettingsClient->GetStillFrameSize( stillFrameSize );
+    if ( stillFrameSize != size )
+        {
+        User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+        }
+    }
+
+void CCaeTestStillSettings::TestGetStillFrameSizeWhenPreparedL()
+    {
+	// ID: CAE.SC.GETSTILLFRAMESIZE.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Get still image frame size for the specified quality level,  
+    //          when prepared.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetStillFrameSizeWhenPrepared );
+
+    TSize size( 640, 480 );
+
+    TSize stillFrameSize;
+    iSettingsClient->GetStillFrameSize( stillFrameSize );
+    if ( stillFrameSize != size )
+        {
+        User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+        }
+    }
+
+/********************************************************/
+/*            ESTIMATED STILL SIZE IN BYTES             */
+/********************************************************/
+
+void CCaeTestStillSettings::TestEstimatedStillSizeInBytesWhenInitializedL()
+    {
+	// ID: CAE.SC.ESTIMATEDSTILLSIZEINBYTES.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Get the estimated still image size in bytes 
+    //          (for the specified quality level).  
+    //          Initialization is done.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EEstimatedStillSizeInBytesWhenInitialized);
+
+    TInt stillByteSize;
+    stillByteSize = iSettingsClient->EstimatedStillSizeInBytes();
+    if ( stillByteSize != 90000 )
+        {
+        User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+        }    
+    }
+
+void CCaeTestStillSettings::TestEstimatedStillSizeInBytesWhenPreparedL()
+    {
+	// ID: CAE.SC.ESTIMATEDSTILLSIZEINBYTES.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Get the estimated still image size in bytes 
+    //          (for the specified quality level),  
+    //          when prepared.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EEstimatedStillSizeInBytesWhenPrepared);
+
+    TInt stillByteSize;
+    stillByteSize = iSettingsClient->EstimatedStillSizeInBytes();
+    if ( stillByteSize != 90000 )
+        {
+        User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+        }    
+    }
+/********************************************************/
+/*             SET SNAP IMAGE SIZE                      */
+/********************************************************/
+
+void CCaeTestStillSettings::TestSetSnapImageSizeBeforePrepareL()
+    {
+	// ID: CAE.SC.SETSNAPIMAGESIZE.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Set the snap image size before preparing.  
+	//      
+	// Output : Should return KErrNotReady.  
+    
+    iSettingsClient->SetStillFormat( CCamera::EFormatExif );
+
+    iSettingsClient->SetSnapFileName( _L("cae_set_snap_size1.mbm") );
+
+    iSettingsClient->SetSnapImageSize( TSize( 44, 52 ) );
+
+    TRAPD(err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetSnapImageSizeBeforePrepare ));
+    
+    assertL( err == KErrNotReady );
+
+    }
+
+void CCaeTestStillSettings::TestSetSnapImageSizeDuringAndAfterPrepareL()
+    {
+	// ID: CAE.SC.SETSNAPIMAGESIZE.003
+    //
+    // Group:   Capture
+    // 
+    // Action : Set the snap image size before preparing.  
+	//      
+	// Output : Ok. Visual check snap image size.  
+    
+    iSettingsClient->SetStillFormat( CCamera::EFormatExif );
+
+    iSettingsClient->SetSnapFileName( _L("cae_set_snap_size2.mbm") );
+
+    iSettingsClient->SetSnapImageSize( TSize( 44, 52 ) );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetSnapImageSizeDuringAndAfterPrepare );
+    
+    }
+
+
+void CCaeTestStillSettings::TestInitUidL()
+    {
+	// ID: CAE.SC.INITUID.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Get the estimated still image size in bytes 
+    //          (for the specified quality level),  
+    //          when prepared.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EInitUid) );
+
+    assertL( err == KErrNotSupported );
+
+    }
+
+void CCaeTestStillSettings::TestSetJpegQuality0L()
+    {
+	// ID: CAE.SET-SC.SETJPEGQUALITY.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture quality level 0 
+    //          image when initialization is done and viewfinder is running.
+    //          This test case is for boundary value testing.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetStillFormat( CCamera::EFormatJpeg );
+
+    iSettingsClient->SetStillCompressionQuality( 0 );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iSettingsClient->SetStillFrameSize( sizeVga );
+
+    // iSettingsClient->SetStillFileName( _L("cae_jpeg_quality_setting_0.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetJpegQualityWhenStillPrepared );
+    
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountStillPrepareComplete() == 1 );
+    assertL( iSettingsClient->CountSnapImageReady() == 1 );
+    assertL( iSettingsClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestStillSettings::TestSetJpegQuality101L()
+    {
+	// ID: CAE.SET-SC.SETJPEGQUALITY.003
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture quality level 101 
+    //          image when initialization is done and viewfinder is running.
+    //          This test case is for boundary value testing.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetStillFormat( CCamera::EFormatJpeg );
+
+    iSettingsClient->SetStillCompressionQuality( 101 );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iSettingsClient->SetStillFrameSize( sizeVga );
+
+    // iSettingsClient->SetStillFileName( _L("cae_jpeg_quality_setting_101.jpg") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetJpegQualityWhenStillPrepared );
+    
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountStillPrepareComplete() == 1 );
+    assertL( iSettingsClient->CountSnapImageReady() == 1 );
+    assertL( iSettingsClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestStillSettings::TestCaptureStillBurstIntervalM2L()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTINTERVAL.M2.004
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode,
+    //          SetStillBurstCaptureIntervalL, StillBurstCaptureInterval  
+    //          and capture three images in a burst, when initialization is done.
+	//      
+	// Output : Leave.   
+
+    const TInt KStillBurstLength = 3;
+
+    iSettingsClient->SetStillQualityLevelIndex( 0 );
+
+    iSettingsClient->SetStillBurstLength( KStillBurstLength );
+   
+    TTimeIntervalMicroSeconds burstInterval( KMaxTUint32 );  // Test with too big value
+    
+    iSettingsClient->SetStillBurstCaptureInterval( burstInterval );
+
+    TRAPD( error, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EPrepareAndSetStillBurstCaptureInterval ) );
+    assertL( error == KErrArgument );
+
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountStillPrepareComplete() == 1 );
+    assertL( iSettingsClient->CountStillBurstCaptureMoment() == 0 );
+    assertL( iSettingsClient->CountSnapImageReady() == 0 );
+    assertL( iSettingsClient->CountStillImageReady() == 0 );
+    assertL( iSettingsClient->CountStillBurstComplete() == 0 );
+    }
+    
+
+void CCaeTestStillSettings::TestSetJpegCodecInvalidL()
+    {
+	// ID: CAE.SET-SC.SETJPEGCODEC.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture an image 
+    //          when initialization is done and viewfinder is running.
+    //          This test case is for invalid codec uid testing.
+	//      
+	// Output : Leave.   
+
+    iSettingsClient->SetStillFormat( CCamera::EFormatExif );
+
+    iSettingsClient->SetImageCodecs( TUid::Uid( 0x12345 ), TUid::Uid( 0x54321 ) ); // Invalid codec uids
+
+    TRAPD( error, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetJpegCodecWhenStillPrepared ));
+    assertL( error == KErrNotFound );
+    
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountStillPrepareComplete() == 1 );
+    assertL( iSettingsClient->CountSnapImageReady() == 1 );
+    assertL( iSettingsClient->CountStillImageReady() == 0 );
+    }
+
+    
+
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+
+MTest* CCaeTestStillSettings::suiteL ()
+{
+	// Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL( _L8("CCaeTestStillSettings") );
+    
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETZOOMVALUEL.003"), &TestDigiZoomVal2L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETZOOMVALUEL.004"), &TestDigiZoomValNeg1L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETZOOMVALUEL.005"), &TestOpticalZoomValMinL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETZOOMVALUEL.006"), &TestOpticalZoomValMaxL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETZOOMMODEL.001"), &TestDigiZoomMode0L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETZOOMMODEL.002"), &TestOpticalZoomMode1L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETZOOMMODEL.003"), &TestOpticalDigiZoomMode2L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETZOOMMODEL.004"), &TestDigiZoomModeNeg1L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETBRIGHTNESSL.002"), &TestBrightness0L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETBRIGHTNESSL.003"), &TestBrightness100L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETBRIGHTNESSL.004"), &TestBrightnessNeg100L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETBRIGHTNESSL.005"), &TestBrightness101L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETBRIGHTNESSL.006"), &TestBrightnessNeg101L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETCONTRASTL.002"), &TestContrast0L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETCONTRASTL.003"), &TestContrast100L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETCONTRASTL.004"), &TestContrastNeg100L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETCONTRASTL.005"), &TestContrast101L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETCONTRASTL.006"), &TestContrastNeg101L ) );
+	
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETEXPOSUREMODEL.003"), &TestExposureMode2L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETEXPOSUREMODEL.004"), &TestExposureMode4L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETEXPOSUREMODEL.005"), &TestExposureModeNeg1L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETEXPOSUREMODEL.006"), &TestExposureMode5L ) );
+	
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETWHITEBALANCEMODEL.002"), &TestWhiteBalanceMode1L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETWHITEBALANCEMODEL.003"), &TestWhiteBalanceMode2L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETWHITEBALANCEMODEL.004"), &TestWhiteBalanceMode4L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETWHITEBALANCEMODEL.005"), &TestWhiteBalanceMode8L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETWHITEBALANCEMODEL.006"), &TestWhiteBalanceMode10L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETWHITEBALANCEMODEL.007"), &TestWhiteBalanceModeNeg1L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETWHITEBALANCEMODEL.008"), &TestWhiteBalanceMode5L ) );
+	
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETFLASHMODEL.004"), &TestFlashMode4L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETFLASHMODEL.005"), &TestFlashMode8L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETFLASHMODEL.006"), &TestFlashModeNeg1L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETFLASHMODEL.007"), &TestFlashMode5L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETFLASHMODEL.008"), &TestFlashMode6L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETFLASHMODEL.009"), &TestFlashMode9L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETFLASHMODEL.010"), &TestFlashMode10L ) );
+	
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETEXPOSUREMODEL.007"), &TestExposureModeInitialized2L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETWHITEBALANCEMODEL.009"), &TestWhiteBalanceModeInitialized2L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETFLASHMODEL.008"), &TestFlashModeInitialized2L ) );
+	suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETZOOMMODEL.005"), &TestDigiZoomInitializedMode0L ) );
+
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.GEN.GETINFO.001"), &TestGetInfo ) );
+	
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.GEN.RESETTODEFAULTSL.001"), &TestResetToDefaultsL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.VF.SETVIEWFINDERMIRROR.001"), &TestSetViewFinderMirrorL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SC.GETSTILLFRAMESIZE.001"), &TestGetStillFrameSizeWhenInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SC.GETSTILLFRAMESIZE.002"), &TestGetStillFrameSizeWhenPreparedL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SC.ESTIMATEDSTILLSIZEINBYTES.001"), &TestEstimatedStillSizeInBytesWhenInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SC.ESTIMATEDSTILLSIZEINBYTES.002"), &TestEstimatedStillSizeInBytesWhenPreparedL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SC.SETSNAPIMAGESIZE.001"), &TestSetSnapImageSizeBeforePrepareL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SC.SETSNAPIMAGESIZE.003"), &TestSetSnapImageSizeDuringAndAfterPrepareL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SC.INITUID.001"), &TestInitUidL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETJPEGQUALITY.002"), &TestSetJpegQuality0L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETJPEGQUALITY.003"), &TestSetJpegQuality101L ) );
+
+#ifdef __CAMERA_BURST_MODE
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTINTERVAL.M2.004"), &TestCaptureStillBurstIntervalM2L ) );
+#endif
+    
+    suite->addTestL( CTestCaller<CCaeTestStillSettings>::NewL( _L8("CAE.SET-SC.SETJPEGCODEC.001"), &TestSetJpegCodecInvalidL ) );
+    
+    return suite;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestStillStates.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,1263 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestStillStates.cpp
+*
+*/
+
+#include "CaeTestStillStates.h"
+#include <f32file.h>
+
+/*
+#if ( defined (__WINS__) || defined (__WINSCW) )
+_LIT(KProcessFileName, "c:\\stillstates.dat");
+#else
+_LIT(KProcessFileName, "e:\\stillstates.dat");
+#endif
+*/
+
+//const TReal32 KViewFinderFrameFrequencyMinimum = 13.0;
+
+
+
+CCaeTestStillStates::CCaeTestStillStates ()
+    {
+    }
+
+
+
+CCaeTestStillStates::~CCaeTestStillStates ()
+    {
+    }
+
+
+void CCaeTestStillStates::setUpL ()
+    {
+	iStatesClient = CCaeTestStatesClient::NewL();
+
+    iStatesClient->SetFileNameBase( KFileNameBase );
+    }
+
+
+void CCaeTestStillStates::tearDown ()
+    {
+    delete iStatesClient;    
+    iStatesClient = 0;
+    }
+
+
+//
+// Own test functions.
+//
+// The framework will do for a test function:
+//
+// setUpL();
+// TRAPD(leaveCode, 'myTestFunction()');
+// "Report leave error or assertion failure for 'myTestFunction()'".
+// tearDown();
+//
+
+/********************************************************/
+/*               PREPARE STILL CAPTURE                  */
+/********************************************************/
+
+void CCaeTestStillStates::TestPrepareStillCaptureNeg1L()
+    {
+	// ID: CAE.SC.PREPARESTILLCAPTUREL.005
+    //
+    // Group:   Capture
+    // 
+    // Action : Try to prepare the engine for still image capture using invalid quality level index. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetStillQualityLevelIndex( -1 );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareStillCapturing ) );
+    assertL( error != KErrNone );
+    }
+
+void CCaeTestStillStates::TestPrepareStillCapture3L()
+    {
+	// ID: CAE.SC.PREPARESTILLCAPTUREL.006
+    //
+    // Group:   Capture
+    // 
+    // Action : Try to prepare the engine for still image capture using invalid quality level index. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetStillQualityLevelIndex( 3 );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareStillCapturing ) );
+    assertL( error != KErrNone );
+    }
+
+void CCaeTestStillStates::TestSpecPrepareSCUnsupportedFormatWhenInitializedL()
+    {
+	// ID: CAE.SC.PREPARESTILLCAPTUREL.008
+    //
+    // Group:   Capture
+    // 
+    // Action : Set still image capturing format to a format unsupported by Camera API implementation. 
+	//          Initialization is done.
+    //
+	// Output : Leave.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizeVga( KImgWidthTooBig, KImgHeightTooBig );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareStill ) );//verified if is correct action
+    assertL( error != KErrNone );
+    }
+
+void CCaeTestStillStates::TestSpecPrepareSCSupportedFormatWhenPreparedL()
+    {
+	// ID: CAE.SC.PREPARESTILLCAPTUREL.009
+    //
+    // Group:   Capture
+    // 
+    // Action : Set still image capturing format to a format supported by Camera API implementation. 
+	//          Still Capture prepared.
+    //
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareStillWhenPrepared );//verified if is correct action
+    }
+
+void CCaeTestStillStates::TestPrepareCroppedStillCapturingL()
+    {
+	// ID: CAE.SC.PREPARESTILLCAPTUREL.011
+    //
+    // Group:   Capture
+    // 
+    // Action : 
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetStillQualityLevelIndex( 1 );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareCroppedStillCapturing ) );
+    assertL( error == KErrNotSupported );
+    }
+
+void CCaeTestStillStates::TestPrepareStillCaptureWhenPowerOffL()
+    {
+	// ID: CAE.SC.PREPARESTILLCAPTUREL.011
+    //
+    // Group:   Capture
+    // 
+    // Action : Prepare still capture when init is not ready
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetStillQualityLevelIndex( 1 );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareStillCaptureWhenPowerOff ) );
+    assertL( error == KErrNotReady );
+    }
+
+void CCaeTestStillStates::TestPrepareStillCaptureWhenRecordingL()
+    {
+	// ID: CAE.SC.PREPARESTILLCAPTUREL.012
+    //
+    // Group:   Capture
+    // 
+    // Action : Prepare still capture when recording
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetStillQualityLevelIndex( 1 );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareStillCaptureWhenRecording ) );
+    assertL( error == KErrNotReady );
+    }
+
+void CCaeTestStillStates::TestPrepareStillCaptrureWrongSizeL()
+    {
+	// ID: CAE.SC.PREPARESTILLCAPTUREL.013
+    //
+    // Group:   Capture
+    // 
+    // Action : Set still image capturing format to a format unsupported by Camera API implementation. 
+	//          Initialization is done.
+    //
+	// Output : Leave.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize wrongSize( 600, 400 );
+
+    iStatesClient->SetStillFrameSize( wrongSize );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareStill ) );//verified if is correct action
+    assertL( error == KErrNotSupported );
+    }
+
+/********************************************************/
+/*                 STATE CHANGE                         */
+/********************************************************/
+
+void CCaeTestStillStates::TestReleaseL()
+    {
+    // ID: CAE.GEN.RELESEANDRESERVE.002
+	//
+    // General
+    // 
+    // Action : Try to release the camera module.
+	//      
+	// Output : OK.   
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERelease );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+void CCaeTestStillStates::TestReleaseReleaseL()
+    {
+    // ID: CAE.GEN.RELESEANDRESERVE.003
+	//
+    // General
+    // 
+    // Action : Try to release the camera module twice.
+	//      
+	// Output : OK.   
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EReleaseRelease);
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+void CCaeTestStillStates::TestReserveL()
+    {
+    // ID: CAE.GEN.RELESEANDRESERVE.004
+	//
+    // General
+    // 
+    // Action : Try to re-reserve the camera module after initial reservation.  
+	//      
+	// Output : OK.   
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EReserveReserve );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+void CCaeTestStillStates::TestReleaseReserveCaptureL()
+    {
+    // ID: CAE.GEN.RELESEANDRESERVE.005
+	//
+    // General
+    // 
+    // Action : Try to re-reserve the camera module after initial reservation
+    //          and releasing. Then capture still image.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillFileName( _L("cae_relres_ql_2.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EReleaseReserveCapture );
+    assertL( iStatesClient->CountInitComplete() == 2 );
+    }
+
+
+/********************************************************/
+/*                GENERAL TESTS                         */
+/********************************************************/
+
+void CCaeTestStillStates::TestPowerOffPowerOffL()
+    {
+    // ID: CAE.GEN.POWEROFFPOWEROFF.001
+	//
+    // General
+    // 
+    // Action : Test to turn camera power off two time, when initialization is done.
+	//      
+	// Output : OK.   
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPowerOffPowerOff );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+void CCaeTestStillStates::TestCaptureAfterPowerOffOnL()
+    {
+	// ID: CAE.SC.CAPTURESTILL.POWEROFF.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing and capture Vga Exif image 
+    //          image after poweroff + poweron.
+	//      
+	// Output : No leave, image cae_snap_1_8_vga_poweroffon captured
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+    //iStatesClient->SetSnapFileName( _L("cae_snap_1_8_vga_poweroff.mbm") );
+
+    iStatesClient->SetSnapImageSize( TSize( 44, 52 ) );
+
+    iStatesClient->SetStillFileName( _L("cae_snap_1_8_vga_poweroffon.jpg") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ECaptureStillAfterPowerOffOn );
+
+    assertL( iStatesClient->CountInitComplete() == 2 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 2 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestStillStates::TestStartVfStartVfL()
+    {
+	// CAE.VF.STARTVIEWFINDERSTARTVIEWFINDER.001
+    //
+    // View Finder
+    // 
+    // Action : Test start two time view finder, when initialization is done.
+	//      
+	// Output : OK.   
+
+    TSize sizeQqvga( KImgWidthQQVGA, KImgHeightQQVGA );
+
+    iStatesClient->SetViewFinderSize( sizeQqvga );
+
+    iStatesClient->SetTimeout( 100000 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfStartVf );
+    }
+
+void CCaeTestStillStates::TestStartVfWhenPowerOffL()
+    {
+	// CAE.VF.STARTVIEWFINDERWHENPOWEROFF.001
+    //
+    // View Finder
+    // 
+    // Action : Test to start view finder when power is off, initialization is done.
+	//      
+	// Output : Leave.  
+    
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVfWhenPowerOff ) );
+    assertL( error == KErrNotReady );
+    }
+
+
+void CCaeTestStillStates::TestCancelCaptureStillWhenInitializedL()
+    {
+	// CAE.SC.CANCEL.001
+    //
+    // Capture (actually just cancelling)
+    // 
+    // Action : Test to cancel still capturing when just initialization is done.
+	//      
+	// Output : OK.  
+    
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ECancelCaptureStillWhenInitialized );
+    }
+
+
+void CCaeTestStillStates::TestCancelCaptureStillAtSnapL()
+    {
+	// CAE.SC.CANCEL.002
+    //
+    // Capture
+    // 
+    // Action : Test to cancel still capturing after snap image callback. Captures an image after cancelling.
+	//      
+	// Output : OK.  
+    
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+    
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureAndCancelStillAtSnap );
+    
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 2 ); // == 2 because calling PrepareStillCaptureL after cancelling
+    assertL( iStatesClient->CountSnapImageReady() == 3 );
+    // Changed this from 2 to 3. Before it was timing dependent, giving either value. Now the case is timed better.
+    assertL( iStatesClient->CountStillImageReady() == 3 ); 
+    }
+
+
+/********************************************************/
+/*                STILL BURST TESTS                     */
+/********************************************************/
+
+
+void CCaeTestStillStates::TestCaptureCaptureStillBurst3L()
+    {
+	// ID: CAE.SC.CAPTURECAPTURESTILLBURST.3.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          images in a burst when initialization is done. Then repeat the burst capture.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_vga16M_burstburst3.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_vga16M_burstburst3.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureCaptureStillBurst );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == ( 2 * KStillBurstLength ) );
+    assertL( iStatesClient->CountSnapImageReady() == ( 2 * KStillBurstLength ) );
+    assertL( iStatesClient->CountStillImageReady() == ( 2 * KStillBurstLength ) );
+    assertL( iStatesClient->CountStillBurstComplete() == 2 );
+    }
+
+void CCaeTestStillStates::TestSpecPrepCaptureCaptureStillBurst3L()
+    {
+	// ID: CAE.SC.CAPTURECAPTURESTILLBURST.3.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          images in a burst when initialization is done. Then repeat the burst capture.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizevga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizevga );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_vga16M_spburstburst3.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_vga16M_spburstburst3.mbm") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecPrepAndCaptureCaptureStillBurst );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == ( 2 * KStillBurstLength ) );
+    assertL( iStatesClient->CountSnapImageReady() == ( 2 * KStillBurstLength ) );
+    assertL( iStatesClient->CountStillImageReady() == ( 2 * KStillBurstLength ) );
+    assertL( iStatesClient->CountStillBurstComplete() == 2 );
+    }
+
+void CCaeTestStillStates::TestCaptureStillBurst3CaptureStillL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTCAPTURESTILL.3.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          images in a burst when initialization is done. Then repeat the burst capture.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_vga16M_burst3capture.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_vga16M_burst3capture.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurstCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountSnapImageReady() == ( KStillBurstLength + 1 ) );
+    assertL( iStatesClient->CountStillImageReady() == ( KStillBurstLength + 1 ) );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+void CCaeTestStillStates::TestSpecPrepCaptureStillBurst3CaptureStillL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURSTCAPTURESTILL.3.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          images in a burst when initialization is done. Then repeat the burst capture.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizevga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizevga );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_qqvga16M_spburst3capture.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_qqvga16M_spburst3capture.mbm") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecPrepAndCaptureStillBurstCaptureStill );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountSnapImageReady() == ( KStillBurstLength + 1 ) );
+    assertL( iStatesClient->CountStillImageReady() == ( KStillBurstLength + 1 ) );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+
+void CCaeTestStillStates::TestCancelCaptureStillBurst3AtSnapL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.CANCEL.007
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          images in a burst and cancel still burst after snap image callback, 
+    //          initialization is done. After cancelling captures a burst.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_vga16M_burst_cancel.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_vga16M_burst_cancel.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureAndCancelStillBurstAtSnap );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 2 ); // == 2 because calling PrepareStillCaptureL after cancel
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == 3 * KStillBurstLength );
+    assertL( iStatesClient->CountSnapImageReady() >= KStillBurstLength + 1 );
+    assertL( iStatesClient->CountStillImageReady() >= KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+
+void CCaeTestStillStates::TestCancelCaptureStillBurst3AtMomentL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.CANCEL.008
+    //
+    // Group:   Capture
+    // 
+    // Action : Test to prepare still capturing burst mode and capture three  
+    //          images in a burst and cancel still burst in the second capture moment callback.
+    //          Initialization is done. After cancelling prepares, captures burst, and cancels.
+    //          Then captures a burst that is not cancelled.
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetSnapFileName( _L("cae_snap_vga16M_burst_cancelmom.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_vga16M_burst_cancelmom.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureAndCancelStillBurstAtMoment );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 2 ); // == 2 because calling PrepareStillCaptureL after cancel
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == ( 2 + 1 + KStillBurstLength ) );
+    assertL( iStatesClient->CountSnapImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+
+void CCaeTestStillStates::TestCaptureStillBurstMp2Exif100IgnoreErrorsL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.MP2EXIF.IGNORE.100.001
+    //
+    // Group: Capture
+    // 
+    // Action : Test OOM case using too long burst with 2 megapixel Exif images. OOM error is ignored in callbacks 
+	//			and the test case tries to get all snap and still images from the engine.  
+	//      
+	// Output : Leave
+
+    const TInt KStillBurstLength = 100;
+    const TSize sizeMp2( KImgWidthMP2, KImgHeightMP2 );
+
+	iStatesClient->SetStopOnErrorInMcaeoSnapImageReady( EFalse );
+	iStatesClient->SetStopOnErrorInMcaeoStillImageReady( EFalse );
+
+    iStatesClient->SetStillFrameSize( sizeMp2 );
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+	TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurstExif ) );
+
+    assertL( error == KErrNoMemory );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountSnapImageReady() + 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountStillImageReady() + 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountImageDeliveredStillBurstComplete() + 1 );	
+    }
+
+void CCaeTestStillStates::TestCaptureStillBurstMp1Exif100IgnoreErrorsL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.MP1EXIF.IGNORE.100.001
+    //
+    // Group: Capture
+    // 
+    // Action : Test OOM case using too long burst with one megapixel Exif images. OOM error is ignored in callbacks 
+	//			and the test case tries to get all snap and still images from the engine.  
+	//      
+	// Output : Leave
+
+    const TInt KStillBurstLength = 100;
+    const TSize sizeMp1M3( KImgWidthMP1M3, KImgHeightMP1M3 );
+
+	iStatesClient->SetStopOnErrorInMcaeoSnapImageReady( EFalse );
+	iStatesClient->SetStopOnErrorInMcaeoStillImageReady( EFalse );
+
+    iStatesClient->SetStillFrameSize( sizeMp1M3 );
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+	TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurstExif ) );
+
+    assertL( error == KErrNoMemory );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountSnapImageReady() + 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountStillImageReady() + 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountImageDeliveredStillBurstComplete() + 1 );	
+    }
+
+
+
+void CCaeTestStillStates::TestCaptureStillBurstVgaBitmap100IgnoreErrorsL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.VGABITMAP.IGNORE.100.002
+    //
+    // Group: Capture
+    // 
+    // Action : Test OOM case using too long burst with VGA bitmaps. OOM error is ignored in callbacks 
+	//			and the test case tries to get all snap and still images from the engine.  
+	//      
+	// Output : Leave    
+
+    const TInt KStillBurstLength = 100;
+    const TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+	iStatesClient->SetStopOnErrorInMcaeoSnapImageReady( EFalse );
+	iStatesClient->SetStopOnErrorInMcaeoStillImageReady( EFalse );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+	TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurst ) );
+
+    assertL( error == KErrNoMemory );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountSnapImageReady() + 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountStillImageReady() + 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountImageDeliveredStillBurstComplete() + 1 );	
+    }
+
+
+void CCaeTestStillStates::TestCaptureStillBurstVgaJpeg100IgnoreErrorsL()
+    {
+	// ID: CAE.SC.CAPTURESTILLBURST.VGAJPEG.IGNORE.100.003
+    //
+    // Group: Capture
+    // 
+    // Action : Test OOM case using too long burst with VGA Jpeg images. OOM error is ignored in callbacks 
+	//			and the test case tries to get all snap and still images from the engine.  
+	//      
+	// Output : Leave    
+
+    const TInt KStillBurstLength = 100;
+    const TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+	iStatesClient->SetStopOnErrorInMcaeoSnapImageReady( EFalse );
+	iStatesClient->SetStopOnErrorInMcaeoStillImageReady( EFalse );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+    iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+	TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndCaptureStillBurstExif ) );
+
+    assertL( error == KErrNoMemory );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountSnapImageReady() + 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountStillImageReady() + 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == iStatesClient->CountImageDeliveredStillBurstComplete() + 1 );	
+    }
+
+
+
+/********************************************************/
+/*                "DESTROY ENGINE"-TESTS                */
+/********************************************************/
+
+
+void CCaeTestStillStates::TestDestroy1L()
+    {
+	// ID: CAE.SC.DESTROY.001
+    //
+    // Group:   General
+    // 
+    // Action : Test to destroy the engine when still capture prepare is ready. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenStillPrepareReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == 0 );
+    }
+
+
+void CCaeTestStillStates::TestDestroy2L()
+    {
+	// ID: CAE.SC.DESTROY.002
+    //
+    // Group:   General
+    // 
+    // Action : Test to destroy the engine just after snap image callback. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenSnapImageReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 0 );
+    }
+
+
+void CCaeTestStillStates::TestDestroy3L()
+    {
+	// ID: CAE.SC.DESTROY.003
+    //
+    // Group:   General
+    // 
+    // Action : Test to destroy the engine just after snap image callback. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatFbsBitmapColor16M );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenSnapImageReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestStillStates::TestDestroy4L()
+    {
+	// ID: CAE.SC.DESTROY.004
+    //
+    // Group:   General
+    // 
+    // Action : Test to destroy the engine just after still image callback. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenStillCaptureReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestStillStates::TestDestroy5L()
+    {
+	// ID: CAE.SC.DESTROY.005
+    //
+    // Group:   General
+    // 
+    // Action : Test to destroy the engine just after still burst ready callback. 
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenStillBurstReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountSnapImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillImageReady() == KStillBurstLength );
+    assertL( iStatesClient->CountStillBurstComplete() == 1 );
+    }
+
+
+void CCaeTestStillStates::TestDestroy6L()
+    {
+	// ID: CAE.SC.DESTROY.006
+    //
+    // Group:   General
+    // 
+    // Action : Test to destroy the engine just after the first snap image callback in still burst. 
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenSnapImageReadyInStillBurst );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountSnapImageReady() >= 1 );
+    assertL( iStatesClient->CountStillImageReady() == 0 );
+    assertL( iStatesClient->CountStillBurstComplete() == 0 );
+    }
+
+
+void CCaeTestStillStates::TestDestroy7L()
+    {
+	// ID: CAE.SC.DESTROY.007
+    //
+    // Group:   General
+    // 
+    // Action : Test to destroy the engine just after the first still image callback in still burst. 
+	//      
+	// Output : OK.   
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
+
+    TSize sizeVga( KImgWidthVGA, KImgHeightVGA );
+
+    iStatesClient->SetStillFrameSize( sizeVga );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenStillImageReadyInStillBurst );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == KStillBurstLength );
+    assertL( iStatesClient->CountSnapImageReady() >= 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    assertL( iStatesClient->CountStillBurstComplete() == 0 );
+    }
+
+
+/********************************************************/
+/*                ERROR SIMULATIONS                     */
+/********************************************************/
+
+
+void CCaeTestStillStates::TestEncodingErrorL()
+    {
+	// ID: CAE.SC.ERRORS.001
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test still image capture with simulated encoding error.
+	//      
+	// Output : Leave with code KErrAbort.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EEncodingError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestStillStates::TestPowerErrorL()
+    {
+	// ID: CAE.SC.ERRORS.002
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test still image capture with simulated camera power error.
+	//      
+	// Output : Leave with code KErrAbort.   
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPowerError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 0 );
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == 0 );
+    }
+
+
+void CCaeTestStillStates::TestReserveErrorL()
+    {
+	// ID: CAE.SC.ERRORS.003
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test still image capture with simulated camera reservation error.
+	//      
+	// Output : Leave with code KErrAbort.   
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EReserveError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 0 );
+    assertL( iStatesClient->CountSnapImageReady() == 0 );
+    assertL( iStatesClient->CountStillImageReady() == 0 );
+    }
+
+
+void CCaeTestStillStates::TestStillCaptureErrorL()
+    {
+	// ID: CAE.SC.ERRORS.004
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test still image capture with simulated capture error.
+	//      
+	// Output : Leave with code KErrAbort.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStillCaptureError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 0 );
+    }
+
+
+void CCaeTestStillStates::TestSnapImageErrorL()
+    {
+	// ID: CAE.SC.ERRORS.005
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test still image capture with simulated snap image error.
+	//      
+	// Output : Leave with code KErrAbort.   
+
+    const TSize sizeMp1M3( KImgWidthMP1M3, KImgHeightMP1M3 );
+    iStatesClient->SetStillFrameSize( sizeMp1M3 );
+    iStatesClient->SetStillFormat( CCamera::EFormatExif );
+
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESnapImageError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 0 );
+    }
+
+
+void CCaeTestStillStates::TestStillImageErrorL()
+    {
+	// ID: CAE.SC.ERRORS.006
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test still image capture with simulated still image error.
+	//      
+	// Output : Leave with code KErrAbort.   
+
+    const TSize sizeMp1M3( KImgWidthMP1M3, KImgHeightMP1M3 );
+    iStatesClient->SetStillFrameSize( sizeMp1M3 );
+    iStatesClient->SetStillFormat( CCamera::EFormatJpeg );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStillImageError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestStillStates::TestStillConvertError1L()
+    {
+	// ID: CAE.SC.ERRORS.007
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test still image capture with simulated still image conversion error.
+	//      
+	// Output : Leave with code KErrAbort.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStillConvertError1 ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestStillStates::TestStillConvertError2L()
+    {
+	// ID: CAE.SC.ERRORS.008
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test still image capture with simulated still image conversion error.
+	//      
+	// Output : Leave with code KErrAbort.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStillConvertError2 ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+
+void CCaeTestStillStates::TestStillConvertError3L()
+    {
+	// ID: CAE.SC.ERRORS.009
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test still image capture with simulated still image conversion error.
+	//      
+	// Output : Leave with code KErrAbort.   
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStillConvertError3 ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestStillStates::TestSetCameraIndexLowL()
+    {
+	// ID: CAE.SC.SETCAMERAINDEX.001
+    //
+    // Group:   Capture
+    // 
+    // Action : Set camera index to -1 and capture a still image.
+	//      
+	// Output : leave
+
+    iStatesClient->SetDisplayIndex( 1 );
+    iStatesClient->SetSnapFileName( _L("cae_snap_camera_index_1.mbm") );
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESetCameraIndexLow ) );
+    assertL( error == KErrHardwareNotAvailable );
+    }
+
+void CCaeTestStillStates::TestSetCameraIndexHighL()
+    {
+	// ID: CAE.SC.SETCAMERAINDEX.002
+    //
+    // Group:   Capture
+    // 
+    // Action : Set camera index to too big value and capture a still image.
+	//      
+	// Output : leave
+
+    iStatesClient->SetDisplayIndex( 1 );
+    iStatesClient->SetSnapFileName( _L("cae_snap_camera_index_1.mbm") );
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESetCameraIndexHigh ) );
+    assertL( error == KErrHardwareNotAvailable );
+    }
+
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+
+MTest* CCaeTestStillStates::suiteL ()
+    {
+	// Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL( _L8("CCaeTestStillStates") );
+
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.005"), &TestPrepareStillCaptureNeg1L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.006"), &TestPrepareStillCapture3L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.008"), &TestSpecPrepareSCUnsupportedFormatWhenInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.009"), &TestSpecPrepareSCSupportedFormatWhenPreparedL ) );
+   
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.010"), &TestPrepareCroppedStillCapturingL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.011"), &TestPrepareStillCaptureWhenPowerOffL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.012"), &TestPrepareStillCaptureWhenRecordingL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.PREPARESTILLCAPTUREL.013"), &TestPrepareStillCaptrureWrongSizeL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.GEN.RELESEANDRESERVE.002"), &TestReleaseL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.GEN.RELESEANDRESERVE.003"), &TestReleaseReleaseL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.GEN.RELESEANDRESERVE.004"), &TestReserveL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.GEN.RELESEANDRESERVE.005"), &TestReleaseReserveCaptureL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.GEN.POWEROFFPOWEROFF.001"), &TestPowerOffPowerOffL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURESTILL.POWEROFF.002"), &TestCaptureAfterPowerOffOnL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.VF.STARTVIEWFINDERSTARTVIEWFINDER.001"), &TestStartVfStartVfL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.VF.STARTVIEWFINDERWHENPOWEROFF.001"), &TestStartVfWhenPowerOffL ) );
+        
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CANCEL.001"), &TestCancelCaptureStillWhenInitializedL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CANCEL.002"), &TestCancelCaptureStillAtSnapL ) );
+
+#ifdef __CAMERA_BURST_MODE
+    // Only if Still BURST is supported (built in).
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURECAPTURESTILLBURST.3.001"), &TestCaptureCaptureStillBurst3L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURECAPTURESTILLBURST.3.002"), &TestSpecPrepCaptureCaptureStillBurst3L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTCAPTURESTILL.3.001"), &TestCaptureStillBurst3CaptureStillL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURESTILLBURSTCAPTURESTILL.3.002"), &TestSpecPrepCaptureStillBurst3CaptureStillL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.CANCEL.007"), &TestCancelCaptureStillBurst3AtSnapL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.CANCEL.008"), &TestCancelCaptureStillBurst3AtMomentL ) );
+
+#if (MIRAGE_X_PROD2) || (MIRAGE_X_PROD4)
+	suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.MP1EXIF.IGNORE.100.001"), &TestCaptureStillBurstMp1Exif100IgnoreErrorsL ) );
+#endif
+#if (MIRAGE_X_PROD7)
+	suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.MP2EXIF.IGNORE.100.001"), &TestCaptureStillBurstMp2Exif100IgnoreErrorsL ) );
+#endif
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.VGABITMAP.IGNORE.100.002"), &TestCaptureStillBurstVgaBitmap100IgnoreErrorsL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.CAPTURESTILLBURST.VGAJPEG.IGNORE.100.003"), &TestCaptureStillBurstVgaJpeg100IgnoreErrorsL ) );
+
+#endif // __CAMERA_BURST_MODE
+
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.DESTROY.001"), &TestDestroy1L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.DESTROY.002"), &TestDestroy2L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.DESTROY.003"), &TestDestroy3L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.DESTROY.004"), &TestDestroy4L ) );
+
+#ifdef __CAMERA_BURST_MODE
+    // Only if Still BURST is supported (built in).
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.DESTROY.005"), &TestDestroy5L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.DESTROY.006"), &TestDestroy6L ) );    
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.DESTROY.007"), &TestDestroy7L ) );
+#endif
+    
+    #ifdef CAE_TEST_VERSION
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.ERRORS.001"), &TestEncodingErrorL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.ERRORS.002"), &TestPowerErrorL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.ERRORS.003"), &TestReserveErrorL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.ERRORS.004"), &TestStillCaptureErrorL ) );
+#if (MIRAGE_X_PROD2) || (MIRAGE_X_PROD4)
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.ERRORS.005"), &TestSnapImageErrorL ) );
+#endif
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.ERRORS.006"), &TestStillImageErrorL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.ERRORS.007"), &TestStillConvertError1L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.ERRORS.008"), &TestStillConvertError2L ) );
+    // suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.ERRORS.009"), &TestStillConvertError3L ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.SETCAMERAINDEX.001"), &TestSetCameraIndexLowL ) );
+    suite->addTestL( CTestCaller<CCaeTestStillStates>::NewL( _L8("CAE.SC.SETCAMERAINDEX.002"), &TestSetCameraIndexHighL ) );
+#endif
+    return suite;
+    }
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestTop.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestTop.cpp
+*
+*/
+#include "CaeTestTop.h"
+#include "CaeTestRelease.h"
+#include "CaeTestStillSettings.h"
+#include "CaeTestStillStates.h"
+#include "CaeTestVideoStates.h"
+#include "CaeTestVideoSettings.h"
+
+#include <e32des8.h>
+
+
+// Starting point of the DLL (Always needed) 
+#ifndef EKA2
+GLDEF_C TInt E32Dll( TDllReason )
+    {
+    return( KErrNone );
+    }
+#endif
+
+// Exactly one exported function returning the suite of 
+// test functions for the test runner in the framework.
+// (Always needed)
+//
+
+
+EXPORT_C MTest* CreateTopFct()
+    {
+	return ( CCaeTestTop::suiteL() );
+    }
+
+
+CCaeTestTop::~CCaeTestTop()
+    {
+    }
+
+
+MTest* CCaeTestTop::suiteL()
+    {
+	CTestSuite *suite = CTestSuite::NewL( _L8( "Camera Application Engine Test Suite Container" ) );
+    
+    suite->addTestL( CCaeTestRelease::suiteL() );
+    
+    //suite->addTestL( CCaeTestStillStates::suiteL() );
+    //suite->addTestL( CCaeTestVideoStates::suiteL() );
+    
+  	//suite->addTestL( CCaeTestStillSettings::suiteL() );
+    //suite->addTestL( CCaeTestVideoSettings::suiteL() );
+    
+    return suite;	
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestVideoSettings.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,2053 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestVideoSettings.cpp
+*
+*/
+
+#include "CaeTestVideoSettings.h"
+#include <f32file.h>
+
+
+
+CCaeTestVideoSettings::CCaeTestVideoSettings()
+    {
+    }
+
+
+CCaeTestVideoSettings::~CCaeTestVideoSettings()
+    {
+    }
+
+
+void CCaeTestVideoSettings::setUpL()
+    {
+	iSettingsClient = CCaeTestSettingsClient::NewL();
+
+    iSettingsClient->SetFileNameBase( KFileNameBase );
+    }
+
+//_LIT(KVideoFileName, "videoclip.3gp");
+
+void CCaeTestVideoSettings::tearDown()
+    {
+    delete iSettingsClient;
+    iSettingsClient = 0;
+    }
+
+
+//
+// Own test functions.
+//
+// The framework will do for a test function:
+//
+// setUpL();
+// TRAPD(leaveCode, 'myTestFunction()');
+// "Report leave error or assertion failure for 'myTestFunction()'".
+// tearDown();
+//
+
+
+/********************************************************/
+/*             VIDEO RECORDING DIGITAL ZOOM VALUE       */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestDigiZoomVal2L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETZOOMVALUEL.008
+    //
+    // Action : Test out-of-bounds digital zoom value.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+	
+    iSettingsClient->SetDigiZoomValue( info.iMaxDigitalZoom + 1 );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_digizoom_val_2.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenVideoPrepared ) );
+    assertL( err != KErrNone );
+}
+
+void CCaeTestVideoSettings::TestDigiZoomNegVal1L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETZOOMVALUEL.009
+    //
+    // Action : Test digital zoom.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetDigiZoomValue( -1 );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_digizoom_val_-1.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenVideoPrepared ) );
+    assertL( err != KErrNone );
+}
+
+/********************************************************/
+/*             VIDEO RECORDING DIGITAL ZOOM MODE        */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestDigiZoomMode0L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETZOOMMODEL.006
+    //
+    // Action : Test digital zoom mode.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetZoomMode( 0 );
+
+    iSettingsClient->SetVideoFileName( _L("cae_digizoom_mode_0.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenVideoPrepared );//verify if is correct action
+}
+
+void CCaeTestVideoSettings::TestOpticalZoomMode1L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETZOOMMODEL.007
+    //
+    // Action : Test optical zoom mode.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetZoomMode( 1 );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_digizoom_mode_1.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenVideoPrepared ) );//verify if is correct action
+    assertL( err != KErrNone );//verify if is correct action
+}
+
+void CCaeTestVideoSettings::TestOpticalDigiZoomMode2L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETZOOMMODEL.008
+    //
+    // Action : Test optical digital zoom mode.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetZoomMode( 2 );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_digizoom_mode_2.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenVideoPrepared ) );//verify if is correct action
+    assertL( err != KErrNone );//verify if is correct action
+}
+
+void CCaeTestVideoSettings::TestDigiZoomNegMode1L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETZOOMMODEL.009
+    //
+    // Action : Test digital zoom mode.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetZoomMode( -1 );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_digizoom_mode_-1.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenVideoPrepared ) );//verify if is correct action
+    assertL( err != KErrNone );
+}
+
+/********************************************************/
+/*             VIDEO RECORDING BRIGHTNESS               */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestBrightness0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETBRIGHTNESSL.009
+    //
+    // Action : Test brightness setting with video recording and viewfinding.
+	//      
+	// Output : No leave.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetBrightness( 0 );
+
+    iSettingsClient->SetVideoFileName( _L("cae_brightness_0.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenVideoPrepared ) );
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestBrightness100L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETBRIGHTNESSL.010
+    //
+    // Action : Test brightness setting with video recording and viewfinding.
+	//      
+	// Output : No leave.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetBrightness( 100 );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_brightness_100.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenVideoPrepared ) );
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestBrightnessNeg100L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETBRIGHTNESSL.011
+    //
+    // Action : Test brightness setting with video recording and viewfinding.
+	//      
+	// Output : No leave.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetBrightness( -100 );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_brightness_-100.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenVideoPrepared ) );
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestBrightness101L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETBRIGHTNESSL.012
+    //
+    // Action : Test brightness setting with video recording and viewfinding.
+	//      
+	// Output : Leave.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetBrightness( 101 );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_brightness_101.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenVideoPrepared ) );
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNotSupported );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestBrightnessNeg101L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETBRIGHTNESSL.013
+    //
+    // Action : Test brightness setting with video recording and viewfinding.
+	//      
+	// Output : Leave.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetBrightness( -101 );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_brightness_-101.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetBrightnessWhenVideoPrepared ) );
+    if ( TCameraInfo::EBrightnessSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNotSupported );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+/********************************************************/
+/*             VIDEO RECORDING CONTRAST                 */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestContrast0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETCONTRASTL.009
+    //
+    // Action : Test contrast setting with video recording and viewfinding.
+	//      
+	// Output : No leave if supported. Leave if not supported.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetContrast( 0 );
+
+    iSettingsClient->SetVideoFileName( _L("cae_contrast_0.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenVideoPrepared ) );
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestContrast100L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETCONTRASTL.010
+    //
+    // Action : Test contrast setting with video recording and viewfinding.
+	//      
+	// Output : No leave if supported. Leave if not supported.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetContrast( 100 );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_contrast_100.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenVideoPrepared ) );
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestContrastNeg100L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETCONTRASTL.011
+    //
+    // Action : Test contrast setting with video recording and viewfinding.
+	//      
+	// Output : No leave if supported. Leave if not supported.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetContrast( -100 );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_contrast_-100.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenVideoPrepared ) );
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestContrast101L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETCONTRASTL.012
+    //
+    // Action : Test contrast setting with video recording and viewfinding.
+	//      
+	// Output : Leave.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetContrast( 101 );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_contrast_101.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenVideoPrepared ) );
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNotSupported );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestContrastNeg101L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETCONTRASTL.013
+    //
+    // Action : Test contrast setting with video recording and viewfinding.
+	//      
+	// Output : Leave.   
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetContrast( -101 );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_contrast_-101.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetContrastWhenVideoPrepared ) );
+    if ( TCameraInfo::EContrastSupported & info.iOptionsSupported )
+		{
+		assertL( err == KErrNotSupported );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+
+/********************************************************/
+/*             VIDEO RECORDING EXPOSURE MODE            */
+/********************************************************/
+
+
+void CCaeTestVideoSettings::TestExposureMode2L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETEXPOSUREMODEL.010
+    //
+    // Action : Test exposure mode 2.
+	//      
+	// Output : No leave if the mode is supported. Leave if not supported.   
+
+	const TInt KSetVal = 2;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetExposureMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_exposure_mode_2.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenVideoPrepared ) );
+	if ( KSetVal & info.iExposureModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err != KErrNone );
+		}
+}
+
+void CCaeTestVideoSettings::TestExposureMode4L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETEXPOSUREMODEL.011
+    //
+    // Action : Test exposure mode 4
+	//      
+	// Output : No leave if the mode is supported. Leave if not supported.   
+
+	const TInt KSetVal = 4;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetExposureMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_exposure_mode_4.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenVideoPrepared ) );
+	if ( KSetVal & info.iExposureModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err != KErrNone );
+		}
+}
+
+void CCaeTestVideoSettings::TestExposureModeNeg1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETEXPOSUREMODEL.012
+    //
+    // Action : Test invalid exposure mode
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = -1;
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetExposureMode( KSetVal );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_exposure_mode_-1.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenVideoPrepared ) );
+    assertL( err == KErrNotSupported );
+}
+
+void CCaeTestVideoSettings::TestExposureMode5L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETEXPOSUREMODEL.013
+    //
+    // Action : Test combined exposure modes.
+	//      
+	// Output : Leave. 
+
+	const TInt KSetVal = 5;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetExposureMode( KSetVal );
+
+    // iSettingsClient->SetVideoFileName( _L("cae_exposure_mode_5.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenVideoPrepared ) );
+	if ( KSetVal & info.iExposureModesSupported )
+		{
+		assertL( err != KErrNotSupported );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+/********************************************************/
+/*           VIDEO RECORDING WHITE BALANCE MODE         */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestWhiteBalanceMode1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETWHITEBALANCEMODEL.011
+    //
+    // Action : Test white balance setting with video recording and viewfinding.
+	//      
+	// Output : No leave if the mode is supported. Leave if not supported.   
+
+	const TInt KSetVal = 1;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_white_balance_mode_1.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenVideoPrepared ) );
+	if ( KSetVal & info.iWhiteBalanceModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestWhiteBalanceMode2L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETWHITEBALANCEMODEL.012
+    //
+    // Action : Test white balance setting with video recording and viewfinding.
+	//      
+	// Output : No leave if the mode is supported. Leave if not supported.   
+
+	const TInt KSetVal = 2;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_white_balance_mode_2.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenVideoPrepared ) );
+	if ( KSetVal & info.iWhiteBalanceModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestWhiteBalanceMode4L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETWHITEBALANCEMODEL.013
+    //
+    // Action : Test white balance setting with video recording and viewfinding.
+	//      
+	// Output : No leave if the mode is supported. Leave if not supported.   
+
+	const TInt KSetVal = 4;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_white_balance_mode_4.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenVideoPrepared ) );
+	if ( KSetVal & info.iWhiteBalanceModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestWhiteBalanceMode8L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETWHITEBALANCEMODEL.014
+    //
+    // Action : Test white balance setting with video recording and viewfinding.
+	//      
+	// Output : No leave if the mode is supported. Leave if not supported.   
+
+	const TInt KSetVal = 8;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_white_balance_mode_8.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenVideoPrepared ) );
+	if ( KSetVal & info.iWhiteBalanceModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestWhiteBalanceMode10L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETWHITEBALANCEMODEL.015
+    //
+    // Action : Test white balance setting with video recording and viewfinding.
+	//      
+	// Output : No leave if the mode is supported. Leave if not supported.   
+
+	const TInt KSetVal = 0x10;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_white_balance_mode_10.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenVideoPrepared ) );
+	if ( KSetVal & info.iWhiteBalanceModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestWhiteBalanceModeNeg1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETWHITEBALANCEMODEL.016
+    //
+    // Action : Test white balance setting with video recording and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = -1;
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_white_balance_mode_-1.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenVideoPrepared ) );
+    assertL( err != KErrNone );
+}
+
+void CCaeTestVideoSettings::TestWhiteBalanceMode5L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETWHITEBALANCEMODEL.017
+    //
+    // Action : Test white balance setting with video recording and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 5;
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_white_balance_mode_5.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenVideoPrepared ) );
+    assertL( err != KErrNone );
+}
+
+void CCaeTestVideoSettings::TestWhiteBalanceMode12L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETWHITEBALANCEMODEL.018
+    //
+    // Action : Test white balance setting with video recording and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 0x12; // illegal combination of cloudy & flash
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_white_balance_mode_12.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenVideoPrepared ) );
+    assertL( err != KErrNone );
+}
+
+/********************************************************/
+/*             VIDEO RECORDING FLASH MODE               */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestFlashMode0L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETFLASHMODEL.009
+    //
+    // Action : Test flash mode setting with video recording and viewfinding.
+	//      
+	// Output : No leave.   
+
+	const TInt KSetVal = 0;
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_flash_mode_0.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenVideoPrepared );
+}
+
+void CCaeTestVideoSettings::TestFlashMode1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETFLASHMODEL.010
+    //
+    // Action : Test flash mode setting with video recording and viewfinding.
+	//      
+	// Output : No leave if the mode is supported. Leave if not supported.   
+
+	const TInt KSetVal = 1;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_flash_mode_1.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenVideoPrepared ) );
+	if ( KSetVal & info.iFlashModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestFlashMode2L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETFLASHMODEL.011
+    //
+    // Action : Test flash mode setting with video recording and viewfinding.
+	//      
+	// Output : No leave if the mode is supported. Leave if not supported.   
+
+	const TInt KSetVal = 2;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_flash_mode_2.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenVideoPrepared ) );
+	if ( KSetVal & info.iFlashModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestFlashMode4L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETFLASHMODEL.012
+    //
+    // Action : Test flash mode setting with video recording and viewfinding.
+	//      
+	// Output : No leave if the mode is supported. Leave if not supported.   
+
+	const TInt KSetVal = 4;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_flash_mode_4.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenVideoPrepared ) );
+	if ( KSetVal & info.iFlashModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestFlashMode8L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETFLASHMODEL.013
+    //
+    // Action : Test flash mode setting with video recording and viewfinding.
+	//      
+	// Output : No leave if the mode is supported. Leave if not supported.   
+
+	const TInt KSetVal = 8;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_flash_mode_8.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenVideoPrepared ) );
+	if ( KSetVal & info.iFlashModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestFlashModeNeg1L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETFLASHMODEL.014
+    //
+    // Action : Test flash mode setting with video recording and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = -1;
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_flash_mode_-1.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenVideoPrepared ) );
+    assertL( err != KErrNone );
+}
+
+void CCaeTestVideoSettings::TestFlashMode5L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETFLASHMODEL.015
+    //
+    // Action : Test flash mode setting with video recording and viewfinding.
+	//      
+	// Output : Leave.   
+
+	const TInt KSetVal = 5;
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    //iSettingsClient->SetVideoFileName( _L("cae_flash_mode_5.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenVideoPrepared ) );
+    assertL( err != KErrNone );
+}
+
+/********************************************************/
+/*             VIDEO RECORDING CLIP MAX SIZE            */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestVideoClipMaxSize0L()
+{
+	// Group:   Settings.
+    // 
+    //ID:       CAE.SET-VR.SETVIDEOCLIPMAXSIZEL.001
+    //
+    // Action : Test video clip max size setting with video recording.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetTimeout( 5000000 );
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoClipMaxSize( 0 );
+
+    iSettingsClient->SetVideoFileName( _L("cae_clip_max_size_0.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetClipMaxSizeWhenVideoPrepared );
+}
+
+void CCaeTestVideoSettings::TestVideoClipMaxSizeNeg1L()
+{
+	// Group:   Settings.
+    // 
+    //ID:       CAE.SET-VR.SETVIDEOCLIPMAXSIZEL.003
+    //
+    // Action : Test video clip max size setting with video recording.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetTimeout( 5000000 );
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoClipMaxSize( -1 );
+
+    iSettingsClient->SetVideoFileName( _L("cae_clip_max_size_-1.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetClipMaxSizeWhenVideoPrepared );
+}
+
+/*
+void CCaeTestVideoSettings::TestVideoClipMaxSize10001L()
+{
+	// Group:   Settings.
+    // 
+    //ID:       CAE.SET-VR.SETVIDEOCLIPMAXSIZEL.004
+    //
+    // Action : Test video clip max size setting with video recording.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetTimeout( 10000000 );
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoClipMaxSize( 10001 );
+
+    iSettingsClient->SetVideoFileName( _L("cae_clip_max_size_10001.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetClipMaxSizeWhenVideoPrepared ) );
+    assertL( err == KErrCompletion );
+}
+*/
+
+/********************************************************/
+/*               VIDEO RECORDING AUDIO                  */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestVideoAudioETrueL()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETVIDEOAUDIO.001
+    //
+    // Action : Test audio enable setting with video recording and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoAudio( ETrue );
+
+    iSettingsClient->SetVideoFileName( _L("cae_video_audio_true.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetAudioWhenVideoPrepared );
+}
+
+void CCaeTestVideoSettings::TestVideoAudioEFalseL()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETVIDEOAUDIO.002
+    //
+    // Action : Test audio enable setting with video recording and viewfinding.
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoAudio( EFalse );
+
+    iSettingsClient->SetVideoFileName( _L("cae_video_audio_false.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetAudioWhenVideoPrepared );
+}
+
+
+/********************************************************/
+/*                    VIDEO RECORDING                   */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestExposureModeRecording2L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETEXPOSUREMODEL.014
+    //
+    // Action : Test exposure mode
+	//      
+	// Output : No leave if mode is supported. Leave if not supported.  
+
+	const TInt KSetVal = 2;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetExposureMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_exposure_mode_recording_2.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetExposureModeWhenVideoRecording ) );
+	if ( KSetVal & info.iExposureModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestWhiteBalanceModeRecording2L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETWHITEBALANCEMODEL.018
+    //
+    // Action : Test white balance setting with Video image capture and viewfinding.
+	//      
+	// Output : No leave if the mode is supported. Leave if not supported.   
+
+	const TInt KSetVal = 2;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetWhiteBalanceMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_white_balance_mode_recording_2.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetWhiteBalanceModeWhenVideoRecording ) );
+	if ( KSetVal & info.iWhiteBalanceModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestFlashModeRecording2L()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETFLASHMODEL.016
+    //
+    // Action : Test flash mode setting with Video image capture and viewfinding.
+	//      
+	// Output : No leave if the mode is supported. Leave if not supported.   
+
+	const TInt KSetVal = 2;
+
+	TCamAppEngineInfo info;
+	iSettingsClient->GetInfo( info );
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetFlashMode( KSetVal );
+
+    iSettingsClient->SetVideoFileName( _L("cae_flash_mode_recording_2.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetFlashModeWhenVideoRecording ) );
+	if ( KSetVal & info.iFlashModesSupported )
+		{
+		assertL( err == KErrNone );
+		}
+	else
+		{
+		assertL( err == KErrNotSupported );
+		}
+}
+
+void CCaeTestVideoSettings::TestDigiZoomRecordingMode0L()
+{
+	// Group:   Settings
+    // 
+    // ID:      CAE.SET-VR.SETZOOMMODEL.010    // ID:      CAE.SET-VR.SETZOOMMODEL.006
+    //
+    //
+    // Action : Test digital zoom mode.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetZoomMode( 0 );
+
+    iSettingsClient->SetVideoFileName( _L("cae_digizoom_recording_mode_0.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetDigiZoomWhenVideoRecording );//verify if is correct action
+}
+
+void CCaeTestVideoSettings::TestVideoClipMaxSizeRecording10000L()
+{
+	// Group:   Settings.
+    // 
+    //ID:       CAE.SET-VR.SETVIDEOCLIPMAXSIZEL.005
+    //
+    // Action : Test video clip max size setting with video recording and viewfinding.
+	//      
+	// Output : Leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoClipMaxSize( 10000 );
+
+    iSettingsClient->SetVideoFileName( _L("cae_clip_max_size_recording_10000.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetClipMaxSizeWhenVideoRecording ) );
+    assertL( err == KErrNotReady );
+}
+
+void CCaeTestVideoSettings::TestVideoClipMaxSizeNotInitialized10000L()
+{
+	// Group:   Settings.
+    // 
+    //ID:       CAE.SET-VR.SETVIDEOCLIPMAXSIZEL.006
+    //
+    // Action : Test video clip max size setting with video recording and viewfinding.
+	//      
+	// Output : Leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoClipMaxSize( 10000 );
+
+    iSettingsClient->SetVideoFileName( _L("cae_clip_max_size_recording_10000.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetClipMaxSizeWhenVideoNotInitialized ) );
+    assertL( err == KErrNotReady );
+}
+
+void CCaeTestVideoSettings::TestVideoAudioRecordingETrueL()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETVIDEOAUDIO.003
+    //
+    // Action : Test audio enable setting with video recording and viewfinding.
+	//      
+	// Output : Leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoAudio( ETrue );
+
+    iSettingsClient->SetVideoFileName( _L("cae_video_audio_recording_true.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetAudioWhenVideoRecording ) );
+    assertL( err == KErrNotReady );
+}
+
+void CCaeTestVideoSettings::TestVideoAudioNotInitializedL()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETVIDEOAUDIO.004
+    //
+    // Action : Test audio enable setting with video not initialized.
+	//      
+	// Output : Leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoAudio( ETrue );
+
+    iSettingsClient->SetVideoFileName( _L("cae_video_audio_recording_notinit.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetAudioWhenVideoNotInitialized ) );
+    assertL( err == KErrNotReady );
+}
+void CCaeTestVideoSettings::TestGetVideoAudioNotInitializedL()
+{
+	// Group:   Settings.
+    // 
+    // ID:      CAE.GET-VR.GETVIDEOAUDIO.005
+    //
+    // Action : Test video audio
+	//      
+	// Output : No leave.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoAudio( EFalse );
+
+    iSettingsClient->SetVideoFileName( _L("cae_video_audio_notinit.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetAudioWhenVideoNotInitialized );
+}
+
+/********************************************************/
+/*             VIDEO RECORDING FILE NAME       */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestSetVideoFileNameL()
+    {
+	// Group:   Settings.
+    //
+    // ID:      CAE.SET-VR.SETVIDEORECORDINGFILENAMEL.001
+    // 
+    // Action : Try to set valid file name for the video clip to be recorded. 
+    //          Video recorder initialization is done .
+	//      
+	// Output : No leave. File KVideoFileName, "videoclip.3gp".   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoFileName( _L("videoclip.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetVideoFileNameWhenInitialized );
+
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    }
+
+
+void CCaeTestVideoSettings::TestSetEmptyVideoFileNameL()
+    {
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETVIDEORECORDINGFILENAMEL.002
+    // 
+    // Action : Try to set invalid (empty) file name for the video clip to be recorded. 
+    //          Video recorder initialization is done .
+	//      
+	// Output : Leave.    
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    //iSettingsClient->SetVideoFileName( _L("") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetEmptyVideoFileNameWhenInitialized ) );
+    assertL( err != KErrNone );
+
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    }
+
+
+void CCaeTestVideoSettings::TestSetVideoFileNameWhenPreparedL()
+    {
+	// Group:   Settings.
+    //
+    // ID:      CAE.SET-VR.SETVIDEORECORDINGFILENAMEL.003
+    // 
+    // Action : Set Video File Name when prepared
+	//      
+	// Output : No leave. File KVideoFileName, "videoclip.3gp".   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetTimeout( 5000000 );
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoFileName( _L("videoclip.3gp") );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetVideoFileNameWhenPrepared );
+
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    }
+
+void CCaeTestVideoSettings::TestSetVideoFileNameWhenNotInitializedL()
+    {
+	// Group:   Settings.
+    // 
+    // ID:      CAE.SET-VR.SETVIDEORECORDINGFILENAMEL.004
+    // 
+    // Action : Try to set file name for the video clip to be recorded. 
+    //          Video recorder initialization is not done .
+	//      
+	// Output : Leave.    
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoFileName( _L("videoclipnoi.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetVideoFileNameWhenNotInitialized ) );
+    assertL( err != KErrNone );
+
+    assertL( iSettingsClient->CountInitComplete() == 1 ); // This is not videoinit counter
+    }
+
+void CCaeTestVideoSettings::TestSetVideoFileNameWhenRecordingL()
+    {
+	// Group:   Settings.
+    //
+    // ID:      CAE.SET-VR.SETVIDEORECORDINGFILENAMEL.005
+    // 
+    // Action : Set Video File Name when recording
+	//      
+	// Output : Leave. 
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );   
+
+    iSettingsClient->SetTimeout( 5000000 );
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->SetVideoFileName( _L("videocliprec.3gp") );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetVideoFileNameWhenRecording ) );
+    assertL( err != KErrNone );
+
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    }
+
+/********************************************************/
+/*             VIDEO RECORDING TIME INTERVAL            */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestSetVideoTimeIntervalSubQcifWhenPreparedL()
+    {
+	// ID: CAE.SET-VR.SETVIDEOTIMEINTERVAL.SUBQCIF.001
+    //
+    // Group:   Settings.
+    // 
+    // Action : Mcaeo VideoRecordingTime when video prepared. 
+    //          Inform about video recording time elapsed.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );
+
+    iSettingsClient->SetTimeout( 3000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iSettingsClient->SetVideoFrameSize( sizeSubQcif );
+    iSettingsClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iSettingsClient->SetVideoBitRate( TInt( 25000 ) );
+
+    iSettingsClient->SetVideoFileName( _L("cae_time_interval_prepared_subqcif.3gp") );
+
+    TTimeIntervalMicroSeconds videoTimeInterval( 400000 );
+    
+    iSettingsClient->SetVideoTimesInterval( videoTimeInterval );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetVideoTimesIntervalWhenVideoPrepared );
+    
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountVideoPrepareComplete() == 1 );
+    assertL( iSettingsClient->CountVideoRecordingOn() == 2 );
+    assertL( iSettingsClient->CountVideoRecordingPaused() == 1 );
+    assertL( iSettingsClient->CountVideoRecordingComplete() == 1 );
+    assertL( iSettingsClient->CountVideoRecordingTimes() >= 3 );
+    }
+
+void CCaeTestVideoSettings::TestSetVideoTimeIntervalSubQcifWhenRecordingL()
+    {
+	// ID: CAE.SET-VR.SETVIDEOTIMEINTERVAL.SUBQCIF.002
+    //
+    // Group:   Settings.
+    // 
+    // Action : Mcaeo VideoRecordingTime when video recording. 
+    //          Inform about video recording time elapsed.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );
+
+    iSettingsClient->SetTimeout( 5000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iSettingsClient->SetVideoFrameSize( sizeSubQcif );
+    iSettingsClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iSettingsClient->SetVideoBitRate( TInt( 25000 ) );
+
+    iSettingsClient->SetVideoFileName( _L("cae_time_interval_recording_subqcif.3gp") );
+
+    TTimeIntervalMicroSeconds videoTimeInterval( 400000 );
+    
+    iSettingsClient->SetVideoTimesInterval( videoTimeInterval );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetVideoTimesIntervalWhenVideoRecording ) );
+    assertL( err == KErrNotReady );
+    
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountVideoPrepareComplete() == 1 );
+    assertL( iSettingsClient->CountVideoRecordingOn() == 1 );
+    assertL( iSettingsClient->CountVideoRecordingComplete() == 1 );
+    assertL( iSettingsClient->CountVideoRecordingTimes() >= 2 );
+
+    }
+
+void CCaeTestVideoSettings::TestSetZeroVideoTimeIntervalSubQcifWhenPreparedL()
+    {
+	// ID: CAE.SET-VR.SETVIDEOTIMEINTERVAL.SUBQCIF.003
+    //
+    // Group:   Settings.
+    // 
+    // Action : Mcaeo VideoRecordingTime when video prepared. 
+    //          Inform about video recording time elapsed.
+	//      
+	// Output : OK.   
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );
+
+    iSettingsClient->SetTimeout( 3000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iSettingsClient->SetVideoFrameSize( sizeSubQcif );
+    iSettingsClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iSettingsClient->SetVideoBitRate( TInt( 25000 ) );
+
+    iSettingsClient->SetVideoFileName( _L("cae_time_interval_zero_prepared_subqcif.3gp") );
+
+    TTimeIntervalMicroSeconds videoTimeInterval( 0 );
+    
+    iSettingsClient->SetVideoTimesInterval( videoTimeInterval );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetVideoTimesIntervalWhenVideoPrepared );
+    
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountVideoPrepareComplete() == 1 );
+    assertL( iSettingsClient->CountVideoRecordingOn() == 2 );
+    assertL( iSettingsClient->CountVideoRecordingPaused() == 1 );
+    assertL( iSettingsClient->CountVideoRecordingComplete() == 1 );
+    assertL( iSettingsClient->CountVideoRecordingTimes() == 0 );
+    }
+
+void CCaeTestVideoSettings::TestSetVideoTimeIntervalNegativeL()
+    {
+	// ID: CAE.SET-VR.SETVIDEOTIMEINTERVAL.SUBQCIF.004
+    //
+    // Group:   Settings.
+    // 
+    // Action : Mcaeo VideoRecordingTime when video prepared. 
+    //          Set illegal interval
+	//      
+	// Output : Leave.
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );
+
+    iSettingsClient->SetTimeout( 3000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iSettingsClient->SetVideoFrameSize( sizeSubQcif );
+    iSettingsClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iSettingsClient->SetVideoBitRate( TInt( 25000 ) );
+
+    iSettingsClient->SetVideoFileName( _L("cae_time_interval_prepared_subqcif_neg.3gp") );
+
+    TTimeIntervalMicroSeconds videoTimeInterval( -1 );
+    
+    iSettingsClient->SetVideoTimesInterval( videoTimeInterval );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetVideoTimesIntervalWhenVideoPrepared ) );
+    assertL( err == KErrArgument );
+    
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountVideoPrepareComplete() == 1 );
+    }
+
+void CCaeTestVideoSettings::TestSetVideoTimeIntervalHugeL()
+    {
+	// ID: CAE.SET-VR.SETVIDEOTIMEINTERVAL.SUBQCIF.005
+    //
+    // Group:   Settings.
+    // 
+    // Action : Mcaeo VideoRecordingTime when video prepared. 
+    //          Set illegal interval
+	//      
+	// Output : Leave.
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );
+
+    iSettingsClient->SetTimeout( 3000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iSettingsClient->SetVideoFrameSize( sizeSubQcif );
+    iSettingsClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iSettingsClient->SetVideoBitRate( TInt( 25000 ) );
+
+    iSettingsClient->SetVideoFileName( _L("cae_time_interval_prepared_subqcif_neg.3gp") );
+
+    TTimeIntervalMicroSeconds videoTimeInterval( KMaxTUint32 );
+    
+    iSettingsClient->SetVideoTimesInterval( videoTimeInterval );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::ESetVideoTimesIntervalWhenVideoPrepared ) );
+    assertL( err == KErrArgument );
+    
+    assertL( iSettingsClient->CountInitComplete() == 1 );
+    assertL( iSettingsClient->CountVideoPrepareComplete() == 1 );
+    }
+
+/********************************************************/
+/*                 GET VIDEO FRAME SIZE                 */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestGetVideoFrameSizeWhenInitializedL()
+    {
+	// ID:      CAE.VR.GETVIDEOFRAMESIZE.001
+    //
+    // Group:   Record.
+    // 
+    // Action : Get the video frame size of the specified 
+    //          quality level, when initialization is done.
+	//      
+	// Output : Compare.  
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetVideoFrameSizeWhenInitialized ) );
+    assertL( err == KErrNone );
+
+    TSize size( KImgWidthQCIF, KImgHeightQCIF );
+
+    TSize videoFrameSize;
+    iSettingsClient->GetVideoFrameSize( videoFrameSize );
+    if ( videoFrameSize != size )
+        {
+        User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+        }
+    }
+
+void CCaeTestVideoSettings::TestGetVideoFrameSizeWhenPreparedL()
+    {
+	// ID:      CAE.VR.GETVIDEOFRAMESIZE.002
+    //
+    // Group:   Record.
+    // 
+    // Action : Get the video frame size of the specified 
+    //          quality level, when prepared.
+	//      
+	// Output : Compare.  
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EGetVideoFrameSizeWhenPrepared );
+
+    TSize size( KImgWidthQCIF, KImgHeightQCIF );
+
+    TSize videoFrameSize;
+    iSettingsClient->GetVideoFrameSize( videoFrameSize );
+    if ( videoFrameSize != size )
+        {
+        User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+        }
+    }
+
+/********************************************************/
+/*                  VIDEO FRAME RATE                    */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestVideoFrameRateWhenInitializedL()
+    {
+	// ID:      CAE.VR.VIDEOFRAMERATE.001
+    //
+    // Group:   Record.
+    // 
+    // Action : Get the video frame rate of the specified 
+    //          quality level, when initialization is done.
+	//      
+	// Output : Compare.  
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EVideoFrameRateWhenInitialized ));
+    assertL( err == KErrNone );
+
+    TReal32 expectedResult( 15.0 );
+
+    TReal32 videoFrameRate = iSettingsClient->VideoFrameRate();
+    if ( videoFrameRate != expectedResult )
+        {
+        User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+        }
+    }
+
+void CCaeTestVideoSettings::TestVideoFrameRateWhenPreparedL()
+    {
+	// ID:      CAE.VR.VIDEOFRAMERATE.002
+    //
+    // Group:   Record.
+    // 
+    // Action : Get the video frame rate of the specified 
+    //          quality level, when prepared.
+	//      
+	// Output : Compare.  
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EVideoFrameRateWhenPrepared );
+
+    TReal32 expectedResult( 15.0 );
+
+    TReal32 videoFrameRate = iSettingsClient->VideoFrameRate();
+    if ( videoFrameRate != expectedResult )
+        {
+        User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+        }
+    }
+
+/********************************************************/
+/*          ESTIMATED VIDEO RECORDING BIT RATE           */
+/********************************************************/
+
+void CCaeTestVideoSettings::TestEstimatedVideoRecordingBitRateWhenInitializedL()
+    {
+	// ID:      CAE.VR.ESTIMATEDVIDEORECORDINGBITRATE.001
+    //
+    // Group:   Record.
+    // 
+    // Action : Get the estimated video recording bit rate including audio bit rate 
+    //          (for specified video quality level) when initialization is done.
+	//      
+	// Output : Compare.  
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    TRAPD( err, iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EEstimatedVideoRecordingBitRateWhenInitialized ) );
+    assertL( err == KErrNone );
+
+    TInt videoBitRate;
+    videoBitRate = iSettingsClient->EstimatedVideoRecordingBitRate();
+    if ( videoBitRate != 78000 )
+        {
+        User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+        }
+    }
+
+void CCaeTestVideoSettings::TestEstimatedVideoRecordingBitRateWhenPreparedL()
+    {
+	// ID:      CAE.VR.ESTIMATEDVIDEORECORDINGBITRATE.002
+    //
+    // Group:   Record.
+    // 
+    // Action : Get the estimated video recording bit rate including audio bit rate 
+    //          (for specified video quality level) when prepared.
+	//      
+	// Output : Compare.  
+
+    iSettingsClient->SetOpMode( CCaeTestSettingsClient::EClientOpModeVideo );
+
+    iSettingsClient->SetVideoQualityLevelIndex( 0 );
+
+    iSettingsClient->RunTestActionL( CCaeTestSettingsClient::EEstimatedVideoRecordingBitRateWhenPrepared );
+
+    TInt videoBitRate;
+    videoBitRate = iSettingsClient->EstimatedVideoRecordingBitRate();
+    if ( videoBitRate != 78000 )
+        {
+        User::Leave ( KErrGetNotEqualToValuePreviouslySet );
+        }
+    }
+
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+
+MTest* CCaeTestVideoSettings::suiteL ()
+{
+	// Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL( _L8("CCaeTestVideoSettings") );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOCLIPMAXSIZEL.001"), &TestVideoClipMaxSize0L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOCLIPMAXSIZEL.003"), &TestVideoClipMaxSizeNeg1L ) );	
+
+// NOT IN USE:    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOCLIPMAXSIZEL.004"), &TestVideoClipMaxSize10001L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETZOOMVALUEL.008"), &TestDigiZoomVal2L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETZOOMVALUEL.009"), &TestDigiZoomNegVal1L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETZOOMMODEL.006"), &TestDigiZoomMode0L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETZOOMMODEL.007"), &TestOpticalZoomMode1L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETZOOMMODEL.008"), &TestOpticalDigiZoomMode2L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETZOOMMODEL.009"), &TestDigiZoomNegMode1L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETBRIGHTNESSL.009"), &TestBrightness0L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETBRIGHTNESSL.010"), &TestBrightness100L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETBRIGHTNESSL.011"), &TestBrightnessNeg100L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETBRIGHTNESSL.012"), &TestBrightness101L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETBRIGHTNESSL.013"), &TestBrightnessNeg101L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETCONTRASTL.009"), &TestContrast0L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETCONTRASTL.010"), &TestContrast100L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETCONTRASTL.011"), &TestContrastNeg100L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETCONTRASTL.012"), &TestContrast101L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETCONTRASTL.013"), &TestContrastNeg101L ) );
+	
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETEXPOSUREMODEL.010"), &TestExposureMode2L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETEXPOSUREMODEL.011"), &TestExposureMode4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETEXPOSUREMODEL.012"), &TestExposureModeNeg1L ) );
+	
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETEXPOSUREMODEL.013"), &TestExposureMode5L ) );
+	
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETWHITEBALANCEMODEL.011"), &TestWhiteBalanceMode1L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETWHITEBALANCEMODEL.012"), &TestWhiteBalanceMode2L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETWHITEBALANCEMODEL.013"), &TestWhiteBalanceMode4L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETWHITEBALANCEMODEL.014"), &TestWhiteBalanceMode8L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETWHITEBALANCEMODEL.015"), &TestWhiteBalanceMode10L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETWHITEBALANCEMODEL.016"), &TestWhiteBalanceModeNeg1L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETWHITEBALANCEMODEL.017"), &TestWhiteBalanceMode5L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETWHITEBALANCEMODEL.018"), &TestWhiteBalanceMode12L ) );
+	
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETFLASHMODEL.009"), &TestFlashMode0L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETFLASHMODEL.010"), &TestFlashMode1L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETFLASHMODEL.011"), &TestFlashMode2L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETFLASHMODEL.012"), &TestFlashMode4L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETFLASHMODEL.013"), &TestFlashMode8L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETFLASHMODEL.014"), &TestFlashModeNeg1L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETFLASHMODEL.015"), &TestFlashMode5L ) );	
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOAUDIO.001"), &TestVideoAudioETrueL ) );
+       
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOAUDIO.002"), &TestVideoAudioEFalseL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETEXPOSUREMODEL.014"), &TestExposureModeRecording2L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETWHITEBALANCEMODEL.018"), &TestWhiteBalanceModeRecording2L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETFLASHMODEL.016"), &TestFlashModeRecording2L ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETZOOMMODEL.010"), &TestDigiZoomRecordingMode0L ) );
+	
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOCLIPMAXSIZEL.005"), &TestVideoClipMaxSizeRecording10000L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOCLIPMAXSIZEL.006"), &TestVideoClipMaxSizeNotInitialized10000L ) );
+    
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOAUDIO.003"), &TestVideoAudioRecordingETrueL ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOAUDIO.004"), &TestVideoAudioNotInitializedL ) );
+	suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.GET-VR.GETVIDEOAUDIO.005"), &TestGetVideoAudioNotInitializedL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEORECORDINGFILENAMEL.001"), &TestSetVideoFileNameL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEORECORDINGFILENAMEL.002"), &TestSetEmptyVideoFileNameL ) );  
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEORECORDINGFILENAMEL.003"), &TestSetVideoFileNameWhenPreparedL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEORECORDINGFILENAMEL.004"), &TestSetVideoFileNameWhenNotInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEORECORDINGFILENAMEL.005"), &TestSetVideoFileNameWhenRecordingL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOTIMEINTERVAL.SUBQCIF.001"), &TestSetVideoTimeIntervalSubQcifWhenPreparedL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOTIMEINTERVAL.SUBQCIF.002"), &TestSetVideoTimeIntervalSubQcifWhenRecordingL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOTIMEINTERVAL.SUBQCIF.003"), &TestSetZeroVideoTimeIntervalSubQcifWhenPreparedL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOTIMEINTERVAL.SUBQCIF.004"), &TestSetVideoTimeIntervalNegativeL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.SET-VR.SETVIDEOTIMEINTERVAL.SUBQCIF.005"), &TestSetVideoTimeIntervalHugeL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.VR.GETVIDEOFRAMESIZE.001"), &TestGetVideoFrameSizeWhenInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.VR.GETVIDEOFRAMESIZE.002"), &TestGetVideoFrameSizeWhenPreparedL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.VR.VIDEOFRAMERATE.001"), &TestVideoFrameRateWhenInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.VR.VIDEOFRAMERATE.002"), &TestVideoFrameRateWhenPreparedL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.VR.ESTIMATEDVIDEORECORDINGBITRATE.001"), &TestEstimatedVideoRecordingBitRateWhenInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoSettings>::NewL( _L8("CAE.VR.ESTIMATEDVIDEORECORDINGBITRATE.002"), &TestEstimatedVideoRecordingBitRateWhenPreparedL ) );
+    
+    return suite;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/src/CaeTestVideoStates.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,4006 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CaeTestVideoStates.cpp
+*
+*/
+
+#include "CaeTestVideoStates.h"
+#include <f32file.h>
+
+
+//const TReal32 KViewFinderFrameFrequencyMinimum = 13.0;
+
+
+CCaeTestVideoStates::CCaeTestVideoStates ()
+    {
+    }
+
+
+CCaeTestVideoStates::~CCaeTestVideoStates ()
+    {
+    }
+
+
+void CCaeTestVideoStates::setUpL ()
+    {
+	iStatesClient = CCaeTestStatesClient::NewL( );
+
+    iStatesClient->SetFileNameBase( KFileNameBase );
+    }
+
+
+void CCaeTestVideoStates::tearDown ()
+    {
+    delete iStatesClient;    
+    iStatesClient = 0;
+    }
+
+
+//
+// Own test functions.
+//
+// The framework will do for a test function:
+//
+// setUpL();
+// TRAPD(leaveCode, 'myTestFunction()');
+// "Report leave error or assertion failure for 'myTestFunction()'".
+// tearDown();
+//
+
+
+/********************************************************/
+/*  VIDEO RECORDING PREPARE AND RECORD QUALITY LEVEL    */
+/********************************************************/
+
+void CCaeTestVideoStates::TestPrepareAndRecordQualityLevel0L()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.QCIF64000FR15.004
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 0 
+    //          video clip when initialization is done.
+	//      
+	// Output : No leave. File cae_novf_ql_0.3gp.  
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetTimeout( 5000000 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoFileName( _L("cae_novf_ql_0.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAndRecordQualityLevel1L()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.SUBQCIF60000FR15.005
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 1 
+    //          video clip when initialization is done.
+	//      
+	// Output : No leave. File cae_novf_ql_1.3gp.  
+
+    iStatesClient->SetVideoQualityLevelIndex( 1 );
+
+    iStatesClient->SetTimeout( 5000000 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoFileName( _L("cae_novf_ql_1.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAndRecordQualityLevel2L()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.SUBQCIF40000FR5.006
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 2 
+    //          video clip when initialization is done.
+	//      
+	// Output : No leave. File cae_novf_ql_2.3gp.  
+
+    iStatesClient->SetVideoQualityLevelIndex( 2 );
+
+    iStatesClient->SetTimeout( 5000000 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoFileName( _L("cae_novf_ql_2.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+/********************************************************/
+/*  VIDEO RECORDING SPECIAL PREPARE AND RECORD          */
+/********************************************************/
+
+void CCaeTestVideoStates::TestVideoRecordingQcif60000Fr10NoAudioNoVfL()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.QCIF.003
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording QCIF sized video works. 
+    //          Video recording prepared for QCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 20000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetRunningWithViewFinder( EFalse );
+
+    iStatesClient->SetVideoFileName( _L("cae_qcif10fps.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestVideoRecordingQcif60000Fr10WithAudioNoVfL()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.QCIF.004
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording QCIF sized video works. 
+    //          Video recording prepared for QCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 20000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+#if ( defined (__WINS__) || defined (__WINSCW) ) // this different on hw
+    iStatesClient->SetVideoAudio( EFalse ); // Audio does not work in emulator, error -9
+#else
+    iStatesClient->SetVideoAudio( ETrue );
+#endif
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetRunningWithViewFinder( EFalse );
+
+    iStatesClient->SetVideoFileName( _L("cae_qcif10fps_audio.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestVideoRecordingQcif60000Fr10NoAudioWithVfL()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.QCIF.005
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording QCIF sized video works. 
+    //          Video recording prepared for QCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 20000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetViewFinderSize( sizeQcif );
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoFileName( _L("cae_qcif10fps_vf.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestVideoRecordingQcif60000Fr10WithAudioWithVfL()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.QCIF.006
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording QCIF sized video works. 
+    //          Video recording prepared for QCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 20000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+#if ( defined (__WINS__) || defined (__WINSCW) ) // this different on hw
+    iStatesClient->SetVideoAudio( EFalse );// Audio does not work in emulator, error -9
+#else
+    iStatesClient->SetVideoAudio( ETrue );
+#endif
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetViewFinderSize( sizeQcif );
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoFileName( _L("cae_qcif10fps_audio_vf.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*              PAUSE VIDEO RECORDING                   */
+/********************************************************/
+
+void CCaeTestVideoStates::TestRecordPauseStopL()
+    {
+	// ID:      CAE.VR.PAUSEVIDEORECORDING.001
+    //
+    // Group:   Record.
+    // 
+    // Action : Pause video clip recording.Video recordin prepared.
+	//      
+	// Output : No leave. File KVideoFileName, "videoclip.3gp".   
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareRecordPauseStopVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPauseWhenPreparedL()
+    {
+	// ID:      CAE.VR.PAUSEVIDEORECORDING.002
+    //
+    // Group:   Record.
+    // 
+    // Action : Call Pause when video is prepared but video recordind is not started.
+	//      
+	// Output : Leave..   
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPauseVideoWhenPrepared ) );
+    assertL( err == KErrNotReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestRecordPausePauseStopL()
+    {
+	// ID:      CAE.VR.PAUSEVIDEORECORDING.003
+    //
+    // Group:   Record.
+    // 
+    // Action : Pause video clip recording twice.Video recordin prepared.
+	//      
+	// Output : No leave. File KVideoFileName, "videoclip.3gp".   
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareRecordPausePauseStopVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 2 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*              RESUME VIDEO RECORDING                  */
+/********************************************************/
+
+void CCaeTestVideoStates::TestResumeWhenPreparedL()
+    {
+	// ID:      CAE.VR.RESUMEVIDEORECORDING.002
+    //
+    // Group:   Record.
+    // 
+    // Action : Resume video clip recording before pause. 
+    //          Video recording.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoFileName( _L("cae_pause_resume.3gp") );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::EResumeVideoWhenPrepared ) );
+    assertL( err == KErrNotReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestResumeWhenNotPausedL()
+    {
+	// ID:      CAE.VR.RESUMEVIDEORECORDING.003
+    //
+    // Group:   Record.
+    // 
+    // Action : Resume video clip recording before pause. 
+    //          Video recording.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoFileName( _L("cae_pause_resume.3gp") );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::EResumeVideoWhenNotPaused ) );
+    assertL( err == KErrNotReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 2 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*              PREPARE VIDEO RECORDING                 */
+/********************************************************/
+
+void CCaeTestVideoStates::TestPrepareVideoRecordingNeg1L()
+    {
+	// ID: CAE.VR.PREPAREVIDEORECORDINGL.005
+    //
+    // Group:   Record
+    // 
+    // Action : Try to prepare the engine for video recording using invalid quality level index. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetVideoQualityLevelIndex( -1 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    //iStatesClient->SetVideoFileName( _L("cae_prepare_vr_-1.3gp") );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareVideoRecording ) );
+    assertL( error != KErrNone );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestPrepareVideoRecording3L()
+    {
+	// ID: CAE.VR.PREPAREVIDEORECORDINGL.006
+    //
+    // Group:   Record
+    // 
+    // Action : Try to prepare the engine for video recording using invalid quality level index. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 3 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    //iStatesClient->SetVideoFileName( _L("cae_prepare_vr_3.3gp") );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareVideoRecording ) );
+    assertL( error != KErrNone );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestSpecPrepareVRUnsupportedFormatWhenVRInitializedL()
+{
+    // ID: CAE.VR.PREPAREVIDEORECORDINGL.008
+    //
+    // Group:   Record.
+    // 
+    // Action : Set video recording format to a format unsupported by MMF Camcorder plug-in 
+    //          and Camera API implementation. 
+    //          Video recorder initialization is done.
+	//      
+	// Output : Leave.    
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    TSize sizeTooBig( KImgWidthTooBig, KImgHeightTooBig );
+    iStatesClient->SetVideoFrameSize( sizeTooBig );
+    iStatesClient->SetVideoFrameRate( 10.0 );
+    iStatesClient->SetVideoBitRate( 50000 );
+    iStatesClient->SetVideoAudio( ETrue );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    //iStatesClient->SetVideoFileName( _L("cae_video_unsupported_format.3gp") );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareVideo ) );//verified if is correct action
+    assertL( error != KErrNone );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestSpecPrepareVRSupportedFormatWhenPreparedL()
+{
+    // ID: CAE.VR.PREPAREVIDEORECORDINGL.009
+    //
+    // Group:   Record.
+    // 
+    // Action : Set video recording format to a format supported by MMF Camcorder plug-in 
+    //          and Camera API implementation when video recording is prepared already. .
+	//      
+	// Output : OK.    
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    TSize sizeSubqcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+    iStatesClient->SetVideoFrameSize( sizeSubqcif );
+    iStatesClient->SetVideoFrameRate( 10.0 );
+    iStatesClient->SetVideoBitRate( 50000 );
+    iStatesClient->SetVideoAudio( ETrue );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    //iStatesClient->SetVideoFileName( _L("cae_video_format_prepared.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareVideoWhenPrepared );//verified if is correct action
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 2 );
+    }
+
+/********************************************************/
+/*              START VIDEO RECORDING                   */
+/********************************************************/
+
+void CCaeTestVideoStates::TestStartVideoRecordingWhenVRInitializedL()
+    {
+	// ID: CAE.VR.STARTVIDEORECORDING.001
+    //
+    // Group:   Record
+    // 
+    // Action : Start video clip recording. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetTimeout( 3000000 );
+    
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVideoRecordingWhenInitialized ) );//we have to put correct action
+    assertL( error == KErrNotReady );
+    
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    }
+
+void CCaeTestVideoStates::TestStartVideoRecordingWhenRecordingL()
+    {
+	// ID: CAE.VR.STARTVIDEORECORDING.002
+    //
+    // Group:   Record
+    // 
+    // Action : Start video clip recording. 
+    //          Video recording on.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetTimeout( 3000000 );
+    
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVideoRecordingWhenRecording ) );//we have to put correct action
+    assertL( error == KErrNotReady );
+    
+    assertL( iStatesClient->CountVideoRecordingOn() == 2 );
+    }
+
+/********************************************************/
+/*              STOP VIDEO RECORDING                    */
+/********************************************************/
+
+void CCaeTestVideoStates::TestStopVideoRecordingWhenVRInitializedL()
+    {
+	// ID: CAE.VR.STOPVIDEORECORDING.001
+    //
+    // Group:   Record
+    // 
+    // Action : Stop video clip recording. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStopVideoRecordingWhenInitialized ) );//we have to put correct action
+    assertL( error == KErrNotReady );
+    
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestStopVideoRecordingWhenPreparedL()
+    {
+	// ID: CAE.VR.STOPVIDEORECORDING.002
+    //
+    // Group:   Record
+    // 
+    // Action : Stop video clip recording. 
+    //          Video recording prepared.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    //iStatesClient->SetVideoFileName( _L("cae_stop_vr_prepared.3gp") );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStopVideoRecordingWhenPrepared ) );//we have to put correct action
+    assertL( error == KErrNotReady );
+    
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*                    STATE CHANGE                      */
+/********************************************************/
+
+void CCaeTestVideoStates::TestCaptureRecordL()
+    {
+	// ID:      CAE.STATECHANGE.CAPTURERECORD.002
+    //
+    // Group:   Capture & Record.
+    // 
+    // Action : Capture photo first and then record video successively
+	//      
+	// Output : No leave.    
+
+    iStatesClient->SetTimeout( 1000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ECaptureRecord );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestRecordCaptureL()
+    {
+	// ID:      CAE.STATECHANGE.RECORDCAPTURE.003
+    //
+    // Group:   Record & Capture.
+    // 
+    // Action : Record video first and then capture photo successively
+	//      
+	// Output : No leave.    
+
+    iStatesClient->SetTimeout( 1000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERecordCapture );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestVideoStates::TestRecordRecordL()
+    {
+	// ID:      CAE.STATECHANGE.RECORDRECORD.004
+    //
+    // Group:   Record.
+    // 
+    // Action : Record video two times successively
+	//      
+	// Output : No leave.    
+
+    iStatesClient->SetTimeout( 2000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERecordRecord );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+
+    // This should equal 2 because before 2nd recording we change the file name 
+    // and it needs preparation.
+    assertL( iStatesClient->CountVideoPrepareComplete() == 2 );
+
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 2 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 2 );
+    }
+
+
+void CCaeTestVideoStates::TestRecordCaptureComplexSequence1L()
+    {
+	// ID:      CAE.STATECHANGE.RECORDCAPTURECOMPLEX1.005
+    //
+    // Group:   Record.
+    // 
+    // Action : Record and capture multiple times successively
+	//      
+	// Output : No leave.    
+
+    iStatesClient->SetTimeout( 15000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoClipMaxSize( 10000 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERecordCaptureComplexSequence1 );
+
+    assertL( iStatesClient->CountInitComplete() == 2 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 2 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 7 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 7 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 7 );
+    assertL( iStatesClient->CountSnapImageReady() == 2 );
+    assertL( iStatesClient->CountStillImageReady() == 2 );
+    }
+
+
+void CCaeTestVideoStates::TestRecordCaptureComplexSequence2L()
+    {
+	// ID:      CAE.STATECHANGE.RECORDCAPTURECOMPLEX2.006
+    //
+    // Group:   Record.
+    // 
+    // Action : Record and capture multiple times successively. Contains also still bursts!
+	//      
+	// Output : No leave.    
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetSnapFileName( _L("cae_complex2.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_complex2.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->SetTimeout( 15000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoClipMaxSize( 10000 );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERecordCaptureComplexSequence2 );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 2 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 4 /*3*/ );
+    assertL( iStatesClient->CountVideoRecordingOn() == 4 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 4 );
+    assertL( iStatesClient->CountSnapImageReady() == ( ( 2 * KStillBurstLength ) + 3 ) );
+    assertL( iStatesClient->CountStillImageReady() == ( ( 2 * KStillBurstLength ) + 3 ) );
+
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == ( 2 * KStillBurstLength ) );
+    assertL( iStatesClient->CountStillBurstComplete() == 2 );
+    }
+
+
+void CCaeTestVideoStates::TestReleaseReserveRecordL()
+    {
+    // ID: CAE.GEN.RELESEANDRESERVE.006
+	//
+    // General
+    // 
+    // Action : Try to re-reserve the camera module after initial reservation
+    //          and releasing. Then capture still image.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 2 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoFileName( _L("cae_relres_ql_2.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EReleaseReserveRecord );
+
+    assertL( iStatesClient->CountInitComplete() == 2 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+/********************************************************/
+/*                "DESTROY ENGINE"-TESTS                */
+/********************************************************/
+
+
+void CCaeTestVideoStates::TestDestroy1L()
+    {
+	// ID: CAE.VR.DESTROY.001
+    //
+    // Group:   Record
+    // 
+    // Action : Test to destroy the engine when video is prepared.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 10000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenVideoPrepareReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestDestroy2L()
+    {
+	// ID: CAE.VR.DESTROY.002
+    //
+    // Group:   Record
+    // 
+    // Action : Test to destroy the engine when video recording is on.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 10000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenVideoRecordingOn );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestDestroy3L()
+    {
+	// ID: CAE.VR.DESTROY.003
+    //
+    // Group:   Record
+    // 
+    // Action : Test to destroy the engine when video recording is paused.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 10000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenVideoRecordingPaused );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestDestroy4L()
+    {
+	// ID: CAE.VR.DESTROY.004
+    //
+    // Group:   Record
+    // 
+    // Action : Test to destroy the engine when video recording is completed.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 10000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenVideoRecordingReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+/********************************************************/
+/*                ERROR SIMULATIONS                     */
+/********************************************************/
+
+void CCaeTestVideoStates::TestVideoRecorderOpenErrorL()
+    {
+	// ID:      CAE.VR.ERRORS.001
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test error handling with video recorder opening.
+	//      
+	// Output : Leave with code KErrAbort.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EVideoRecorderOpenError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestVideoRecorderPrepareErrorL()
+    {
+	// ID:      CAE.VR.ERRORS.002
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test error handling with video recorder preparation.
+	//      
+	// Output : Leave with code KErrAbort.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EVideoRecorderPrepareError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestVideoRecordingCompleteErrorL()
+    {
+	// ID:      CAE.VR.ERRORS.003
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test error handling with video recording completion.
+	//      
+	// Output : Leave with code KErrAbort.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EVideoRecordingCompleteError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+void CCaeTestVideoStates::TestPrepareVideoSettingsErrorL()
+    {
+	// ID:      CAE.VR.ERRORS.004
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test error handling with video recorder settings preparation.
+	//      
+	// Output : Leave with code KErrAbort.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareVideoSettingsError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+/********************************************************/
+/*      PREPARE AUDIO BIT RATE AND RECORD VIDEO         */
+/********************************************************/
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR0L()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.002
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 0 ) );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_0.3gp") );
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo ) );
+    assertL( err == KErrArgument );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR5150L()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.003
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 5150 ) );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_5150.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR12200L()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.004
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 12200 ) );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_12200.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR20000L()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.005
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 20000 ) );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_20000.3gp") );
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo ) );
+    assertL( err == KErrArgument );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR12200AudioType0L()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.006
+    //
+    // Group:   Record
+    // 
+    // Action : Test with special audio type 0
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 12200 ) );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_12200AT0.3gp") );
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideoAT0 );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR12200AudioTypeInvL()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.007
+    //
+    // Group:   Record
+    // 
+    // Action : Test with special audio type
+	//      
+	// Output : Leave
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 12200 ) );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_12200ATInv.3gp") );
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideoATInv ) );
+    assertL( err == KErrArgument );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+/********************************************************/
+/*      MISC tests                                      */
+/********************************************************/
+void CCaeTestVideoStates::TestInitVideoRecorderWithUidL()
+    {
+    // ID: CAE.GEN.INITVIDEORECORDERL.002
+	//
+    // General
+    // 
+    // Action : Test Call InitVideoRecorderL() when initialization is done with Uid.
+	//      
+	// Output : Leave, Uid init is not supported.
+
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::EInitVideoRecorderWithUid ));
+    assertL( err == KErrNotSupported );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+/********************************************************/
+/*        AMR audio tests (set 1 )                      */
+/********************************************************/
+/********************************************************/
+/*  VIDEO RECORDING PREPARE AND RECORD QUALITY LEVEL    */
+/********************************************************/
+
+void CCaeTestVideoStates::TestPrepareAndRecordQualityLevel0QL()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.QCIF64000FR15.Q.004
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 0 
+    //          video clip when initialization is done.
+	//      
+	// Output : No leave. File cae_novf_ql_0.3gp.  
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    iStatesClient->SetVideoFileName( _L("cae_novf_ql_0Q.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAndRecordQualityLevel1QL()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.SUBQCIF60000FR15.Q.005
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 1 
+    //          video clip when initialization is done.
+	//      
+	// Output : No leave. File cae_novf_ql_1.3gp.  
+
+    iStatesClient->SetVideoQualityLevelIndex( 1 );
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    iStatesClient->SetVideoFileName( _L("cae_novf_ql_1Q.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAndRecordQualityLevel2QL()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.SUBQCIF40000FR5.Q.006
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 2 
+    //          video clip when initialization is done.
+	//      
+	// Output : No leave. File cae_novf_ql_2.3gp.  
+
+    iStatesClient->SetVideoQualityLevelIndex( 2 );
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    iStatesClient->SetVideoFileName( _L("cae_novf_ql_2Q.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+/********************************************************/
+/*  VIDEO RECORDING SPECIAL PREPARE AND RECORD          */
+/********************************************************/
+
+void CCaeTestVideoStates::TestVideoRecordingQcif60000Fr10NoAudioNoVfQL()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q.003
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording QCIF sized video works. 
+    //          Video recording prepared for QCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 20000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+
+    iStatesClient->SetRunningWithViewFinder( EFalse );
+
+    iStatesClient->SetVideoFileName( _L("cae_qcif10fpsQ.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestVideoRecordingQcif60000Fr10WithAudioNoVfQL()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q.004
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording QCIF sized video works. 
+    //          Video recording prepared for QCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 20000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( ETrue );
+
+    iStatesClient->SetRunningWithViewFinder( EFalse );
+
+    iStatesClient->SetVideoFileName( _L("cae_qcif10fps_audioQ.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestVideoRecordingQcif60000Fr10NoAudioWithVfQL()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q.005
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording QCIF sized video works. 
+    //          Video recording prepared for QCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 20000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+
+    iStatesClient->SetViewFinderSize( sizeQcif );
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoFileName( _L("cae_qcif10fps_vfQ.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestVideoRecordingQcif60000Fr10WithAudioWithVfQL()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q.006
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording QCIF sized video works. 
+    //          Video recording prepared for QCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 20000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( ETrue );
+
+    iStatesClient->SetViewFinderSize( sizeQcif );
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoFileName( _L("cae_qcif10fps_audio_vfQ.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*              PAUSE VIDEO RECORDING                   */
+/********************************************************/
+
+void CCaeTestVideoStates::TestRecordPauseStopQL()
+    {
+	// ID:      CAE.VR.PAUSEVIDEORECORDING.Q.001
+    //
+    // Group:   Record.
+    // 
+    // Action : Pause video clip recording.Video recordin prepared.
+	//      
+	// Output : No leave. File KVideoFileName, "videoclip.3gp".   
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareRecordPauseStopVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPauseWhenPreparedQL()
+    {
+	// ID:      CAE.VR.PAUSEVIDEORECORDING.Q.002
+    //
+    // Group:   Record.
+    // 
+    // Action : Call Pause when video is prepared but video recordind is not started.
+	//      
+	// Output : Leave..   
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPauseVideoWhenPrepared ) );
+    assertL( err == KErrNotReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestRecordPausePauseStopQL()
+    {
+	// ID:      CAE.VR.PAUSEVIDEORECORDING.Q.003
+    //
+    // Group:   Record.
+    // 
+    // Action : Pause video clip recording twice.Video recordin prepared.
+	//      
+	// Output : No leave. File KVideoFileName, "videoclip.3gp".   
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareRecordPausePauseStopVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 2 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*              RESUME VIDEO RECORDING                  */
+/********************************************************/
+
+void CCaeTestVideoStates::TestResumeWhenPreparedQL()
+    {
+	// ID:      CAE.VR.RESUMEVIDEORECORDING.Q.002
+    //
+    // Group:   Record.
+    // 
+    // Action : Resume video clip recording before pause. 
+    //          Video recording.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoFileName( _L("cae_pause_resumeQ.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::EResumeVideoWhenPrepared ) );
+    assertL( err == KErrNotReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestResumeWhenNotPausedQL()
+    {
+	// ID:      CAE.VR.RESUMEVIDEORECORDING.Q.003
+    //
+    // Group:   Record.
+    // 
+    // Action : Resume video clip recording before pause. 
+    //          Video recording.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoFileName( _L("cae_pause_resumeQ.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::EResumeVideoWhenNotPaused ) );
+    assertL( err == KErrNotReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 2 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*              PREPARE VIDEO RECORDING                 */
+/********************************************************/
+
+void CCaeTestVideoStates::TestPrepareVideoRecordingNeg1QL()
+    {
+	// ID: CAE.VR.PREPAREVIDEORECORDINGL.Q.005
+    //
+    // Group:   Record
+    // 
+    // Action : Try to prepare the engine for video recording using invalid quality level index. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetVideoQualityLevelIndex( -1 );
+
+    //iStatesClient->SetVideoFileName( _L("cae_prepare_vr_-1Q.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareVideoRecording ) );
+    assertL( error != KErrNone );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestPrepareVideoRecording3QL()
+    {
+	// ID: CAE.VR.PREPAREVIDEORECORDINGL.Q.006
+    //
+    // Group:   Record
+    // 
+    // Action : Try to prepare the engine for video recording using invalid quality level index. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 3 );
+
+    //iStatesClient->SetVideoFileName( _L("cae_prepare_vr_3Q.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareVideoRecording ) );
+    assertL( error != KErrNone );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestSpecPrepareVRUnsupportedFormatWhenVRInitializedQL()
+{
+    // ID: CAE.VR.PREPAREVIDEORECORDINGL.Q.008
+    //
+    // Group:   Record.
+    // 
+    // Action : Set video recording format to a format unsupported by MMF Camcorder plug-in 
+    //          and Camera API implementation. 
+    //          Video recorder initialization is done.
+	//      
+	// Output : Leave.    
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    TSize sizeTooBig( KImgWidthTooBig, KImgHeightTooBig );
+    iStatesClient->SetVideoFrameSize( sizeTooBig );
+    iStatesClient->SetVideoFrameRate( 10.0 );
+    iStatesClient->SetVideoBitRate( 50000 );
+    iStatesClient->SetVideoAudio( ETrue );
+
+    //iStatesClient->SetVideoFileName( _L("cae_video_unsupported_formatQ.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareVideo ) );//verified if is correct action
+    assertL( error != KErrNone );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestSpecPrepareVRSupportedFormatWhenPreparedQL()
+{
+    // ID: CAE.VR.PREPAREVIDEORECORDINGL.Q.009
+    //
+    // Group:   Record.
+    // 
+    // Action : Set video recording format to a format supported by MMF Camcorder plug-in 
+    //          and Camera API implementation when video recording is prepared already. .
+	//      
+	// Output : OK.    
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    TSize sizeSubqcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+    iStatesClient->SetVideoFrameSize( sizeSubqcif );
+    iStatesClient->SetVideoFrameRate( 10.0 );
+    iStatesClient->SetVideoBitRate( 50000 );
+    iStatesClient->SetVideoAudio( ETrue );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    //iStatesClient->SetVideoFileName( _L("cae_video_format_preparedQ.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareVideoWhenPrepared );//verified if is correct action
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 2 );
+    }
+
+/********************************************************/
+/*              START VIDEO RECORDING                   */
+/********************************************************/
+
+void CCaeTestVideoStates::TestStartVideoRecordingWhenVRInitializedQL()
+    {
+	// ID: CAE.VR.STARTVIDEORECORDING.Q.001
+    //
+    // Group:   Record
+    // 
+    // Action : Start video clip recording. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetTimeout( 3000000 );
+    
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVideoRecordingWhenInitialized ) );//we have to put correct action
+    assertL( error == KErrNotReady );
+    
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    }
+
+void CCaeTestVideoStates::TestStartVideoRecordingWhenRecordingQL()
+    {
+	// ID: CAE.VR.STARTVIDEORECORDING.Q.002
+    //
+    // Group:   Record
+    // 
+    // Action : Start video clip recording. 
+    //          Video recording on.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetTimeout( 3000000 );
+    
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVideoRecordingWhenRecording ) );//we have to put correct action
+    assertL( error == KErrNotReady );
+    
+    assertL( iStatesClient->CountVideoRecordingOn() == 2 );
+    }
+
+/********************************************************/
+/*              STOP VIDEO RECORDING                    */
+/********************************************************/
+
+void CCaeTestVideoStates::TestStopVideoRecordingWhenVRInitializedQL()
+    {
+	// ID: CAE.VR.STOPVIDEORECORDING.Q.001
+    //
+    // Group:   Record
+    // 
+    // Action : Stop video clip recording. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStopVideoRecordingWhenInitialized ) );//we have to put correct action
+    assertL( error == KErrNotReady );
+    
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestStopVideoRecordingWhenPreparedQL()
+    {
+	// ID: CAE.VR.STOPVIDEORECORDING.Q.002
+    //
+    // Group:   Record
+    // 
+    // Action : Stop video clip recording. 
+    //          Video recording prepared.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    //iStatesClient->SetVideoFileName( _L("cae_stop_vr_preparedQ.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStopVideoRecordingWhenPrepared ) );//we have to put correct action
+    assertL( error == KErrNotReady );
+    
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*                    STATE CHANGE                      */
+/********************************************************/
+
+void CCaeTestVideoStates::TestCaptureRecordQL()
+    {
+	// ID:      CAE.STATECHANGE.CAPTURERECORD.Q.002
+    //
+    // Group:   Capture & Record.
+    // 
+    // Action : Capture photo first and then record video successively
+	//      
+	// Output : No leave.    
+
+    iStatesClient->SetTimeout( 1000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ECaptureRecord );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestRecordCaptureQL()
+    {
+	// ID:      CAE.STATECHANGE.RECORDCAPTURE.Q.003
+    //
+    // Group:   Record & Capture.
+    // 
+    // Action : Record video first and then capture photo successively
+	//      
+	// Output : No leave.    
+
+    iStatesClient->SetTimeout( 1000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERecordCapture );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestVideoStates::TestRecordRecordQL()
+    {
+	// ID:      CAE.STATECHANGE.RECORDRECORD.Q.004
+    //
+    // Group:   Record.
+    // 
+    // Action : Record video two times successively
+	//      
+	// Output : No leave.    
+
+    iStatesClient->SetTimeout( 2000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERecordRecord );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+
+    // This should equal 2 because before 2nd recording we change the file name 
+    // and it needs preparation.
+    assertL( iStatesClient->CountVideoPrepareComplete() == 2 );
+
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 2 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 2 );
+    }
+
+
+void CCaeTestVideoStates::TestRecordCaptureComplexSequence1QL()
+    {
+	// ID:      CAE.STATECHANGE.RECORDCAPTURECOMPLEX1.Q.005
+    //
+    // Group:   Record.
+    // 
+    // Action : Record and capture multiple times successively
+	//      
+	// Output : No leave.    
+
+    iStatesClient->SetTimeout( 15000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoClipMaxSize( 10000 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERecordCaptureComplexSequence1 );
+
+    assertL( iStatesClient->CountInitComplete() == 2 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 2 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 7 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 7 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 7 );
+    assertL( iStatesClient->CountSnapImageReady() == 2 );
+    assertL( iStatesClient->CountStillImageReady() == 2 );
+    }
+
+
+void CCaeTestVideoStates::TestRecordCaptureComplexSequence2QL()
+    {
+	// ID:      CAE.STATECHANGE.RECORDCAPTURECOMPLEX2.Q.006
+    //
+    // Group:   Record.
+    // 
+    // Action : Record and capture multiple times successively. Contains also still bursts!
+	//      
+	// Output : No leave.    
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetSnapFileName( _L("cae_complex2Q.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_complex2Q.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->SetTimeout( 15000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillQualityLevelIndex( 2 );
+
+    iStatesClient->SetVideoClipMaxSize( 10000 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERecordCaptureComplexSequence2 );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 2 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 4 /*3*/ );
+    assertL( iStatesClient->CountVideoRecordingOn() == 4 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 4 );
+    assertL( iStatesClient->CountSnapImageReady() == ( ( 2 * KStillBurstLength ) + 3 ) );
+    assertL( iStatesClient->CountStillImageReady() == ( ( 2 * KStillBurstLength ) + 3 ) );
+
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == ( 2 * KStillBurstLength ) );
+    assertL( iStatesClient->CountStillBurstComplete() == 2 );
+    }
+
+
+void CCaeTestVideoStates::TestReleaseReserveRecordQL()
+    {
+    // ID: CAE.GEN.RELESEANDRESERVE.Q.006
+	//
+    // General
+    // 
+    // Action : Try to re-reserve the camera module after initial reservation
+    //          and releasing. Then capture still image.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 2 );
+
+    iStatesClient->SetVideoFileName( _L("cae_relres_ql_2Q.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EReleaseReserveRecord );
+
+    assertL( iStatesClient->CountInitComplete() == 2 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+/********************************************************/
+/*                "DESTROY ENGINE"-TESTS                */
+/********************************************************/
+
+
+void CCaeTestVideoStates::TestDestroy1QL()
+    {
+	// ID: CAE.VR.DESTROY.Q.001
+    //
+    // Group:   Record
+    // 
+    // Action : Test to destroy the engine when video is prepared.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 10000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenVideoPrepareReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestDestroy2QL()
+    {
+	// ID: CAE.VR.DESTROY.Q.002
+    //
+    // Group:   Record
+    // 
+    // Action : Test to destroy the engine when video recording is on.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 10000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenVideoRecordingOn );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestDestroy3QL()
+    {
+	// ID: CAE.VR.DESTROY.Q.003
+    //
+    // Group:   Record
+    // 
+    // Action : Test to destroy the engine when video recording is paused.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 10000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenVideoRecordingPaused );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestDestroy4QL()
+    {
+	// ID: CAE.VR.DESTROY.Q.004
+    //
+    // Group:   Record
+    // 
+    // Action : Test to destroy the engine when video recording is completed.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 10000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenVideoRecordingReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+/********************************************************/
+/*                ERROR SIMULATIONS                     */
+/********************************************************/
+
+void CCaeTestVideoStates::TestVideoRecorderOpenErrorQL()
+    {
+	// ID:      CAE.VR.ERRORS.Q.001
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test error handling with video recorder opening.
+	//      
+	// Output : Leave with code KErrAbort.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EVideoRecorderOpenError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestVideoRecorderPrepareErrorQL()
+    {
+	// ID:      CAE.VR.ERRORS.Q.002
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test error handling with video recorder preparation.
+	//      
+	// Output : Leave with code KErrAbort.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EVideoRecorderPrepareError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestVideoRecordingCompleteErrorQL()
+    {
+	// ID:      CAE.VR.ERRORS.Q.003
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test error handling with video recording completion.
+	//      
+	// Output : Leave with code KErrAbort.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EVideoRecordingCompleteError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+void CCaeTestVideoStates::TestPrepareVideoSettingsErrorQL()
+    {
+	// ID:      CAE.VR.ERRORS.Q.004
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test error handling with video recorder settings preparation.
+	//      
+	// Output : Leave with code KErrAbort.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareVideoSettingsError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+/********************************************************/
+/*      PREPARE AUDIO BIT RATE AND RECORD VIDEO         */
+/********************************************************/
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR0QL()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q.002
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 0 ) );
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_0Q.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo ) );
+    assertL( err == KErrArgument );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR5150QL()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q.003
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 5150 ) );
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_5150Q.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR12200QL()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q.004
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 12200 ) );
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_12200Q.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR20000QL()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q.005
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 20000 ) );
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_20000Q.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo ) );
+    assertL( err == KErrArgument );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR12200AudioType0QL()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q.006
+    //
+    // Group:   Record
+    // 
+    // Action : Test with special audio type 0
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 12200 ) );
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_12200AT0Q.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideoAT0 );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR12200AudioTypeInvQL()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q.007
+    //
+    // Group:   Record
+    // 
+    // Action : Test with special audio type
+	//      
+	// Output : Leave
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 12200 ) );
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_12200ATInvQ.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideoATInv ) );
+    assertL( err == KErrArgument );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+/********************************************************/
+/*      MISC tests                                      */
+/********************************************************/
+void CCaeTestVideoStates::TestInitVideoRecorderWithUidQL()
+    {
+    // ID: CAE.GEN.INITVIDEORECORDERL.Q.002
+	//
+    // General
+    // 
+    // Action : Test Call InitVideoRecorderL() when initialization is done with Uid.
+	//      
+	// Output : Leave, Uid init is not supported.
+
+    iStatesClient->SetVideoCodecSet( 1 ); // 1: AMR audio, H.263 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::EInitVideoRecorderWithUid ));
+    assertL( err == KErrNotSupported );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+
+
+
+
+/********************************************************/
+/*      AAC audio tests (set 2 )                      */
+/********************************************************/
+/********************************************************/
+/*  VIDEO RECORDING PREPARE AND RECORD QUALITY LEVEL    */
+/********************************************************/
+
+void CCaeTestVideoStates::TestPrepareAndRecordQualityLevel0Q4L()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.QCIF64000FR15.Q4.004
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 0 
+    //          video clip when initialization is done.
+	//      
+	// Output : No leave. File cae_novf_ql_0.3gp.  
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    iStatesClient->SetVideoFileName( _L("cae_novf_ql_0Q4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAndRecordQualityLevel1Q4L()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.SUBQCIF60000FR15.Q4.005
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 1 
+    //          video clip when initialization is done.
+	//      
+	// Output : No leave. File cae_novf_ql_1.3gp.  
+
+    iStatesClient->SetVideoQualityLevelIndex( 1 );
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    iStatesClient->SetVideoFileName( _L("cae_novf_ql_1Q4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAndRecordQualityLevel2Q4L()
+    {
+	// ID:      CAE.VR.VIDEORECORDING.SUBQCIF40000FR5.Q4.006
+    //
+    // Group:   Record.
+    // 
+    // Action : Test to prepare video recording and record quality level 2 
+    //          video clip when initialization is done.
+	//      
+	// Output : No leave. File cae_novf_ql_2.3gp.  
+
+    iStatesClient->SetVideoQualityLevelIndex( 2 );
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    iStatesClient->SetVideoFileName( _L("cae_novf_ql_2Q4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+/********************************************************/
+/*  VIDEO RECORDING SPECIAL PREPARE AND RECORD          */
+/********************************************************/
+
+void CCaeTestVideoStates::TestVideoRecordingQcif60000Fr10NoAudioNoVfQ4L()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q4.003
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording QCIF sized video works. 
+    //          Video recording prepared for QCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 20000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+
+    iStatesClient->SetRunningWithViewFinder( EFalse );
+
+    iStatesClient->SetVideoFileName( _L("cae_qcif10fpsQ4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestVideoRecordingQcif60000Fr10WithAudioNoVfQ4L()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q4.004
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording QCIF sized video works. 
+    //          Video recording prepared for QCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 20000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( ETrue );
+
+    iStatesClient->SetRunningWithViewFinder( EFalse );
+
+    iStatesClient->SetVideoFileName( _L("cae_qcif10fps_audioQ4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestVideoRecordingQcif60000Fr10NoAudioWithVfQ4L()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q4.005
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording QCIF sized video works. 
+    //          Video recording prepared for QCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 20000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+
+    iStatesClient->SetViewFinderSize( sizeQcif );
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoFileName( _L("cae_qcif10fps_vfQ4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestVideoRecordingQcif60000Fr10WithAudioWithVfQ4L()
+    {
+	// ID: CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q4.006
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+    //          To ensure that starting and stopping video recording works. 
+    //          To ensure that recording QCIF sized video works. 
+    //          Video recording prepared for QCIF format.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 20000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( ETrue );
+
+    iStatesClient->SetViewFinderSize( sizeQcif );
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoFileName( _L("cae_qcif10fps_audio_vfQ4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*              PAUSE VIDEO RECORDING                   */
+/********************************************************/
+
+void CCaeTestVideoStates::TestRecordPauseStopQ4L()
+    {
+	// ID:      CAE.VR.PAUSEVIDEORECORDING.Q4.001
+    //
+    // Group:   Record.
+    // 
+    // Action : Pause video clip recording.Video recordin prepared.
+	//      
+	// Output : No leave. File KVideoFileName, "videoclip.3gp".   
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareRecordPauseStopVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPauseWhenPreparedQ4L()
+    {
+	// ID:      CAE.VR.PAUSEVIDEORECORDING.Q4.002
+    //
+    // Group:   Record.
+    // 
+    // Action : Call Pause when video is prepared but video recordind is not started.
+	//      
+	// Output : Leave..   
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPauseVideoWhenPrepared ) );
+    assertL( err == KErrNotReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestRecordPausePauseStopQ4L()
+    {
+	// ID:      CAE.VR.PAUSEVIDEORECORDING.Q4.003
+    //
+    // Group:   Record.
+    // 
+    // Action : Pause video clip recording twice.Video recordin prepared.
+	//      
+	// Output : No leave. File KVideoFileName, "videoclip.3gp".   
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareRecordPausePauseStopVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 2 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*              RESUME VIDEO RECORDING                  */
+/********************************************************/
+
+void CCaeTestVideoStates::TestResumeWhenPreparedQ4L()
+    {
+	// ID:      CAE.VR.RESUMEVIDEORECORDING.Q4.002
+    //
+    // Group:   Record.
+    // 
+    // Action : Resume video clip recording before pause. 
+    //          Video recording.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoFileName( _L("cae_pause_resumeQ4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::EResumeVideoWhenPrepared ) );
+    assertL( err == KErrNotReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestResumeWhenNotPausedQ4L()
+    {
+	// ID:      CAE.VR.RESUMEVIDEORECORDING.Q4.003
+    //
+    // Group:   Record.
+    // 
+    // Action : Resume video clip recording before pause. 
+    //          Video recording.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoFileName( _L("cae_pause_resumeQ4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::EResumeVideoWhenNotPaused ) );
+    assertL( err == KErrNotReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 2 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*              PREPARE VIDEO RECORDING                 */
+/********************************************************/
+
+void CCaeTestVideoStates::TestPrepareVideoRecordingNeg1Q4L()
+    {
+	// ID: CAE.VR.PREPAREVIDEORECORDINGL.Q4.005
+    //
+    // Group:   Record
+    // 
+    // Action : Try to prepare the engine for video recording using invalid quality level index. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetVideoQualityLevelIndex( -1 );
+
+    //iStatesClient->SetVideoFileName( _L("cae_prepare_vr_-1Q4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareVideoRecording ) );
+    assertL( error != KErrNone );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestPrepareVideoRecording3Q4L()
+    {
+	// ID: CAE.VR.PREPAREVIDEORECORDINGL.Q4.006
+    //
+    // Group:   Record
+    // 
+    // Action : Try to prepare the engine for video recording using invalid quality level index. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 3 );
+
+    //iStatesClient->SetVideoFileName( _L("cae_prepare_vr_3Q4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareVideoRecording ) );
+    assertL( error != KErrNone );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestSpecPrepareVRUnsupportedFormatWhenVRInitializedQ4L()
+{
+    // ID: CAE.VR.PREPAREVIDEORECORDINGL.Q4.008
+    //
+    // Group:   Record.
+    // 
+    // Action : Set video recording format to a format unsupported by MMF Camcorder plug-in 
+    //          and Camera API implementation. 
+    //          Video recorder initialization is done.
+	//      
+	// Output : Leave.    
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    TSize sizeTooBig( KImgWidthTooBig, KImgHeightTooBig );
+    iStatesClient->SetVideoFrameSize( sizeTooBig );
+    iStatesClient->SetVideoFrameRate( 10.0 );
+    iStatesClient->SetVideoBitRate( 50000 );
+    iStatesClient->SetVideoAudio( ETrue );
+
+    //iStatesClient->SetVideoFileName( _L("cae_video_unsupported_formatQ4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareVideo ) );//verified if is correct action
+    assertL( error != KErrNone );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestSpecPrepareVRSupportedFormatWhenPreparedQ4L()
+{
+    // ID: CAE.VR.PREPAREVIDEORECORDINGL.Q4.009
+    //
+    // Group:   Record.
+    // 
+    // Action : Set video recording format to a format supported by MMF Camcorder plug-in 
+    //          and Camera API implementation when video recording is prepared already. .
+	//      
+	// Output : OK.    
+
+    iStatesClient->SetTimeout( 5000000 );
+
+    TSize sizeSubqcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+    iStatesClient->SetVideoFrameSize( sizeSubqcif );
+    iStatesClient->SetVideoFrameRate( 10.0 );
+    iStatesClient->SetVideoBitRate( 50000 );
+    iStatesClient->SetVideoAudio( ETrue );
+    iStatesClient->SetVideoCodecSet( 0 ); // 0: AMR audio, H.263 video
+
+    //iStatesClient->SetVideoFileName( _L("cae_video_format_preparedQ4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareVideoWhenPrepared );//verified if is correct action
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 2 );
+    }
+
+/********************************************************/
+/*              START VIDEO RECORDING                   */
+/********************************************************/
+
+void CCaeTestVideoStates::TestStartVideoRecordingWhenVRInitializedQ4L()
+    {
+	// ID: CAE.VR.STARTVIDEORECORDING.Q4.001
+    //
+    // Group:   Record
+    // 
+    // Action : Start video clip recording. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetTimeout( 3000000 );
+    
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVideoRecordingWhenInitialized ) );//we have to put correct action
+    assertL( error == KErrNotReady );
+    
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    }
+
+void CCaeTestVideoStates::TestStartVideoRecordingWhenRecordingQ4L()
+    {
+	// ID: CAE.VR.STARTVIDEORECORDING.Q4.002
+    //
+    // Group:   Record
+    // 
+    // Action : Start video clip recording. 
+    //          Video recording on.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetTimeout( 3000000 );
+    
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStartVideoRecordingWhenRecording ) );//we have to put correct action
+    assertL( error == KErrNotReady );
+    
+    assertL( iStatesClient->CountVideoRecordingOn() == 2 );
+    }
+
+/********************************************************/
+/*              STOP VIDEO RECORDING                    */
+/********************************************************/
+
+void CCaeTestVideoStates::TestStopVideoRecordingWhenVRInitializedQ4L()
+    {
+	// ID: CAE.VR.STOPVIDEORECORDING.Q4.001
+    //
+    // Group:   Record
+    // 
+    // Action : Stop video clip recording. 
+    //          Initialization is done.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStopVideoRecordingWhenInitialized ) );//we have to put correct action
+    assertL( error == KErrNotReady );
+    
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestStopVideoRecordingWhenPreparedQ4L()
+    {
+	// ID: CAE.VR.STOPVIDEORECORDING.Q4.002
+    //
+    // Group:   Record
+    // 
+    // Action : Stop video clip recording. 
+    //          Video recording prepared.
+	//      
+	// Output : Leave.   
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    //iStatesClient->SetVideoFileName( _L("cae_stop_vr_preparedQ4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EStopVideoRecordingWhenPrepared ) );//we have to put correct action
+    assertL( error == KErrNotReady );
+    
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+/********************************************************/
+/*                    STATE CHANGE                      */
+/********************************************************/
+
+void CCaeTestVideoStates::TestCaptureRecordQ4L()
+    {
+	// ID:      CAE.STATECHANGE.CAPTURERECORD.Q4.002
+    //
+    // Group:   Capture & Record.
+    // 
+    // Action : Capture photo first and then record video successively
+	//      
+	// Output : No leave.    
+
+    iStatesClient->SetTimeout( 1000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ECaptureRecord );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestRecordCaptureQ4L()
+    {
+	// ID:      CAE.STATECHANGE.RECORDCAPTURE.Q4.003
+    //
+    // Group:   Record & Capture.
+    // 
+    // Action : Record video first and then capture photo successively
+	//      
+	// Output : No leave.    
+
+    iStatesClient->SetTimeout( 1000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERecordCapture );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+
+    assertL( iStatesClient->CountStillPrepareComplete() == 1 );
+    assertL( iStatesClient->CountSnapImageReady() == 1 );
+    assertL( iStatesClient->CountStillImageReady() == 1 );
+    }
+
+void CCaeTestVideoStates::TestRecordRecordQ4L()
+    {
+	// ID:      CAE.STATECHANGE.RECORDRECORD.Q4.004
+    //
+    // Group:   Record.
+    // 
+    // Action : Record video two times successively
+	//      
+	// Output : No leave.    
+
+    iStatesClient->SetTimeout( 2000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERecordRecord );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+
+    // This should equal 2 because before 2nd recording we change the file name 
+    // and it needs preparation.
+    assertL( iStatesClient->CountVideoPrepareComplete() == 2 );
+
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 2 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 2 );
+    }
+
+
+void CCaeTestVideoStates::TestRecordCaptureComplexSequence1Q4L()
+    {
+	// ID:      CAE.STATECHANGE.RECORDCAPTURECOMPLEX1.Q4.005
+    //
+    // Group:   Record.
+    // 
+    // Action : Record and capture multiple times successively
+	//      
+	// Output : No leave.    
+
+    iStatesClient->SetTimeout( 15000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoClipMaxSize( 10000 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERecordCaptureComplexSequence1 );
+
+    assertL( iStatesClient->CountInitComplete() == 2 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 2 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 7 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 7 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 7 );
+    assertL( iStatesClient->CountSnapImageReady() == 2 );
+    assertL( iStatesClient->CountStillImageReady() == 2 );
+    }
+
+
+void CCaeTestVideoStates::TestRecordCaptureComplexSequence2Q4L()
+    {
+	// ID:      CAE.STATECHANGE.RECORDCAPTURECOMPLEX2.Q4.006
+    //
+    // Group:   Record.
+    // 
+    // Action : Record and capture multiple times successively. Contains also still bursts!
+	//      
+	// Output : No leave.    
+
+    const TInt KStillBurstLength = 3;
+
+    iStatesClient->SetSnapFileName( _L("cae_complex2Q4.mbm") );
+
+    iStatesClient->SetStillFileName( _L("cae_complex2Q4.jpg") );
+
+    iStatesClient->SetStillBurstLength( KStillBurstLength );
+
+    iStatesClient->SetTimeout( 15000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetStillQualityLevelIndex( 2 );
+
+    iStatesClient->SetVideoClipMaxSize( 10000 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERecordCaptureComplexSequence2 );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountStillPrepareComplete() == 2 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 4 /*3*/ );
+    assertL( iStatesClient->CountVideoRecordingOn() == 4 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 4 );
+    assertL( iStatesClient->CountSnapImageReady() == ( ( 2 * KStillBurstLength ) + 3 ) );
+    assertL( iStatesClient->CountStillImageReady() == ( ( 2 * KStillBurstLength ) + 3 ) );
+
+    assertL( iStatesClient->CountStillBurstCaptureMoment() == ( 2 * KStillBurstLength ) );
+    assertL( iStatesClient->CountStillBurstComplete() == 2 );
+    }
+
+
+void CCaeTestVideoStates::TestReleaseReserveRecordQ4L()
+    {
+    // ID: CAE.GEN.RELESEANDRESERVE.Q4.006
+	//
+    // General
+    // 
+    // Action : Try to re-reserve the camera module after initial reservation
+    //          and releasing. Then capture still image.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 3000000 );
+
+    iStatesClient->SetVideoQualityLevelIndex( 2 );
+
+    iStatesClient->SetVideoFileName( _L("cae_relres_ql_2Q4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EReleaseReserveRecord );
+
+    assertL( iStatesClient->CountInitComplete() == 2 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+/********************************************************/
+/*                "DESTROY ENGINE"-TESTS                */
+/********************************************************/
+
+
+void CCaeTestVideoStates::TestDestroy1Q4L()
+    {
+	// ID: CAE.VR.DESTROY.Q4.001
+    //
+    // Group:   Record
+    // 
+    // Action : Test to destroy the engine when video is prepared.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 10000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenVideoPrepareReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestDestroy2Q4L()
+    {
+	// ID: CAE.VR.DESTROY.Q4.002
+    //
+    // Group:   Record
+    // 
+    // Action : Test to destroy the engine when video recording is on.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 10000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenVideoRecordingOn );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestDestroy3Q4L()
+    {
+	// ID: CAE.VR.DESTROY.Q4.003
+    //
+    // Group:   Record
+    // 
+    // Action : Test to destroy the engine when video recording is paused.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 10000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenVideoRecordingPaused );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestDestroy4Q4L()
+    {
+	// ID: CAE.VR.DESTROY.Q4.004
+    //
+    // Group:   Record
+    // 
+    // Action : Test to destroy the engine when video recording is completed.
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 10000000 );
+    
+    TSize sizeQcif( KImgWidthQCIF, KImgHeightQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 60000 ) );
+    iStatesClient->SetVideoAudio( EFalse );
+
+    iStatesClient->SetRunningWithViewFinder( ETrue );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::EDestroyEngineWhenVideoRecordingReady );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingPaused() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+/********************************************************/
+/*                ERROR SIMULATIONS                     */
+/********************************************************/
+
+void CCaeTestVideoStates::TestVideoRecorderOpenErrorQ4L()
+    {
+	// ID:      CAE.VR.ERRORS.Q4.001
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test error handling with video recorder opening.
+	//      
+	// Output : Leave with code KErrAbort.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EVideoRecorderOpenError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestVideoRecorderPrepareErrorQ4L()
+    {
+	// ID:      CAE.VR.ERRORS.Q4.002
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test error handling with video recorder preparation.
+	//      
+	// Output : Leave with code KErrAbort.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EVideoRecorderPrepareError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+
+void CCaeTestVideoStates::TestVideoRecordingCompleteErrorQ4L()
+    {
+	// ID:      CAE.VR.ERRORS.Q4.003
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test error handling with video recording completion.
+	//      
+	// Output : Leave with code KErrAbort.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EVideoRecordingCompleteError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+
+void CCaeTestVideoStates::TestPrepareVideoSettingsErrorQ4L()
+    {
+	// ID:      CAE.VR.ERRORS.Q4.004
+    //
+    // Group:   Errors.
+    // 
+    // Action : Test error handling with video recorder settings preparation.
+	//      
+	// Output : Leave with code KErrAbort.
+
+    iStatesClient->SetVideoQualityLevelIndex( 0 );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( error, iStatesClient->RunTestActionL( CCaeTestStatesClient::EPrepareVideoSettingsError ) );
+    assertL( error == KErrAbort );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+/********************************************************/
+/*      PREPARE AUDIO BIT RATE AND RECORD VIDEO         */
+/********************************************************/
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR0Q4L()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q4.002
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 0 ) );
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_0Q4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo ) );
+    assertL( err == KErrArgument );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR5150Q4L()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q4.003
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 5150 ) );
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_5150Q4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR12200Q4L()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q4.004
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 12200 ) );
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_12200Q4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR20000Q4L()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q4.005
+    //
+    // Group:   Record
+    // 
+    // Action : To ensure that the implementation is compatible with camcorder plug-in. 
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 20000 ) );
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_20000Q4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideo ) );
+    assertL( err == KErrArgument );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR12200AudioType0Q4L()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q4.006
+    //
+    // Group:   Record
+    // 
+    // Action : Test with special audio type 0
+	//      
+	// Output : OK.   
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 12200 ) );
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_12200AT0Q4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideoAT0 );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 1 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 1 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 1 );
+    }
+
+void CCaeTestVideoStates::TestPrepareAudioBitRateVR12200AudioTypeInvQ4L()
+    {
+	// ID: CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q4.007
+    //
+    // Group:   Record
+    // 
+    // Action : Test with special audio type
+	//      
+	// Output : Leave
+
+    iStatesClient->SetTimeout( 4000000 );
+
+    TSize sizeSubQcif( KImgWidthSubQCIF, KImgHeightSubQCIF );
+
+    iStatesClient->SetVideoFrameSize( sizeSubQcif );
+    iStatesClient->SetVideoFrameRate( TReal32( 10.0 ) );
+    iStatesClient->SetVideoBitRate( TInt( 25000 ) );
+    
+    iStatesClient->SetAudioBitRate( TInt( 12200 ) );
+
+    iStatesClient->SetVideoFileName( _L("cae_subqcif_AudioBitRate_12200ATInvQ4.3gp") );
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::ESpecifiedPrepareAudioBrAndRecordVideoATInv ) );
+    assertL( err == KErrArgument );
+
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    assertL( iStatesClient->CountVideoPrepareComplete() == 0 );
+    assertL( iStatesClient->CountVideoRecordingOn() == 0 );
+    assertL( iStatesClient->CountVideoRecordingComplete() == 0 );
+    }
+
+/********************************************************/
+/*      MISC tests                                      */
+/********************************************************/
+void CCaeTestVideoStates::TestInitVideoRecorderWithUidQ4L()
+    {
+    // ID: CAE.GEN.INITVIDEORECORDERL.Q4.002
+	//
+    // General
+    // 
+    // Action : Test Call InitVideoRecorderL() when initialization is done with Uid.
+	//      
+	// Output : Leave, Uid init is not supported.
+
+    iStatesClient->SetVideoCodecSet( 2 ); // 2: AAC audio, MPEG-4 video
+
+    TRAPD( err, iStatesClient->RunTestActionL( CCaeTestStatesClient::EInitVideoRecorderWithUid ));
+    assertL( err == KErrNotSupported );
+    assertL( iStatesClient->CountInitComplete() == 1 );
+    }
+
+/********************************************************/
+/*            REMAINING VIDEO RECORDING TIME            */
+/********************************************************/
+
+void CCaeTestVideoStates::TestRemainingTimeWhenVideoNotInitializedL()
+{
+	// Group:   Video.
+    // 
+    // ID:      CAE.VR.REMAININGVIDEORECORDINGTIME.002
+    //
+    // Action : Get RemainingVideoRecordingTime, when video recording is not initialized.
+	//      
+	// Output : No leave.   
+
+    iStatesClient->RunTestActionL( CCaeTestStatesClient::ERemainingTimeWhenVideoNotInitialized );
+}
+//
+// An own static function to collect the test functions into one 
+// suite of tests. The framework will run the tests and free the
+// memory allocated for the test suite.
+// 
+
+
+MTest* CCaeTestVideoStates::suiteL ()
+    {
+	// Always use NewL (Do not use NewLC) !!!
+    CTestSuite *suite = CTestSuite::NewL( _L8("CCaeTestVideoStates") ); 
+
+    // AMR audio, H.263 video
+#if (!MIRAGE_X_PROD3)
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.VIDEORECORDING.QCIF64000FR15.004"), &TestPrepareAndRecordQualityLevel0L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.VIDEORECORDING.SUBQCIF60000FR15.005"), &TestPrepareAndRecordQualityLevel1L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.VIDEORECORDING.SUBQCIF40000FR5.006"), &TestPrepareAndRecordQualityLevel2L ) );
+
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.QCIF.003"), &TestVideoRecordingQcif60000Fr10NoAudioNoVfL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.QCIF.004"), &TestVideoRecordingQcif60000Fr10WithAudioNoVfL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.QCIF.005"), &TestVideoRecordingQcif60000Fr10NoAudioWithVfL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.QCIF.006"), &TestVideoRecordingQcif60000Fr10WithAudioWithVfL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PAUSEVIDEORECORDING.001"), &TestRecordPauseStopL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PAUSEVIDEORECORDING.002"), &TestPauseWhenPreparedL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PAUSEVIDEORECORDING.003"), &TestRecordPausePauseStopL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.RESUMEVIDEORECORDING.002"), &TestResumeWhenPreparedL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.RESUMEVIDEORECORDING.003"), &TestResumeWhenNotPausedL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.005"), &TestPrepareVideoRecordingNeg1L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.006"), &TestPrepareVideoRecording3L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.008"), &TestSpecPrepareVRUnsupportedFormatWhenVRInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.009"), &TestSpecPrepareVRSupportedFormatWhenPreparedL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTVIDEORECORDING.001"), &TestStartVideoRecordingWhenVRInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTVIDEORECORDING.002"), &TestStartVideoRecordingWhenRecordingL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STOPVIDEORECORDING.001"), &TestStopVideoRecordingWhenVRInitializedL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STOPVIDEORECORDING.002"), &TestStopVideoRecordingWhenPreparedL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.CAPTURERECORD.002"), &TestCaptureRecordL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.RECORDCAPTURE.003"), &TestRecordCaptureL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.RECORDRECORD.004"), &TestRecordRecordL ) );
+        
+    // These "complex sequences" take quite long, probably a minute or more.
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.RECORDCAPTURECOMPLEX1.005"), &TestRecordCaptureComplexSequence1L ) );
+    
+#ifdef __CAMERA_BURST_MODE
+    // Only if Still BURST is supported (built in).
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.RECORDCAPTURECOMPLEX2.006"), &TestRecordCaptureComplexSequence2L ) );
+#endif
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.GEN.RELESEANDRESERVE.006"), &TestReleaseReserveRecordL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.002"), &TestPrepareAudioBitRateVR0L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.003"), &TestPrepareAudioBitRateVR5150L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.004"), &TestPrepareAudioBitRateVR12200L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.005"), &TestPrepareAudioBitRateVR20000L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.006"), &TestPrepareAudioBitRateVR12200AudioType0L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.007"), &TestPrepareAudioBitRateVR12200AudioTypeInvL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.DESTROY.001"), &TestDestroy1L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.DESTROY.002"), &TestDestroy2L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.DESTROY.003"), &TestDestroy3L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.DESTROY.004"), &TestDestroy4L ) );
+ 
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.GEN.INITVIDEORECORDERL.002"), &TestInitVideoRecorderWithUidL ) );
+
+    #ifdef CAE_TEST_VERSION
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.ERRORS.001"), &TestVideoRecorderOpenErrorL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.ERRORS.002"), &TestVideoRecorderPrepareErrorL ) );
+    // suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.ERRORS.003"), &TestVideoRecordingCompleteErrorL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.ERRORS.004"), &TestPrepareVideoSettingsErrorL ) );
+    #endif
+#endif //!MIRAGE_X_PROD3
+
+    // AMR audio, H.263 video
+#if (MIRAGE_X_PROD3)
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.VIDEORECORDING.QCIF64000FR15.Q.004"), &TestPrepareAndRecordQualityLevel0QL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.VIDEORECORDING.SUBQCIF60000FR15.Q.005"), &TestPrepareAndRecordQualityLevel1QL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.VIDEORECORDING.SUBQCIF40000FR5.Q.006"), &TestPrepareAndRecordQualityLevel2QL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q.003"), &TestVideoRecordingQcif60000Fr10NoAudioNoVfQL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q.004"), &TestVideoRecordingQcif60000Fr10WithAudioNoVfQL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q.005"), &TestVideoRecordingQcif60000Fr10NoAudioWithVfQL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q.006"), &TestVideoRecordingQcif60000Fr10WithAudioWithVfQL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PAUSEVIDEORECORDING.Q.001"), &TestRecordPauseStopQL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PAUSEVIDEORECORDING.Q.002"), &TestPauseWhenPreparedQL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PAUSEVIDEORECORDING.Q.003"), &TestRecordPausePauseStopQL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.RESUMEVIDEORECORDING.Q.002"), &TestResumeWhenPreparedQL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.RESUMEVIDEORECORDING.Q.003"), &TestResumeWhenNotPausedQL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.Q.005"), &TestPrepareVideoRecordingNeg1QL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.Q.006"), &TestPrepareVideoRecording3QL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.Q.008"), &TestSpecPrepareVRUnsupportedFormatWhenVRInitializedQL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.Q.009"), &TestSpecPrepareVRSupportedFormatWhenPreparedQL ) );
+
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTVIDEORECORDING.Q.001"), &TestStartVideoRecordingWhenVRInitializedQL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTVIDEORECORDING.Q.002"), &TestStartVideoRecordingWhenRecordingQL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STOPVIDEORECORDING.Q.001"), &TestStopVideoRecordingWhenVRInitializedQL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STOPVIDEORECORDING.Q.002"), &TestStopVideoRecordingWhenPreparedQL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.CAPTURERECORD.Q.002"), &TestCaptureRecordQL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.RECORDCAPTURE.Q.003"), &TestRecordCaptureQL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.RECORDRECORD.Q.004"), &TestRecordRecordQL ) );
+        
+    // These "complex sequences" take quite long, probably a minute or more.
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.RECORDCAPTURECOMPLEX1.Q.005"), &TestRecordCaptureComplexSequence1QL ) );
+    
+#ifdef __CAMERA_BURST_MODE
+    // Only if Still BURST is supported (built in).
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.RECORDCAPTURECOMPLEX2.Q.006"), &TestRecordCaptureComplexSequence2QL ) );
+#endif
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.GEN.RELESEANDRESERVE.Q.006"), &TestReleaseReserveRecordQL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q.002"), &TestPrepareAudioBitRateVR0QL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q.003"), &TestPrepareAudioBitRateVR5150QL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q.004"), &TestPrepareAudioBitRateVR12200QL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q.005"), &TestPrepareAudioBitRateVR20000QL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q.006"), &TestPrepareAudioBitRateVR12200AudioType0QL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q.007"), &TestPrepareAudioBitRateVR12200AudioTypeInvQL ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.DESTROY.Q.001"), &TestDestroy1QL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.DESTROY.Q.002"), &TestDestroy2QL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.DESTROY.Q.003"), &TestDestroy3QL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.DESTROY.Q.004"), &TestDestroy4QL ) );
+ 
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.GEN.INITVIDEORECORDERL.Q.002"), &TestInitVideoRecorderWithUidQL ) );
+
+    #ifdef CAE_TEST_VERSION
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.ERRORS.Q.001"), &TestVideoRecorderOpenErrorQL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.ERRORS.Q.002"), &TestVideoRecorderPrepareErrorQL ) );
+    // suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.ERRORS.Q.003"), &TestVideoRecordingCompleteErrorQL ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.ERRORS.Q.004"), &TestPrepareVideoSettingsErrorQL ) );
+    #endif
+#endif //MIRAGE_X_PROD3
+
+    // AAC audio, MPEG-4 video
+#if (MIRAGE_X_PROD3)
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.VIDEORECORDING.QCIF64000FR15.Q4.004"), &TestPrepareAndRecordQualityLevel0Q4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.VIDEORECORDING.SUBQCIF60000FR15.Q4.005"), &TestPrepareAndRecordQualityLevel1Q4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.VIDEORECORDING.SUBQCIF40000FR5.Q4.006"), &TestPrepareAndRecordQualityLevel2Q4L ) );
+
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q4.003"), &TestVideoRecordingQcif60000Fr10NoAudioNoVfQ4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q4.004"), &TestVideoRecordingQcif60000Fr10WithAudioNoVfQ4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q4.005"), &TestVideoRecordingQcif60000Fr10NoAudioWithVfQ4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTSTOPVIDEORECORDING.QCIF.Q4.006"), &TestVideoRecordingQcif60000Fr10WithAudioWithVfQ4L ) );
+
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PAUSEVIDEORECORDING.Q4.001"), &TestRecordPauseStopQ4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PAUSEVIDEORECORDING.Q4.002"), &TestPauseWhenPreparedQ4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PAUSEVIDEORECORDING.Q4.003"), &TestRecordPausePauseStopQ4L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.RESUMEVIDEORECORDING.Q4.002"), &TestResumeWhenPreparedQ4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.RESUMEVIDEORECORDING.Q4.003"), &TestResumeWhenNotPausedQ4L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.Q4.005"), &TestPrepareVideoRecordingNeg1Q4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.Q4.006"), &TestPrepareVideoRecording3Q4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.Q4.008"), &TestSpecPrepareVRUnsupportedFormatWhenVRInitializedQ4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREVIDEORECORDINGL.Q4.009"), &TestSpecPrepareVRSupportedFormatWhenPreparedQ4L ) );
+
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTVIDEORECORDING.Q4.001"), &TestStartVideoRecordingWhenVRInitializedQ4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STARTVIDEORECORDING.Q4.002"), &TestStartVideoRecordingWhenRecordingQ4L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STOPVIDEORECORDING.Q4.001"), &TestStopVideoRecordingWhenVRInitializedQ4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.STOPVIDEORECORDING.Q4.002"), &TestStopVideoRecordingWhenPreparedQ4L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.CAPTURERECORD.Q4.002"), &TestCaptureRecordQ4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.RECORDCAPTURE.Q4.003"), &TestRecordCaptureQ4L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.RECORDRECORD.Q4.004"), &TestRecordRecordQ4L ) );
+        
+    // These "complex sequences" take quite long, probably a minute or more.
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.RECORDCAPTURECOMPLEX1.Q4.005"), &TestRecordCaptureComplexSequence1Q4L ) );
+    
+#ifdef __CAMERA_BURST_MODE
+    // Only if Still BURST is supported (built in).
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.STATECHANGE.RECORDCAPTURECOMPLEX2.Q4.006"), &TestRecordCaptureComplexSequence2QL ) );
+#endif
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.GEN.RELESEANDRESERVE.Q4.006"), &TestReleaseReserveRecordQ4L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q4.002"), &TestPrepareAudioBitRateVR0Q4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q4.003"), &TestPrepareAudioBitRateVR5150Q4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q4.004"), &TestPrepareAudioBitRateVR12200Q4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q4.005"), &TestPrepareAudioBitRateVR20000Q4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q4.006"), &TestPrepareAudioBitRateVR12200AudioType0Q4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.PREPAREAUDIOBITRATEANDRECORDVIDEO.Q4.007"), &TestPrepareAudioBitRateVR12200AudioTypeInvQ4L ) );
+    
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.DESTROY.Q4.001"), &TestDestroy1Q4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.DESTROY.Q4.002"), &TestDestroy2Q4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.DESTROY.Q4.003"), &TestDestroy3Q4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.DESTROY.Q4.004"), &TestDestroy4Q4L ) );
+ 
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.GEN.INITVIDEORECORDERL.Q4.002"), &TestInitVideoRecorderWithUidQ4L ) );
+
+    #ifdef CAE_TEST_VERSION
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.ERRORS.Q4.001"), &TestVideoRecorderOpenErrorQ4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.ERRORS.Q4.002"), &TestVideoRecorderPrepareErrorQ4L ) );
+    // suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.ERRORS.Q4.003"), &TestVideoRecordingCompleteErrorQ4L ) );
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.ERRORS.Q4.004"), &TestPrepareVideoSettingsErrorQ4L ) );
+    #endif
+#endif //MIRAGE_X_PROD3
+
+    suite->addTestL( CTestCaller<CCaeTestVideoStates>::NewL( _L8("CAE.VR.REMAININGVIDEORECORDINGTIME.002"), &TestRemainingTimeWhenVideoNotInitializedL ) );
+
+    return suite;
+    }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/src/StifCaeTestTop.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,359 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Cae Test DLL
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include "StifCaeTestTop.h"
+#include "TestFrameWork/testSuite.h"
+#include "CaeTestTop.h"
+#include "CaeTestRelease.h"
+#include "CaeTestStillSettings.h"
+#include "CaeTestStillStates.h"
+#include "CaeTestVideoStates.h"
+#include "CaeTestVideoSettings.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+           
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+    
+    This file (DemoModule.cpp) contains all STIF test framework related parts of
+    this test module.
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C TInt SetRequirements( CTestModuleParam*& aTestModuleParam, TUint32& aParameterValid )
+    {
+    aParameterValid = KStifTestModuleParameterChanged;
+
+    CTestModuleParamVer01* param = CTestModuleParamVer01::NewL();
+
+    // Stack size
+    param->iTestThreadStackSize= 2*16384; // 2*16K stack
+
+    // Heap sizes
+    param->iTestThreadMinHeap = 4096;   // 4K heap min
+    param->iTestThreadMaxHeap = 8*1048576;// 8M heap max
+
+    aTestModuleParam = param;
+
+    return KErrNone;
+    }
+
+// ================= MEMBER FUNCTIONS =========================================
+
+
+CTestModule::CTestModule()
+    {
+    }
+
+
+void CTestModule::ConstructL()
+    {  
+    iTestSuite = CTestSuite::NewL(_L8("Test Suite Container"));
+
+    iTestSuite->addTestL( CCaeTestRelease::suiteL() );    
+    
+    //iTestSuite->addTestL( CCaeTestStillStates::suiteL() );
+    //iTestSuite->addTestL( CCaeTestVideoStates::suiteL() );
+    //iTestSuite->addTestL( CCaeTestStillSettings::suiteL() );
+    //iTestSuite->addTestL( CCaeTestVideoSettings::suiteL() );
+
+    
+    //SetAllocFailureSimulation( RHeap::EDeterministic, 0 ); // Enable OOM test loop
+    SetAllocFailureSimulation( RHeap::ENone, 0 ); // Disable OOM test loop
+
+    /* Install an active scheduler */
+    iScheduler = new(ELeave)CActiveScheduler;
+    CActiveScheduler::Install(iScheduler);
+
+    }
+
+
+CTestModule* CTestModule::NewL()
+    {
+
+    // Construct new CTestModule instance.
+    CTestModule* self = new ( ELeave ) CTestModule();    
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+  
+    }
+
+
+CTestModule::~CTestModule()
+    {
+    delete iTestSuite;
+    delete iScheduler;
+    }
+
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: GetTestCases
+
+    Description: GetTestCases is used to inquire test cases 
+    from the test module. Because this test module have hard coded test cases
+    (i.e cases are not read from file), paramter aConfigFile is not used.
+
+    This function loops through all cases defined in Cases() function and 
+    adds corresponding items to aTestCases array.
+
+    Parameters: const TFileName&  : in: Configuration file name. Not used                                                       
+                RPointerArray<TTestCaseInfo>& aTestCases: out: 
+                      Array of TestCases.
+    
+    Return Values: KErrNone: No error
+
+    Errors/Exceptions: Function leaves if any memory allocation operation fails
+
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/      
+TInt CTestModule::GetTestCasesL( const TFileName& /*aConfigFile*/, 
+                                     RPointerArray<TTestCaseInfo>& aTestCases )
+    {
+
+    // Loop through all test cases and create new
+    // TTestCaseInfo items and append items to aTestCase array    
+    for( TInt i = 0; i< iTestSuite->CountTestCases(); i++ )
+        {
+ 
+	    // Allocate new TTestCaseInfo from heap for a testcase definition.
+        TTestCaseInfo* newCase = new( ELeave ) TTestCaseInfo();
+    
+	    // PushL TTestCaseInfo to CleanupStack.    
+        CleanupStack::PushL( newCase );
+
+	    // Set number for the testcase.
+	    // When the testcase is run, this comes as a parameter to RunTestCaseL.
+        newCase->iCaseNumber = i;
+
+	    // Set title for the test case. This is shown in UI to user.
+        newCase->iTitle.Copy( iTestSuite->TestCaseName(i) );
+
+	    // Append TTestCaseInfo to the testcase array. After appended 
+	    // successfully the TTestCaseInfo object is owned (and freed) 
+	    // by the TestServer. 
+        User::LeaveIfError(aTestCases.Append ( newCase ) );
+        
+	    // Pop TTestCaseInfo from the CleanupStack.
+        CleanupStack::Pop( newCase );
+
+        }
+    
+    return KErrNone;
+  
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CTestModule
+
+    Method: RunTestCase
+
+    Description: Run a specified testcase.
+
+    Function runs a test case specified by test case number. Test case file
+    parameter is not used.
+
+    If case number is valid, this function runs a test case returned by
+    function Cases(). 
+  
+    Parameters: const TInt aCaseNumber: in: Testcase number 
+                const TFileName& : in: Configuration file name. Not used
+                TTestResult& aResult: out: Testcase result
+    
+    Return Values: KErrNone: Testcase ran.
+                   KErrNotFound: Unknown testcase
+
+    Errors/Exceptions: None
+    
+    Status: Proposal
+    
+-------------------------------------------------------------------------------
+*/
+TInt CTestModule::RunTestCaseL( const TInt aCaseNumber, 
+                                    const TFileName& /*aConfig*/,
+                                    TTestResult& aResult )
+    {
+    // Next is a temporary solution for Stif memory leak error
+     TestModuleIf().SetBehavior(CTestModuleIf::ETestLeaksMem);
+     TestModuleIf().SetBehavior(CTestModuleIf::ETestLeaksRequests);
+     TestModuleIf().SetBehavior(CTestModuleIf::ETestLeaksHandles);
+
+    if ( iAllocFailureType != RHeap::ENone )
+        {
+        RunTestCaseInOOMLoopL( aCaseNumber, aResult );
+        }
+    else
+        {
+        iTestSuite->ExecuteTestL( aResult, aCaseNumber );
+        }
+
+    // Return case execution status (not the result of the case execution)
+    return KErrNone; 
+    }
+
+
+/*
+*/    
+
+void CTestModule::RunTestCaseInOOMLoopL( const TInt aCaseNumber,
+                                        TTestResult& aResult )
+    {
+
+    // 
+    TInt error = KErrNone; 
+    aResult.SetResult( KErrNoMemory, _L("") ); // Initial value
+
+    for (; ( aResult.iResult == KErrNoMemory ) && !error;)
+        {      
+        // Switches on alloc failure simulation if the parameters are set for it
+        AllocFailureSimulation( ETrue ); 
+        RDebug::Print(_L("*** OOM loop : %d ***\n"), iCurrentAllocFailureRate );
+        TRAP( error, iTestSuite->ExecuteTestL( aResult, aCaseNumber ) );
+        if ( error == KErrNoMemory )
+            {
+            error = KErrNone;
+            }
+        }
+    
+    //
+    AllocFailureSimulation( EFalse );
+    User::LeaveIfError( error ); 
+    }
+
+
+/*
+*/    
+
+void CTestModule::AllocFailureSimulation (TBool aSwitchedOn)
+	{
+	if (aSwitchedOn)
+		{
+		__UHEAP_SETFAIL ( iAllocFailureType, iCurrentAllocFailureRate );
+        iCurrentAllocFailureRate++;
+		}
+	else
+		{
+		__UHEAP_RESET;
+        iCurrentAllocFailureRate = iAllocFailureRate;
+		}
+	}
+
+
+/*
+*/    
+
+void CTestModule::SetAllocFailureSimulation( RHeap::TAllocFail aAllocFailureType, TInt aAllocFailureRate )
+    {
+    iAllocFailureType = aAllocFailureType;
+    iAllocFailureRate = aAllocFailureRate;
+    iCurrentAllocFailureRate = aAllocFailureRate;
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+/*
+-------------------------------------------------------------------------------
+   
+    Function: LibEntryL
+
+    Description: Polymorphic Dll Entry Point
+    
+    Test framework calls this function to obtain new instance of test module
+    class. 
+
+    Parameters:    None
+    
+    Return Values: CTestModule*    Pointer to CTestModule instance
+    
+    Errors/Exceptions: Leaves if CTestModule::NewL leaves
+    
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+EXPORT_C CTestModule* LibEntryL()
+    {
+    return CTestModule::NewL();
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+   
+    Function: E32Dll
+
+    Description: DLL entry point function
+    
+    Parameters:    TDllReason: Not used
+    
+    Return Values: KErrNone: always
+    
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+#ifndef EKA2
+GLDEF_C TInt E32Dll(TDllReason /*aReason*/)
+    {
+    return( KErrNone );
+
+    }
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/src/TestFrameWork/AssertFailure.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: AssertFailure.cpp
+*
+*/
+
+
+#include "AssertFailure.h"
+
+
+CAssertFailure* CAssertFailure::NewL (const TDesC8& aMessage,
+									  TInt aLineNumber,
+									  const TDesC8& aFileName)
+	{
+	CAssertFailure* self=NewLC(aMessage, aLineNumber, aFileName);
+	CleanupStack::Pop();
+	return self;
+	}
+
+
+CAssertFailure* CAssertFailure::NewLC (const TDesC8& aMessage,
+									   TInt aLineNumber,
+									   const TDesC8& aFileName)
+
+	{
+	CAssertFailure* self = new (ELeave) CAssertFailure(aLineNumber);
+	CleanupStack::PushL(self);
+	self->ConstructL(aMessage, aFileName);
+	return self;
+	}
+
+
+CAssertFailure* CAssertFailure::NewL (CAssertFailure& aAssertFailure)
+	{
+	CAssertFailure* self=NewLC(aAssertFailure);
+	CleanupStack::Pop();
+	return self;
+	}
+
+
+CAssertFailure* CAssertFailure::NewLC (CAssertFailure& aAssertFailure)
+	{
+	CAssertFailure* self = new(ELeave)CAssertFailure;
+	CleanupStack::PushL(self);
+	self->ConstructL(aAssertFailure);
+	return self;
+	}
+
+
+void CAssertFailure::ConstructL (const TDesC8& aMessage,
+								 const TDesC8& aFileName)
+	{
+    iMessage = aMessage.AllocL();
+    iFileName = aFileName.AllocL();
+	}
+
+
+void CAssertFailure::ConstructL (CAssertFailure& aAssertFailure)
+	{
+	iLineNumber = aAssertFailure.iLineNumber;
+	iMessage = aAssertFailure.iMessage->AllocL();
+	iFileName = aAssertFailure.iFileName->AllocL();
+	}
+
+
+CAssertFailure::CAssertFailure ()
+	{
+	}
+
+
+CAssertFailure::CAssertFailure (TInt aLineNumber)
+ : iLineNumber (aLineNumber)
+	{
+	}
+
+
+CAssertFailure::~CAssertFailure () 
+	{
+    delete iFileName;
+	delete iMessage;
+	}
+
+
+const TDesC8& CAssertFailure::What() const
+	{
+	return *iMessage;
+	}
+
+
+TInt CAssertFailure::LineNumber()  const
+	{
+	return iLineNumber;
+	}
+
+
+const TDesC8& CAssertFailure::FileName()  const
+	{
+	return *iFileName;
+	}
+
+
+void CAssertFailure::SetMyHeapCellCount (TInt aHeapCellCount)
+	{
+	iMyHeapCellCount = aHeapCellCount;
+	}
+	
+
+TInt CAssertFailure::MyHeapCellCount ()
+	{
+	return iMyHeapCellCount;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/src/TestFrameWork/TestCase.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,310 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: TestCase.cpp
+*
+*/
+
+
+#include <utf.h>
+
+#include "TestFrameWork/testCase.h"
+#include "TestFrameWork/AssertFailure.h"
+#include <StifTestModule.h>
+
+#if 0
+#include "TestCase.h"
+#include "TestResult.h"
+#include "AssertFailure.h"
+#include "CppUnitLog.h"
+#endif
+
+
+// Assertion failure message formats:
+_LIT8(KIntsNotEqualFormat,"expected: %d but was: %d");
+_LIT8(KRealsNotEqualFormat,"expected: %g but was: %g");                                                    
+_LIT8(KDesCsNotEqualFormat,"expected: '%S' but was: '%S'");
+
+
+// A unique error code:
+const TInt KErrCppUnitAssertionFailed=(-99999999);
+
+
+
+void CTestCase::ConstructL (const TDesC8& aName)
+    {
+    iName = aName.AllocL();
+    User::LeaveIfError(Dll::SetTls(0));
+    }
+
+
+CTestCase::CTestCase ()
+: iAllocFailureType(RHeap::ENone),
+iAllocFailureRate(0)
+    {
+    }
+
+
+CTestCase::~CTestCase () 
+    { 
+    delete iName;
+    }
+
+
+// From MTest:
+void CTestCase::ExecuteL (TTestResult& aResult)
+    {
+    TInt error = ExecuteImplL();
+    aResult.iResult = error;
+    // add the possible failure or error to the result
+    
+    if (error == KErrCppUnitAssertionFailed)
+        {
+        CAssertFailure* assertFailure = AssertFailureFromTlsL ();
+        CleanupStack::PushL(assertFailure);
+        TBuf16 <0x80> convertBuf;
+        TBuf16 <256> temporaryBuf;
+        convertBuf.Copy(assertFailure->What());
+        temporaryBuf.Append(convertBuf);
+        temporaryBuf.AppendFormat(_L(" at Line %i of "), assertFailure->LineNumber()); 
+        convertBuf.Copy(assertFailure->FileName());
+        if (convertBuf.Length() + temporaryBuf.Length() >= 0x80)
+            {
+            TBuf <0x80> printBuf;
+            printBuf = convertBuf.Right(0x80 - temporaryBuf.Length() - 1 -3 );
+            convertBuf = _L("...");
+            convertBuf.Append(printBuf);
+            }
+        temporaryBuf.Append(convertBuf);
+        aResult.iResultDes = temporaryBuf;
+        CleanupStack::PopAndDestroy(assertFailure); 
+        }
+    }
+
+// From MTest:
+TInt CTestCase::CountTestCases ()
+    {
+    return 1;
+    }
+
+
+// From MTest:
+const TDesC8& CTestCase::Name ()
+    {
+    return *iName;
+    }
+
+
+
+#if 1
+// From MTest:
+void CTestCase::ExecuteTestL(TTestResult& aResult,
+                             TInt /*aIndex */)
+    { 
+    ExecuteL(aResult);
+    }
+
+const TDesC8& CTestCase::TestCaseName (TInt /*aIndex*/) 
+    {
+    return Name();
+    }
+#endif
+
+
+
+// Check for a failed general assertion 
+void CTestCase::AssertL (TBool aCondition,
+                         const TDesC8& aConditionExpression,
+                         TInt aLineNumber,
+                         const TDesC8& aFileName)
+    {
+    if (!aCondition)
+        {
+        AllocFailureSimulation(EFalse);
+        AssertFailureToTlsL (aConditionExpression,aLineNumber,aFileName);
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+
+// Check for a failed equality assertion
+void CTestCase::AssertEqualsL (TInt anExpected, 
+                               TInt anActual, 
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (anExpected != anActual)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = HBufC8::NewLC (KIntsNotEqualFormat().Size()+100);
+        msg->Des().Format(KIntsNotEqualFormat, anExpected, anActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+
+// Check for a failed equality assertion
+void CTestCase::AssertEqualsL (TReal anExpected, 
+                               TReal anActual, 
+                               TReal aDelta,
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (Abs(anExpected-anActual) > aDelta)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = HBufC8::NewLC (KRealsNotEqualFormat().Size()+100);
+        msg->Des().Format(KRealsNotEqualFormat, anExpected, anActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+
+// Check equality of the contents of two 8-bit descriptors 
+void CTestCase::AssertEqualsL (const TDesC8& anExpected,
+                               const TDesC8& anActual,
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (anExpected.Compare(anActual) != 0)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = NotEqualsMessageLC (anExpected, anActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+
+// Check equality of the contents of two 16-bit descriptors 
+void CTestCase::AssertEqualsL (const TDesC16& aExpected,
+                               const TDesC16& aActual,
+                               TInt aLineNumber,
+                               const TDesC8& aFileName)
+    {
+    if (aExpected.Compare(aActual) != 0)
+        {
+        AllocFailureSimulation(EFalse);
+        HBufC8* msg = NotEqualsMessageLC (aExpected, aActual);
+        AssertFailureToTlsL(*msg,aLineNumber,aFileName);
+        CleanupStack::PopAndDestroy(); // msg
+        User::Leave (KErrCppUnitAssertionFailed);
+        }
+    }
+
+
+void CTestCase::AllocFailureSimulation (TBool aSwitchedOn)
+    {
+    if (aSwitchedOn)
+        {
+        __UHEAP_SETFAIL (iAllocFailureType, iAllocFailureRate);
+        }
+    else
+        {
+        __UHEAP_RESET;
+        }
+    }
+
+
+TInt CTestCase::ExecuteImplL ()
+    {
+    
+    __UHEAP_MARK;
+    TRAPD (setupError, setUpL());
+    if (setupError != KErrNone)
+        {
+        tearDown();
+        __UHEAP_MARKEND;
+        User::Leave(setupError);
+        }
+    
+    TRAPD (executionError, executeTestL());
+    
+    tearDown();
+    __UHEAP_MARKENDC(HeapCellsReservedByAssertFailure());
+
+    return executionError;
+    }
+
+
+// Construct the message and put it in the cleanup stack
+HBufC8* CTestCase::NotEqualsMessageLC (const TDesC8& aExpected,
+                                       const TDesC8& aActual)
+    {
+    TInt size = KDesCsNotEqualFormat().Size()+aExpected.Size()+aActual.Size();
+    HBufC8 *msg = HBufC8::NewLC(size);
+    msg->Des().Format(KDesCsNotEqualFormat, &aExpected, &aActual);
+    return msg;
+    }
+
+
+// Construct the message and put it in the cleanup stack
+HBufC8* CTestCase::NotEqualsMessageLC (const TDesC16& aExpected,
+                                       const TDesC16& aActual)
+    {
+    TInt length = KDesCsNotEqualFormat().Length() + 
+        aExpected.Length() + aActual.Length();
+    
+    HBufC8* msg = HBufC8::NewLC(length);
+    
+    // Convert 16-bit to 8-bit to ensure readability
+    // of the output possibly directed to a file.
+    HBufC8* expected = HBufC8::NewLC(aExpected.Length());
+    expected->Des().Copy(aExpected);
+    
+    HBufC8* actual = HBufC8::NewLC(aActual.Length());
+    actual->Des().Copy(aActual);
+    
+    msg->Des().Format(KDesCsNotEqualFormat,expected,actual);
+    
+    // pop and destroy actual and expected
+    CleanupStack::PopAndDestroy(2);
+    return msg;
+    }
+
+
+void CTestCase::AssertFailureToTlsL (const TDesC8& aMessage,
+                                     TInt  aLineNumber,
+                                     const TDesC8& aFileName)
+    {
+    TInt cellsBefore = User::CountAllocCells();
+    CAssertFailure* assertFailure = 
+        CAssertFailure::NewLC(aMessage,aLineNumber,aFileName);
+    User::LeaveIfError(Dll::SetTls(assertFailure));
+    CleanupStack::Pop(); // assertFailure
+    TInt cellsAfter = User::CountAllocCells();
+    assertFailure->SetMyHeapCellCount(cellsAfter-cellsBefore);
+    }
+
+
+CAssertFailure* CTestCase::AssertFailureFromTlsL ()
+    {
+    CAssertFailure* assertFailure = static_cast<CAssertFailure*>(Dll::Tls());
+    CAssertFailure* copy = CAssertFailure::NewL(*assertFailure);
+    delete assertFailure;
+    Dll::SetTls(0);
+    return copy;
+    }
+
+
+TInt CTestCase::HeapCellsReservedByAssertFailure ()
+    {
+    if (Dll::Tls() == 0) return 0;
+    CAssertFailure* assertFailure = static_cast<CAssertFailure*>(Dll::Tls());
+    return assertFailure->MyHeapCellCount();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camerasrv_plat/camera_application_engine_api/tsrc/src/TestFrameWork/TestSuite.cpp	Wed Sep 01 12:23:23 2010 +0100
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: TestSuite.cpp
+*
+*/
+
+
+
+#include "TestFrameWork/testSuite.h"
+#include <StifTestModule.h>
+
+
+CTestSuite* CTestSuite::NewLC (const TDesC8& aName)
+    {
+    CTestSuite* self=new(ELeave) CTestSuite();
+    CleanupStack::PushL(self);
+    self->ConstructL(aName);
+    return self;
+    }
+
+
+CTestSuite* CTestSuite::NewL (const TDesC8& aName)
+    {
+    CTestSuite* self=NewLC(aName);
+    CleanupStack::Pop();
+    return self;
+    }
+
+
+void CTestSuite::ConstructL (const TDesC8& aName)
+    {
+    iName = aName.AllocL();
+    }
+
+
+CTestSuite::~CTestSuite () 
+    {
+    iTests.ResetAndDestroy();
+    delete iName;
+    }
+
+
+void CTestSuite::addTestL (MTest* aTest)
+    {
+    User::LeaveIfError (iTests.Append(aTest));
+    }
+
+
+// Runs the tests and collects their result in a TestResult.
+// Deprecated.
+// Version with index should be used instead.
+
+void CTestSuite::ExecuteL (TTestResult& aResult)
+    {
+    for (TInt i=0; i < iTests.Count(); i++)
+        {
+        iTests[i]->ExecuteL(aResult);
+        }
+    }
+
+
+// Counts the number of test cases that will be run by this test.
+TInt CTestSuite::CountTestCases ()
+    {
+    TInt count = 0;
+    for (TInt i=0; i < iTests.Count(); i++)
+        {
+        count += iTests[i]->CountTestCases ();
+        }
+    return count;
+    }
+
+
+const TDesC8& CTestSuite::Name ()
+    {
+    return *iName;
+    }
+
+#if 1
+void CTestSuite::ExecuteTestL(TTestResult& aResult,
+                              TInt aIndex)
+    { 
+    for (TInt i=0; i< iTests.Count(); i++)
+        {
+        TInt count = iTests[i]->CountTestCases();
+        if ( aIndex > ( count - 1 ) )
+            {
+            aIndex -= count;
+            }
+        else
+            {
+            iTests[i]->ExecuteTestL(aResult, aIndex);
+            return ;
+            }
+        }
+    }
+
+const TDesC8& CTestSuite::TestCaseName (TInt aIndex)
+    {
+    for (TInt i=0; i< iTests.Count(); i++)
+        {
+        TInt count = iTests[i]->CountTestCases();
+        if ( aIndex > ( count - 1 ) )
+            {
+            aIndex -= count;
+            }
+        else
+            {
+            return ( iTests[i]->TestCaseName(aIndex) ) ;
+            }
+        }
+    // It's an error if we reached that point.
+    return(KNullDesC8);
+    }
+#endif
--- a/camerasrv_plat/group/bld.inf	Tue Aug 31 15:25:20 2010 +0300
+++ b/camerasrv_plat/group/bld.inf	Wed Sep 01 12:23:23 2010 +0100
@@ -19,7 +19,10 @@
 
 
 #include "../media_recorder_sink_api/group/bld.inf"
+#include "../cae_extentension_api/group/bld.inf"
+#include "../camera_application_engine_api/group/bld.inf"
 #include "../custom_onboard_camera_api/group/bld.inf"
 #include "../imaging_configuration_manager_api/group/bld.inf"
 #include "../media_recorder_api/group/bld.inf"
 #include "../3gp_file_composer_api/group/bld.inf"
+#include "../asynchronous_file_saving_queue_api/group/bld.inf"
--- a/group/bld.inf	Tue Aug 31 15:25:20 2010 +0300
+++ b/group/bld.inf	Wed Sep 01 12:23:23 2010 +0100
@@ -21,6 +21,7 @@
 #include "../camerasrv_plat/group/bld.inf"
 
 #include "../configmanagers/group/bld.inf"
+#include "../camappengine/Build/bld.inf"
 #include "../camcordermmfplugin/Build/bld.inf"
 
 PRJ_EXPORTS
--- a/layers.sysdef.xml	Tue Aug 31 15:25:20 2010 +0300
+++ b/layers.sysdef.xml	Wed Sep 01 12:23:23 2010 +0100
@@ -13,6 +13,8 @@
     
     <layer name="api_test_layer">
       <module name="camerasrv_api_tests">
+      	<unit unitID="imm.camerasrv.asynchronous_file_saving_queue_api" mrp="" bldFile="sf/mw/camerasrv/camerasrv_plat/asynchronous_file_saving_queue_api/tsrc/group"  name="asynchronous_file_saving_queue_api"  />
+      	<unit unitID="imm.camerasrv.camera_application_engine_api" mrp="" bldFile="sf/mw/camerasrv/camerasrv_plat/camera_application_engine_api/tsrc/group"  name="camera_application_engine_api"  />
       	<unit unitID="imm.camerasrv.imaging_configuration_manager_api" mrp="" bldFile="sf/mw/camerasrv/camerasrv_plat/imaging_configuration_manager_api/tsrc/group"  name="imaging_configuration_manager_api"  />
       	<unit unitID="imm.camerasrv.media_recorder_api" mrp="" bldFile="sf/mw/camerasrv/camerasrv_plat/media_recorder_api/tsrc/group"  name="media_recorder_api"  />
       </module>